php code
URL : http://65.181.118.232/dialer/ami_call.php?dest=15054506810&cid=18002361010&name=Ambiorix&message=demo-thanks&digits=3697
<?php
/*parameters */
$param= array("host"=>"localhost","port"=>5038,"trunk"=>"tw0","timeout"=>45);
/*form variables */
$dest=$_GET['dest'];
$cid=$_GET['cid'];
$name=$_GET['name'];
$msg=$_GET['message'];
$digits=$_GET['digits'];
$socket = fsockopen($param['host'],$param['port'], $errno, $errstr,$param['timeout']);
fputs($socket, "Action: Login\r\n");
fputs($socket, "UserName: admin\r\n"); //
fputs($socket, "Secret:r456\r\n\r\n"); //
$wrets=fgets($socket,128);
echo $wrets;
fputs($socket, "Action: Originate\r\n" );
fputs($socket, "Channel: Local/$dest@jack\r\n" );
fputs($socket, "Exten: s\r\n" );
fputs($socket, "Context: from-jack\r\n" );
fputs($socket, "Priority: 1\r\n" );
fputs($socket, "CallerID: $cid\r\n" ); //No used here
fputs($socket, "Variable: __cid=$cid\r\n" );
fputs($socket, "Variable: __name=$name\r\n" );
fputs($socket, "Variable: __message=$msg\r\n" );
fputs($socket, "Variable: __digits=$digits\r\n" );
fputs($socket, "Variable: __dest=$dest\r\n" );
fputs($socket, "Async: yes\r\n\r\n" );
fputs($socket, "Action: Logoff\r\n\r\n");
sleep (1);
$wrets=fgets($socket,128);
?>
DIAL PLANN
[jack]
exten=>_x.,1,Set(CALLERID(all)=${name}<${cid}>)
same=>n,Dial(IAX2/1005/${EXTEN},30)
[from-jack]
exten=>s,1,Answer()
same=>n,Saydigits(${digits})
same=>n,background(${message})
same=>n,WaitExten(5)
exten=>i,1,goto(from-jack,s,1)
exten=>t,1,goto(from-jack,s,1)
No hay comentarios:
Publicar un comentario