Wrong sip port number is used in Contact of 200 answer response over TCP chan_sip

Hi All,
I met a problem with SIP over TCP on chan_sip driver:

Network setup:
Client in public internet.
Server behind the router is reachable through port forwarding.
Customized sip server port is used (not 5060).

SIP client from public internet registers successfully but can’t make calls – call gets interrupted in 6 s after answer with the “no reply to our critical packet” warning. This happens only over TCP and over UDP all OK.

After some investigations I found a difference in 200 response on INVITE:
over TCP the port in Contact is 5060
and over UDP this port is my custom value.
So then over TCP the server can’t receive an ACK on answer and call gets dropped.

Seems like no such problem for pjsip.

Did any one meet this and resolved, appreciate any ideas. Thanks!

TCP in ChanSIP was never a stellar performer, so this problem doesn’t really surprise me. I’ve never seen this specific problem before (that I can remember) but if it works with PJ-SIP, then why don’t you just use that? You can use them both, at the same time, on the same machine. It’s not like you have to stick with the broken one…

PJSIP on TCP also has some issue – it works well only from public internet, but doesn’t work when the client in the same netwrork with server. I also make debugging and didn’t find clue yet. Meanwhile I use UDP as workaround (UDP works in all scenarious), but want to switch to TCP due to less battery consumption on mobile client.