Summary:ASTERISK-20360: XMPP sendtodialplan hangs up after executing first priority (when using Hangup())
Reporter:Noah Engelberth (mlnoah)Labels:
Date Opened:2012-09-04 13:03:51Date Closed:2015-03-14 10:26:30
Status:Closed/CompleteComponents:Core/Channels Resources/res_xmpp
Versions:SVN Frequency of
Environment:CentOS 6.3 for Asterisk. XMPP server running Openfire 3.6.4 on CentOS 5.8. XMPP client sending messages to Asterisk is Pidgin 2.10.6Attachments:( 0) xmpp-backtrace.txt
( 1) xmpp-debug.txt
Description:When using sendtodialplan=yes in xmpp.conf for res_xmpp.so and you have a Hangup() in the execution path for the inbound unsolicited XMPP messages, Asterisk will process the first inbound XMPP message as expected, and then all subsequent inbound XMPP messages will execute ONLY the first priority before hanging up the "call".  Restarting Asterisk causes the first XMPP message received after the restart to work, and then the hangup after first priority problem returns.  If no Hangup() ever executes during XMPP messages (instead relying on auto-fallthrough to hangup the message "calls"), XMPP messages will run as expected.  Once the Hangup() has executed, I cannot get Asterisk to resume receiving messages without restarting Asterisk.

Regardless of how res_xmpp.so was loaded, trying to use "module reload res_xmpp.so" to get it to resume normal message handling results in a debug output of "xmpp.conf was unchanged", and Asterisk continues to hangup on incoming XMPP messages after executing a single priority.  

If res_xmpp.so was noload'ed in modules.conf and manually loaded from asterisk -r, attempting to issue "module unload res_xmpp.so" crashes asterisk, with no debug output making it to the console prior to the crash.  I have attached the backtrace to this ticket.

If res_xmpp.so was automatically loaded at Asterisk runtime, attempting to issue "module unload res_xmpp.so" causes the console to output the "Unregistered application" and "Unregistered function" lines, but the XMPP client remains logged in and will receive messages (though it still hangs up on them after the first priority).  If you then issue "module load res_xmpp.so" subsequent to the module unload command, the Asterisk console shows the normal output for loading res_xmpp.so, but my XMPP client can no longer send messages to Asterisk (even though the Asterisk XMPP client shows online in my buddy list and the server's status).
Comments:By: Richard Mudgett (rmudgett) 2012-09-07 15:00:09.768-0500

In message.c
static void chan_cleanup(struct ast_channel *chan)
needs to clear all of the the softhangup flags as part of its cleanup.

By: Leif Madsen (lmadsen) 2012-09-11 07:44:48.856-0500

I can confirm this as well. Not using Hangup() is fine, but using Hangup() causes the behaviour as described here.

By: Matt Jordan (mjordan) 2015-03-14 10:25:16.701-0500

This was actually fixed in r374019:

r374019 | beagles | 2012-09-28 08:02:17 -0500 (Fri, 28 Sep 2012) | 12 lines

Reset hangup flags on channels created through messages and cleanup globals
in res_xmpp on unload.

This patch fixes an issue where hangup flags were not being reset on a
channel, affecting subsequent use of that channel. The patch also adds some
additional cleanup to res_xmpp to fix an issue with reloading the module.

(closes ASTERISK-20360)
Reported by: Noah Engelberth
Tested by: beagles
Review: https://reviewboard.asterisk.org/r/2134/