TCP transport issue (port in contact not same as the source/Via port) v1.8.10-trunk

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



from a previous post:

I found that the following change allowed a successful tls session (using
QjSimple):

static pj_status_t mod_on_tx_msg(pjsip_tx_data *tdata)
{
#define CHG101109
#ifdef CHG101109
    //if tcp or tls
    //make Contact port equal local port (as well as ip addr)
    pjsip_contact_hdr* contact;
    pjsip_sip_uri* contact_uri;

    if ((tdata->tp_info.transport->
flag & PJSIP_TRANSPORT_SECURE)
        || (tdata->tp_info.transport->flag & PJSIP_TRANSPORT_RELIABLE)) {
        contact = (pjsip_contact_hdr*)
                pjsip_msg_find_hdr(tdata->msg, PJSIP_H_CONTACT, NULL);
        if (contact) {
            contact_uri = (pjsip_sip_uri*)pjsip_uri_get_uri(contact->uri);
            if (tdata->tp_info.transport->local_name.port)
                contact_uri->port =
tdata->tp_info.transport->local_name.port;
        }
    }
#endif
    return pjsip_tx_data_encode(tdata);
}


On Thu, Dec 9, 2010 at 7:31 AM, Anshuman S. Rawat <arawat at 3clogic.com>wrote:

>  Hi,
>
> I am using an older version of PJSIP (1.0.1) with which I was facing
> problems using TCP with OpenSIPS 1.6 as the server. I found this ->
> http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/2009-August/008501.html which
> led to to test out the pjsua client (PJSUA v1.8.10-trunk/win32) but same
> problem.
>
>
> Now the problem, using TCP with PJSIP the register goes out from port X but
> contact contains port Y. Registration suceeds but the client doesn't receive
> any request as the contact port in the registration is different. Here's a
> trace of the REGISTER request/response.
>
> Transmission Control Protocol, Src Port: *1276* (1276), Dst Port: 5506
> (5506), Seq: 652, Ack: 490, Len: 851
> Session Initiation Protocol
>     Request-Line: REGISTER sip:192.168.3.14:5506;transport=tcp SIP/2.0
>     Message Header
>         Via: SIP/2.0/TCP 192.168.3.21:1276
> ;rport;branch=z9hG4bKPjc09d30513e73438fbd42bd51bfee60af
>         Max-Forwards: 70
>         From: <sip:admin@192.168.3.14 <sip%3Aadmin at 192.168.3.14>
> >;tag=4304c5e32a434217bcd4d67a94f135a4
>         To: <sip:admin at 192.168.3.14 <sip%3Aadmin at 192.168.3.14>>
>         Call-ID: f5cb3910974343ff8066e3cf2b55a833
>         CSeq: 15015 REGISTER
>         User-Agent: PJSUA v1.8.10-trunk/win32
>         Supported: outbound, path
>         Contact: <sip:admin at 192.168.3.21 <sip%3Aadmin at 192.168.3.21>:*5060*
> ;transport=TCP;ob>;reg-id=1;+sip.instance="<urn:uuid:00000000-0000-0000-0000-0000e6ab0100>"
>         Expires: 300
>         Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, SUBSCRIBE, NOTIFY,
> REFER, MESSAGE, OPTIONS
>         Authorization: Digest username="admin", realm="192.168.3.14",
> nonce="4d00c6d30dcb2b946f4c5a1cc17f3329afb991f5", uri="sip:192.168.3.14:5506;transport=tcp",
> response="0022fd9bb0e26472dfbba99bb712db33"
>         Content-Length: 0
>
> Transmission Control Protocol, Src Port: 5506 (5506), Dst Port: *1276*(1276), Seq: 490, Ack: 1503, Len: 451
> Session Initiation Protocol
>     Status-Line: SIP/2.0 200 OK
>     Message Header
>         Via: SIP/2.0/TCP 192.168.3.21:1276
> ;rport=1276;branch=z9hG4bKPjc09d30513e73438fbd42bd51bfee60af
>         From: <sip:admin@192.168.3.14 <sip%3Aadmin at 192.168.3.14>
> >;tag=4304c5e32a434217bcd4d67a94f135a4
>         To: <sip:admin at 192.168.3.14 <sip%3Aadmin at 192.168.3.14>
> >;tag=963a4f451b19d91042195990b9b42283.8b61
>         Call-ID: f5cb3910974343ff8066e3cf2b55a833
>         CSeq: 15015 REGISTER
>         Contact: <sip:admin at 192.168.3.21 <sip%3Aadmin at 192.168.3.21>:*5060*
> ;transport=TCP;ob>;expires=300
>         Server: OpenSIPS (1.6.0-tls (i386/linux))
>         Content-Length: 0
>
>
> Now, OpenSIPS is unable to route the request to the contact when the client
> is behind a NAT. Is there a way to make the port on 'Contact' same as the
> source port? That way OpenSIPS would route the request over the already
> established TCP connection.
>
>
> Regards,
> Anshuman
>
> _______________________________________________
> Visit our blog: http://blog.pjsip.org
>
> pjsip mailing list
> pjsip at lists.pjsip.org
> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20101209/9b46da89/attachment-0001.html>


[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux