#!/usr/bin/php -q
<?php
set_time_limit(30);
require('/var/lib/asterisk/agi-bin/phpagi-2.20/phpagi.php');
error_reporting(E_ALL);
$agi = new AGI();
$cid = $agi->parse_callerid();
$agi->stream_file("welcome");
$agi->exec("sayalpha","$cid[username]");
//$result = $agi->get_data('agent-pass',8000,3);
$str =$cid[username];
$chars = preg_split('//', $str, -1, PREG_SPLIT_NO_EMPTY);
$num=0;
$letters=0;
foreach($chars as $elements){
if (is_numeric($elements)) {
$num+=1;
}
else{
$letters+=1;
}
}
$agi->exec("sayalpha","$num");
$agi->exec("sayalpha","$letters");
if($num==4){
$agi->exec_goto("cidialout","$argv[1]","_777");
}
if($num==5){
$agi->exec_goto("cidialout","$argv[1]","_888");
}
?>
[cidialout]
exten=>_x.,1,Noop( Dialing to ${EXTEN})
same=>n(_555 ),Dial(SIP/rapidvox/555${EXTEN},25)
same=>n,Hangup()
same=>n(_666),Dial(SIP/${TRUNK}/666${EXTEN},25)
same=>n,Hangup()
same=>n(_777),Dial(SIP/rapidvox/777${EXTEN},25)
same=>n,Hangup()
same=>n(_888),Dial(SIP/${TRUNK}/888${EXTEN},25)
same=>n,Hangup()
No hay comentarios:
Publicar un comentario