[OpenSIPS-Users] null dialog error on callee BYE

Răzvan Crainea razvan at opensips.org
Fri Jun 11 07:05:36 EST 2021


Hi, Kingsley!

The BYE that comes from gw1 does not appear to be right, as the r-uri 
domain points to OpenSIPS itself, therefore, after the first 
loose_route(), the BYE would loop back to OpenSIPS - that's probably 
when you get that error.
The BYE coming from gw1 should have gw2 in R-URI (79.121.42.22:5060), 
not the proxy's IP. This is probably happening due to a bad contact sent 
to gw1, or perhaps a bad fixing of the contact of gw1 - I don't have the 
entire call flow, so I can't say exactly.
What you could try though is after validate_dialog(), run 
fix_route_dialog() [1] - this might repair what gw1 is sending and point 
R-URI to gw2.

[1] https://opensips.org/docs/modules/3.2.x/dialog.html#idp6271744

Best regards,

Răzvan Crainea
OpenSIPS Core Developer
http://www.opensips-solutions.com

On 6/10/21 8:24 PM, Kingsley Tart wrote:
> Hi,
> 
> I'm getting null dialog errors when the callee hangs up, but not when
> the caller hangs up.
> 
> In this example, I'm calling from gw2 to gw1. The call gets answered.
> If gw2 hangs up, all is good. If gw1 hangs up, it is not.
> 
> This is the top of my routing script (xlog just for diags):
> 
> if (has_totag()) {
> 	if (is_method("ACK") && t_check_trans()) {
> 		t_relay();
> 		exit;
> 	}
> 	if (!loose_route()) {
> 		xlog("NOT loose_route()\n");
> 		send_reply(404, "Not here");
> 		exit;
> 	} else {
> 		xlog("loose_route() OK\n");
> 	}
> 	if (!validate_dialog()) {
> 		xlog("Ignoring $rm from $si due to invalid dialog; rc=$rc\n");
> 		exit;
> 	}
> 		if (is_method("BYE")) {
> 		route(acc_leg_set_end_reason);
> 	}
> 		route(relay);
> 	exit;
> }
> 
> 
> And this is the dialog match mode:
> 
> modparam("dialog", "dlg_match_mode", 1)
> 
> I'm calling record_route() and then create_dialog("pP") when I receive
> an INVITE.
> 
> 
> If the call is answered and then gw1 sends the BYE, I get this in the
> opensips log:
> 
> loose_route() OK
> ERROR:dialog:w_validate_dialog: null dialog
> Ignoring BYE from 79.121.42.21 due to invalid dialog; rc=-4
> 
> 
> and I see the following SIP messages coming from gw1, and re-trying
> because I'm dropping the messages due to null dialog:
> 
> (RX and TX from the perspective of OpenSIPS)
> 
> RX<-gw1  U 2021/06/10 17:58:44.950661 79.121.42.21:5060 -> 79.121.42.45:5060 #29059
> RX<-gw1  BYE sip:asterisk at 79.121.42.45:5060 SIP/2.0.
> RX<-gw1  Via: SIP/2.0/UDP 79.121.42.21:5060;rport;branch=z9hG4bKPjc946d0af-e97d-4f85-b592-58df46d73d0e.
> RX<-gw1  From: <sip:02030212929 at 79.121.42.21>;tag=0b7b5a28-2dc1-493f-8d74-c939674643f3.
> RX<-gw1  To: <sip:01743272015 at 79.121.42.22>;tag=682e4380-74c8-4a53-a1f4-a339d758c986.
> RX<-gw1  Call-ID: cc4f4b92-7ba0-4c43-9b8e-c467fa897460.
> RX<-gw1  CSeq: 30163 BYE.
> RX<-gw1  Route: <sip:79.121.42.45;lr;did=d9c.67fcbf86>.
> RX<-gw1  Reason: Q.850;cause=16.
> RX<-gw1  Max-Forwards: 70.
> RX<-gw1  User-Agent: Asterisk PBX 13.27.0.
> RX<-gw1  Content-Length:  0.
> RX<-gw1  .
> 
> RX<-gw1  U 2021/06/10 17:58:45.451242 79.121.42.21:5060 -> 79.121.42.45:5060 #29060
> RX<-gw1  BYE sip:asterisk at 79.121.42.45:5060 SIP/2.0.
> RX<-gw1  Via: SIP/2.0/UDP 79.121.42.21:5060;rport;branch=z9hG4bKPjc946d0af-e97d-4f85-b592-58df46d73d0e.
> RX<-gw1  From: <sip:02030212929 at 79.121.42.21>;tag=0b7b5a28-2dc1-493f-8d74-c939674643f3.
> RX<-gw1  To: <sip:01743272015 at 79.121.42.22>;tag=682e4380-74c8-4a53-a1f4-a339d758c986.
> RX<-gw1  Call-ID: cc4f4b92-7ba0-4c43-9b8e-c467fa897460.
> RX<-gw1  CSeq: 30163 BYE.
> RX<-gw1  Route: <sip:79.121.42.45;lr;did=d9c.67fcbf86>.
> RX<-gw1  Reason: Q.850;cause=16.
> RX<-gw1  Max-Forwards: 70.
> RX<-gw1  User-Agent: Asterisk PBX 13.27.0.
> RX<-gw1  Content-Length:  0.
> RX<-gw1  .
> 
> RX<-gw1  U 2021/06/10 17:58:46.450860 79.121.42.21:5060 -> 79.121.42.45:5060 #29061
> RX<-gw1  BYE sip:asterisk at 79.121.42.45:5060 SIP/2.0.
> RX<-gw1  Via: SIP/2.0/UDP 79.121.42.21:5060;rport;branch=z9hG4bKPjc946d0af-e97d-4f85-b592-58df46d73d0e.
> RX<-gw1  From: <sip:02030212929 at 79.121.42.21>;tag=0b7b5a28-2dc1-493f-8d74-c939674643f3.
> RX<-gw1  To: <sip:01743272015 at 79.121.42.22>;tag=682e4380-74c8-4a53-a1f4-a339d758c986.
> RX<-gw1  Call-ID: cc4f4b92-7ba0-4c43-9b8e-c467fa897460.
> RX<-gw1  CSeq: 30163 BYE.
> RX<-gw1  Route: <sip:79.121.42.45;lr;did=d9c.67fcbf86>.
> RX<-gw1  Reason: Q.850;cause=16.
> RX<-gw1  Max-Forwards: 70.
> RX<-gw1  User-Agent: Asterisk PBX 13.27.0.
> RX<-gw1  Content-Length:  0.
> RX<-gw1  .
> 
> 
> but if the caller (gw2) hangs up and sends the BYE, then all is fine:
> 
> RX<-gw2  U 2021/06/10 17:57:37.506889 79.121.42.22:5060 -> 79.121.42.45:5060 #29043
> RX<-gw2  BYE sip:79.121.42.21:5060 SIP/2.0.
> RX<-gw2  Via: SIP/2.0/UDP 79.121.42.22:5060;rport;branch=z9hG4bKPjdf132a9c-ee20-4cbd-bbf4-ccb3d0aaab42.
> RX<-gw2  From: <sip:01743272015 at 79.121.42.22>;tag=c91f69bc-9548-4245-86b9-a9202d0b33c8.
> RX<-gw2  To: <sip:02030212929 at 79.121.42.45>;tag=3d0cfd81-357b-448f-92ab-712aadfdf895.
> RX<-gw2  Call-ID: 38e1a3aa-54d3-456a-99b2-201295179c95.
> RX<-gw2  CSeq: 9118 BYE.
> RX<-gw2  Route: <sip:79.121.42.45;lr;did=fcb.680bf303>.
> RX<-gw2  Reason: Q.850;cause=16.
> RX<-gw2  Max-Forwards: 70.
> RX<-gw2  User-Agent: Asterisk PBX 13.27.0.
> RX<-gw2  Content-Length:  0.
> RX<-gw2  .
> 
> TX->gw1  U 2021/06/10 17:57:37.507451 79.121.42.45:5060 -> 79.121.42.21:5060 #29044
> TX->gw1  BYE sip:79.121.42.21:5060 SIP/2.0.
> TX->gw1  Via: SIP/2.0/UDP 79.121.42.45:5060;branch=z9hG4bK5071.80e2e516.0.
> TX->gw1  Via: SIP/2.0/UDP 79.121.42.22:5060;received=79.121.42.22;rport=5060;branch=z9hG4bKPjdf132a9c-ee20-4cbd-bbf4-ccb3d0aaab42.
> TX->gw1  From: <sip:01743272015 at 79.121.42.22>;tag=c91f69bc-9548-4245-86b9-a9202d0b33c8.
> TX->gw1  To: <sip:02030212929 at 79.121.42.45>;tag=3d0cfd81-357b-448f-92ab-712aadfdf895.
> TX->gw1  Call-ID: 38e1a3aa-54d3-456a-99b2-201295179c95.
> TX->gw1  CSeq: 9118 BYE.
> TX->gw1  Reason: Q.850;cause=16.
> TX->gw1  Max-Forwards: 70.
> TX->gw1  User-Agent: Asterisk PBX 13.27.0.
> TX->gw1  Content-Length:  0.
> TX->gw1  .
> 
> RX<-gw1  U 2021/06/10 17:57:37.508346 79.121.42.21:5060 -> 79.121.42.45:5060 #29045
> RX<-gw1  SIP/2.0 200 OK.
> RX<-gw1  Via: SIP/2.0/UDP 79.121.42.45:5060;rport=5060;received=79.121.42.45;branch=z9hG4bK5071.80e2e516.0.
> RX<-gw1  Via: SIP/2.0/UDP 79.121.42.22:5060;rport=5060;received=79.121.42.22;branch=z9hG4bKPjdf132a9c-ee20-4cbd-bbf4-ccb3d0aaab42.
> RX<-gw1  Call-ID: 38e1a3aa-54d3-456a-99b2-201295179c95.
> RX<-gw1  From: <sip:01743272015 at 79.121.42.22>;tag=c91f69bc-9548-4245-86b9-a9202d0b33c8.
> RX<-gw1  To: <sip:02030212929 at 79.121.42.45>;tag=3d0cfd81-357b-448f-92ab-712aadfdf895.
> RX<-gw1  CSeq: 9118 BYE.
> RX<-gw1  Server: Asterisk PBX 13.27.0.
> RX<-gw1  Content-Length:  0.
> RX<-gw1  .
> 
> TX->gw2  U 2021/06/10 17:57:37.509205 79.121.42.45:5060 -> 79.121.42.22:5060 #29046
> TX->gw2  SIP/2.0 200 OK.
> TX->gw2  Via: SIP/2.0/UDP 79.121.42.22:5060;rport=5060;received=79.121.42.22;branch=z9hG4bKPjdf132a9c-ee20-4cbd-bbf4-ccb3d0aaab42.
> TX->gw2  Call-ID: 38e1a3aa-54d3-456a-99b2-201295179c95.
> TX->gw2  From: <sip:01743272015 at 79.121.42.22>;tag=c91f69bc-9548-4245-86b9-a9202d0b33c8.
> TX->gw2  To: <sip:02030212929 at 79.121.42.45>;tag=3d0cfd81-357b-448f-92ab-712aadfdf895.
> TX->gw2  CSeq: 9118 BYE.
> TX->gw2  Server: Asterisk PBX 13.27.0.
> TX->gw2  Content-Length:  0.
> TX->gw2  .
> 
> 
> Am I doing something silly here?
> 
> Cheers,
> Kingsley.
> 
> 
> 
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
> 



More information about the Users mailing list