Summary:ASTERISK-11369: Asterisk don't get the BYE packet from callee
Reporter:Magnus Nordström (mnnojd)Labels:
Date Opened:2008-02-04 04:47:42.000-0600Date Closed:2008-02-08 09:30:30.000-0600
Versions:Frequency of
Environment:Attachments:( 0) asterisk.log
( 1) sip.conf
( 2) sipsettings.log
( 3) Wireshark_at_Asterisk

There is problem when callee hangup the call which is connected between a caller, Asterisk and callee. Asterisk don't get the bye packet from callee. But if the caller hangup the call everything works fine.


The problem is when Asterisk call to the callee and in the packet SIP invite in sip message header "Contact:" there is port number set to 0, and then later when callee hangup and send a bye packet(it uses the information from "Contact") - the packet sends to correct ip-address but to wrong port number and Asterisk never got the packet. Instead a ICMP packet sends back with information about "Unreachable port".

Sip-client A calls to Asterisk which switch the call to sip-client B. B answering and they have a call. Then B hangup the call and Asterisk still yet think the call is connected.

In extensions.conf I have the extension;

exten => 12345, 1, Dial(SIP/B@sipserver.se)
exten => 12345, n, Hangup()

The problem is always repeatable.

The platform is: Linux Ubuntu Desktop ver 7.10

I think there is some other reported bugs which is related to this but have other scenarios.

Comments:By: Joshua C. Colp (jcolp) 2008-02-04 08:22:14.000-0600

Please attach your sip.conf minus passwords

By: pj (pj) 2008-02-06 06:38:37.000-0600

I'm also experiencing this issue, as workaround I'm using 'rtptimeout=15' in sip.conf [general] section to hangup death sip channels.

By: Joshua C. Colp (jcolp) 2008-02-06 09:16:33.000-0600

That is quite strange... okay. Can either of you attach full console output with debug enabled in logger.conf plus sip debug and as well the output of sip show settings on an affected system. This will narrow down exactly where the port is not correct.

By: Private Name (falves11) 2008-02-06 18:28:16.000-0600

Regarding my "closed" about the malformation of the contact field on an Invite.
I did a painstaking regression analysis and the last version that works is 99082, when you jump to 99085, the contact field is malformed and asterisk can not talk to many sip end-points. I think that I am the only one in the world that is using Trunk for business on a high density wholesale model, otherwise, somebody else must have found out about this issue. The change happenned in the jump from 99082 to 99085. Since we are now in 102726+, I think that we should stop here and fix this issue. I had to go back and use a previous version, but I want to use the latest memory fixes. Please help.

By: Magnus Nordström (mnnojd) 2008-02-07 02:40:57.000-0600


Here I send you some logs.

There is two sip-clients and they are registered as;

A = sipcon1@, this is on ip-address
B = allanec@, this is on ip-address
Asterisk at ip-address

and the sip-server is at ip-address This environment is local but I have tried on public ip-addresses with same results.

In this case A calls to Asterisk with address 11111@ and in Asterisk the extension 11111@ switches to allanec@ which is B.

I collected some logs from Asterisk(file asterisk.log and sipsettings.log) which you asked for, but if there is some missing information, just tell me.

I also collected some logs with Wireshark(file Wireshark_at_asterisk) in same computer as Asterisk. In the logs with Wireshark is it interesting to se the sip invite from Asterisk to B, there you find in header "Contact" there is port number 0...

By: Private Name (falves11) 2008-02-07 21:41:16.000-0600

I found the offending code
where it says ast_string_field_build(p, our_contact, "<sip:%s%s%s:%d>
it should say
ast_string_field_build(p, our_contact, "<sip:%s%s%s>
and it works fine. Maybe it is more complex than that, and maybe the developers had a good reason to write it that way, but for now it works.

By: Go4Calls INC (go4calls) 2008-02-08 04:21:46.000-0600


In which file i should modify ast_string_field_build(p, our_contact, "<sip:%s%s%s> it?

I am facing same problem the calls stay very long in asterisk when asterisk did not recived the BYE.

Thank You

By: Private Name (falves11) 2008-02-08 05:44:12.000-0600

The file that needs patching is main/chan_sip.c

By: Digium Subversion (svnbot) 2008-02-08 09:30:28.000-0600

Repository: asterisk
Revision: 103018

U   trunk/channels/chan_sip.c

r103018 | file | 2008-02-08 09:30:26 -0600 (Fri, 08 Feb 2008) | 4 lines

Fix a network byte order issue and ensure when creating an outgoing dialog that the socket always contains information such as type and port.
(closes issue ASTERISK-11369)
Reported by: mnnojd