#!/usr/bin/php-cli -q <?php require dirname(__FILE__) . '/../lib/phpagi/phpagi.php'; require dirname(__FILE__) . '/../include/db_utils.inc.php'; require dirname(__FILE__) . '/common/AGI_Logger.class.php'; require dirname(__FILE__) . '/common/AGI_CDR.class.php'; require dirname(__FILE__) . '/common/AGI_Utils.php'; $agi = new AGI(); $logger = new AGI_Logger($agi); $cdr = new AGI_CDR($agi); // Get Called Extension informations $called_ext = $agi->request['agi_extension']; $Extension_D = DB_Extension($called_ext); // Get 'DialTone' Parameters $DialTone = Database_Entry('Ext_DialTone', $Extension_D['PK_Extension']); //CDR: Set called info $cdr->set_called("{$DialTone['PK_Extension']}", "DialTone", "Dial Tone", "{$Extension_D['Extension']}"); // Call DISA Application if ($DialTone['Password'] != '') { $agi->exec('DISA', array($DialTone['Password'], 'internal')); } else { $agi->exec('DISA', array('no-password', 'internal')); }
#!/usr/bin/php -q <?php set_time_limit(30); require_once 'phpagi.php'; require_once 'db_work.php'; $agi = new AGI(); $agi->answer(); $callerid = $agi->get_variable("CALLERID(name)"); $incoming_num = mysql_escape_string($callerid['data']); $incoming_num = substr(preg_replace("/[^0-9]/", "", $incoming_num), -9); $agi->exec('NoOp', 'CONTEXT:' . $incoming_num); $client = values("SELECT lastdata FROM asteriskcdrdb.`cdr` WHERE (src LIKE '%" . $incoming_num . "' OR srcplus LIKE '%" . $incoming_num . "') AND calldate > '" . date("Y-m-d H:i:s", time() - 604800) . "' AND dcontext='work' AND dstchannel!='' AND lastapp='Dial' AND disposition='ANSWERED' ORDER BY calldate DESC LIMIT 1"); if (count($client) > 0 and strlen($incoming_num) > 6) { $arr = explode(',', $client[0]["lastdata"]); $agi->exec('Dial', $arr[0] . ',10,r'); $ds = $agi->get_variable("DIALSTATUS"); if ($ds['data'] == "ANSWER") { $agi->hangup(); } $agi->exec('NoOp', 'GOTO:' . $arr[0]); }
#!/usr/bin/php -q <?php set_time_limit(30); require_once 'phpagi.php'; require_once 'db_work.php'; $agi = new AGI(); $agi->answer(); $callerid = $agi->get_variable("CALLERID(num)"); $incoming_num = mysql_escape_string($callerid['data']); $incoming_num = substr(preg_replace("/[^0-9]/", "", $incoming_num), -9); $agi->exec('NoOp', $incoming_num); if (strlen($incoming_num) > 6) { $client = values("SELECT id, checkid, autoresponse_file FROM `workbase`.`autoresponser` WHERE phone LIKE '%" . $incoming_num . "' AND need_autoresponse=1 ORDER BY need_autoresponse DESC, id DESC LIMIT 7"); $agi->exec('NoOp', 'Count: ' . count($client)); for ($i = 0; $i < count($client); $i++) { if (!file_exists("/var/lib/asterisk/sounds/en/" . $client[$i]["autoresponse_file"] . "_.wav")) { $agi->exec('NoOp', "/var/lib/asterisk/sounds/en/" . $client[$i]["autoresponse_file"] . "_.wav"); continue; } $agi->stream_file('receipt_', "79#"); $agi->say_digits($client[$i]["checkid"], "79#"); $agi->stream_file($client[$i]["autoresponse_file"] . "_", "79#"); values("UPDATE `workbase`.`autoresponser` SET response_date='" . Date("Y-m-d H:i:s") . "' WHERE id=" . $client[$i]['id']); } }
#!/usr/bin/php -q <?php set_time_limit(30); require_once "phpagi.php"; require_once "PxpRestClient.php"; include_once '/var/www/html/libs/JSON.php'; error_reporting(E_ALL); $agi = new AGI(); $agi->answer(); //agi(googletts.agi,"Esta es una simple prueba de google",es) $agi->exec("AGI", "googletts.agi,\"Bienvenido a la aplicación para inactivar roles en el servidor vps de estados unidos .\",es,#,1.28"); $pxpRestClient = PxpRestClient::connect('gema.kplian.com', 'pxp/lib/rest/')->setCredentialsPxp('admin', 'admin'); $jsonString = $pxpRestClient->doGet('seguridad/Rol/listarRol', array('start' => '0', 'limit' => '10')); $jsonString = str_replace('(', '', $jsonString); $jsonString = str_replace(')', '', $jsonString); $json = new Services_JSON(); $array = $json->decode($jsonString); $id = 1; foreach ($array->datos as $value) { $valor = $value->rol; $agi->exec("AGI", "googletts.agi,\" {$id} Rol {$valor}.\",es,#,1.28"); $id++; } $agi->exec("AGI", "googletts.agi,\" Ingrese el número de rol a eliminar despues del tono \",es,#,1.28"); $resultado = $agi->get_data('beep', 3000, 20); $numero = $resultado['result']; $id_rol = $array->datos[$numero - 1]->id_rol; $agi->exec("AGI", "googletts.agi,\" El id del rol seleccionado es {$id_rol}\",es,#,1.28"); $jsonString = $pxpRestClient->doPost('seguridad/Rol/eliminarRol', array('_tipo' => 'matriz', 'row' => "{\"0\":{\"id_rol\":\"{$id_rol}\",\"_fila\":{$numero}}}")); $agi->exec("AGI", "googletts.agi,\" El rol ha sido inactivado exitosamente \",es,#,1.28"); $agi->hangup();
require dirname(__FILE__) . '/common/AGI_CDR.class.php'; require dirname(__FILE__) . '/common/AGI_Utils.php'; $agi = new AGI(); $logger = new AGI_Logger($agi); $cdr = new AGI_CDR($agi); // Get Called Extension informations $called_ext = $agi->request['agi_extension']; $Extension_D = DB_Extension($called_ext); // Get Called SipPhone information $SipPhone = Database_Entry('Ext_SipPhones', $Extension_D['PK_Extension']); //CDR: Set called info $cdr->set_called("{$SipPhone['PK_Extension']}", "SipPhone", "{$SipPhone['FirstName']} {$SipPhone['LastName']}", "{$Extension_D['Extension']}"); //CDR: Push RING event $cdr->push_event('RING', "{$SipPhone['FirstName']} {$SipPhone['LastName']},{$Extension_D['Extension']}"); // Perform the Dial $agi->exec('Dial', array("SIP/{$Extension_D['Extension']}", 10, 'tT')); //CDR: Push DIALSTATUS $resp = $agi->get_variable('DIALSTATUS'); $DIALSTATUS = $resp['data']; $resp = $agi->get_variable('HANGUPCAUSE'); $HANGUPCAUSE = $resp['data']; if ($DIALSTATUS != "") { $cdr->push_event('DIALSTATUS', "{$DIALSTATUS},{$HANGUPCAUSE}"); } if ($DIALSTATUS != 'ANSWER') { // Exit if voicemail is not defined for this extension $query = "SELECT * FROM Ext_SipPhones_Features WHERE FK_Extension = {$SipPhone['PK_Extension']} AND FK_Feature=1 LIMIT 1"; $agi->verbose($query); $result = $mysqli->query($query) or $agi->verbose($mysqli->error); if ($mysqli->numrows($result) != 1) { exit(0);
#!/usr/bin/php -q <?php set_time_limit(30); require_once 'phpagi.php'; require_once 'db_work.php'; $agi = new AGI(); $callerid = $agi->get_variable("CALLERID(num)"); $phone = preg_replace("/[^0-9]/", "", $callerid['data']); $phone = substr($phone, -9); if (strlen($phone) == 9) { $agi->exec('NoOP', $phone); $op = values("SELECT dstchannel FROM `cdr` WHERE src LIKE '%" . $phone . "' AND dcontext = 'phones_incom' AND dstchannel!='' ORDER BY calldate DESC LIMIT 1"); $agi->exec('NoOP', $op[0]["out"]); if (count($op) > 0) { $arr = explode('-', $op[0]["dstchannel"]); $agi->exec('Dial', $arr[0] . ',10,r'); $ds = $agi->get_variable("DIALSTATUS"); if ($ds['data'] == "ANSWER") { $agi->hangup(); } $agi->exec('NoOp', 'GOTO:' . $arr[0]); } } ?>
#!/usr/bin/php -q <?php /* * IVR.php * * IVR AGI приложение для Asterisk PBX * * Григорий Майстренко (Grygorii Maistrenko) * grygoriim@gmail.com */ include dirname(__FILE__) . "/lib/Class.IVR.php"; include dirname(__FILE__) . "/lib/phpagi-2.14/phpagi.php"; $agi = new AGI(); //$agi->verbose(basename(__FILE__).":".__LINE__." - Входящие параметры ".print_r($argv, true)); if (isset($argv[1]) && $argv[1] != "") { $MENUID = $argv[1]; //$agi->verbose(basename(__FILE__).":".__LINE__." - Передан параметр".print_r($resrun, true)); } else { $MENUID = "common"; } $ivr = new IVR($agi); $resrun = $ivr->Run($MENUID); if ($resrun != '-1') { // делаем трансфер $resrun = $agi->exec("TRANSFER {$resrun}"); $agi->verbose(basename(__FILE__) . ":" . __LINE__ . " - " . print_r($resrun, true)); }
sleep(2); //I had it set up to check the callerid against a set of valid peeps - but i decided i was tired of that. and it made it too complex. //get caller id. $cid = $agi->parse_callerid(); $cid= $cid[username]; //streamfile that says "Enter number to spoof" $agi->stream_file('enter_spoof'); //beep then get the resulting 10 digits - set it to spoofnumber $result = $agi->get_data('beep', 3000, 10); $spoofnumber= $result['result']; $agi->verbose("Spoof Number:".$spoofnumber); //streamfile that says "enter number to call" $agi->stream_file('call_spoof'); //beep then get the resulting 10 digits - set it to callnumber $result = $agi->get_data('beep', 3000, 10); $callnumber= $result['result']; $agi->verbose("Number to call:".$callnumber); // set caller id to the spoofnumber $agi->set_callerid($spoofnumber); //call the number using whatever you got //notice i have placed the 1 before the callnumber. this is so that i can keep everything ten digits. and cuz i am lazy $agi->exec("Dial IAX2/yourpassword@provider/1".$callnumber); // That is it. simple.. scary and easy ?>
$Admins = array(); $query = "\n\tSELECT \n\t\tExtension\n\tFROM\n\t\tExtensions\n\t\tINNER JOIN Ext_ConfCenter_Admins ON FK_Extension = PK_Extension\n\tWHERE\n\t\tFK_Room = '{$Room['PK_Room']}'\n"; $result = $mysqli->query($query) or $logger->error_sql($mysqli->error, $query, __FILE__, __LINE__); while ($row = $result->fetch_assoc()) { $Admins[] = $row['Extension']; } // Set conference options $conf_options = ''; if (in_array($caller_ext, $Admins)) { $conf_options .= 'Aa'; } elseif ($Room['OnlyAdminTalk'] == '1') { $conf_options .= 'm'; } if ($Room['PlayMOH'] == '1') { $conf_options .= 'M'; } if ($Room['PlayEnterSound'] != '1') { $conf_options .= 'q'; } if ($Room['Operator'] != '') { $conf_options .= 'p'; } if ($Room['NoTalkTillAdmin'] == '1') { $conf_options .= 'w'; } if ($Room['HangupIfNoAdmin'] == '1') { $conf_options .= 'x'; } // Call MeetMe Applications $agi->exec('MeetMe', array($conf_no, $conf_options)); $agi->exec('Goto', array('internal', $Room['Operator'], 1));
function disponible($codigo) { $url = 'http://104.131.89.133/codes/consulta?code=' . $codigo; $respuesta = json_decode(file_get_contents($url)); // foreach($respuesta[0] as $key=>$value) { $fields_string .= $key.'='.$value.'&'; } $respuesta = $respuesta[0]; if ($respuesta->blank == "-1") { $respuesta = "-1"; } else { $total = $respuesta->disponible; $respuesta = floor($total / 60); } return $respuesta; } foreach ($obtenerTelefonos(1) as $key => $value) { $agi->exec('DIAL', "SIP/servicom/03" . $value->phone . ",10,gHCL(360000:360000:0000)"); } // $agi->exec_dial("SIP/4444141,100,HCL(10000:10000:0000)"); // $agi->exec('DIAL', 'SIP/1021'.",30,gHCL(10000:10000:0000)"); // $callduration = $agi->get_variable("ANSWEREDTIME"); //foreach($callduration as $key=>$value) { $fields_string .= $key.'='.$value.'&'; } //file_get_contents('http://webdaniel.info/nethexa/?'.$fields_string); //$agi->exec('Dial("SIP/1021,60,HCL(5:5:0000)")'); //$agi->stream_file('traductores/ESPANOL/Gracias_por_llamar_a_nuestra_compañia'); // $agi->get_data('traductores/saludo', $tiempoDeEspera, 1); // $agi->exec_dial("SIP/une/033104452509,HCL(5:5:0000)"); //$agi->exec("set_context($context)"); //$agi->exec("ResetCDR"); // $callduration = $agi->get_variable("ANSWEREDTIME"); // $callduration = $agi->get_variable("CDR(billsec)"); /// foreach($callduration as $key=>$value) { $fields_string .= $key.'='.$value.'&'; }
/* This script requires the php-agi library (http://phpagi.sourceforge.net/). You need to modify php.ini 1) register_argc_argv From: register_argc_argv = Off To: register_argc_argv = On 2) variables_order From: variables_order = "GPCS" To: variables_order = "EGPCS" The order forthe value of variables_order is IMPORTANT! */ $email_contact = '*****@*****.**'; //seperate them by , $agi = new AGI(); //This line is not needed but hepful if you want to dump all the data on the call. //$agi->exec("DumpChan", ""); $agi->exec('PlayBack', 'one-moment-please'); $values_to_get = array('audioreadformat', 'audionativeformat', 'audiowriteformat', 'peerip', 'recvip', 'from', 'uri', 'useragent', 'peername', 'channeltype', 'rtpdest'); $peer = get_channel_var('peername'); $email_msg = ''; $email_msg .= "Hi there,\n\n"; $email_msg .= "The peer {$peer} just dialed *222 to indicate that they may have a quality issue. Below is the details of the connection as well as a trace.\n\n\n"; foreach ($values_to_get as $item) { $var = get_channel_var($item); $email_msg .= "{$item}: {$var}\n"; } $email_msg .= "\n\n\n"; $rtp_ip = get_channel_var('rtpdest'); $rtp_ip = explode(':', $rtp_ip); $rtp_ip = $rtp_ip[0]; $output = shell_exec("/usr/sbin/mtr -o \"L SRD NBAW JMXI\" --report --report-cycles 5 --no-dns {$rtp_ip}"); $email_msg .= $output;
include_once 'netsds.inc'; /* navigation and taps logs */ $agi = new AGI(); if (!isset($argv[1]) or !isset($argv[2]) or !isset($argv[3]) or !isset($argv[4]) or !isset($argv[5]) or !isset($argv[6]) or !isset($argv[7]) or !isset($argv[8])) { $agi->verbose("Usage: cdr(calldate) cdr(src) custom_dst dtmf previous_context current_context previous_id previous_seconds"); exit(0); } $cdr_calldate = $argv[1]; $cdr_src = $argv[2]; $custom_dst = $argv[3]; // $moment = now(); $dtmf = $argv[4]; $previous_context = $argv[5]; $current_context = $argv[6]; $previous_id = $argv[7]; $previous_seconds = $argv[8]; $pgdbh = netsds_connect(); $agi->verbose("Previous id is {$previous_id}"); if ($previous_id > 0) { // We have previous ID. $agi->verbose("Setting seconds for previous position to {$previous_seconds}"); pg_query($pgdbh, "update ivr.navigation_taps_logs set seconds={$previous_seconds} where id={$previous_id}"); } $query = sprintf("insert into ivr.navigation_taps_logs (cdr_calldate, cdr_src, custom_dst, dtmf, previous_context, current_context ) values ('%s','%s','%s','%s','%s','%s') returning id;", $cdr_calldate, $cdr_src, $custom_dst, $dtmf, $previous_context, $current_context); $insert = pg_query($pgdbh, $query); $row = pg_fetch_row($insert); $agi->verbose("PREVIOUS_ID must be " . $row[0]); $agi->exec("Set", "PREVIOUS_ID=" . $row[0]); pg_close($pgdbh); $agi->verbose("IVR history saved"); exit(0);
$row = $mysqli->fetch_array($result); $dialing_enabled = $row[0]; // If extension dialing is enabled if ($dialing_enabled) { // Loop while user timeouts on keypress or pound key is pressed $new_digit = $key; while ($new_digit != '' && $new_digit != '#') { $extension_to_dial .= $new_digit; $result = $agi->get_data('beep', 2000, 1); $new_digit = $result['result']; } // Check if the extension entered is valid to be dialed, if so dial and get out $query = "SELECT * FROM Extensions WHERE IVRDial = '1' AND Extension = '{$extension_to_dial}' LIMIT 1"; $result = $mysqli->query($query) or $logger->error_sql("", $query, __FILE__, __LINE__); if ($mysqli->num_rows($result)) { $agi->exec('Goto', array('internal', $extension_to_dial, 1)); die; } } // Check for requested option $query = "SELECT * FROM IVR_Options WHERE FK_Menu= '{$menu}' AND `Key`='{$key}' LIMIT 1"; $result = $mysqli->query($query) or $logger->error_sql("", $query, __FILE__, __LINE__); // If it's a valid option if ($mysqli->num_rows($result)) { $row = $result->fetch_assoc(); // Get Starting Menus $menu = $row['FK_Menu_Entry']; // Get Starting Order $query = "SELECT `Order` FROM IVR_Actions WHERE PK_Action = '{$row['FK_Action_Entry']}' LIMIT 1"; $result = $mysqli->query($query) or $logger->error_sql("", $query, __FILE__, __LINE__); if ($mysqli->numrows($result) == 1) {
#!/usr/bin/php -q <?php set_time_limit(30); require_once 'phpagi.php'; require_once 'db_work.php'; $agi = new AGI(); $agi->answer(); //$agi->stream_file('tone_', "79#"); //$agi->stream_file('work2_', "79#"); $callerid = $agi->get_variable("CALLERID(num)"); $agi->exec('NoOp', $callerid['data']); //$agi->exec('NoOp',$callerid['result']); $client = values("SELECT id, checkid, autoresponse_file FROM `workbase`.`autoresponser` WHERE phone LIKE '%" . mysql_escape_string($callerid['data']) . "' AND (need_autoresponse=1 OR need_autoresponse=0) ORDER BY need_autoresponse DESC, id DESC LIMIT 4"); $agi->exec('NoOp', 'Count: ' . count($client)); for ($i = 0; $i < count($client); $i++) { if (!file_exists("/var/lib/asterisk/sounds/en/" . $client[$i]["autoresponse_file"] . "_.wav")) { $agi->exec('NoOp', "/var/lib/asterisk/sounds/en/" . $client[$i]["autoresponse_file"] . "_.wav"); continue; } $agi->stream_file('receipt_', "79#"); $agi->say_digits($client[$i]["checkid"], "79#"); $agi->stream_file($client[$i]["autoresponse_file"] . "_", "79#"); values("UPDATE `workbase`.`autoresponser` SET need_autoresponse=0, response_date='" . Date("Y-m-d H:i:s") . "' WHERE id=" . $client[$i]['id']); } //$agi->stream_file('/var/www/html/callservice/agi/test', "79#"); /* $agi->stream_file('all_', "79#"); // Отремонтировано $agi->stream_file('beg2_', "79#"); // Ремонт начат, диагностируется ОЧЕНЬ ТИХО !!!!!!!!!!!!!!!!!!!!! $agi->stream_file('call_', "79#"); // В ремонте, вам необходимо связаться с сервисным центром $agi->stream_file('d_', "79#"); // отремонтировано, счет выписан, оплата получена, устройство готово к выдаче $agi->stream_file('dwork_', "79#"); // В даный момент мы не можем ответить...
#!/usr/bin/php -q <?php set_time_limit(30); $callerid = $argv[1]; require_once 'phpagi.php'; require_once 'db_work.php'; $agi = new AGI(); //$phone = preg_replace("/[^0-9]/", "", $callerid['data']); $phone = substr($callerid, -9); $agi->exec('NoOP', $phone); if (strlen($phone) == 9) { $agi->exec('NoOP', '11111' . $phone); $op = values("SELECT dstchannel FROM `cdr` WHERE src LIKE '%" . $phone . "' AND dcontext = 'phones_incom' AND dstchannel!='' ORDER BY calldate DESC LIMIT 1"); $agi->exec('NoOP', '22222-Count' . count($op)); if (count($op) < 1) { //$agi->exec('NoOP','3333'.$op[0]["dstchannel"]); //header ('Content-type: text/html; charset=utf-8'); $client = new SoapClient('http://turbosms.in.ua/api/wsdl.html'); //$agi->exec('NoOP','444'); $auth = array('login' => 'oyv1979', 'password' => 'Av1979'); //$agi->exec('NoOP','555'); $result = $client->Auth($auth); //$agi->exec('NoOP','666'); $text = 'Krainashin.com - любые шины и диски. Бесплатная линия 0(800)300-305'; $sms = array('sender' => 'KRAINASHIN', 'destination' => '+380' . $phone, 'text' => $text); $agi->exec('NoOP', '777'); //$result = $client->SendSMS ($sms); $agi->exec('NoOP', $result); } } ?>
#!/usr/bin/php-cli -q <?php require dirname(__FILE__) . '/../lib/phpagi/phpagi.php'; require dirname(__FILE__) . '/../include/db_utils.inc.php'; require dirname(__FILE__) . '/common/AGI_Logger.class.php'; require dirname(__FILE__) . '/common/AGI_CDR.class.php'; require dirname(__FILE__) . '/common/AGI_Utils.php'; $agi = new AGI(); $logger = new AGI_Logger($agi); $cdr = new AGI_CDR($agi); // Get Called Extension informations $called_ext = $agi->request['agi_extension']; $Extension_D = DB_Extension($called_ext); // Get 'Voicemail' Parameters $SimpleConf = Database_Entry('Ext_SimpleConf', $Extension_D['PK_Extension']); //CDR: Set called info $cdr->set_called("{$SimpleConf['PK_Extension']}", "SimpleConf", "Simple Conference", "{$Extension_D['Extension']}"); // Set transfer extension if we have one if ($SimpleConf['TransferExt'] != "") { $agi->set_variable('CONF_TRANSFER_EXT', $SimpleConf['TransferExt']); } // Call SimpleConf application $params = 'S'; if ($SimpleConf['PlaySound'] == 1) { $params .= 'n'; } if ($SimpleConf['PlayMOH'] == 1) { $params .= 'm'; } $agi->exec('Conference', "simpleconf-{$Extension_D['PK_Extension']}/{$params}");
$query = "\n\t\tSELECT\n\t\t\tExtension\n\t\tFROM\n\t\t\tExt_Intercom_Admins\n\t\t\tINNER JOIN Extensions ON PK_Extension = FK_Ext_Admin\n\t\tWHERE\n\t\t\tFK_Extension = {$Intercom['PK_Extension']}\n\t\t\tAND\n\t\t\tExtensions.Extension = {$caller_ext}\n\t\tLIMIT 1\n\t"; } else { $query = "\n\t\tSELECT\n\t\t\tExtension\n\t\tFROM\n\t\t\tExt_Intercom_Admins\n\t\t\tINNER JOIN Extension_Groups ON Extension_Groups.FK_Group = Ext_Intercom_Admins.FK_Ext_Group\n\t\t\tINNER JOIN Extensions ON Extensions.PK_Extension = Extension_Groups.FK_Extension\n\t\tWHERE\n\t\t\tExt_Intercom_Admins.FK_Extension = {$Intercom['PK_Extension']}\n\t\t\tAND\n\t\t\tExtensions.Extension = {$caller_ext}\n\t\tLIMIT 1\n\t"; } $result = $mysqli->query($query) or $agi->verbose($mysqli->error . $query); if ($mysqli->numrows($result) != 1) { $agi->stream_file('beeperr'); $agi->hangup(); exit(0); } //CDR: Set called info $cdr->set_called("{$Intercom['PK_Extension']}", "Intercom", "Intercom", "{$Extension_D['Extension']}"); $agi->set_variable('__SIP_URI_OPTIONS', 'intercom=true'); $agi->set_variable('SIPURI', 'intercom=true'); $agi->set_variable('_VXML_URL', 'intercom=true'); $agi->exec('AbsoluteTimeout', $Intercom['Timeout']); $agi->exec('SipAddHeader', $Intercom['Header']); $agi->exec('SipAddHeader', '"Call Info: Answer-After=0"'); $agi->exec('SipAddHeader', '"Alert-Info: Ring Answer"'); $agi->exec('SipAddHeader', '"Call-Info: <uri>\\;answer-after=0"'); // Get a list of phones we want to page if ($Intercom['Use_Members_ByAccount']) { $query = "\n\t\tSELECT\n\t\t\tExtension\n\t\tFROM\n\t\t\tExt_Intercom_Members\n\t\t\tINNER JOIN Extensions ON PK_Extension = FK_Ext_Member\n\t\tWHERE\n\t\t\tFK_Extension = {$Intercom['PK_Extension']}\n\t"; } else { $query = "\n\t\tSELECT\n\t\t\tExtension\n\t\tFROM\n\t\t\tExt_Intercom_Members\n\t\t\tINNER JOIN Extension_Groups ON Extension_Groups.FK_Group = Ext_Intercom_Members.FK_Ext_Group\n\t\t\tINNER JOIN Extensions ON Extensions.PK_Extension = Extension_Groups.FK_Extension\n\t\tWHERE\n\t\t\tExt_Intercom_Members.FK_Extension = {$Intercom['PK_Extension']}\n\t"; } $result = $mysqli->query($query) or $agi->verbose($mysqli->error . $query); while ($row = $result->fetch_assoc()) { if ($page_phones != "") { $page_phones .= '&'; }
#!/usr/bin/php-cli -q <?php require dirname(__FILE__) . '/../lib/phpagi/phpagi.php'; require dirname(__FILE__) . '/../include/db_utils.inc.php'; require dirname(__FILE__) . '/common/AGI_Logger.class.php'; require dirname(__FILE__) . '/common/AGI_CDR.class.php'; require dirname(__FILE__) . '/common/AGI_Utils.php'; $agi = new AGI(); $logger = new AGI_Logger($agi); $cdr = new AGI_CDR($agi); // Get Called Extension informations $called_ext = $agi->request['agi_extension']; $Extension_D = DB_Extension($called_ext); // Get 'Voicemail' Parameters $Voicemail = Database_Entry('Ext_Voicemail', $Extension_D['PK_Extension']); //CDR: Set called info $cdr->set_called("{$Voicemail['PK_Extension']}", "Voicemail", "Voice Mail", "{$Extension_D['Extension']}"); // Get the extension of the caller $cid = $agi->parse_callerid(); $caller_ext = $cid['username']; // Call Voicemail application $VM_MAIN_ARGS = "{$caller_ext}@default"; if ($Voicemail['RequirePassword'] != 1) { $VM_MAIN_ARGS .= "|s"; } $agi->exec('VoicemailMain', $VM_MAIN_ARGS);