Sponsor: VoiceMeUp - Corporate & Wholesale VoIP Services

VoIP Mailing List Archives
Mailing list archives for the VoIP community
 SearchSearch 

[asterisk-users] Problems passing variables from a macro


 
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> Asterisk Users
View previous topic :: View next topic  
Author Message
plyschen at gmail.com
Guest





PostPosted: Fri May 16, 2008 2:36 am    Post subject: [asterisk-users] Problems passing variables from a macro Reply with quote

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:
Quote:
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,Cool
-- 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
Back to top
rizwanhasham at gmail.com
Guest





PostPosted: Fri May 16, 2008 2:57 am    Post subject: [asterisk-users] Problems passing variables from a macro Reply with quote

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:

Quote:
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:
Quote:
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,Cool
-- 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
Back to top
oej at edvina.net
Guest





PostPosted: Fri May 16, 2008 3:36 am    Post subject: [asterisk-users] Problems passing variables from a macro Reply with quote

The macros is executed in the OUTBOUND call leg, which is different
from the INBOUND that executes the rest of the dialplan. So variables
you set in that call leg, stays in that channel (They're called
"channel variables" since they have the channel as the scope).

/O
Back to top
info at tripple-o.nl
Guest





PostPosted: Fri May 16, 2008 10:34 am    Post subject: [asterisk-users] Problems passing variables from a macro Reply with quote

I pass a value from a macro by storing the value needed to the $
{MACRO_RESULT} variable. This is returned and because of this
available after finishing the macro. I'm not sure that it works in the
way you are looking for but it works for me.

Erik de Wild
Tripple-o
Back to top
Display posts from previous:   
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> Asterisk Users All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

VoiceMeUp - Corporate & Wholesale VoIP Services