Search code examples
proxysipkamailio

Relationship between SIP To header and Contact header


I recently encountered such a problem about SIP proxy:

Bob(192.168.10.10) ----- Proxy1(192.168.10.11) ----- Proxy2(192.168.10.12) ----- Alice(registered Proxy2)(192.168.10.13)

Question:Bob call Alice(the first socket send address is Proxy1), SIP request uri use [email protected] or [email protected] ?

I did experiments on these two cases respectively, in the first case, there is no problem, the problem arises in the second case, different terminals look different, I think this is directly related to the SIP Contact head on the called side.

case failed(Polycom RealPresence Desktop for Windows (3.10.0.71107)):
    callee recv SIP INVITE header:
        Request-Line: INVITE sip:[email protected]:5060 SIP/2.0
        Record-Route: <sip:192.168.10.12;lr>
        Record-Route: <sip:192.168.10.11;lr;nat=yes>
        Via: SIP/2.0/UDP 192.168.10.12;branch=z9hG4bKaaf1.70dfc3f1d0af80c063cb4249ae938e9e.0
        Via: SIP/2.0/UDP 192.168.10.11;branch=z9hG4bKaaf1.802002a25de0b2f6bd5501e66591e189.0
        Via: SIP/2.0/UDP 192.168.10.10:5060;received=192.168.10.10;rport=5060;branch=z9hG4bK1763450237
        From: "elink11" <sip:[email protected]>;tag=1452304765
        To: <sip:[email protected];user=phone>

    callee SIP response 200 OK header:
        Via: SIP/2.0/UDP 192.168.10.12;branch=z9hG4bKaaf1.70dfc3f1d0af80c063cb4249ae938e9e.0
        Via: SIP/2.0/UDP 192.168.10.11;branch=z9hG4bKaaf1.802002a25de0b2f6bd5501e66591e189.0
        Via: SIP/2.0/UDP 192.168.10.10:5060;received=192.168.10.10;rport=5060;branch=z9hG4bK1763450237
        From: "xxxx" <sip:[email protected]>;tag=1452304765
        To: "PVS2803841713" <sip:[email protected];user=phone>;tag=C76FC69F-9372BA4C
        Contact: <sip:[email protected]:5060>
        Record-Route: <sip:192.168.10.12;lr>
        Record-Route: <sip:192.168.10.11;lr;nat=yes>

When the 200 OK Contact header carry To header address(callee local party address), call is failed, subsequent requests cannot be routed to the callee correctly due to a request URI error.

case success(PolycomRealPresenceGroup310/6.1.7):
    The callee send 200 OK header:
        Contact: 4594927728 <sip:[email protected]:5060>

Carry the contact address is own address. Subsequent requests (example ACK) will use the contact address as the request URI, so that they can be routed to callee.

Which one is standard carrying? In the case of multiple proxys, what is the correct address of the request URI ? Or are they all right ? Thank you very much.


Solution

  • When Bob tries to contact Alice the Request-URI should be the Address-Of-Record of Alice. The AOR has the form Alice@Domain. Domain could be the domain's name or an IP address of the domain server, handling requests regarding the domain. The To and From header contain the AORs of Alice and Bob respectively.

    From your example I gather that proxy2 is the domain server for Alice's domain and proxy1 an outbound proxy for Bob. That means the Request-URI should be [email protected]. The INVITE request will then be routed to proxy2, which will forward it to Alice.

    The INVITE response will contain the contact address with which Alice can be reached within the created dialog. The domain part of this contact address could be both 192.168.10.12 or 192.168.10.13. This depends on whether proxy2 allows direct communication between Bob and Alice or wants to be in the communication path. And whether those IP addresses are routable for requests from Bob.

    If proxy1 is the domain server of Alice's domain the AOR should be Alice@proxy1. Proxy1 will then forward the incoming request within the domain (to proxy2). Again the response will contain a contact address which Bob should use to send in-dialog requests to Alice.

    There is no direct relationship between the URIs in the To/From header and the contact header. The To/From headers should contain the AORs of Alice and Bob. Contact address can be whatever Alice (or a proxy in the communication path) wants it to be.