<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
On 11/25/2011 10:48 AM, salaheddine elharit wrote:
<blockquote
cite="mid:CAHexamu0QxcE79rfSKApWbei23D1_7UhOZEvhL6ZLwd6OzbiCg@mail.gmail.com"
type="cite">
<div dir="ltr">
<div><br>
thanks for your response </div>
<div> </div>
<div>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</div>
<div>could you please give an exemple like below</div>
<div> </div>
<div>thanks and regards</div>
<div> </div>
<div>[menu]<br>
exten => s,1,Background(${sounds_path}menu)<br>
exten => 0,1,Goto(menu,s,1)<br>
exten => 1,1,Goto(appel,s,1)<br>
exten => 2,1,Goto(message,s,1)<br>
<p style="margin: 0cm 0cm 0pt;" class="MsoNormal"><span
style="color: red;"><font size="3"><font face="Times New
Roman">exten => 3,1,Goto(support,s,1) </font></font></span></p>
exten => s,2,goto(menu,s,1)<br>
exten => i,1,Playback(${sounds_path}erreur-saisie)<br>
exten => i,2,Goto(menu,s,1)<br>
exten => t,1,Goto(menu,s,1)<br>
</div>
<br>
</div>
</blockquote>
<br>
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. <br>
<br>
If you have the app_mysql module compiled and loaded you can user
the MYSQL() app.<br>
<a class="moz-txt-link-freetext" href="http://www.voip-info.org/wiki/view/Asterisk+cmd+MYSQL">http://www.voip-info.org/wiki/view/Asterisk+cmd+MYSQL</a><br>
<br>
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).<br>
<br>
How you update the database from within dialplan depends on which
access method you choose.<br>
<br>
Assume you have a mysql table with two columns:<br>
option_name varchar(15)<br>
count int<br>
<br>
<br>
You could write something like this if you are using app_mysql<br>
<br>
exten => 3,1,NoOp(User chose support option)<br>
exten => 3,n,MYSQL(Connect connid localhost database_user
database_password database_name)<br>
exten => 3,n,MYSQL(Query resultid ${connid} update counter_table
set count = count + 1 where option_name = 'support')<br>
exten => 3,n,MYSQL(Clear ${resultid})<br>
exten => 3,n,MYSQL(Disconnect ${connid})<br>
exten => 3,n,Goto(support,s,1)<br>
<br>
<br>
<br>
<br>
<pre class="moz-signature" cols="72">--
"The truth speaks for itself. I'm just the messenger."
Lyta Alexander - Babylon 5
</pre>
</body>
</html>