[pjsip] Multiple transports

logan logan04x at gmail.com
Thu Nov 22 13:48:00 EST 2007

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 
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 


Best Regards,

More information about the pjsip mailing list