http://audio.online-convert.com/convert-to-wav
Soporte & Consultoria
Soporte Remoto y Consultoria skype : ambiorixg12.
Nota no se brinda ningun tipo de consulta o soporte fuera del blog de forma gratuita
jueves, 24 de marzo de 2016
miércoles, 23 de marzo de 2016
Dialing based on extensions range
[from-internal-custom]
exten=>_1234,1,Playback(demo-thanks)
same=>n,Hangup
exten=>_XXX,1,Noop(${CALLERID(num)})
same=n,Set(range=${CALLERID(num):0:1})
;same=>n,GotoIf($["${EXTEN:0:1}"="${range}"]?allow:disallow)
;same=>n,GotoIf($[$["${EXTEN:0:1}"= "${range}"] | $["${CALLERID(num)}"= "9999"]]?allow:disallow)
same=>n,GotoIf($[$["${EXTEN:0:1}"= "${range}"] | $["${CALLERID(num)}"= "9999"] | $["${CALLERID(num)}"= "9998"]]?allow:disallow)
same=>n(allow),Goto(ext-local,${EXTEN},1)
same=>n,Hangup()
same=>n(disallow),Playback(im-sorry)
same=>n,Hangup()
[from-internal-custom]
exten=>_1234,1,Playback(demo-thanks)
same=>n,Hangup
exten=>_XXX,1,Noop(${CALLERID(num)})
same=n,Set(range=${CALLERID(num):0:1})
same=>n,GotoIf($["${EXTEN:0:1}"="${range}"]?allow:disallow)
;same=>n,GotoIf($[$["${EXTEN:0:1}"= "${range}"] | $["${CALLERID(num)}"= "9999"]]?allow:disallow)
;same=>n,GotoIf($[$["${EXTEN:0:1}"= "${range}"] | $["${CALLERID(num)}"= "9999"] | $["${CALLERID(num)}"= "9998"]]?allow:disallow)
same=>n,Hangup()
same=>n(disallow),Playback(im-sorry)
same=>n,Hangup()
exten=>_911,1,Macro(dialout-trunk,1,${EXTEN},,)
same=>n,Hangup()
jueves, 3 de marzo de 2016
ban ami failed authentication
php ami_ban.php InvalidAccountID > /dev/null 2 &
<?php
$host="localhost";
$username="admin";
$secret="1133";
$socket = fsockopen($host,"5038", $errno, $errstr,10);
if (!$socket){
echo "$errstr ($errno)\n";
}else{
fputs($socket, "Action: Login\r\n");
fputs($socket, "UserName: $username\r\n");
fputs($socket, "Secret: $secret\r\n\r\n");
fputs($socket, "Action: WaitEvent\r\n");
fputs($socket, "Action: Logoff\r\n\r\n");
while(!feof($socket)){
$result=fread($socket,5000);
if (preg_match("/\b$argv[1]\b/i", $result, $match)){
$r=explode("\n",$result);
$channel=explode("/",$r[9]);
echo "fail to auntehticate $channel[2]\n";
foreach( $r as $key=>$value){
echo " $key : $value\n";
system( "echo \" $key : $value\n \" >>/root/ban.log");
system("/root/block.sh $channel[2]");
}
continue;
}
}
}
fclose($socket);
?>
<?php
$host="localhost";
$username="admin";
$secret="1133";
$socket = fsockopen($host,"5038", $errno, $errstr,10);
if (!$socket){
echo "$errstr ($errno)\n";
}else{
fputs($socket, "Action: Login\r\n");
fputs($socket, "UserName: $username\r\n");
fputs($socket, "Secret: $secret\r\n\r\n");
fputs($socket, "Action: WaitEvent\r\n");
fputs($socket, "Action: Logoff\r\n\r\n");
while(!feof($socket)){
$result=fread($socket,5000);
if (preg_match("/\b$argv[1]\b/i", $result, $match)){
$r=explode("\n",$result);
$channel=explode("/",$r[9]);
echo "fail to auntehticate $channel[2]\n";
foreach( $r as $key=>$value){
echo " $key : $value\n";
system( "echo \" $key : $value\n \" >>/root/ban.log");
system("/root/block.sh $channel[2]");
}
continue;
}
}
}
fclose($socket);
?>
php ami caller
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)
miércoles, 2 de marzo de 2016
ami channel redirect on a dtmf key
php /root/event.php DTMFEnd
<?php
$host="localhost";
$username="admin";
$secret="456";
$socket = fsockopen($host,"5038", $errno, $errstr,10);
if (!$socket){
echo "$errstr ($errno)\n";
}else{
fputs($socket, "Action: Login\r\n");
fputs($socket, "UserName: $username\r\n");
fputs($socket, "Secret: $secret\r\n\r\n");
fputs($socket, "Action: WaitEvent\r\n");
fputs($socket, "Action: Logoff\r\n\r\n");
while(!feof($socket)){
$result=fread($socket,5000);
//if(stristr($result,'HangupRequest')){ //no used
if (preg_match("/\b$argv[1]\b/i", $result, $match)){
$r=explode("\n",$result);
$channel=explode(" ",$r[2]);
echo "channel name is $channel[1]\n";
system(" curl \"http://65.181.118.232/chanredirect.php?context=internal&exten=10&channel=$channel[1]\"");
foreach( $r as $key=>$value){
echo " $key : $value\n";
}
continue;
}
}
}
fclose($socket);
?>
@@@@@@@@@@@@@@@@@@@@@
<?php
//http://65.181.118.232/php-project/chanredirect.php?exten=1010&context=internal&channel=SIP/102-00000004
$pbx="localhost";
$timeout=45;
$chan=$_GET['channel'];
$exten=$_GET['exten'];
$context=$_GET['context'];
if($_GET['channel'] && $_GET['context'] && $_GET['exten']){
$socket = fsockopen($pbx,"5038", $errno, $errstr, $timeout);
fputs($socket, "Action: Login\r\n");
fputs($socket, "UserName: admin\r\n"); //
fputs($socket, "Secret: 456\r\n\r\n"); //
//
$wrets=fgets($socket,128);
echo "<center>$wrets</center>";
fputs($socket, "Action: Redirect\r\n" );
fputs($socket, "Channel:$chan\r\n" );
fputs($socket, "Exten: $exten\r\n" );
fputs($socket, "Context: $context\r\n" );
fputs($socket, "Priority: 1\r\n" );
fputs($socket, "Async: yes\r\n\r\n" );
fputs($socket, "Action: Logoff\r\n\r\n");
sleep (1);
$wrets=fgets($socket,128);
echo "<center><h2>Transfer completed</h2></center>";
}
?>
AMI channel redirect
<?php
//http://65.181.118.232/php-project/chanredirect.php?exten=1010&context=internal&channel=SIP/102-00000004
$pbx="localhost";
$timeout=45;
$chan=$_GET['channel'];
$exten=$_GET['exten'];
$context=$_GET['context'];
if($_GET['channel'] && $_GET['context'] && $_GET['exten']){
$socket = fsockopen($pbx,"5038", $errno, $errstr, $timeout);
fputs($socket, "Action: Login\r\n");
fputs($socket, "UserName: admin\r\n"); //
fputs($socket, "Secret: 456\r\n\r\n"); //
//
$wrets=fgets($socket,128);
echo "<center>$wrets</center>";
fputs($socket, "Action: Redirect\r\n" );
fputs($socket, "Channel:$chan\r\n" );
fputs($socket, "Exten: $exten\r\n" );
fputs($socket, "Context: $context\r\n" );
fputs($socket, "Priority: 1\r\n" );
fputs($socket, "Async: yes\r\n\r\n" );
fputs($socket, "Action: Logoff\r\n\r\n");
sleep (1);
$wrets=fgets($socket,128);
echo "<center><h2>Transfer completed</h2></center>";
}
?>
//http://65.181.118.232/php-project/chanredirect.php?exten=1010&context=internal&channel=SIP/102-00000004
$pbx="localhost";
$timeout=45;
$chan=$_GET['channel'];
$exten=$_GET['exten'];
$context=$_GET['context'];
if($_GET['channel'] && $_GET['context'] && $_GET['exten']){
$socket = fsockopen($pbx,"5038", $errno, $errstr, $timeout);
fputs($socket, "Action: Login\r\n");
fputs($socket, "UserName: admin\r\n"); //
fputs($socket, "Secret: 456\r\n\r\n"); //
//
$wrets=fgets($socket,128);
echo "<center>$wrets</center>";
fputs($socket, "Action: Redirect\r\n" );
fputs($socket, "Channel:$chan\r\n" );
fputs($socket, "Exten: $exten\r\n" );
fputs($socket, "Context: $context\r\n" );
fputs($socket, "Priority: 1\r\n" );
fputs($socket, "Async: yes\r\n\r\n" );
fputs($socket, "Action: Logoff\r\n\r\n");
sleep (1);
$wrets=fgets($socket,128);
echo "<center><h2>Transfer completed</h2></center>";
}
?>
AMI DTMF reader
<?php
$host="localhost";
$username="admin";
$secret="a136";
$socket = fsockopen($host,"5038", $errno, $errstr,10);
if (!$socket){
echo "$errstr ($errno)\n";
}else{
fputs($socket, "Action: Login\r\n");
fputs($socket, "UserName: $username\r\n");
fputs($socket, "Secret: $secret\r\n\r\n");
fputs($socket, "Action: WaitEvent\r\n");
fputs($socket, "Action: Logoff\r\n\r\n");
while(!feof($socket)){
$result=fread($socket,5000);
//if(stristr($result,'HangupRequest')){ //no used
if (preg_match("/\b$argv[1]\b/i", $result, $match)){
$r=explode("\n",$result);
foreach( $r as $key=>$value){
echo " $key : $value\n";
}
continue;
}
}
}
fclose($socket);
?>
reading dtmf begin event
php event.php DTMFBegin
reading dtmf end event
php event.php DTMFEnd
$host="localhost";
$username="admin";
$secret="a136";
$socket = fsockopen($host,"5038", $errno, $errstr,10);
if (!$socket){
echo "$errstr ($errno)\n";
}else{
fputs($socket, "Action: Login\r\n");
fputs($socket, "UserName: $username\r\n");
fputs($socket, "Secret: $secret\r\n\r\n");
fputs($socket, "Action: WaitEvent\r\n");
fputs($socket, "Action: Logoff\r\n\r\n");
while(!feof($socket)){
$result=fread($socket,5000);
//if(stristr($result,'HangupRequest')){ //no used
if (preg_match("/\b$argv[1]\b/i", $result, $match)){
$r=explode("\n",$result);
foreach( $r as $key=>$value){
echo " $key : $value\n";
}
continue;
}
}
}
fclose($socket);
?>
reading dtmf begin event
php event.php DTMFBegin
reading dtmf end event
php event.php DTMFEnd
ARI COMMANDS
Playing audio on a channel
curl -v -u asterisk:asterisk -X POST "http://localhost:8088/ari/channels/1456957509.267/play?media=sound:/var/lib/asterisk/sounds/en/hello-world"
curl -v -u asterisk:asterisk -X POST "http://localhost:8088/ari/channels/1456957509.267/play?media=sound:/var/www/demo/newb"
LIST ALL ENDPOINTS
curl -v -u asterisk:asterisk -X GET "http://localhost:8088/ari/endpoints"
LIST SIP ENDPOINTS
curl -v -u asterisk:asterisk -X GET "http://localhost:8088/ari/endpoints/SIP"
GET DETAILS OF AN ENDPOINT
root@asterisk-dominicana:~# curl -v -u asterisk:asterisk -X GET "http://localhost:8088/ari/endpoints/SIP/102"
SEND DTMF
curl -v -u asterisk:asterisk -X POST "http://localhost:8088/ari/channels/1456956819.263/dtmf?dtmf=1"
LIST CHANNELS
curl -v -u asterisk:asterisk -X GET "http://localhost:8088/ari/channels"
TRANSFER TO A CONTEXT
curl -v -u asterisk:asterisk -X POST "http://localhost:8088/ari/channels/1456957265.265/continue?context=internal&extension=0&priority=1"
HOLD AND UNHOLD
curl -v -u asterisk:asterisk -X POST "http://localhost:8088/ari/channels/1456957509.267/hold"
curl -v -u asterisk:asterisk -X DELETE "http://localhost:8088/ari/channels/1456957509.267/hold"
START AND STOP RING
curl -v -u asterisk:asterisk -X POST "http://localhost:8088/ari/channels/1456957509.267/ring"
curl -v -u asterisk:asterisk -X DELETE "http://localhost:8088/ari/channels/1456957509.267/ring"
Getting variables from a channel
curl -v -u asterisk:asterisk -X GET "http://localhost:8088/ari/channels/1456957509.267/variable?variable=CHANNEL"
curl -v -u asterisk:asterisk -X GET "http://localhost:8088/ari/channels/1456957509.267/variable?variable=EXTEN"
curl -v -u asterisk:asterisk -X GET "http://localhost:8088/ari/channels/1456957509.267/variable?variable=CALLERID(num)"
Listing bridges
curl -v -u asterisk:asterisk -X POST "http://localhost:8088/ari/bridges"
https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Channels+REST+API
Suscribirse a:
Entradas (Atom)