[pjsip] [help] How to make transport port in Via and Contact hdr is the same?

Cheng, 成 ato_wu at yahoo.com.tw
Mon Nov 2 22:04:43 CST 2009


Hi:
    I am using pjsip v1.4 to implement my application, and I want my app using tcp connect to SIP server.
    The pjsip is using a random socket port( In via header, e.g. 2050) to register to sip server.
    But, in the Contact header, the specific port we want is 5060.
    I want the port in the Via and Contact is the same value (5060).
    How can I do to reach the goal?
    
    My step is as below:   
    First, in system init, it already created the default tcp transport. (partial code as below)
    |-------------------------------------------------------------------------|
     pjsua_transport_config cfg;                                               
                                                                               
     /* config the first transport port.*/                                     
     pjsua_transport_config_default(&cfg);                                     
                                                                               
     status = pjsua_transport_create(PJSIP_TRANSPORT_TCP, &cfg, NULL);         
     if (status != PJ_SUCCESS)                                                 
         error_exit("Error creating transport TCP", status);                   
    |-------------------------------------------------------------------------|
    
    Then, I add a account (ex:7219) to registe to SIP server, and capture the register packet. (as below)
    |----------------------------------------------------------------------------------------------|
     REGISTER sip:192.168.1.10 SIP/2.0                                                             
     Via: SIP/2.0/TCP 192.168.1.8:2050;rport;branch=z9hG4bKPjfe940641-ca72-464f-b6aa-5bb48ce7c896  
     Max-Forwards: 70                                                                              
     From: <sip:7219 at 192.168.1.8>;tag=360cc11a-83ac-4aa5-a950-714fb109b855                         
     To: <sip:7219 at 192.168.1.8>                                                                    
     Call-ID: f109804c-11a6-4f6e-88b3-ef9b553fd345                                                 
     CSeq: 57453 REGISTER                                                                          
     User-Agent: PJSUA v1.4/i686-pc-linux-gnu                                                      
     Contact: <sip:7219 at 192.168.1.8:5060;transport=TCP>                                            
     Expires: 300                                                                                  
     Content-Length:  0                                                                            
    |----------------------------------------------------------------------------------------------|
     
Best Regards
DaCheng
                                                          
            


___________________________________________________ 
 您的生活即時通 - 溝通、娛樂、生活、工作一次搞定! 
 http://messenger.yahoo.com.tw/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20091103/84213bd3/attachment-0001.html>


More information about the pjsip mailing list