drachtio / drachtio-server

A SIP call processing server that can be controlled via nodejs applications
https://drachtio.org
MIT License
237 stars 92 forks source link

SIP registration over TCP #304

Closed spointer closed 1 year ago

spointer commented 1 year ago

Hello Dave,

My drachtio-server's contact is set to --contact "sip:*:4118;transport=udp,tcp" and my srf-app registers with transport=tcp but actually it seems drachtio-server sends SIP Register message to remote server over UDP protocol.

Should my srf-app add Via header(SIP/2.0/TCP) or some other SIP headers? I have thought drachtio-server add Via header properly.

Any suggestions are appreciated.

drachtio-server log is as follows:

2023-07-19 14:16:43.177326 Client::read_handler read: c3902dba-ff51-4d90-8102-2289d003c0d7|sip||
REGISTER sip:172.31.13.176:5060 SIP/2.0
Expires: 120
From: "20701" <sip:20701@172.31.13.176:5060>
To: "20701" <sip:20701@172.31.13.176:5060>
Contact: <sip:20701@localhost;transport=tcp>;expires=120
User-Agent: CTes
Call-ID: c1699818-3770-4f5f-8600-cd5ddcc4b327
Content-Length: 0

2023-07-19 14:16:43.177403 Client::processMessage - got request with 4 tokens
2023-07-19 14:16:43.177420 Client::processMessage - request id c3902dba-ff51-4d90-8102-2289d003c0d7, request type: sip transaction id: , dialog id: 
2023-07-19 14:16:43.177464 Client::processMessage - sending a request outside of a dialog
2023-07-19 14:16:43.177489 ClientController::addAppTransaction: transactionId 37fce353-6d73-4b1d-a4bd-aec28665a785; size: 2
2023-07-19 14:16:43.177502 ClientController::addApiRequest: clientMsgId c3902dba-ff51-4d90-8102-2289d003c0d7; size: 1
2023-07-19 14:16:43.177858 SipTransport::findAppropriateTransport: searching for a transport to reach udp/sip:172.31.13.176:5060
2023-07-19 14:16:43.177896 SipTransport::findAppropriateTransport - after filtering for transport we have 6 candidates
2023-07-19 14:16:43.177911 SipTransport::findAppropriateTransport - after filtering for protocol we have 2 candidates
2023-07-19 14:16:43.178161 SipTransport::findAppropriateTransport: - returning the best match 0x55f26f510500: udp/192.168.131.241:4118
2023-07-19 14:16:43.178181 SipTransport::getContactUri - created Contact header: sip:172.31.13.176:4118
2023-07-19 14:16:43.178198 SipDialogController::doSendRequestOutsideDialog selected transport 0x55f26f510500udp/192.168.131.241:4118
2023-07-19 14:16:43.178275 makeTags - using external IP as replacement for 'localhost': 172.31.13.176
2023-07-19 14:16:43.178303 makeTags - Adding well-known header 'Expires' with value '120'
2023-07-19 14:16:43.178322 makeTags - Adding well-known header 'From' with value '"20701" <sip:20701@172.31.13.176:5060>'
2023-07-19 14:16:43.178337 makeTags - Adding well-known header 'To' with value '"20701" <sip:20701@172.31.13.176:5060>'
2023-07-19 14:16:43.178352 makeTags - hdr 'Contact' replacing host with 172.31.13.176
2023-07-19 14:16:43.178371 makeTags - Adding well-known header 'Contact' with value '<sip:20701@172.31.13.176:4118;transport=tcp>;expires=120'
2023-07-19 14:16:43.178386 makeTags - Adding well-known header 'User-Agent' with value 'CTes'
2023-07-19 14:16:43.178400 makeTags - Adding well-known header 'Call-ID' with value 'c1699818-3770-4f5f-8600-cd5ddcc4b327'
2023-07-19 14:16:43.178434 SipDialogController::doSendRequestOutsideDialog - from: "20701" <sip:20701@172.31.13.176:5060>
2023-07-19 14:16:43.178459 SipDialogController::doSendRequestOutsideDialog - to: "20701" <sip:20701@172.31.13.176:5060>
2023-07-19 14:16:43.178472 SipDialogController::doSendRequestOutsideDialog - contact: <sip:172.31.13.176:4118>
2023-07-19 14:16:43.178484 SipDialogController::doSendRequestOutsideDialog - using client-specified call-id: c1699818-3770-4f5f-8600-cd5ddcc4b327
2023-07-19 14:16:43.178508 isLocalSipUri: checking to see if this is one of mine: sip:172.31.13.176:5060
2023-07-19 14:16:43.178574 nta.c:2848 nta_tpn_by_url() nta: selecting scheme sip
2023-07-19 14:16:43.178608 tport.c:1181 tport_ref() tport_ref(0x55f26f510500): refcount is now 2
2023-07-19 14:16:43.178629 tport.c:3343 tport_tsend() tport_tsend(0x55f26f510500) tpn = */172.31.13.176:5060
2023-07-19 14:16:43.178650 tport.c:4142 tport_resolve() tport_resolve addrinfo = 172.31.13.176:5060
2023-07-19 14:16:43.178666 tport.c:4831 tport_by_addrinfo() tport_by_addrinfo(0x55f26f510500): not found by name */172.31.13.176:5060
2023-07-19 14:16:43.178680 tport.c:4831 tport_by_addrinfo() tport_by_addrinfo(0x55f26f510780): not found by name */172.31.13.176:5060
2023-07-19 14:16:43.178694 tport.c:4831 tport_by_addrinfo() tport_by_addrinfo(0x55f26f510a00): not found by name */172.31.13.176:5060
2023-07-19 14:16:43.178707 tport.c:4831 tport_by_addrinfo() tport_by_addrinfo(0x55f26f510c80): not found by name */172.31.13.176:5060
2023-07-19 14:16:43.178720 tport.c:4831 tport_by_addrinfo() tport_by_addrinfo(0x55f26f510f00): not found by name */172.31.13.176:5060
2023-07-19 14:16:43.178734 tport.c:4831 tport_by_addrinfo() tport_by_addrinfo(0x55f26f511180): not found by name */172.31.13.176:5060
2023-07-19 14:16:43.178860 tport.c:3592 tport_send_msg() tport_vsend returned 488
2023-07-19 14:16:43.178903 send 488 bytes to udp/[172.31.13.176]:5060 at 14:16:43.178758:
REGISTER sip:172.31.13.176:5060 SIP/2.0
Via: SIP/2.0/UDP 172.31.13.176:4118;rport;branch=z9hG4bKBrQ1BpNSrmFaB
Max-Forwards: 70
From: "20701" <sip:20701@172.31.13.176:5060>;tag=rD4B9a4vUptHS
To: "20701" <sip:20701@172.31.13.176:5060>
Call-ID: c1699818-3770-4f5f-8600-cd5ddcc4b327
CSeq: 70318109 REGISTER
Contact: <sip:20701@172.31.13.176:4118;transport=tcp>;expires=120
Expires: 120
User-Agent: CTes
Content-Length: 0
spointer commented 1 year ago

I solved this issue with adding "transport=tcp" to request uri.