[asterisk-users] saving pressed keys
Steve Edwards
asterisk.org at sedwards.com
Sun Mar 7 10:28:12 CST 2010
On Sun, 7 Mar 2010, Necati Demir wrote:
> When a user selects menu from dialplan, i want to save it in a text file
> or a database.
You can "save" their selection to a text file using the system()
application like:
system(echo <something-meaningful-to-you> >>/tmp/selections)
This will obviously fail at some point if you have the ability to
handle more than 1 call at a time. You could implement some sort of
locking in the dialplan, but I think it's a bad idea.
You can save their selection to a database (depending on the database)
with several different methods. You could use ODBC, the MySQL addon, or
write an AGI.
Personally, I would vote for AGI because I think database access in
dialplan is ugly and IMO does not belong in dialplan.
I have an application where (almost) every context is a product that is
billed at its respective rate per minute. At the start of each context, I
call an AGI that writes a row to a MySQL database with all of the relevant
data -- date, agent ID, theme, previous context name, seconds spent in
previous context. At the end of the call, another AGI sums up all of the
rows for that call and submits a credit card sale.
--
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards sedwards at sedwards.com Voice: +1-760-468-3867 PST
Newline Fax: +1-760-731-3000
More information about the asterisk-users
mailing list