[Home]

Summary:ASTERISK-10161: SIP Notify on Snom phones causes Asterisk to stop responding (not crash)
Reporter:Ramon Peek-Fares (ramonpeek)Labels:
Date Opened:2007-08-24 05:35:30Date Closed:2007-10-29 09:27:39
Priority:BlockerRegression?No
Status:Closed/CompleteComponents:Channels/chan_sip/Interoperability
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 008.diff
( 1) cli.txt
( 2) gdb.txt
( 3) unescape-85177-1.patch
Description:Due to the revisions 79902-79904 which removes the semi-column in SIP NOTIFY messages asterisk will stop responding after a Snom phones is rebooted or check-synced through the SIP-NOTIFY command.

However Snom phones use the semi-column in their NOTIFY messages to reboot or load configuration. (they can't do without!)

Please note that the default SIP Notify message defined in sip_notify.conf still shows an escaped semi-column ;
  [snom-check-cfg]
  Event=>check-sync\;reboot=false
  Content-Length=>0

Not escaping the semi-column does not work, since the phone doesn't receive teh correct NOTIFY message and this reboots.. instead of just reloading it's configuration.

Simply reverting the revisions solves the problem..
But is that really the solution?
There must be a good reason for trying to remove that semi-column?


****** STEPS TO REPRODUCE ******

ON CLI:

  sip notify snom-check-cfg <peer>

After this command asterisk will stop responding.....
Comments:By: Ramon Peek-Fares (ramonpeek) 2007-08-24 06:04:08

BTW:
Reversing the patch doesn't make Asterisk crash anymore..
However it also does not make [snom-check-cfg] work...

By: Ramon Peek-Fares (ramonpeek) 2007-08-24 07:26:18

Looked a bit deeper into the issue...
It looks like the fix made in 9938 is causing quite a bit of problems.
I also needed to revert the changes in config.c to make it work again..

However the "real" issue here is that the "ast_unescape_semicolon" function works but after it has been called it seems to put Asterisk in a loop a bit further down the code..
The first time it's run, everything looks fine.. and the the SIP-NOTIFY is send correctly... but after that ..... BUMMER... :-(

When I remove the call to the "ast_unescape_semicolon" function the problem seems to be solved... however we then send an invalid NOTIFY message...
But asterisk doesn't crash..

Some further help is wanted..
Since I cannot seem to figure out where it is that Asterisk starts to loop.

PS:
My collegue Theo Belder will take over this issue..
Since I'm bound for a holiday in France ;-)

By: Jason Parker (jparker) 2007-08-24 10:10:50

The fix in revision 79904 does not remove the semicolon - it removes the backslash that was escaping the semicolon.

Please upload a backtrace.

By: Theo Belder (tbelder) 2007-08-27 01:31:14

I don't think a backtrace is necessary because asterisk doesn’t crash. It hangs. When I do a ‘ps -aux’ I see asterisk has a cpu load of 70-80%.

When I change the following code in chan_sip.c (method: sip_notify)
   add_header(&req, var->name, ast_unescape_semicolon(var->value));
to
   add_header(&req, var->name, var->value);

Asterisk will work properly, only the semicolon is still escaped (off course).


I have take a look in the code of util.c for the method ‘ast_unescape_semicolon’ and should work properly.

When you send a ‘snom-check-cfg’ it works, only immediately asterisk hangs and gives a cpu load of 70-80%.

I hope this enough information.. If a backtrace is necessary I will upload a backtrace.

By: Theo Belder (tbelder) 2007-08-31 04:01:27

Is there already any progression with this bug? Please could you tell me whether you have enough information or not and a backtrace is necessary.

By: Theo Belder (tbelder) 2007-09-11 02:32:53

* kick *

By: Jason Parker (jparker) 2007-09-12 11:46:20

Yes, more information is needed.

It was said that it loops "a bit further down the code" - if you know where it's happening, please say so.

I also need to see CLI logs, and a backtrace (as I requested previously...)

By: Theo Belder (tbelder) 2007-09-13 02:54:08

Uploaded cli.txt en gdb.txt. Hope this is the information you need.

I don't know where in the code it loops.
As is said, the function 'ast_unescape_semicolon' in sip_notify returns correctly. But after that asterisk isn't responding. When I comment the call 'ast_unescape_semicolon', asterisk works fine, only the sip notify isn't send correctly (off course).

By: mlegas (mlegas) 2007-09-25 04:59:15

I have the same problem on 1.4.11 and snom phones
a first sip notify will work and the second one will cause asterisk to hang

By: Ramon Peek-Fares (ramonpeek) 2007-10-09 17:26:59

We wrote the attached patch to revert back to the old functionality.
Offcourse this is a dirty thing, because we ignore all the changes that most likely have been made by other purposly.
However it gives us the ability to run our asterisk server.

Obviuosly we should handle this correctly.
I hope this small and dirty revert-patch will interest someone to look abit further.. since I couldn't understand why they made those changes and also where exactly.

By: Igor Goncharovsky (igorg) 2007-10-09 22:01:22

this is a simple problem, but take some time to solve. Second time, when ast_unescape_semicolon semicolon already unescaped and we have endless cycle on while. I'll post patch in a few minutes.

By: Igor Goncharovsky (igorg) 2007-10-09 22:17:46

This is also must be fixed in 1.4. If semicolon already escaped then ast_unescape_semicolon deadlocked :(

By: Theo Belder (tbelder) 2007-10-11 02:20:48

Thanks IgorG. The patch you wrote works for us. I've commit it on 1.4.13 and asterisk isn't deadlocked anymore.

By: Theo Belder (tbelder) 2007-10-29 08:56:17

The patch 'unescape-85177-1.patch' uploaded by IgorG solves the problem. Could this patch be applied to the branch?

By: Digium Subversion (svnbot) 2007-10-29 09:22:53

Repository: asterisk
Revision: 87294

U   branches/1.4/main/utils.c

------------------------------------------------------------------------
r87294 | file | 2007-10-29 09:22:52 -0500 (Mon, 29 Oct 2007) | 6 lines

Fix issue with ast_unescape_semicolon going into an endless loop.
(closes issue ASTERISK-10161)
Reported by: ramonpeek
Patches:
     unescape-85177-1.patch uploaded by IgorG (license 20)

------------------------------------------------------------------------

By: Digium Subversion (svnbot) 2007-10-29 09:27:39

Repository: asterisk
Revision: 87295

_U  trunk/
U   trunk/main/utils.c

------------------------------------------------------------------------
r87295 | file | 2007-10-29 09:27:38 -0500 (Mon, 29 Oct 2007) | 14 lines

Merged revisions 87294 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r87294 | file | 2007-10-29 11:23:49 -0300 (Mon, 29 Oct 2007) | 6 lines

Fix issue with ast_unescape_semicolon going into an endless loop.
(closes issue ASTERISK-10161)
Reported by: ramonpeek
Patches:
     unescape-85177-1.patch uploaded by IgorG (license 20)

........

------------------------------------------------------------------------