Summary:ASTERISK-09204: Bad reinvite when called close the call...
Reporter:Nicky (nicky)Labels:
Date Opened:2007-04-05 16:06:09Date Closed:2011-06-07 14:03:19
Versions:Frequency of
Environment:Attachments:( 0) asterisk_vs_clarent_reinvite.txt
( 1) Called_is_reinvited.txt
( 2) Called_Hangup_chan_sip.c_patched.txt
( 3) Caller_Hangup_chan_sip.c_patched.txt
( 4) chan_sip.patch
( 5) verbosedebug.txt
Description:For my project, I need to activate the reinvite because I use a Clarent Call Manager and the RTP voice is handled by Clarent Gateway. Without this option, there is no voice and no reinvit problem of course.

So when the option reinvit is actived on Asterisk, when the called close the call, the caller stay connected, and if caller close, called stay connected. Apparently Asterisk doesn't destroy the two legs of the call...

And a strange reinvit is sent by asterisk to the called when he try to close the call. So the phone ring but no voice communication :(

The problem is not see if the called stay online for few seconds after caller close the call.


I hope my description is clear ;-)

Here the caller (12345678) call the number 33XXXXXXXX:

12345678 --> clarent GW --> CallManager5 --> Asterisk -> 33XXXXXXXXX
Comments:By: please_remove_this_account (quintana) 2007-04-06 06:36:53

We have testing with asterisk 1.2.17 and there is he same problem. Maybe it's an interop problem with the hangup.

By: Serge Vecher (serge-v) 2007-04-06 08:53:21

the SIP debug trace you've posted does not contain 'debug' output. Please reproduce as per following (use 1.2.17 for testing):
1) Prepare test environment (reduce the amount of unrelated traffic on the server);
2) Make sure your logger.conf has the following line:
  console => notice,warning,error,debug
3) restart Asterisk with the following command:
  'asterisk -Tvvvvvdddddngc | tee /tmp/verbosedebug.txt'
4) Enable SIP transaction logging with the following CLI commands (1.4/trunk commands in parenthesis):
set debug 4 (core set debug 4)
set verbose 4 (core set verbose 4)
sip debug (sip set debug)
5) Reproduce the problem
6) Trim startup information and attach verbosedebug.txt to the issue.

By: please_remove_this_account (quintana) 2007-04-06 09:10:34

After some further tests including packet sniffing and analysis of sip sessions, neither Clarent Call Manager nor Asterisk are respecting the SIP protocol :

1) Asterisk continues to send re-INVITEs on a session where a BYE as been ACKnowledged

2) Clarent Call Manager doesn't answer at all to re-INVITEs messages.

Both bugs needs to be fixed in order for this call scenario to be processed cleanly.

A summary of SIP sessions is uploaded in asterisk_vs_clarent_reinvite.txt

By: please_remove_this_account (quintana) 2007-04-06 09:50:16

Another _extremely_ broken thing in the way the Clarent tries (and miserably fails) to talk SIP is that it appears to store SIP headers it know nothing about and send them back in its following messages...

This results in quite "funny" incoming SIP packets to be sent by the Clarent with "user-agent: Asterisk PBX" for example, and could with other headers break things in really creative ways.

Maybe Asterisk continues to send reINVITE message after having ACKnowledged BYE because the BYE seems to contain a wrong sequence number (it's the same as the one in the INVITE, after reading the SIP RFC I think it shouldn't) ?

By: Serge Vecher (serge-v) 2007-04-06 12:11:31

we need that verbosedebug.txt, Quintana

By: please_remove_this_account (quintana) 2007-04-06 12:20:27

Serge-v we working on a patch on we send us all informations on the next week.

By: Malcolm Davenport (mdavenport) 2007-04-06 16:30:31

Bug ReInvite SIP - Full Trace.rtf deleted by request of the bug poster.

By: Nicky (nicky) 2007-04-06 22:50:40

Added verbose debug trace...

In the log at 22:53:32, when the called hangup the call, the asterisk make a "Returning from native bridge" and an another SIP re-invite is delayed...

By: Nicky (nicky) 2007-04-07 19:48:29

Here the patch to fix two problem in the setup :
1/ Stop to send re-INVITEs after call is closed
2/ Remove the test on pending invite before send the BYE to close the call

By: Serge Vecher (serge-v) 2007-04-09 11:32:01

nicky: you forgot to enter "sip set debug" in step 4. To be sure what your patch is doing, please redo the log for Asterisk without a patch and with your patch.

By: Nicky (nicky) 2007-04-09 16:40:02

I upload two scenario (hangup by called or caller) with asterisk 1.2.17 patched...

By: Serge Vecher (serge-v) 2007-04-09 16:50:57

ok, we also need a log from *unpatched* asterisk

By: Olle Johansson (oej) 2007-05-30 02:45:55

This patch is obviously wrong, since we cancel retransmits in the sip_hangup() function. I think you are communicating with a very poor sip implementation.

By: Guillaume Knispel (gknispel_proformatique) 2007-06-07 04:20:54

oej: are you saying that a version of Asterisk above 1.2.14 has been corrected so that it won't retransmit unanswered pending _RE_invites after it has received a BYE from the peer ?
Because 1.2.14 had the problem, and looking carefully to both chan_sip.c and the attached patch chan_sip.patch, it is trivial to trace the problem.

By: Joshua C. Colp (jcolp) 2007-10-22 11:03:26

Suspended for now since this is a 1.2 issue.