Soporte & Consultoria

Soporte Remoto y Consultoria skype : ambiorixg12.
Nota no se brinda ningun tipo de consulta o soporte fuera del blog de forma gratuita

lunes, 28 de diciembre de 2015

routing AGI queue freepbx

1-Create FreePBX virtual DID.

2-Route Virutal DID  to Queues or the desired destination.

3-On the DB there  is  colum called support_level(interger) that number match the Virtual DID

4- made a  custom destination or misc destination to the  agi

So based on  the query result we made a goto to the support level queue


[from-internal-custom]
exten=>101013,1,Agi(ivr.php)
same=>n,Hangup()


;;IVR AGI
#!/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();
$agi->answer();
$cid = $agi->parse_callerid();

$agi->stream_file("welcome");
$agi->stream_file("thank-you-for-calling");

$agi->exec("sayalpha","$cid[username]");

 $result = $agi->get_data('agent-pass',8000,5);

$keys = $result['result'];
if($keys){

$agi->stream_file("you-entered");

$agi->exec("sayalpha","$keys");

}

$setting=array("username"=>"root","password"=>"7816","host"=>"localhost","db"=>"test");

$link = mysqli_connect($setting["host"],$setting["username"],$setting["password"],$setting["db"]);

/* check connection */
if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit();
}

if ($keys){

$query="select * from customer_company where customer_id='$keys' limit 1";


if ($result = mysqli_query($link, $query)) {

    if   ($row = mysqli_fetch_assoc($result)) {


   $agi->stream_file("auth-thankyou");

/* route the call to the virtual DID based on support_level */

$agi->exec_goto('from-trunk',$row[support_level],1);
 }

      else {
$agi->stream_file("pin-invalid");


 }


   // printf(" Query failed: %s\n",mysqli_error($link));

}

}


else {
$agi->stream_file("im-sorry");


}

/* close connection */
mysqli_close($link);


?>








No hay comentarios:

Publicar un comentario