[Home]

Summary:ASTERISK-09982: Hangup command is ignored when called within a macro that was called by using MacroIf.
Reporter:Ramon Peek-Fares (ramonpeek)Labels:
Date Opened:2007-07-30 07:37:34Date Closed:2007-07-30 09:35:54
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Applications/app_macro
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:When we call a macro that has the command "hangup" included, this hangup command will not function if the Macro was called using the MacroIf application.

!! See steps to reproduce section for example dialplan !!

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

Use this dialplan (or something like this) and dial extension 420.
(NOTE: I used SIP channels only and called via extension 401!)

exten = 420,1,MacroIf($[${CALLERID(number)} = 401]?playback)
exten = 420,n,Dial(SIP/405,10)
exten = 420,n,Hangup
exten = 420,n,Noop(We should not reach this priority)

[macro-playback]
exten = s,1,Answer
exten = s,n,Wait(1)
exten = s,n,Playback(tt-weasels)
exten = s,n,Hangup
exten = s,n,Noop(We should not reach this priority)
exten = s,n,MacroExit

****** ADDITIONAL INFORMATION ******

View on CLI:

   -- Executing [420@user-01:1] MacroIf("SIP/401-0a105a28", "1?playback") in new stack
   -- Executing [s@macro-playback:1] Answer("SIP/401-0a105a28", "") in new stack
   -- Executing [s@macro-playback:2] Wait("SIP/401-0a105a28", "1") in new stack
   -- Executing [s@macro-playback:3] Playback("SIP/401-0a105a28", "tt-weasels") in new stack
   -- <SIP/401-0a105a28> Playing 'tt-weasels' (language 'nl')
   -- Executing [s@macro-playback:4] NoOp("SIP/401-0a105a28", "We should not reach this priority") in new stack
   -- Executing [s@macro-playback:5] MacroExit("SIP/401-0a105a28", "") in new stack
   -- Executing [420@user-01:2] Dial("SIP/401-0a105a28", "SIP/405|10") in new stack
   -- Called 405
   -- SIP/405-0a1a6060 is ringing
Comments:By: Joshua C. Colp (jcolp) 2007-07-30 08:20:27

Can you please provide a show dialplan to confirm that it was read in correctly? Based on your CLI output it is not even trying to execute it.

By: Ramon Peek-Fares (ramonpeek) 2007-07-30 09:20:43

The dialplan is listed under "steps to reproduce", visible when viewing the bugtracker in "View Advanced".
Howevever here is the dialplan using "show dialplan"

[ Context 'macro-playback' created by 'pbx_config' ]
 's' =>            1. Answer()                                   [pbx_config]
                   2. Wait(1)                                    [pbx_config]
                   3. Playback(tt-weasels)                       [pbx_config]
                   4. Noop(We should not reach this priority)    [pbx_config]
                   5. MacroExit()                                [pbx_config]
pbx*CLI>
[ Context 'first-contexts' created by 'pbx_config' ]
 '420' =>          1. MacroIf($[${CALLERID(number)} = 401]?playback) [pbx_config]
                   2. Dial(SIP/405|10)                           [pbx_config]
                   3. Hangup()                                   [pbx_config]
                   4. Noop(We should not reach this priority)    [pbx_config]

By: Joshua C. Colp (jcolp) 2007-07-30 09:24:21

Hrm... this is quite interesting. Are you sure you don't have two macro-playback entries? Can you paste the entire file and not the specific portion? Putting it into my extensions.conf yields the correct dialplan logic, while yours apparently does not:

[ Context 'macro-playback' created by 'pbx_config' ]
 's' =>            1. Answer()                                   [pbx_config]
                   2. Wait(1)                                    [pbx_config]
                   3. Playback(tt-weasels)                       [pbx_config]
                   4. Hangup()                                   [pbx_config]
                   5. Noop(We should not reach this priority)    [pbx_config]
                   6. MacroExit()                                [pbx_config]

By: Ramon Peek-Fares (ramonpeek) 2007-07-30 09:26:01

When I reread the posted dialplan I noticed that the Hangup priority was not listed... strange....
However I reloaded the dialplan and now it is shown:

[ Context 'macro-playback' created by 'pbx_config' ]
 's' =>            1. Answer()                                   [pbx_config]
                   2. Wait(1)                                    [pbx_config]
                   3. Playback(tt-weasels)                       [pbx_config]
                   4. Hangup()                                   [pbx_config]
                   5. Noop(We should not reach this priority)    [pbx_config]
                   6. MacroExit()                                [pbx_config]
pbx*CLI>
[ Context 'default' created by 'pbx_config' ]
 '420' =>          1. MacroIf($[${CALLERID(number)} = 401]?playback) [pbx_config]
                   2. Dial(SIP/405|10)                           [pbx_config]
                   3. Hangup()                                   [pbx_config]
                   4. Noop(We should not reach this priority)    [pbx_config]


But still the CLI shows that it doesn't work:
pbx*CLI>
   -- Executing [420@user-01:1] MacroIf("SIP/401-0a196c10", "1?playback") in new stack
   -- Executing [s@macro-playback:1] Answer("SIP/401-0a196c10", "") in new stack
   -- Executing [s@macro-playback:2] Wait("SIP/401-0a196c10", "1") in new stack
   -- Executing [s@macro-playback:3] Playback("SIP/401-0a196c10", "tt-weasels") in new stack
   -- <SIP/401-0a196c10> Playing 'tt-weasels' (language 'nl')
   -- Executing [s@macro-playback:4] Hangup("SIP/401-0a196c10", "") in new stack
 == Spawn extension (macro-playback, s, 4) exited non-zero on 'SIP/401-0a196c10' in macro 'playback'
   -- Executing [s@macro-playback:5] NoOp("SIP/401-0a196c10", "We should not reach this priority") in new stack
   -- Executing [s@macro-playback:6] MacroExit("SIP/401-0a196c10", "") in new stack

By: Ramon Peek-Fares (ramonpeek) 2007-07-30 09:28:39

I just did a "dialplan show macro-" but it showed only one macro-playback.
So this is not the case.. Probably an error while cut & paste.

PS: Try calling the macro with Macro instead of MacroIf and the you will notice the hangup application is not ignored.

By: Digium Subversion (svnbot) 2007-07-30 09:32:45

Repository: asterisk
Revision: 77767

------------------------------------------------------------------------
r77767 | file | 2007-07-30 09:32:44 -0500 (Mon, 30 Jul 2007) | 4 lines

(closes issue ASTERISK-9982)
Reported by: ramonpeek
Pass through the return value from macro_exec through the MacroIf application.

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

By: Digium Subversion (svnbot) 2007-07-30 09:34:24

Repository: asterisk
Revision: 77768

------------------------------------------------------------------------
r77768 | file | 2007-07-30 09:34:24 -0500 (Mon, 30 Jul 2007) | 12 lines

Merged revisions 77767 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r77767 | file | 2007-07-30 11:50:02 -0300 (Mon, 30 Jul 2007) | 4 lines

(closes issue ASTERISK-9982)
Reported by: ramonpeek
Pass through the return value from macro_exec through the MacroIf application.

........

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

By: Digium Subversion (svnbot) 2007-07-30 09:35:54

Repository: asterisk
Revision: 77769

------------------------------------------------------------------------
r77769 | file | 2007-07-30 09:35:53 -0500 (Mon, 30 Jul 2007) | 20 lines

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

................
r77768 | file | 2007-07-30 11:51:44 -0300 (Mon, 30 Jul 2007) | 12 lines

Merged revisions 77767 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r77767 | file | 2007-07-30 11:50:02 -0300 (Mon, 30 Jul 2007) | 4 lines

(closes issue ASTERISK-9982)
Reported by: ramonpeek
Pass through the return value from macro_exec through the MacroIf application.

........

................

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