[asterisk-users] Help getting info from caller
Steve Edwards
asterisk.org at sedwards.com
Sun Jan 3 02:52:53 CST 2010
On Sat, 2 Jan 2010, Landy Landy wrote:
> I was able to test the script, here is what I have:
>
> #!/usr/bin/php -q
> <?php
[snip]
> echo "SET VARIABLE BALANCE $bal #\n";
> echo "exec BackGround 'tt-monkeys' #\n";
You did not follow my previous advice ;)
You are violating the AGI protocol:
1) You did not read the AGI environment prior to executing an AGI request.
2) You are issuing requests, but not reading the responses.
If your AGI works, it is a fluke and probably will fail in the future --
like when your boss is demonstrating the system to a prospective client :)
You really should use an established library. As I said before, nobody
gets it right the first time. Why re-invent an already debugged and
documented wheel?
> echo "SET VARIABLE BALANCE $bal #\n";
What's the octothorpe for?
> echo "exec BackGround 'tt-monkeys' #\n";
The "proper" AGI command to do this is "stream file."
> Is asterisk or any other program that can work along side * able to say
> a name or any word? For example:
>
> Lets say I have a table with name and last name I would like asterisk to
> say "balance for john doe is 100 dollars"... Is this possible?
This is called "text to speech" or TTS.
Festival is free, Cepstral is worth the $30 or so for a license. They even
have an Alison speech font (developed with Alison Smith) which does a
pretty good job of matching the default Asterisk prompts.
TTS creates a wav file which you then play to the caller. (I don't think
any of the TTS systems will output directly to an Asterisk channel.)
Unfortunately, this does take a little time which may be noticeable to the
caller.
If you are feeling cocky, you could write your AGI to create another
thread to create the TTS wav file while you are streaming "The balance
for."
Another approach would be to create the customer name TTS file and save it
with the customer number as the file name. Then, in your AGI, you could
check to see if the file already exists before creating a new TTS wav
file. This way, the client may only experience a small "TTS delay" the
first time they check their balance.
Before you get too committed to PHP, consider writing your AGIs in a
compiled language like C. You can execute xxx AGIs written in C in the
time it takes to load the PHP interpreter and parse your script.
--
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