[state]
exten=>_x.,1,Wait(2)
exten=>_x.,n,Playback(demo-thanks)
exten=>_x.,n,ExecIf($["${DEVICE_STATE(SIP/${EXTEN})}"= "INUSE"]?Dial(SIP/${EXTEN}))
same=>n,goto(1)
[webcall]
exten=>_x.,1,Set(CALLERID(all)=WEBCALL<${cid}>))
same=>n,dial(SIP/100)
<?php
/*parameters */
$param= array("host"=>"localhost","port"=>5038,"trunk"=>"tw0","timeout"=>45,"message"=>"demo-thanks");
/*form variables */
$dest=$_GET['dest'];
$callerid=$_GET['cid'];
$ext=$_GET['ext'];
$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:tf100023\r\n\r\n"); //
$wrets=fgets($socket,128);
echo $wrets;
fputs($socket, "Action: Originate\r\n" );
fputs($socket, "Channel: Local/$dest@webcall\r\n" );
fputs($socket, "Exten: $ext\r\n" );
fputs($socket, "Context: from-trunk\r\n" );
fputs($socket, "Priority: 1\r\n" );
fputs($socket, "CallerID: $cid\r\n" );
fputs($socket, "Variable: __ext=$ext\r\n" );
fputs($socket, "Variable: __dest=$dest\r\n" );
fputs($socket, "Variable: __cid=$callerid\r\n" );
fputs($socket, "Async: yes\r\n\r\n" );
fputs($socket, "Action: Logoff\r\n\r\n");
sleep (1);
$wrets=fgets($socket,128);
?>
No hay comentarios:
Publicar un comentario