Summary:ASTERISK-12621: [patch] Manager action SipNotify disconnecting the manager session on error
Reporter:Tomás Laureano Peralta Tormey (laureano)Labels:
Date Opened:2008-08-20 22:42:41Date Closed:2008-08-22 15:12:05
Versions:Frequency of
Environment:Attachments:( 0) sipnotify_action_fix.patch
Description:Sending an SipNotify action without a Channel header or with an invalid channel will disconnect from the current manager session. This is caused by the return value of the funcion manager_sipnotify (-1).
As far I can see, other implementations of manager action functions always return 0, even on error. Also, the channel header is not being correctly checked.

The uploaded patch fixes both issues.

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

Connect to a manager session an issue a SipNotify without the Channel header.


Output from the AMI interface:
tomas@newells:~/asterisk-java$ telnet dev 5038
Connected to dev.
Escape character is '^]'.
Asterisk Call Manager/1.1
Action: Login
Username: mark
Secret: mysecret

Response: Success
Message: Authentication accepted

Action: SipNotify

Response: Error
Message: Could not create address

Connection closed by foreign host.
Comments:By: Digium Subversion (svnbot) 2008-08-22 15:12:03

Repository: asterisk
Revision: 139563

U   trunk/channels/chan_sip.c

r139563 | mmichelson | 2008-08-22 15:12:03 -0500 (Fri, 22 Aug 2008) | 15 lines

The -1 return value from incomplete or improper
headers for the SipNotify manager command was
causing the current manager session to become
disconnected. Change the return value to 0 for
these cases.

Also change a test for a NULL pointer to be
ast_strlen_zero instead.

(closes issue ASTERISK-12621)
Reported by: Laureano
     sipnotify_action_fix.patch uploaded by Laureano (license 265)