Rport

RFC 3581 - An Extension to the Session Initiation Protocol (SIP)

5. Syntax

The syntax for the "rport" parameter is:

response-port = "rport" [EQUAL 1*DIGIT]

This extends the existing definition of the Via header field
parameters, so that its BNF now looks like:

via-params = via-ttl / via-maddr
/ via-received / via-branch
/ response-port / via-extension

6. Example

A client sends an INVITE to a proxy server which looks like, in part:

INVITE sip:moc.elpmaxe|resu#moc.elpmaxe|resu SIP/2.0
Via: SIP/2.0/UDP 10.1.1.1:4540;rport;branch=z9hG4bKkjshdyff

This INVITE is sent with a source port of 4540 and a source IP
address of 10.1.1.1. The proxy is at 192.0.2.2 (proxy.example.com),
listening on both port 5060 and 5070. The client sends the request
to port 5060. The request passes through a NAT on the way to the
proxy, so that the source IP address appears as 192.0.2.1 and the
source port as 9988. The proxy forwards the request, but not before
appending a value to the "rport" parameter in the proxied request:

INVITE sip:moc.elpmaxe|resu#moc.elpmaxe|resu SIP/2.0
Via: SIP/2.0/UDP proxy.example.com;branch=z9hG4bKkjsh77
Via: SIP/2.0/UDP 10.1.1.1:4540;received=192.0.2.1;rport=9988
;branch=z9hG4bKkjshdyff

This request generates a response which arrives at the proxy:

SIP/2.0 200 OK
Via: SIP/2.0/UDP proxy.example.com;branch=z9hG4bKkjsh77
Via: SIP/2.0/UDP 10.1.1.1:4540;received=192.0.2.1;rport=9988
;branch=z9hG4bKkjshdyff

The proxy strips its top Via header field value, and then examines
the next one. It contains both a "received" parameter and an "rport"
parameter. The server follows the rules specified in Section 4 and
sends the response to IP address 192.0.2.1, port 9988, and sends it
from port 5060 on 192.0.2.2:

SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.1.1.1:4540;received=192.0.2.1;rport=9988
;branch=z9hG4bKkjshdyff

This packet matches the binding created by the initial request.
Therefore, the NAT rewrites the destination address of this packet
back to 10.1.1.1, and the destination port back to 4540. It forwards
this response to the client, which is listening for the response on
that address and port. The client properly receives the response.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License