[pjsip] Multiple transports

logan logan04x at gmail.com
Thu Nov 22 23:52:30 EST 2007


Hello Benny,

Thanks a lot.

Best Regards,
Hitesh

----- Original Message ----- 
From: "Benny Prijono" <bennylp at pjsip.org>
To: "pjsip embedded/DSP SIP discussion" <pjsip at lists.pjsip.org>
Sent: Friday, November 23, 2007 9:29 AM
Subject: Re: [pjsip] Multiple transports


> logan wrote:
>> Hello Benny,
>>
>> I use multiple UDP transports in my application. One is used for accounts
>> which are on public Internet and other for the local proxy (both 
>> transports
>> use different SIP ports).
>>
>> We saw one weird issue, the REGISTER request is always send from the port
>> which was created at the last (I guess pjsua_create_transport makes the
>> created transport the default one). Because of this the originating UDP 
>> port
>
> Yes this is pjsip's behavior. The latest UDP transport will
> overwrite the previously registered transport in the transport hash
> table, so it will be used as the default transport.
>
>
>> is different from the one mentioned in via and contact headers. All other
>> requests like INVITE, CANCEL, BYE, etc are send from the correct port, 
>> with
>> the correct port mentioned in the other headers. The problem seemed to be
>> with REGISTER requests only. After some digging into the library it seems 
>> to
>> me that the REGISTER transactions are not using the correct transport. I
>> added the following code to \pjsip\sip_util_statefull.c, inside the 
>> function
>> pjsip_endpt_send_request, around line number 105:
>>
>> if (timeout == REGC_TSX_TIMEOUT)
>> {
>>     pjsip_regc *regc = (pjsip_regc *)token;
>>     if (regc)
>>     {
>>         pjsip_tsx_set_transport (tsx, &regc->tp_sel);
>>     }
>> }
>>
>> This seems to have solved the problem as we now set the transport to be 
>> used
>> explicitly, after making the check that the transaction is for a REGISTER
>> request, and the requests are now send from the correct port. But, I'm 
>> not
>> sure if this is a solution or just a temporary fix. Can you please shed 
>> some
>> light?
>
> I think you're right, turns out that regc doesn't make use of the
> transport selector/tp_sel when sending the outgoing REGISTER, hence
> the default transport will be used!
>
> I've committed a fix for this in
> http://www.pjsip.org/trac/ticket/423. Basically, in sip_reg.c, in
> function pjsip_regc_send() line 838, before calling
> pjsip_endpt_send_request(), add these lines:
>
>     /* Bind to transport selector */
>     pjsip_tx_data_set_transport(tdata, &regc->tp_sel);
>
> Then in \pjsip\sip_util_statefull.c, inside the function
> pjsip_endpt_send_request(), line number 105:
>
>     pjsip_tsx_set_transport(tsx, &tdata->tp_sel);
>
> I think that should fix it. Thanks for the report!
>
> cheers,
>  -benny
>
>
>> Thanks.
>>
>> Best Regards,
>> Hitesh
>
>
>
>
>
> _______________________________________________
> 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 





More information about the pjsip mailing list