Summary:ASTERISK-18131: IAX_COMMAND_HANGUP-Frame not sent after Hangup(${HANGUPCAUSE})
Reporter:Olaf Winkler (abw1oim)Labels:
Date Opened:2011-07-12 13:16:02Date Closed:2011-07-12 14:45:23
Versions: Frequency of
Description:It seems, that when iax2_hangup in chan_iax2.c is called via ast_hangup from channel.c the channel is already destroyed or something other happened as the IAX_COMMAND_HANGUP-Frame is not sent out to the hung up IAX-Channel.
As a result the given HANGUPCAUSSE from asterisk is never reported to the IAX-Peer.

You may retest this by a simple dialplan just executing

[context fax]

exten => _X!,1,Set(HANGUPCAUSE=19)
exten => _X!.n,Hangup(${HANGUPCAUSE})

Debug result You'll see (with core set debug=1):_

[Jul 12 19:56:19] DEBUG[9222]: pbx.c:4083 pbx_extension_helper: Launching 'Hangup'
   -- Executing [03435625102@fax:1] Hangup("IAX2/iaxmodem2-3656", "19") in new stack
[Jul 12 19:56:19] DEBUG[9222]: pbx.c:4783 __ast_pbx_run: Spawn extension (fax,03435625102,1) exited non-zero on 'IAX2/iaxmodem2-3656'
 == Spawn extension (fax, 03435625102, 1) exited non-zero on 'IAX2/iaxmodem2-3656'
[Jul 12 19:56:19] DEBUG[9222]: channel.c:2679 ast_softhangup_nolock: Soft-Hanging up channel 'IAX2/iaxmodem2-3656'
[Jul 12 19:56:19] DEBUG[9222]: channel.c:2807 ast_hangup: Hanging up channel 'IAX2/iaxmodem2-3656'
[Jul 12 19:56:19] DEBUG[9222]: chan_iax2.c:5199 iax2_hangup: We're hanging up IAX2/iaxmodem2-3656 now...

iax debug will show, that the IAX_COMMAND_HANGUP-Frame is not sent to the peer causing the peer to be unaware why the call was terminated.
Comments:By: Olaf Winkler (abw1oim) 2011-07-12 14:45:23.101-0500

After a double-check it seems to work between Asterisk-Boxes (both 1.8.5), but seems to be broken with iaxmodem. We should try to find a solution in their code.