[Home]

Summary:ASTERISK-15399: [patch][regression] Macro executes "h" extension instead of exiting
Reporter:David Hajek (hajekd)Labels:
Date Opened:2010-01-05 15:51:09.000-0600Date Closed:2011-06-07 14:00:51
Priority:MajorRegression?Yes
Status:Closed/CompleteComponents:Applications/app_dial
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 20100106__issue16548.diff.txt
( 1) 20100126__issue16548__debug.diff.txt
( 2) 20100127__issue16548.diff.txt
( 3) 20100128__issue16548.diff.txt
( 4) conf.tar.gz
Description:Latest version 1.6.0.20 does not correctly hangup calls. We have some dialplan under extension h which ends with cmd Hangup. Asterisk continue in dialplan even after calling cmd Hangup. This is not the case with 1.6.0.19 and earlier. This is causing some issues with CDR, etc.

In this example, macro hangupcall is called twice!

- Executing [h@macro-dial:1] Macro("SIP/501-00000003", "hangupcall") in new stack
   -- Executing [s@macro-hangupcall:1] ResetCDR("SIP/501-00000003", "w") in new stack
   -- Executing [s@macro-hangupcall:2] NoCDR("SIP/501-00000003", "") in new stack
   -- Executing [s@macro-hangupcall:3] GotoIf("SIP/501-00000003", "1?skiprg") in new stack
   -- Goto (macro-hangupcall,s,6)
   -- Executing [s@macro-hangupcall:6] GotoIf("SIP/501-00000003", "1?skipblkvm") in new stack
   -- Goto (macro-hangupcall,s,9)
   -- Executing [s@macro-hangupcall:9] GotoIf("SIP/501-00000003", "1?theend") in new stack
   -- Goto (macro-hangupcall,s,11)
   -- Executing [s@macro-hangupcall:11] Hangup("SIP/501-00000003", "") in new stack
 == Spawn extension (macro-hangupcall, s, 11) exited non-zero on 'SIP/501-00000003' in macro 'hangupcall'
 == Spawn extension (macro-dial, h, 1) exited non-zero on 'SIP/501-00000003'
 == Spawn extension (macro-dial, s, 8) exited non-zero on 'SIP/501-00000003' in macro 'dial'
 == Spawn extension (macro-exten-vm, s, 9) exited non-zero on 'SIP/501-00000003' in macro 'exten-vm'
 == Spawn extension (from-internal, 502, 1) exited non-zero on 'SIP/501-00000003'
   -- Executing [h@from-internal:1] Macro("SIP/501-00000003", "hangupcall") in new stack
   -- Executing [s@macro-hangupcall:1] ResetCDR("SIP/501-00000003", "w") in new stack
   -- Executing [s@macro-hangupcall:2] NoCDR("SIP/501-00000003", "") in new stack
   -- Executing [s@macro-hangupcall:3] GotoIf("SIP/501-00000003", "1?skiprg") in new stack
   -- Goto (macro-hangupcall,s,6)
   -- Executing [s@macro-hangupcall:6] GotoIf("SIP/501-00000003", "1?skipblkvm") in new stack
   -- Goto (macro-hangupcall,s,9)
   -- Executing [s@macro-hangupcall:9] GotoIf("SIP/501-00000003", "1?theend") in new stack
   -- Goto (macro-hangupcall,s,11)
   -- Executing [s@macro-hangupcall:11] Hangup("SIP/501-00000003", "") in new stack
 == Spawn extension (macro-hangupcall, s, 11) exited non-zero on 'SIP/501-00000003' in macro 'hangupcall'
 == Spawn extension (from-internal, h, 1) exited non-zero on 'SIP/501-00000003'
Comments:By: David Hajek (hajekd) 2010-01-05 16:02:34.000-0600

And this is how the same dialplan looks with 1.6.0.19 (macro hangupcall is not called again in from-internal context)

-- Called 502
   -- SIP/502-00000001 is ringing
   -- SIP/502-00000001 answered SIP/501-00000000
   -- Executing [h@macro-dial:1] Macro("SIP/501-00000000", "hangupcall") in new stack
   -- Executing [s@macro-hangupcall:1] ResetCDR("SIP/501-00000000", "w") in new stack
   -- Executing [s@macro-hangupcall:2] NoCDR("SIP/501-00000000", "") in new stack
   -- Executing [s@macro-hangupcall:3] GotoIf("SIP/501-00000000", "1?skiprg") in new stack
   -- Goto (macro-hangupcall,s,6)
   -- Executing [s@macro-hangupcall:6] GotoIf("SIP/501-00000000", "1?skipblkvm") in new stack
   -- Goto (macro-hangupcall,s,9)
   -- Executing [s@macro-hangupcall:9] GotoIf("SIP/501-00000000", "1?theend") in new stack
   -- Goto (macro-hangupcall,s,11)
   -- Executing [s@macro-hangupcall:11] Hangup("SIP/501-00000000", "") in new stack
 == Spawn extension (macro-hangupcall, s, 11) exited non-zero on 'SIP/501-00000000' in macro 'hangupcall'
 == Spawn extension (macro-dial, h, 1) exited non-zero on 'SIP/501-00000000'
 == Spawn extension (macro-dial, s, 8) exited non-zero on 'SIP/501-00000000' in macro 'dial'
 == Spawn extension (macro-exten-vm, s, 9) exited non-zero on 'SIP/501-00000000' in macro 'exten-vm'
 == Spawn extension (from-internal, 502, 1) exited non-zero on 'SIP/501-00000000'

By: Tilghman Lesher (tilghman) 2010-01-06 01:12:09.000-0600

You're not actually supposed to call Hangup from a hangup context.  Instead, you should be calling MacroExit to exit the Macro.

By: Tilghman Lesher (tilghman) 2010-01-06 01:26:52.000-0600

Probably the best solution for this would be to remove the "h" extension from any and all macros (because what's actually happening here is that the macro is executing the "h" extension, which it should NOT -- the "h" extension should only ever be triggered from the main pbx.c loop).



By: Tilghman Lesher (tilghman) 2010-01-06 01:45:03.000-0600

Patch uploaded that will make Macro exit upon encountering an "h" extension that was not directly invoked by the pbx.c loop.

By: David Hajek (hajekd) 2010-01-06 16:42:27.000-0600

Patch does not seem to work. Same behaviour. This is the dialplan:

[macro-dial]
exten => s, something
exten => h, Macro(hangupcall)

[macro-hangupcall]
exten => s, some CDR stuff
exten => s, Hangup

Why the behaviour changed from 1.6.0.20? As I said, 1.6.0.19 and earlier is fine and works as expected.


SIP/102-00000003 is ringing
   -- Remote UNIX connection
   -- SIP/102-00000003 is ringing
   -- Remote UNIX connection disconnected
   -- SIP/102-00000003 answered SIP/105-00000002
   -- Executing [s@macro-auto-blkvm:1] Set("SIP/102-00000003", "__MACRO_RESULT=") in new stack
   -- Executing [s@macro-auto-blkvm:2] DBdel("SIP/102-00000003", "BLKVM/102/SIP/105-00000002") in new stack
   -- DBdel: family=BLKVM, key=102/SIP/105-00000002
   -- Executing [h@macro-dial:1] Macro("SIP/105-00000002", "hangupcall") in new stack
   -- Executing [s@macro-hangupcall:1] ResetCDR("SIP/105-00000002", "w") in new stack
   -- Executing [s@macro-hangupcall:2] NoCDR("SIP/105-00000002", "") in new stack
   -- Executing [s@macro-hangupcall:3] GotoIf("SIP/105-00000002", "1?skiprg") in new stack
   -- Goto (macro-hangupcall,s,6)
   -- Executing [s@macro-hangupcall:6] GotoIf("SIP/105-00000002", "0?skipblkvm") in new stack
   -- Executing [s@macro-hangupcall:7] NoOp("SIP/105-00000002", "Cleaning Up Block VM Flag: BLKVM/102/SIP/105-00000002") in new stack
   -- Executing [s@macro-hangupcall:8] DBdel("SIP/105-00000002", "BLKVM/102/SIP/105-00000002") in new stack
   -- DBdel: family=BLKVM, key=102/SIP/105-00000002
   -- DBdel: Error deleting key from database.
   -- Executing [s@macro-hangupcall:9] GotoIf("SIP/105-00000002", "1?theend") in new stack
   -- Goto (macro-hangupcall,s,11)
   -- Executing [s@macro-hangupcall:11] Hangup("SIP/105-00000002", "") in new stack
 == Spawn extension (macro-hangupcall, s, 11) exited non-zero on 'SIP/105-00000002' in macro 'hangupcall'
 == Spawn extension (macro-dial, h, 1) exited non-zero on 'SIP/105-00000002'
 == Spawn extension (macro-dial, s, 8) exited non-zero on 'SIP/105-00000002' in macro 'dial'
 == Spawn extension (from-internal, 102, 16) exited non-zero on 'SIP/105-00000002'
   -- Executing [h@from-internal:1] Macro("SIP/105-00000002", "hangupcall") in new stack
   -- Executing [s@macro-hangupcall:1] ResetCDR("SIP/105-00000002", "w") in new stack
   -- Executing [s@macro-hangupcall:2] NoCDR("SIP/105-00000002", "") in new stack
   -- Executing [s@macro-hangupcall:3] GotoIf("SIP/105-00000002", "1?skiprg") in new stack
   -- Goto (macro-hangupcall,s,6)
   -- Executing [s@macro-hangupcall:6] GotoIf("SIP/105-00000002", "0?skipblkvm") in new stack
   -- Executing [s@macro-hangupcall:7] NoOp("SIP/105-00000002", "Cleaning Up Block VM Flag: BLKVM/102/SIP/105-00000002") in new stack
   -- Executing [s@macro-hangupcall:8] DBdel("SIP/105-00000002", "BLKVM/102/SIP/105-00000002") in new stack
   -- DBdel: family=BLKVM, key=102/SIP/105-00000002
   -- DBdel: Error deleting key from database.
   -- Executing [s@macro-hangupcall:9] GotoIf("SIP/105-00000002", "1?theend") in new stack
   -- Goto (macro-hangupcall,s,11)
   -- Executing [s@macro-hangupcall:11] Hangup("SIP/105-00000002", "") in new stack

By: Tilghman Lesher (tilghman) 2010-01-06 17:50:19.000-0600

Clearly that's not the whole dialplan.  DBDel does not initiate a change of the extension from "s" to "h", as this shows.  I need to see the WHOLE dialplan.

By: David Hajek (hajekd) 2010-01-06 18:05:04.000-0600

Attached is extensions.conf and extensions_additional.conf

Here is complete console log:

asterisk16*CLI>
 == Using SIP RTP TOS bits 184
 == Using SIP RTP CoS mark 5
   -- Executing [104@from-internal:1] Macro("SIP/105-0000000c", "exten-vm,104,104") in new stack
   -- Executing [s@macro-exten-vm:1] Macro("SIP/105-0000000c", "user-callerid") in new stack
   -- Executing [s@macro-user-callerid:1] Set("SIP/105-0000000c", "AMPUSER=105") in new stack
   -- Executing [s@macro-user-callerid:2] GotoIf("SIP/105-0000000c", "0?report") in new stack
   -- Executing [s@macro-user-callerid:3] ExecIf("SIP/105-0000000c", "1?Set(REALCALLERIDNUM=105)") in new stack
   -- Executing [s@macro-user-callerid:4] Set("SIP/105-0000000c", "AMPUSER=105") in new stack
   -- Executing [s@macro-user-callerid:5] Set("SIP/105-0000000c", "AMPUSERCIDNAME=testovaci linka") in new stack
   -- Executing [s@macro-user-callerid:6] GotoIf("SIP/105-0000000c", "0?report") in new stack
   -- Executing [s@macro-user-callerid:7] Set("SIP/105-0000000c", "AMPUSERCID=105") in new stack
   -- Executing [s@macro-user-callerid:8] Set("SIP/105-0000000c", "CALLERID(all)="testovaci linka" <105>") in new stack
   -- Executing [s@macro-user-callerid:9] Set("SIP/105-0000000c", "REALCALLERIDNUM=105") in new stack
   -- Executing [s@macro-user-callerid:10] ExecIf("SIP/105-0000000c", "0?Set(CHANNEL(language)=)") in new stack
   -- Executing [s@macro-user-callerid:11] GotoIf("SIP/105-0000000c", "0?continue") in new stack
   -- Executing [s@macro-user-callerid:12] Set("SIP/105-0000000c", "__TTL=64") in new stack
   -- Executing [s@macro-user-callerid:13] GotoIf("SIP/105-0000000c", "1?continue") in new stack
   -- Goto (macro-user-callerid,s,20)
   -- Executing [s@macro-user-callerid:20] NoOp("SIP/105-0000000c", "Using CallerID "testovaci linka" <105>") in new stack
   -- Executing [s@macro-exten-vm:2] Set("SIP/105-0000000c", "RingGroupMethod=none") in new stack
   -- Executing [s@macro-exten-vm:3] Set("SIP/105-0000000c", "VMBOX=104") in new stack
   -- Executing [s@macro-exten-vm:4] Set("SIP/105-0000000c", "EXTTOCALL=104") in new stack
   -- Executing [s@macro-exten-vm:5] Set("SIP/105-0000000c", "CFUEXT=") in new stack
   -- Executing [s@macro-exten-vm:6] Set("SIP/105-0000000c", "CFBEXT=") in new stack
   -- Executing [s@macro-exten-vm:7] Set("SIP/105-0000000c", "RT=15") in new stack
   -- Executing [s@macro-exten-vm:8] Macro("SIP/105-0000000c", "record-enable,104,IN") in new stack
   -- Executing [s@macro-record-enable:1] GotoIf("SIP/105-0000000c", "1?check") in new stack
   -- Goto (macro-record-enable,s,4)
   -- Executing [s@macro-record-enable:4] AGI("SIP/105-0000000c", "recordingcheck,20100107-010303,1262822583.12") in new stack
   -- Launched AGI Script /var/lib/asterisk/agi-bin/recordingcheck
recordingcheck,20100107-010303,1262822583.12: RAMDISK_PATH = /mnt/ramdisk/
recordingcheck,20100107-010303,1262822583.12: MIXMON_DIR =  /RECORDINGS/2010/01/07/
recordingcheck,20100107-010303,1262822583.12: Inbound recording not enabled
   -- <SIP/105-0000000c>AGI Script recordingcheck completed, returning 0
   -- Executing [s@macro-record-enable:5] MacroExit("SIP/105-0000000c", "") in new stack
   -- Executing [s@macro-exten-vm:9] Macro("SIP/105-0000000c", "dial,15,tr,104") in new stack
   -- Executing [s@macro-dial:1] AGI("SIP/105-0000000c", "CUSTOM_EXTEN_ACCESS_16.php") in new stack
   -- Launched AGI Script /var/lib/asterisk/agi-bin/CUSTOM_EXTEN_ACCESS_16.php
CUSTOM_EXTEN_ACCESS_16.php: CONTEXT = macro-dial
CUSTOM_EXTEN_ACCESS_16.php: CDR(src) = 105
CUSTOM_EXTEN_ACCESS_16.php: CDR(dst) = 104
CUSTOM_EXTEN_ACCESS_16.php: NODEST =
CUSTOM_EXTEN_ACCESS_16.php: AMPUSER = 105
CUSTOM_EXTEN_ACCESS_16.php: EXTEN = s
CUSTOM_EXTEN_ACCESS_16.php: RingGroupMethod = none
CUSTOM_EXTEN_ACCESS_16.php: RINGGROUP_INDEX =
CUSTOM_EXTEN_ACCESS_16.php: KEEPCID =
CUSTOM_EXTEN_ACCESS_16.php: USE_CONFIRMATION =
CUSTOM_EXTEN_ACCESS_16.php: CDR(dcontext) = from-internal
CUSTOM_EXTEN_ACCESS_16.php: CDR(channel) = SIP/105-0000000c
CUSTOM_EXTEN_ACCESS_16.php: REALCALLERIDNUM = 105
CUSTOM_EXTEN_ACCESS_16.php: DBget_CALLTRACE =
CUSTOM_EXTEN_ACCESS_16.php: CALLBACK_NUMBER =
CUSTOM_EXTEN_ACCESS_16.php: CUSTOM_ACCESS =
CUSTOM_EXTEN_ACCESS_16.php: FMGRP =
CUSTOM_EXTEN_ACCESS_16.php: RRNODEST =
CUSTOM_EXTEN_ACCESS_16.php: CUSTOM_EXTEN_ACCESS_NODEST =
CUSTOM_EXTEN_ACCESS_16.php: FROM_DID =
CUSTOM_EXTEN_ACCESS_16.php:      Overit prava odchoziho volani z interni linky 105 na cislo 104    (105=>104)
CUSTOM_EXTEN_ACCESS_16.php: 104, 1
CUSTOM_EXTEN_ACCESS_16.php: Povoleno
   -- <SIP/105-0000000c>AGI Script CUSTOM_EXTEN_ACCESS_16.php completed, returning 0
   -- Executing [s@macro-dial:2] GotoIf("SIP/105-0000000c", "1?dial") in new stack
   -- Goto (macro-dial,s,4)
   -- Executing [s@macro-dial:4] AGI("SIP/105-0000000c", "dialparties.agi") in new stack
   -- Launched AGI Script /var/lib/asterisk/agi-bin/dialparties.agi
dialparties.agi: Starting New Dialparties.agi
 == Manager 'admin' logged on from 127.0.0.1
dialparties.agi: Caller ID name is 'testovaci linka' number is '105'
      > dialparties.agi: USE_CONFIRMATION:  'FALSE'
      > dialparties.agi: RINGGROUP_INDEX:   ''
dialparties.agi: Methodology of ring is  'none'
   -- dialparties.agi: Added extension 104 to extension map
   -- dialparties.agi: Extension 104 cf is disabled
   -- dialparties.agi: Extension 104 do not disturb is disabled
     > dialparties.agi: extnum 104 has:  cw: 0; hascfb: 0 [] hascfu: 0 []
      > dialparties.agi: ExtensionState: 0
dialparties.agi: Extension 104 has ExtensionState: 0
   -- dialparties.agi: Checking CW and CFB status for extension 104
   -- dialparties.agi: dbset CALLTRACE/104 to 105
   -- dialparties.agi: Filtered ARG3: 104
 == Manager 'admin' logged off from 127.0.0.1
   -- <SIP/105-0000000c>AGI Script dialparties.agi completed, returning 0
   -- Executing [s@macro-dial:8] Dial("SIP/105-0000000c", "SIP/104,15,tr") in new stack
 == Using SIP RTP TOS bits 184
 == Using SIP RTP CoS mark 5
   -- Called 104
   -- SIP/104-0000000d is ringing
   -- SIP/104-0000000d answered SIP/105-0000000c
   -- Executing [h@macro-dial:1] Macro("SIP/105-0000000c", "hangupcall") in new stack
   -- Executing [s@macro-hangupcall:1] ResetCDR("SIP/105-0000000c", "w") in new stack
   -- Executing [s@macro-hangupcall:2] NoCDR("SIP/105-0000000c", "") in new stack
   -- Executing [s@macro-hangupcall:3] GotoIf("SIP/105-0000000c", "1?skiprg") in new stack
   -- Goto (macro-hangupcall,s,6)
   -- Executing [s@macro-hangupcall:6] GotoIf("SIP/105-0000000c", "1?skipblkvm") in new stack
   -- Goto (macro-hangupcall,s,9)
   -- Executing [s@macro-hangupcall:9] GotoIf("SIP/105-0000000c", "1?theend") in new stack
   -- Goto (macro-hangupcall,s,11)
   -- Executing [s@macro-hangupcall:11] Hangup("SIP/105-0000000c", "") in new stack
 == Spawn extension (macro-hangupcall, s, 11) exited non-zero on 'SIP/105-0000000c' in macro 'hangupcall'
 == Spawn extension (macro-dial, h, 1) exited non-zero on 'SIP/105-0000000c'
 == Spawn extension (macro-dial, s, 8) exited non-zero on 'SIP/105-0000000c' in macro 'dial'
 == Spawn extension (macro-exten-vm, s, 9) exited non-zero on 'SIP/105-0000000c' in macro 'exten-vm'
 == Spawn extension (from-internal, 104, 1) exited non-zero on 'SIP/105-0000000c'
   -- Executing [h@from-internal:1] Macro("SIP/105-0000000c", "hangupcall") in new stack
   -- Executing [s@macro-hangupcall:1] ResetCDR("SIP/105-0000000c", "w") in new stack
   -- Executing [s@macro-hangupcall:2] NoCDR("SIP/105-0000000c", "") in new stack
   -- Executing [s@macro-hangupcall:3] GotoIf("SIP/105-0000000c", "1?skiprg") in new stack
   -- Goto (macro-hangupcall,s,6)
   -- Executing [s@macro-hangupcall:6] GotoIf("SIP/105-0000000c", "1?skipblkvm") in new stack
   -- Goto (macro-hangupcall,s,9)
   -- Executing [s@macro-hangupcall:9] GotoIf("SIP/105-0000000c", "1?theend") in new stack
   -- Goto (macro-hangupcall,s,11)
-- Executing [s@macro-hangupcall:11] Hangup("SIP/105-0000000c", "") in new stack
 == Spawn extension (macro-hangupcall, s, 11) exited non-zero on 'SIP/105-0000000c' in macro 'hangupcall'
 == Spawn extension (from-internal, h, 1) exited non-zero on 'SIP/105-0000000c'

By: Tilghman Lesher (tilghman) 2010-01-26 13:00:41.000-0600

Please try this patch and let's see if you get any additional warning messages.

By: Tilghman Lesher (tilghman) 2010-01-27 13:39:00.000-0600

Okay, cancel that patch.  I think the solution for you is to add the 'g' flag to the Dial command.

By: David Hajek (hajekd) 2010-01-27 14:48:50.000-0600

OK, tried your patch with 1.6.0.21. No warning messages about "e" option has been passed to dial command. The bug is still there.

I also try to recompile 1.6.0.19 and confirm this version works fine.

By: David Hajek (hajekd) 2010-01-27 15:38:11.000-0600

Hmm, studied the changelog carefully and see main/features.c has been changed with this comment:

2009-11-24 18:53 +0000 [r231096]  Jeff Peeler <jpeeler@digium.com>

       * /, main/features.c: Merged revisions 231095 via svnmerge from
         https://origsvn.digium.com/svn/asterisk/trunk ........ r231095 |
         jpeeler | 2009-11-24 12:50:36 -0600 (Tue, 24 Nov 2009) | 11 lines
         Fix erroneous hangup extension execution ast_spawn_extension
         behaves differently from 1.4 in that hangups and extensions that
         do not exist do not return an error, whereas in 1.6 it does. This
         is now taken into account so that the AST_FLAG_BRIDGE_HANGUP_RUN
         flag gets set properly. (closes issue ASTERISK-15017) Reported by:
         ajohnson Tested by: ajohnson ........

Tried to copy main/features.c from 1.6.0.19 to 1.6.0.21 and the correct bahviour is back again! Now should be easy to find out what the problem is.

By: Tilghman Lesher (tilghman) 2010-01-27 17:21:09.000-0600

After looking at that particular patch, I believe that will actually make the prevention of "h" running more than once more reliable, not less so.

By: Tilghman Lesher (tilghman) 2010-01-27 17:44:57.000-0600

New patch uploaded that may prevent "h" from getting called more than once.  Let's see if this one works.  I'm also interested in hearing if adding 'g' to the Dial arguments fixes this with no code change necessary.

By: David Hajek (hajekd) 2010-01-27 18:29:19.000-0600

Use the patch against 1.6.0.21 but no change. Still bad behaviour. Using 'g' option with Dial command does not help - it just continue with dialplan. In my case it means its going to voicemail after hangup - not what we want.

-- Called 104
   -- SIP/104-00000009 is ringing
   -- SIP/104-00000009 answered SIP/102-00000008
   -- Executing [h@macro-dial:1] Macro("SIP/102-00000008", "hangupcall") in new stack
   -- Executing [s@macro-hangupcall:1] ResetCDR("SIP/102-00000008", "w") in new stack
   -- Executing [s@macro-hangupcall:2] NoCDR("SIP/102-00000008", "") in new stack
   -- Executing [s@macro-hangupcall:3] GotoIf("SIP/102-00000008", "1?skiprg") in new stack
   -- Goto (macro-hangupcall,s,6)
   -- Executing [s@macro-hangupcall:6] GotoIf("SIP/102-00000008", "1?skipblkvm") in new stack
   -- Goto (macro-hangupcall,s,9)
   -- Executing [s@macro-hangupcall:9] GotoIf("SIP/102-00000008", "1?theend") in new stack
   -- Goto (macro-hangupcall,s,11)
   -- Executing [s@macro-hangupcall:11] Hangup("SIP/102-00000008", "") in new stack
 == Spawn extension (macro-hangupcall, s, 11) exited non-zero on 'SIP/102-00000008' in macro 'hangupcall'
 == Spawn extension (macro-dial, h, 1) exited non-zero on 'SIP/102-00000008'
 == Spawn extension (macro-dial, s, 8) exited non-zero on 'SIP/102-00000008' in macro 'dial'
 == Spawn extension (macro-exten-vm, s, 9) exited non-zero on 'SIP/102-00000008' in macro 'exten-vm'
 == Spawn extension (from-internal, 104, 1) exited non-zero on 'SIP/102-00000008'
   -- Executing [h@from-internal:1] Macro("SIP/102-00000008", "hangupcall") in new stack
   -- Executing [s@macro-hangupcall:1] ResetCDR("SIP/102-00000008", "w") in new stack
   -- Executing [s@macro-hangupcall:2] NoCDR("SIP/102-00000008", "") in new stack
   -- Executing [s@macro-hangupcall:3] GotoIf("SIP/102-00000008", "1?skiprg") in new stack
   -- Goto (macro-hangupcall,s,6)
   -- Executing [s@macro-hangupcall:6] GotoIf("SIP/102-00000008", "1?skipblkvm") in new stack
   -- Goto (macro-hangupcall,s,9)
   -- Executing [s@macro-hangupcall:9] GotoIf("SIP/102-00000008", "1?theend") in new stack
   -- Goto (macro-hangupcall,s,11)
   -- Executing [s@macro-hangupcall:11] Hangup("SIP/102-00000008", "") in new stack
 == Spawn extension (macro-hangupcall, s, 11) exited non-zero on 'SIP/102-00000008' in macro 'hangupcall'
 == Spawn extension (from-internal, h, 1) exited non-zero on 'SIP/102-00000008'

By: Tilghman Lesher (tilghman) 2010-01-28 17:00:13.000-0600

Okay, new patch uploaded.

By: David Hajek (hajekd) 2010-01-28 17:24:01.000-0600

Patch applied against 1.6.0.21. Still no luck.

Ext 102 is calling Ext 104:

-- Called 104
   -- SIP/104-00000001 is ringing
   -- SIP/104-00000001 answered SIP/102-00000000
   -- Remote UNIX connection
   -- Executing [h@from-internal:1] Macro("SIP/102-00000000", "hangupcall") in new stack
   -- Executing [s@macro-hangupcall:1] ResetCDR("SIP/102-00000000", "w") in new stack
   -- Executing [s@macro-hangupcall:2] NoCDR("SIP/102-00000000", "") in new stack
   -- Executing [s@macro-hangupcall:3] GotoIf("SIP/102-00000000", "1?skiprg") in new stack
   -- Goto (macro-hangupcall,s,6)
   -- Executing [s@macro-hangupcall:6] GotoIf("SIP/102-00000000", "1?skipblkvm") in new stack
   -- Goto (macro-hangupcall,s,9)
   -- Executing [s@macro-hangupcall:9] GotoIf("SIP/102-00000000", "1?theend") in new stack
   -- Goto (macro-hangupcall,s,11)
   -- Executing [s@macro-hangupcall:11] Hangup("SIP/102-00000000", "") in new stack
 == Spawn extension (macro-hangupcall, s, 11) exited non-zero on 'SIP/102-00000000' in macro 'hangupcall'
 == Spawn extension (macro-dial, s, 8) exited non-zero on 'SIP/102-00000000' in macro 'dial'
 == Spawn extension (macro-exten-vm, s, 9) exited non-zero on 'SIP/102-00000000' in macro 'exten-vm'
 == Spawn extension (from-internal, 104, 1) exited non-zero on 'SIP/102-00000000'
   -- Executing [h@from-internal:1] Macro("SIP/102-00000000", "hangupcall") in new stack
   -- Executing [s@macro-hangupcall:1] ResetCDR("SIP/102-00000000", "w") in new stack
   -- Executing [s@macro-hangupcall:2] NoCDR("SIP/102-00000000", "") in new stack
   -- Executing [s@macro-hangupcall:3] GotoIf("SIP/102-00000000", "1?skiprg") in new stack
   -- Goto (macro-hangupcall,s,6)
   -- Executing [s@macro-hangupcall:6] GotoIf("SIP/102-00000000", "1?skipblkvm") in new stack
   -- Goto (macro-hangupcall,s,9)
   -- Executing [s@macro-hangupcall:9] GotoIf("SIP/102-00000000", "1?theend") in new stack
   -- Goto (macro-hangupcall,s,11)
   -- Executing [s@macro-hangupcall:11] Hangup("SIP/102-00000000", "") in new stack
 == Spawn extension (macro-hangupcall, s, 11) exited non-zero on 'SIP/102-00000000' in macro 'hangupcall'
 == Spawn extension (from-internal, h, 1) exited non-zero on 'SIP/102-00000000'

By: Tilghman Lesher (tilghman) 2010-01-28 18:53:56.000-0600

Again, please stop using Hangup() in the "h" extension or in any Macro called from the "h" extension.  Try again, please.

By: David Hajek (hajekd) 2010-01-29 02:26:41.000-0600

Why we should force users to do that? 1.6.0.20 introduces big change in dialplan behaviour. By the way, my dialplan is from standard freepbx, so all freepbx users will be afected when they upgrade asterisk. They will suffer with double CDR records.

By: David Hajek (hajekd) 2010-01-29 03:17:49.000-0600

Anyway stock 1.6.0.21 seems to be working okay when "h" extension is not being called from Macro.

Can there be any issue by calling Hangup from "h" extension from the main loop?

[from-internal]
.
.
exten => h,1,Hangup

Or this is bug as well?

By: Tilghman Lesher (tilghman) 2010-01-29 09:46:48.000-0600

Resolved by configuration change.

By: Digium Subversion (svnbot) 2011-05-09 14:07:03

Repository: asterisk
Revision: 318282

U   branches/1.8/main/features.c

------------------------------------------------------------------------
r318282 | rmudgett | 2011-05-09 14:07:02 -0500 (Mon, 09 May 2011) | 24 lines

Hangup extension executed twice.

When a user hangs up a call, in certain circumstances, the hangup
extension can end up being executed twice:

1) If a call is bridged and the 'h' extension executes the Hangup
application, then the 'h' extension will be executed twice.

2) If a call is bridged within a macro (Dial or Queue), it has its own 'h'
extension, the main context also has an 'h' extension, and the macro 'h'
extension executes the Hangup application, then both 'h' extensions will
be executed.

* Revert originally commited fix for ASTERISK-15017 and just set
AST_FLAG_BRIDGE_HANGUP_RUN unconditionally in ast_bridge_call().  The
bridge code just executed an 'h' extension so the main PBX loop does not
need to execute one as well.

(issue ASTERISK-15017)
Reported by: ajohnson

(issue ASTERISK-15399)
Reported by: hajekd

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

http://svn.digium.com/view/asterisk?view=rev&revision=318282

By: Digium Subversion (svnbot) 2011-05-09 14:09:18

Repository: asterisk
Revision: 318283

_U  trunk/
U   trunk/main/features.c

------------------------------------------------------------------------
r318283 | rmudgett | 2011-05-09 14:09:17 -0500 (Mon, 09 May 2011) | 31 lines

Merged revisions 318282 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
 r318282 | rmudgett | 2011-05-09 14:07:01 -0500 (Mon, 09 May 2011) | 24 lines
 
 Hangup extension executed twice.
 
 When a user hangs up a call, in certain circumstances, the hangup
 extension can end up being executed twice:
 
 1) If a call is bridged and the 'h' extension executes the Hangup
 application, then the 'h' extension will be executed twice.
 
 2) If a call is bridged within a macro (Dial or Queue), it has its own 'h'
 extension, the main context also has an 'h' extension, and the macro 'h'
 extension executes the Hangup application, then both 'h' extensions will
 be executed.
 
 * Revert originally commited fix for ASTERISK-15017 and just set
 AST_FLAG_BRIDGE_HANGUP_RUN unconditionally in ast_bridge_call().  The
 bridge code just executed an 'h' extension so the main PBX loop does not
 need to execute one as well.
 
 (issue ASTERISK-15017)
 Reported by: ajohnson
 
 (issue ASTERISK-15399)
 Reported by: hajekd
........

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

http://svn.digium.com/view/asterisk?view=rev&revision=318283