[asterisk-users] Problems passing variables from a macro
Tobias Ahlander
plyschen at gmail.com
Fri May 16 02:36:40 CDT 2008
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20080516/6c662dfc/attachment-0001.htm
More information about the asterisk-users
mailing list