Open tinpotnick opened 8 months ago
If you want the contact to masquerade as the external ip, then I believe you need to do --contact sip:13.42.100.65:9997;transport=udp,tcp
.
I think @tinpotnick sets a proper argument(--external-ip to 13.42.100.65). If drachtio is set external-ip, i think drachtio is intended to replace the host part of well-known headers to that external-ip.
I found drachtio does not replace the host part of a contact header to the external ip inside the doRespondToSipRequest function.
// external ip is not set when calling makeTags function. tags = makeTags( headers, transportDesc ) ;
My issue is similar to @tinpotnick and here is the log i found.
2024-01-24 11:32:19.017153 Client::processMessage - got request with 4 tokens 2024-01-24 11:32:19.017166 Client::processMessage - request id bafe06b3-e132-4fbd-9111-e0ba6d5cfb74, request type: sip transaction id: 3e13bfcd-493a-4868-a143-a7e46bab0247, dialog id: 2024-01-24 11:32:19.017178 ClientController::addApiRequest: clientMsgId bafe06b3-e132-4fbd-9111-e0ba6d5cfb74; size: 1 2024-01-24 11:32:19.017226 SipDialogController::doRespondToSipRequest thread 140192544079552 2024-01-24 11:32:19.017264 SipDialogController::findAndRemoveTransactionIdForIncomingRequest - searching transactionId 3e13bfcd-493a-4868-a143-a7e46bab0247 2024-01-24 11:32:19.017276 SipDialogController::findAndRemoveTransactionIdForIncomingRequest - failed to find transactionId 3e13bfcd-493a-4868-a143-a7e46bab0247, most likely this is a response to an invite we sent 2024-01-24 11:32:19.017304 pending-request: removing entry, prior to removal length: 1 2024-01-24 11:32:19.017324 pending-request: removed entry, timer not set (queue is empty after removal), length: 0 2024-01-24 11:32:19.017347 nta.c:1428 set_timeout() nta: timer shortened to 200 ms 2024-01-24 11:32:19.017366 tport.c:1181 tport_ref() tport_ref(0x55f7b1dda500): refcount is now 5 2024-01-24 11:32:19.017403 nta.c:4604 nta_leg_tcreate() nta_leg_tcreate(0x55f7b1e06780) 2024-01-24 11:32:19.017422 DrachtioController::setupLegForIncomingRequest - created leg: 0x55f7b1e06780, irq: 0x55f7b1dfc8c0, for transactionId: 3e13bfcd-493a-4868-a143-a7e46bab0247, tag: 2024-01-24 11:32:19.017443 tport.c:1181 tport_ref() tport_ref(0x55f7b1dda500): refcount is now 6 2024-01-24 11:32:19.017458 SipDialog::SipDialog - (UAS) detected client behind nat, using 10.178.104.101:28504 as route for requests within this dialog 2024-01-24 11:32:19.017480 SipDialog::SipDialog - creating dialog for inbound INVITE sent from UDP/172.16.177.234:3417 2024-01-24 11:32:19.017502 adding IIP inbound tid:3e13bfcd-493a-4868-a143-a7e46bab0247 alive:0s leg:0x55f7b1e06780 irq:0x55f7b1dfc8c0 orq:0 rel:0 2024-01-24 11:32:19.017527 IIP_Insert incoming - ref count: 1 inserting inbound tid:3e13bfcd-493a-4868-a143-a7e46bab0247 alive:0s leg:0x55f7b1e06780 irq:0x55f7b1dfc8c0 orq:0 rel:0 2024-01-24 11:32:19.017546 tport.c:1194 tport_unref() tport_unref(0x55f7b1dda500): refcount is now 5 2024-01-24 11:32:19.017565 SipDialogController::doRespondToSipRequest found invite or subscribe in progress 0x55f7b1dde9a0 2024-01-24 11:32:19.017582 tport.c:1181 tport_ref() tport_ref(0x55f7b1dda500): refcount is now 6 2024-01-24 11:32:19.017601 SipTransport::getContactUri - created Contact header: sip:10.3.15.184:3417 2024-01-24 11:32:19.017625 tport.c:1194 tport_unref() tport_unref(0x55f7b1dda500): refcount is now 5 2024-01-24 11:32:19.017711 makeTags - Adding well-known header 'Call-ID' with value '008B4552-9279-1368-B6B9-B368B20AAA77-332971@10.178.104.101' 2024-01-24 11:32:19.017739 makeTags - Adding well-known header 'cseq' with value '1 INVITE' 2024-01-24 11:32:19.017759 makeTags - Adding well-known header 'from' with value 'sip:1111@test.com;user=phone;tag=008B4570-9279-1368-B6B9-B368B20AAA77-433212' 2024-01-24 11:32:19.017778 makeTags - Adding well-known header 'to' with value 'sip:1111205@10.178.104.101:5060' 2024-01-24 11:32:19.017797 makeTags - hdr 'contact' replacing host with 172.16.177.234 2024-01-24 11:32:19.017815 makeTags - Adding well-known header 'contact' with value 'sip:2412@172.16.177.234:3417' 2024-01-24 11:32:19.017853 SipDialogController::doRespondToSipRequest - client provided contact header so we wont include our internally-generated one 2024-01-24 11:32:19.017871 SipDialogController::doRespondToSipRequest - UAC is refresher, interval will be 180 2024-01-24 11:32:19.017884 SipDialog::setSessionTimer: 008B4552-9279-1368-B6B9-B368B20AAA77-332971@10.178.104.101 Session expires has been set to 180 seconds and refresher is them
When creating an outbound dialog using
createUAC( "sip:1006@82.19.206.102:41826;transport=tcp", someheadersbutdefinitlynocontactheader )
The outbound INVITE contains the contact string, which uses the private address rather than the external address. This is causing the phone to send the BYE to the wrong location.
i.e.
Contact: <sip:172.18.0.7:9997;transport=tcp>
I expect it to beContact: <sip:13.42.100.65:9997;transport=tcp>
Drachtio is started with
Start-up logs:
When we create the new dialog - this is the output from Drachtio