Added forward on busy and extension queue features

This commit is contained in:
Riccardo Granchi
2014-10-29 16:06:53 +00:00
parent 76c09322da
commit b4c6906520
8 changed files with 308 additions and 6 deletions

View File

@@ -11,7 +11,7 @@
$text['description']['fr-fr'] = "Rediriger les appels entrant pour l'extension:";
$text['description-2']['en-us'] = "Use the links to configure call forward follow me, or do not disturb.";
$text['descriptionA-2']['es-cl'] = "Utilice los links para configurar reenvio de llamada, sígueme o no Molestar.";
$text['description-2']['es-cl'] = "Utilice los links para configurar reenvio de llamada, sígueme o no Molestar.";
$text['description-2']['pt-pt'] = "Utilizar os links para definir as funcinalidades de encaminhamento de chamada, seguimento ou de não perturbar.";
$text['description-2']['fr-fr'] = "Utiliser les liens afin de configurer le renvoi \"follow me\", ou ne pas déranger.";
@@ -25,6 +25,9 @@
$text['label-call-forward']['pt-pt'] = "Encaminhamento de Chamadas";
$text['label-call-forward']['fr-fr'] = "Renvoi d'appel";
$text['label-forward-busy']['en-us'] = "Forward on busy";
$text['label-forward-busy']['it-it'] = "Rinvio su occupato";
$text['label-enabled']['en-us'] = "Enabled";
$text['label-enabled']['es-cl'] = "Activo";
$text['label-enabled']['pt-pt'] = "Activo";

View File

@@ -116,6 +116,8 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
if (count($_POST)>0) {
$forward_all_enabled = check_str($_POST["forward_all_enabled"]);
$forward_all_destination = check_str($_POST["forward_all_destination"]);
$forward_busy_enabled = check_str($_POST["forward_busy_enabled"]);
$forward_busy_destination = check_str($_POST["forward_busy_destination"]);
$cid_name_prefix = check_str($_POST["cid_name_prefix"]);
$cid_number_prefix = check_str($_POST["cid_number_prefix"]);
$follow_me_enabled = check_str($_POST["follow_me_enabled"]);
@@ -150,6 +152,9 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
if (strlen($forward_all_destination) > 0) {
// $forward_all_destination = preg_replace("~[^0-9]~", "",$forward_all_destination);
}
if (strlen($forward_busy_destination) > 0) {
// $forward_busy_destination = preg_replace("~[^0-9*]~", "",$forward_busy_destination);
}
if (strlen($destination_data_1) > 0) {
// $destination_data_1 = preg_replace("~[^0-9]~", "",$destination_data_1);
}
@@ -345,6 +350,15 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
unset($ext);
}
// Forward on busy is stored in table and will be used by lua scripts
$sql = "update v_extensions set ";
$sql .= "forward_busy_destination = '$forward_busy_destination', ";
$sql .= "forward_busy_enabled = '$forward_busy_enabled' ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and extension_uuid = '$extension_uuid'";
$db->exec(check_sql($sql));
unset($sql);
//delete extension from memcache
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if ($fp) {
@@ -531,6 +545,47 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "</td>\n";
echo "</tr>\n";
/* BUSY handling */
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " <strong>".$text['label-forward-busy'].":</strong>\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
$on_click = "document.getElementById('dnd_enabled').checked=false;";
$on_click .= "document.getElementById('dnd_disabled').checked=true;";
if ($forward_busy_enabled == "true") {
echo " <input type='radio' name='forward_busy_enabled' id='forward_busy_enabled' onclick=\"$on_click\" value='true' checked='checked'/> ".$text['label-enabled']." \n";
}
else {
echo " <input type='radio' name='forward_busy_enabled' id='forward_busy_enabled' onclick=\"$on_click\" value='true' /> ".$text['label-enable']." \n";
}
if ($forward_busy_enabled == "false" || $forward_busy_enabled == "") {
echo " <input type='radio' name='forward_busy_enabled' id='forward_busy_disabled' onclick=\"\" value='false' checked='checked' /> ".$text['label-disabled']." \n";
}
else {
echo " <input type='radio' name='forward_busy_enabled' id='forward_busy_disabled' onclick=\"\" value='false' /> ".$text['label-disable']." \n";
}
unset($on_click);
echo "<br />\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-number'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <input class='formfld' type='text' name='forward_busy_destination' maxlength='255' value=\"$forward_busy_destination\">\n";
echo "<br />\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td colspan='2'>\n";
echo " <br />\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " <strong>".$text['label-follow-me'].":</strong>\n";
@@ -719,6 +774,8 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$on_click .= "document.getElementById('forward_all_disabled').checked=true;";
$on_click .= "document.getElementById('follow_me_enabled').checked=true;";
$on_click .= "document.getElementById('follow_me_disabled').checked=true;";
$on_click .= "document.getElementById('forward_busy_enabled').checked=true;";
$on_click .= "document.getElementById('forward_busy_disabled').checked=true;";
if ($dnd_enabled == "true") {
echo " <input type='radio' name='dnd_enabled' id='dnd_enabled' value='true' onclick=\"$on_click\" checked='checked'/> ".$text['label-enabled']." \n";
}

View File

@@ -155,6 +155,7 @@ else {
echo " <td valign='top' class='".$row_style[$c]."'>".$row['extension']."</td>\n";
echo " <td valign='top' class='".$row_style[$c]."'>\n";
if (permission_exists('call_forward')) { echo "<a href='".$tr_url."'>".$text['label-call-forward']."</a>&nbsp;&nbsp;&nbsp;"; }
if (permission_exists('call_forward')) { echo "<a href='".$tr_url."'>".$text['label-forward-busy']."</a>&nbsp;&nbsp;&nbsp;"; }
if (permission_exists('follow_me')) { echo "<a href='".$tr_url."'>".$text['label-follow-me']."</a>&nbsp;&nbsp;&nbsp;"; }
if (permission_exists('do_not_disturb')) { echo "<a href='".$tr_url."'>".$text['label-dnd']."</a>"; }
echo " </td>\n";

View File

@@ -23,6 +23,8 @@
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
Luis Daniel Lucio Quiroz <dlucio@okay.com.mx>
Salvatore Caruso <salvatore.caruso@nems.it>
Riccardo Granchi <riccardo.granchi@nems.it>
*/
include "root.php";
@@ -312,7 +314,8 @@ include "root.php";
$prep_statement_2 = $db->prepare(check_sql($sql));
$prep_statement_2->execute();
$result = $prep_statement_2->fetchAll(PDO::FETCH_NAMED);
$dial_string = "{instant_ringback=true";
$dial_string = "{fail_on_single_reject=USER_BUSY";
$dial_string .= ",instant_ringback=true";
$dial_string .= ",ignore_early_media=true,";
$dial_string .= ",domain_uuid=".$_SESSION['domain_uuid'];
$dial_string .= ",sip_invite_domain=".$_SESSION['domain_name'];