[asterisk-users] hwo to stok variable wiith menu

salaheddine elharit salah.elharit200 at gmail.com
Fri Nov 25 10:48:54 CST 2011


thanks for your response

i use mysql like a database and my question when the customer press 3 in
context menu i want to stok this variable in a table in my database and i
want to get this variable after
could you please give an exemple like below

thanks and regards

[menu]
exten => s,1,Background(${sounds_path}menu)
exten => 0,1,Goto(menu,s,1)
exten => 1,1,Goto(appel,s,1)
exten => 2,1,Goto(message,s,1)

exten => 3,1,Goto(support,s,1)
exten => s,2,goto(menu,s,1)
exten => i,1,Playback(${sounds_path}erreur-saisie)
exten => i,2,Goto(menu,s,1)
exten => t,1,Goto(menu,s,1)
2011/11/25 Dale Noll <dnoll at wi.rr.com>

>
>
> On 11/25/2011 09:32 AM, salaheddine elharit wrote:
>
>> hello list,
>> i have created one menu like below all work without issue, what i want to
>> do is ,
>> when the customer press  3 in menu context  exten =>
>> 3,1,Goto(support,s,1) i want to stok this variable (3) in database or file
>> instead to go to support context
>>
>>
> You can save a value to a global variable like you did within your sample
> dialplan, although I do not recommend this approach, you should read the
> note below as to why.
>
> You can save a value to a channel variable with the Set() command and use
> it later within the same call.
>
> You can save a value into the AstDB with the Set(${DB())) and access the
> value from any channel even after an Asterisk restart.
>
> You can setup ODBC, func_odbc and  a database then access the variables
> via the functions defined within the func_odbc.conf
>
> The method you choose should be determined by your needs.
>
>
> Note:  You set the global variable at the start of your dialplan. This
> global variable is available to ALL channels. If you set it for every call,
> you are doing so needlessly.  If you have multiple applications accessing
> the same variable and each one sets it with a different value, you will
> have problems. Global variables should be used to store information needed
> in the majority of calls.  The way you are using the global variable, I
> believe you may be better off removing the SetGlobalVar() call and instead
> set the variable in the [globals] section of extensions.conf.
>
>
> I hope that helps.
>
> Dale
>
> --
> "The truth speaks for itself. I'm just the messenger."
>     Lyta Alexander - Babylon 5
>
>
> --
> ______________________________**______________________________**_________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> New to Asterisk? Join us for a live introductory webinar every Thurs:
>              http://www.asterisk.org/hello
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>  http://lists.digium.com/**mailman/listinfo/asterisk-**users<http://lists.digium.com/mailman/listinfo/asterisk-users>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20111125/75c47faa/attachment.htm>


More information about the asterisk-users mailing list