1
votes

Server is a Opensips server 1.10.0-tls (linux). It can handle conversations to/from local stations and recently it has been updated to allow stations from external systems. It does this by changing the username, ip and port in the $ru if the station doesn't exist locally ($tu is untouched). This works fine for invites, calls and all similar messages.

The problem I'm having is that byes coming from the external server, that are being passed on to the local client station, are being rejected by a 481 (call leg/transaction does not exist) that i can confirm is coming from the client software, yet it accepts byes from local stations on the same server without any bother. Calls from local to local end ok, calls from local to external all shutdown ok, it's just calls from external caller to local callee that won't close (it is the callee that is saying 481).

I understand this is caused by transaction matching not occurring due to something different in the tags in the to/from and the call-id; i understand that something (like my $ru script) that changes parts of the $ru might have an effect on the hash to determine the transaction, but i don't change the tags or the callid, just the $ru name to make it go to the right IP and station name.

My question is how do i go about solving this on the server without changing the client applications? I've included some examples of the messages being sent below taken from a wireshark capture on the client workstation, so i'm unsure what i'm doing wrong..I've tried different things on the server with no luck. Is there a way to mark or tell the client via sip messages to shutdown the conversation regardless of transaction matching?

I would greatly appreciate any aid in this as I've been pulling my hair out about this for some time.

Message examples for External caller (103 on server 5.44) to Local Callee (local name is wks2, external ref name is 155, on server 3.3, client is 3.0). First bye is the problem, second bye is me closing the hanging connection on the client.

----------
INVITE sip:[email protected]:5050 SIP/2.0  
    Record-Route: <sip:172.16.3.3;lr;ftag=as678f227c>  
    Via: SIP/2.0/UDP 172.16.3.3:5060;branch=z9hG4bKd066.93df6e05.0  
    Via: SIP/2.0/UDP 172.16.5.44:5060;received=172.16.5.44;branch=z9hG4bK50029c58;rport=5060  
    Max-Forwards: 69  
    From: "Station 103   " <sip:[email protected]>;tag=as678f227c  
    To: <sip:[email protected]:5060>  
    Contact: <sip:[email protected]:5060>  
    Call-ID: [email protected]:5060  
    CSeq: 102 INVITE  
    User-Agent: Asterisk PBX 1.8.13.1~dfsg1-3+deb7u3  
    Date: Thu, 25 Jun 2015 14:27:31 GMT  
    Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH  
    Supported: replaces, timer  
    Content-Type: application/sdp  
    Content-Length: 296  
    Redirect-to: sip:[email protected]:5060  
----------
SIP/2.0 180 Ringing  
    Via: SIP/2.0/UDP 172.16.3.3:5060;branch=z9hG4bKd066.93df6e05.0;received=172.16.3.3;rport=5060  
    Via: SIP/2.0/UDP 172.16.5.44:5060;received=172.16.5.44;branch=z9hG4bK50029c58;rport=5060  
    To: <sip:[email protected]:5060>;tag=1262186908  
    From: "Station 103   " <sip:[email protected]>;tag=as678f227c  
    Call-ID: [email protected]:5060  
    CSeq: 102 INVITE  
    Allow: ACK, BYE, CANCEL, INFO, INVITE, NOTIFY, OPTIONS, REFER, REGISTER, SUBSCRIBE  
    Content-Length: 0  
----------
SIP/2.0 200 Ok  
    Via: SIP/2.0/UDP 172.16.3.3:5060;branch=z9hG4bKd066.93df6e05.0;received=172.16.3.3;rport=5060  
    Via: SIP/2.0/UDP 172.16.5.44:5060;received=172.16.5.44;branch=z9hG4bK50029c58;rport=5060  
    To: <sip:[email protected]:5060>;tag=1262186908  
    From: "Station 103   " <sip:[email protected]>;tag=as678f227c  
    Call-ID: [email protected]:5060  
    CSeq: 102 INVITE  
    Contact: <sip:172.16.3.0:5050>  
    Record-Route: <sip:172.16.3.3;lr;ftag=as678f227c>  
    Server: www.sipsorcery.com  
    Content-Length: 161  
    Content-Type: application/sdp  
----------
ACK sip:172.16.3.0:5050 SIP/2.0  
    Via: SIP/2.0/UDP 172.16.3.3:5060;branch=z9hG4bKd066.93df6e05.2  
    Via: SIP/2.0/UDP 172.16.5.44:5060;received=172.16.5.44;branch=z9hG4bK49d179f0;rport=5060  
    Max-Forwards: 69  
    From: "Station 103   " <sip:[email protected]>;tag=as678f227c  
    To: <sip:[email protected]:5060>;tag=1262186908  
    Contact: <sip:[email protected]:5060>  
    Call-ID: [email protected]:5060  
    CSeq: 102 ACK  
    User-Agent: Asterisk PBX 1.8.13.1~dfsg1-3+deb7u3  
    Content-Length: 0  
----------
BYE sip:172.16.3.0:5050 SIP/2.0  
    Via: SIP/2.0/UDP 172.16.3.3:5060;branch=z9hG4bKe066.64948323.0  
    Via: SIP/2.0/UDP 172.16.5.44:5060;received=172.16.5.44;branch=z9hG4bK1e381a63;rport=5060  
    Max-Forwards: 69  
    From: "Station 103   " <sip:[email protected]>;tag=as678f227c  
    To: <sip:[email protected]:5060>;tag=1262186908  
    Call-ID: [email protected]:5060  
    CSeq: 103 BYE  
    User-Agent: Asterisk PBX 1.8.13.1~dfsg1-3+deb7u3  
    X-Asterisk-HangupCause: Normal Clearing  
    X-Asterisk-HangupCauseCode: 16  
    Content-Length: 0  
----------
SIP/2.0 481 CallLegTransactionDoesNotExist  
    Via: SIP/2.0/UDP 172.16.3.3:5060;branch=z9hG4bKe066.64948323.0;received=172.16.3.3;rport=5060  
    Via: SIP/2.0/UDP 172.16.5.44:5060;received=172.16.5.44;branch=z9hG4bK1e381a63;rport=5060  
    To: <sip:[email protected]:5060>;tag=1262186908  
    From: "Station 103   " <sip:[email protected]>;tag=as678f227c  
    Call-ID: [email protected]:5060  
    CSeq: 103 BYE  
    Allow: ACK, BYE, CANCEL, INFO, INVITE, NOTIFY, OPTIONS, REFER, REGISTER, SUBSCRIBE  
    Content-Length: 0  
----------
BYE sip:[email protected]:5060 SIP/2.0  
    Via: SIP/2.0/UDP 172.16.3.0:5050;branch=z9hG4bKfe13e63d99524b06846bde0fedbd8a69;rport  
    To: "Station 103   " <sip:[email protected]>;tag=as678f227c  
    From: <sip:[email protected]:5060>;tag=1262186908  
    Call-ID: [email protected]:5060  
    CSeq: 103 BYE  
    Max-Forwards: 70  
    Route: <sip:172.16.3.3;lr;ftag=as678f227c>  
    Content-Length: 0  
----------
SIP/2.0 481 Call leg/transaction does not exist  
    Via: SIP/2.0/UDP 172.16.3.0:5050;received=172.16.3.0;branch=z9hG4bKfe13e63d99524b06846bde0fedbd8a69;rport=5050  
    From: <sip:[email protected]:5060>;tag=1262186908  
    To: "Station 103 " <sip:[email protected]>;tag=as678f227c  
    Call-ID: [email protected]:5060  
    CSeq: 103 BYE  
    Server: Asterisk PBX 1.8.13.1~dfsg1-3+deb7u3  
    Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH  
    Supported: replaces, timer  
    Content-Length: 0  
----------

Thank you :-)

1
Turns out client apps weren't following the standard routine for checking transactions, they were checking against the call-id and the To-tag against the internally stored contact header. Because redirection/diversion occurred, the names never matched so it always sends a 481. Informed the client app it needs to check against the to-tag and call-id instead when checking to see if the bye message was for it. I also added the diversion headerline into the server to help. Could not rename the To header at all without issues on the server to accomodate non-standard client behaviour.TsukikoValkyr

1 Answers

1
votes

See comment above, issue was client app was following non-standard behaviour for checking bye messages (it checked to, not the to-tag). Issue being resolved through client app change.