[asterisk-users] hwo to stok variable wiith menu

salaheddine elharit salah.elharit200 at gmail.com
Mon Nov 28 08:24:07 CST 2011


hello Noll

thank you for your help

i would to ask you please, i want to store the phone number of the
customer  in the option_name column when he press 3 in context menu

i have created a database "aheevacss" with user "aheevaccs" and password
"aheevaccs" and also i have creatd a table in this database name of table
test with two columns:
option_name    varchar(15)
count                int

1-how can i check if the app_mysql module compiled and loaded  i use
asterisk 1.4 and if not installed how can ido in order to install and
loaded it

2- can you please veify the menu below and tell me waht is wrong

thanks and regards

[default]
exten => 529,1,Ringing()
exten => 529,2,Wait(4)
exten => 529,3,Goto(accueil,s,1)

[accueil] ; définition d’un contexte pour l’accueil
exten => s,1,SetGlobalVar(sounds_path=/var/lib/asterisk/sounds/)
exten => s,2,Background(${sounds_path}welcome)
exten => s,3,goto(accueil,s,1)
exten => #,1,Goto(menu,s,1)
exten => i,1,Playback(${sounds_path}erreur-saisie)
exten => i,2,goto(accueil,s,1)
exten => t,1,Goto(accueil,s,1)

[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,NoOp(User chose support option)
exten => 3,n,MYSQL(Connect connid localhost aheevaccs aheevaccs aheevaccs)
exten => 3,n,MYSQL(Query resultid ${connid}  update test set count = count
+ 1 where option_name = 'support')
exten => 3,n,MYSQL(Clear ${resultid})
exten => 3,n,MYSQL(Disconnect ${connid})
exten => 3,n,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)

[appel] ; définition d’un contexte pour le menu d’appel
exten => s,1,Background(${sounds_path}appel)
exten => s,2,WaitExten(10)
exten => 0,1,Goto(menu,s,1)
exten => 223,1,Dial(SIP/${EXTEN},20,tr)
exten => i,1,Playback(${sounds_path}erreur-saisie)
exten => i,2,Goto(appel,s,1)
exten => t,1,Goto(appel,s,1)
[message] ; définition d’un contexte pour la messagerie
exten => s,1,VoiceMailMain(${CALLERIDNUM})
exten => t,1,Hangup()

[support] ; définition d’un contexte pour le support
exten => s,1,GoToIfTime(09:00-17:00|mon-fri|*|*?s,4)
exten => s,2,Playback(${sounds_path}no-relation-support)
exten => s,3,Goto(menu,s,1)
exten => s,4,Playback(${sounds_path}relation-support)
exten => s,5,Queue(default)
exten => t,1,Hangup()




2011/11/25 Dale Noll <dnoll at wi.rr.com>

> **
> On 11/25/2011 10:48 AM, salaheddine elharit wrote:
>
>
> 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)
>
>
> It is difficult to get a good example because I do not know what you are
> looking to save.  You say you want to store the variable, but the only
> variable you have in this case is the digit the user entered, in this case
> '3'.  If you are trying to count the number of times callers press option
> '3', then it is a simple update.
>
> If you have the app_mysql module compiled and loaded you can user the
> MYSQL() app.
> http://www.voip-info.org/wiki/view/Asterisk+cmd+MYSQL
>
> If you do not want would prefer to setup an ODBC connection, that is a bid
> more complex as you have to setup unixODBC ( /etc/odbcinst.ini,
> /etc/odbc.ini ), then setup res_odbc(/etc/asterisk/res_odbc.conf) and
> func_odbc (/etc/asterisk/func_odbc.conf).
>
> How you update the database from within dialplan depends on which access
> method you choose.
>
> Assume you have a mysql table with two columns:
> option_name    varchar(15)
> count                int
>
>
> You could write something like this if you are using app_mysql
>
> exten => 3,1,NoOp(User chose support option)
> exten => 3,n,MYSQL(Connect connid localhost database_user
> database_password database_name)
> exten => 3,n,MYSQL(Query resultid ${connid}  update counter_table set
> count = count + 1 where option_name = 'support')
> exten => 3,n,MYSQL(Clear ${resultid})
> exten => 3,n,MYSQL(Disconnect ${connid})
> exten => 3,n,Goto(support,s,1)
>
>
>
>
>
> --
> "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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20111128/0f01a862/attachment.htm>


More information about the asterisk-users mailing list