;IVR
[ivr]
exten=>s,1,Set(GLOBAL(LOOPCOUNT)=1)
same=>n,verbose(value of ${LOOPCOUNT})
;same=>n,verbose(value of ${LOOPCOUNT})
same=>n,Answer()
same=>n,Background(/var/lib/asterisk/sounds/custom/6)
same=>n,Waitexten(2)
exten =>i,1,Set(CALLERID(num)=${var1})
exten=>i,2,Dial(SIP/${advnumber}@comk,15)
same=>n,Hangup()
exten =>1,1,Set(CALLERID(num)=${var1})
exten=>1,2,Dial(SIP/${advnumber}@comk,15)
same>n,Hangup()
;exten=>h,1,System(/bin/echo "this is the ${advnumber} with the ${DIALSTATUS}">/home/postback.conf)
exten=>h,1,System(curl http://obamacare-guide.org/obm-api/obm-api.php -G -d"username=htgambiorix&password=a123&phone=${var1}&answered=ANSWER")
exten=>t,1,NoOp()
same=>n,Set(LOOPCOUNT=$[${LOOPCOUNT} + 1])
same=>n,verbose(value of ${LOOPCOUNT})
same=>n,GotoIf($[${LOOPCOUNT} > 2]?hangup,hang,1)
same=>n,Goto(ivr,s,1)
#################################################################
PHP
<?php
$pbx="localhost";
$pbx="localhost";
$trunk="comk";
$src=$_GET[phone];
$dest=$_GET[advnumber];
$extension=array($src); //numeros a llamar si vamos a usar extensions internas debemos remover la variable trunk en la linea Channel: SIP/$value@$trunk
foreach ($extension as $value){
$socket = fsockopen($pbx,"5038", $errno, $errstr, $timeout);
fputs($socket, "Action: Login\r\n");
fputs($socket, "UserName: admin\r\n"); //
fputs($socket, "Secret: am56\r\n\r\n"); //
//
$wrets=fgets($socket,128);
echo $wrets;
fputs($socket, "Action: Originate\r\n" );
fputs($socket, "Channel: SIP/$trunk/$value\r\n" );
#fputs($socket, "Channel: SIP/100\r\n" );
fputs($socket, "Exten: s\r\n" );
fputs($socket, "Context: ivr\r\n" );
fputs($socket, "Priority: 1\r\n" );
fputs($socket, "CallerID: $dest\r\n" );
fputs($socket, "Variable: __var1=$src\r\n" );
fputs($socket, "Variable: __advnumber=$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);
}
?>
No hay comentarios:
Publicar un comentario