[asterisk-users] Problems passing variables from a macro
Rizwan Hisham
rizwanhasham at gmail.com
Fri May 16 02:57:14 CDT 2008
I haven't used ael but in extension.conf whenever we set a channel variable
we use a SET command just like you used it to set the variable MACRO_RESULT.
try using the set command, if still it does not work then try to initialize
the wrongpin=0 before the dial command, or outside the macro.
On Fri, May 16, 2008 at 12:36 PM, Tobias Ahlander <plyschen at gmail.com>
wrote:
> Good day,
>
> I'm using a dial string as follows:
> Dial(SIP/${phonenumber},30,grM(screen^${pin})L(${300000}[:60000]));
> When I set a variable in the macro screen, it doesn't get passed back to
> the extension from where the dial was called. I can always put the result in
> the MySQL database, but that feels a bit overkill... the macro looks as
> follows:
>
> macro screen (arg1) {
>
> Wait(0.2);
> Read(acceptcall|sounds/pin|7);
> if(${acceptcall} = ${arg1}) {
> NoOp(connect them);
> wrongpin=0;
> } else {
> Set(MACRO_RESULT=CONTINUE);
> wrongpin=1;
> }
> NoOp(MACRO_RESULT = ${MACRO_RESULT});
>
> }
>
> This is the output from the CLI, and I can see that the wrongpin is set to
> 1, but when I do a NoOp right after leaving the macro, it says its empty...
>
> -- Executing [s at connect:36] Dial("SIP/1003-b7619b78",
> "SIP/1203|30|grM(screen^1234)L(300000[:60000])") in new stack
> -- Limit Data for this call:
> > timelimit = 300000
> > play_warning = 60000
> > play_to_caller = yes
> > play_to_callee = yes
> > warning_freq = 0
> > start_sound = (null)
> > warning_sound = beep
> > end_sound = beep
> -- Called 1203
> -- SIP/1203-08d62408 is ringing
> -- SIP/1203-08d62408 answered SIP/1003-b7619b78
> -- Executing [s at macro-screen:1] Set("SIP/1203-08d62408", "arg1=1234")
> in new stack
> -- Executing [s at macro-screen:2] Wait("SIP/1203-08d62408", "0.2") in
> new stack
> -- Executing [s at macro-screen:3] Read("SIP/1203-08d62408",
> "acceptcall|sounds/pin|7") in new stack
> -- Accepting a maximum of 7 digits.
> -- <SIP/1203-08d62408> Playing 'sounds/pin' (language 'en')
> -- User entered '1'
> -- Executing [s at macro-screen:4] GotoIf("SIP/1203-08d62408", "0?5:8")
> in new stack
> -- Goto (macro-screen,s,8)
> -- Executing [s at macro-screen:8] Set("SIP/1203-08d62408",
> "MACRO_RESULT=CONTINUE") in new stack
> -- Executing [s at macro-screen:9] Set("SIP/1203-08d62408", "wrongpin=1")
> in new stack
> -- Executing [s at macro-screen:10] NoOp("SIP/1203-08d62408", "Finish
> if-screen-32753") in new stack
> -- Executing [s at macro-screen:11] NoOp("SIP/1203-08d62408",
> "MACRO_RESULT = CONTINUE") in new stack
> -- Executing [s at connect:37] NoOp("SIP/1003-b7619b78",
> "DIALSTATUS:ANSWER") in new stack
> -- Executing [s at connect:38] NoOp("SIP/1003-b7619b78", "wrongpin=") in
> new stack
>
> Is there a good way to pass this variable back to the context "connect"?
>
> Thanks,
> Best regards,
> Tobias
>
> _______________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-users
>
--
Best Regards
Rizwan Hisham
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20080516/715318ed/attachment.htm
More information about the asterisk-users
mailing list