[HELP] Setting a global Var from a set_variable instruction

Hi ! I’m using the last asterisk verson, with perl AGI on debian sarge. I’m trying to store digits entered by the user on a globar var of my dialplan so i can re-use it on other context, for example to launch the mailbox of the user without entering his id and password.

#Retrieve_ID.pl

…Agi and sql statements…

while (@data = $dbexe->fetchrow_array())
{
my $id = $data[0];
$AGI->set_variable(‘ID’,‘$id’);
}

No worries about that…

Dialplan:

[General]
exten => s,1,Wait()
exten => s,2,Answer()
exten => s,3,AGI(retrieve_id.pl)
???exten => s,4,SetGlobalVar(ID=$id) ???
exten => s,5,Goto(mailbox,0,1)

[mailbox}
exten => ID,1,VoicemailMain(ID@mailbox)

as you can see, i would also like to replace my last line with the good data in order to launch the user mailbox, and so it should be ok. But i also would like to call my ‘ID’ on each context in my dialplan. I know there are constraint of inheritance but it doesn’t matter, for the first time i really would like to make it work!!! please help !!
:frowning:

hi everyone,got some good news.

I got 2 main problems on my example below. here’s the solution

file .pl :
set_variable(‘NAME’,$variable)
–> no quotes for the $variable

at this point, on the cli you should see :

here’s the log from the CLI

AGI Tx >> 200 result=11
AGI Rx << SET VARIABLE NAME “11” (not “$variable”)
AGI Tx >> 200 result=1
– AGI Script retrieve_id.pl completed, returning 0
– Executing [0@menu:4] SetGlobalVar(“SIP/freephonie.net-40f04918”, “IDUSER=$id”) in new stack
– Executing [0@menu:5] VoiceMailMain(“SIP/freephonie.net-40f04918”, “11@mailbox”) in new stack -->(not "$variable@mailbox)
– <SIP/freephonie.net-40f04918> Playing ‘vm-login’ (language ‘fr’)

Finally, the dialplan should be like this :

[menu]
exten => 0,1,Wait()
exten => 0,2,Answer()
exten => 0,3,AGI(retrieve_id.pl)
exten => 0,4,VoicemailMain(${ID}@mailbox)

At this point, you can consider your system will automaticaly open the right mailbox, and ask for the password. Now we need to know how to bypass this point…but it should be a new reply !
if it can help someone…