[asterisk-users] Get dialed numbers in AGI
Ralph Liebessohn
ralphliebessohn at gmail.com
Wed Jan 10 11:46:51 MST 2007
On 1/10/07, Yuan LIU <yliu11 at hotmail.com> wrote:
>
> Then there must be an error somewhere. The variable READ() in Asterisk
> should be usable. Should be able to use SayDigits() to play it back - or
> no
> value is read.
>
> Yuan Liu
Hi Yuan and Anton,
Let's put here all AGI for test:
#!/usr/bin/php -q
<?php
ob_implicit_flush(false);
error_reporting(0);
$stdin = fopen( 'php://stdin', 'r' );
if (!defined('STDIN'))
{
define('STDIN',fopen('php://stdin','r'));
}
if (!defined('STDOUT'))
{
define('STDOUT',fopen('php://stdout','r'));
}
if (!defined('STDERR'))
{
define('STERR',fopen('php://stderr','r'));
}
while(!feof($stdin))
{
$temp=trim(fgets(STDIN,4096));
if (($temp=="") || ($temp="\n"))
{
break;
}
$s=split(":",$temp);
$nome=str_subst("agi_","",$s[0]);
$agi[$nome]=trim($s[1]);
}
foreach($agi as $chave=>$valor)
{
fwrite(STDERR,"--$chave=$valor\n");
fflush(STDERR);
}
$my_var="123";
fflush(STDERR);
fwrite(STDERR,"Just testing\"\"\n");
fflush(STDERR);
fwrite(STDOUT,"exec read
my_var|//usr/share/asterisk/sounds/please-wait-connect-oncall-eng|5|||15
\n");
fwrite(STDOUT,"exec saydigits ${my_var} \n");
fflush(STDOUT);
$conn=odbc_connect('MSSQL', 'asterisk', '123456');
$query = odbc_exec($conn, "INSERT INTO usuario(nome) VALUES('$my_var')");
?>
If I not startup $my_var="123"; Saydigits receives a NULL as options. And so
nothing was inserted into db.
I tried to use WAIT FOR DIGIT but it makes no sense, asterisk passed through
it directly like Joel Lansden <Joel AT digitalparadise DOT net> reported on
9/14/06.
Is there another function or way to test it or I must try in another
asterisk box?
--
Ralph Liebessohn
ICQ: 74835911
Skype: liebessohn
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20070110/67db9f37/attachment.htm
More information about the asterisk-users
mailing list