I am using PJSIP for a SIP application and have the following problem. When I register via UDP with register URI "sip:[email protected]:5060" the register works fine. When a SipPhone calls via UDP it works fine but when the SoftPhone calls via TCP the application answers with a SIP OK where the "transport=tcp" param is missing in the contact of the SIP OK and so the Softphone declines the call. Does anybody knwos this problem and knows a easy solution? Thanks
1 Answers
The behaviour you described sounds like it could be perfectly "valid" sip proxy behaviour as defined in the SIP RFC depending on what the proxy supports against what you have setup in pjsip.
My guess is that you didn't setup the UDP transport correctly in pjsip setup?
What you have to remember is that the proxy is perfectly valid to send NEW dialog messages to the "contact" address.
Normally you have to setup both a UDP and TCP transport for pjsip even with using UDP by default because the SIP message size can get too big for UDP and have to use a TCP connection.
If you want to always connect via TCP you must add ";tansport=tcp" in the account pjsua_acc_config::id field where you setup the sip address for the account.
I would also recommend that if the pjsip client is connect via the internet via a NAT that you also turn on rport support (and hope that the proxy server support rport correctly) as it may be impossible for the sip server to create a TCP/UDP connection back to you when you are behind a NAT.