Ring Groups: Added Missed Call notification interface.

Extensions: Removed unnecessary echoes.
This commit is contained in:
Nate Jones
2015-06-19 16:33:05 +00:00
parent 5a58a9c3d4
commit 611b308d9e
4 changed files with 131 additions and 5 deletions

View File

@@ -358,19 +358,19 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
foreach ($missed_call_data_array as $array_index => $email_address) {
if (!valid_email($email_address)) { unset($missed_call_data_array[$array_index]); }
}
echo "<pre>".print_r($missed_call_data_array, true)."</pre><br><br>";
//echo "<pre>".print_r($missed_call_data_array, true)."</pre><br><br>";
if (sizeof($missed_call_data_array) > 0) {
$missed_call_data = implode(',', $missed_call_data_array);
}
else {
unset($missed_call_app, $missed_call_data);
}
echo "Multiple Emails = ".$missed_call_data;
//echo "Multiple Emails = ".$missed_call_data;
}
else {
echo "Single Email = ".$missed_call_data."<br>";
//echo "Single Email = ".$missed_call_data."<br>";
if (!valid_email($missed_call_data)) {
echo "Invalid Email<br><br>";
//echo "Invalid Email<br><br>";
unset($missed_call_app, $missed_call_data);
}
}

View File

@@ -78,6 +78,10 @@
$apps[$x]['permissions'][$y]['name'] = "ring_group_user_delete";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$apps[$x]['permissions'][$y]['groups'][] = "admin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "ring_group_missed_call";
//$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
//$apps[$x]['permissions'][$y]['groups'][] = "admin";
//schema details
$y = 0; //table array index
@@ -151,6 +155,14 @@
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Skip destinations with active calls.";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "ring_group_missed_call_app";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "ring_group_missed_call_data";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "ring_group_enabled";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "Select enable or disable the ring group.";
@@ -198,7 +210,6 @@
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "varchar(255)";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "destination_delay";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";

View File

@@ -268,6 +268,16 @@ $text['label-user_list']['sv-se'] = "Användar-lista";
$text['label-user_list']['uk'] = "Список користувачів";
$text['label-user_list']['de-at'] = "Benutzer Liste";
$text['label-url']['en-us'] = "URL";
$text['label-url']['es-cl'] = "URL";
$text['label-url']['pt-pt'] = "URL";
$text['label-url']['fr-fr'] = "URL";
$text['label-url']['pt-br'] = "URL";
$text['label-url']['pl'] = "URL";
$text['label-url']['uk'] = "URL";
$text['label-url']['sv-se'] = "URL";
$text['label-url']['de-at'] = "URL";
$text['label-tools']['en-us'] = "Tools";
$text['label-tools']['es-cl'] = "Herramientas";
$text['label-tools']['fr-fr'] = "Outils";
@@ -298,6 +308,16 @@ $text['label-timeout']['sv-se'] = "Tidsgräns";
$text['label-timeout']['uk'] = "Таймаут";
$text['label-timeout']['de-at'] = "Time-Out";
$text['label-text']['en-us'] = "Text";
$text['label-text']['es-cl'] = "Texto";
$text['label-text']['pt-pt'] = "Texto";
$text['label-text']['fr-fr'] = "texte";
$text['label-text']['pt-br'] = "Texto";
$text['label-text']['pl'] = "Tekst";
$text['label-text']['uk'] = "текст";
$text['label-text']['sv-se'] = "Text";
$text['label-text']['de-at'] = "Text";
$text['label-strategy']['en-us'] = "Strategy";
$text['label-strategy']['es-cl'] = "Estrategia";
$text['label-strategy']['fr-fr'] = "Stratégie";
@@ -358,6 +378,16 @@ $text['label-name']['sv-se'] = "Namn";
$text['label-name']['uk'] = "Назва";
$text['label-name']['de-at'] = "Name";
$text['label-missed_call']['en-us'] = "Missed Call";
$text['label-missed_call']['es-cl'] = "Llamada Perdida";
$text['label-missed_call']['pt-pt'] = "Chamada Perdida";
$text['label-missed_call']['fr-fr'] = "Appel Manqué";
$text['label-missed_call']['pt-br'] = "Chamada Perdida";
$text['label-missed_call']['pl'] = "Nieodebrane Połączenie";
$text['label-missed_call']['uk'] = "пропущений Дзвінок";
$text['label-missed_call']['sv-se'] = "Missat Samtal";
$text['label-missed_call']['de-at'] = "Verpasster Anruf";
$text['label-forward_destination']['en-us'] = "Number";
$text['label-forward_destination']['es-cl'] = "Número";
$text['label-forward_destination']['fr-fr'] = "Numéro";
@@ -388,6 +418,16 @@ $text['label-enabled']['sv-se'] = "Aktiverad";
$text['label-enabled']['uk'] = "Включено";
$text['label-enabled']['de-at'] = "An";
$text['label-email']['en-us'] = "Email";
$text['label-email']['es-cl'] = "Email";
$text['label-email']['pt-pt'] = "Email";
$text['label-email']['fr-fr'] = "Courriel";
$text['label-email']['pt-br'] = "Email";
$text['label-email']['pl'] = "Email";
$text['label-email']['uk'] = "Електронна пошта";
$text['label-email']['sv-se'] = "E-post";
$text['label-email']['de-at'] = "Email";
$text['label-duration']['en-us'] = "Duration";
$text['label-duration']['es-cl'] = "Duración";
$text['label-duration']['fr-fr'] = "Durée";
@@ -647,6 +687,16 @@ $text['description-name']['sv-se'] = "Ange ett namn.";
$text['description-name']['uk'] = "Введіть назву меню";
$text['description-name']['de-at'] = "Geben Sie einen Namen an.";
$text['description-missed_call']['en-us'] = "Select the notification type, and enter the appropriate destination.";
$text['description-missed_call']['es-cl'] = "Seleccione el tipo de notificación, y entrar en el destino apropiado.";
$text['description-missed_call']['pt-pt'] = "Selecione o tipo de notificação e digite o destino apropriado.";
$text['description-missed_call']['fr-fr'] = "Sélectionnez le type de notification, et entrez la destination appropriée.";
$text['description-missed_call']['pt-br'] = "Selecione o tipo de notificação e digite o destino apropriado.";
$text['description-missed_call']['pl'] = "Wybierz typ powiadomienia, i wpisz odpowiednie miejsce przeznaczenia.";
$text['description-missed_call']['uk'] = "Виберіть тип повідомлення, і ввести відповідний пункт призначення.";
$text['description-missed_call']['sv-se'] = "Välj typ anmälan, och ange lämplig destination.";
$text['description-missed_call']['de-at'] = "Wählen Sie den Benachrichtigungstyp und geben Sie das entsprechende Ziel an.";
$text['description-extension']['en-us'] = "Enter the extension number.";
$text['description-extension']['es-cl'] = "Introduzca el número de extensión.";
$text['description-extension']['pt-pt'] = "Digite o número do ramal.";

View File

@@ -100,6 +100,8 @@ else {
$ring_group_distinctive_ring = check_str($_POST["ring_group_distinctive_ring"]);
$ring_group_ringback = check_str($_POST["ring_group_ringback"]);
$ring_group_skip_active = check_str($_POST["ring_group_skip_active"]);
$ring_group_missed_call_app = check_str($_POST["ring_group_missed_call_app"]);
$ring_group_missed_call_data = check_str($_POST["ring_group_missed_call_data"]);
$ring_group_enabled = check_str($_POST["ring_group_enabled"]);
$ring_group_description = check_str($_POST["ring_group_description"]);
$dialplan_uuid = check_str($_POST["dialplan_uuid"]);
@@ -180,6 +182,47 @@ else {
//add or update the database
if ($_POST["persistformvar"] != "true") {
//prep missed call values for db insert/update
switch ($ring_group_missed_call_app) {
case 'email':
$ring_group_missed_call_data = str_replace(';',',',$ring_group_missed_call_data);
$ring_group_missed_call_data = str_replace(' ','',$ring_group_missed_call_data);
if (substr_count($ring_group_missed_call_data, ',') > 0) {
$ring_group_missed_call_data_array = explode(',', $ring_group_missed_call_data);
foreach ($ring_group_missed_call_data_array as $array_index => $email_address) {
if (!valid_email($email_address)) { unset($ring_group_missed_call_data_array[$array_index]); }
}
//echo "<pre>".print_r($ring_group_missed_call_data_array, true)."</pre><br><br>";
if (sizeof($ring_group_missed_call_data_array) > 0) {
$ring_group_missed_call_data = implode(',', $ring_group_missed_call_data_array);
}
else {
unset($ring_group_missed_call_app, $ring_group_missed_call_data);
}
//echo "Multiple Emails = ".$ring_group_missed_call_data;
}
else {
//echo "Single Email = ".$ring_group_missed_call_data."<br>";
if (!valid_email($ring_group_missed_call_data)) {
//echo "Invalid Email<br><br>";
unset($ring_group_missed_call_app, $ring_group_missed_call_data);
}
}
break;
case 'text':
$ring_group_missed_call_data = str_replace('-','',$ring_group_missed_call_data);
$ring_group_missed_call_data = str_replace('.','',$ring_group_missed_call_data);
$ring_group_missed_call_data = str_replace('(','',$ring_group_missed_call_data);
$ring_group_missed_call_data = str_replace(')','',$ring_group_missed_call_data);
$ring_group_missed_call_data = str_replace(' ','',$ring_group_missed_call_data);
if (!is_numeric($ring_group_missed_call_data)) { unset($ring_group_missed_call_app, $ring_group_missed_call_data); }
break;
}
if (permission_exists('ring_group_missed_call') && $ring_group_missed_call_app != '' && $ring_group_missed_call_data != '') {
$_POST["ring_group_missed_call_app"] = $ring_group_missed_call_app;
$_POST["ring_group_missed_call_data"] = $ring_group_missed_call_data;
}
//set the app and data
$ring_group_timeout_array = explode(":", $ring_group_timeout_action);
$ring_group_timeout_app = array_shift($ring_group_timeout_array);
@@ -344,6 +387,8 @@ else {
$ring_group_distinctive_ring = $row["ring_group_distinctive_ring"];
$ring_group_ringback = $row["ring_group_ringback"];
$ring_group_skip_active = $row["ring_group_skip_active"];
$ring_group_missed_call_app = $row["ring_group_missed_call_app"];
$ring_group_missed_call_data = $row["ring_group_missed_call_data"];
$ring_group_enabled = $row["ring_group_enabled"];
$ring_group_description = $row["ring_group_description"];
$dialplan_uuid = $row["dialplan_uuid"];
@@ -706,6 +751,26 @@ else {
echo "</td>\n";
echo "</tr>\n";
if (permission_exists('ring_group_missed_call')) {
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-missed_call']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='ring_group_missed_call_app' id='ring_group_missed_call_app' onchange=\"if (this.selectedIndex != 0) { document.getElementById('ring_group_missed_call_data').style.display = ''; document.getElementById('ring_group_missed_call_data').focus(); } else { document.getElementById('ring_group_missed_call_data').style.display='none'; }\">\n";
echo " <option value=''></option>\n";
echo " <option value='email' ".(($ring_group_missed_call_app == "email" && $ring_group_missed_call_data != '') ? "selected='selected'" : null).">".$text['label-email']."</option>\n";
//echo " <option value='text' ".(($ring_group_missed_call_app == "text" && $ring_group_missed_call_data != '') ? "selected='selected'" : null).">".$text['label-text']."</option>\n";
//echo " <option value='url' ".(($ring_group_missed_call_app == "url" && $ring_group_missed_call_data != '') ? "selected='selected'" : null).">".$text['label-url']."</option>\n";
echo " </select>\n";
$ring_group_missed_call_data = ($ring_group_missed_call_app == 'text') ? format_phone($ring_group_missed_call_data) : $ring_group_missed_call_data;
echo " <input class='formfld' type='text' name='ring_group_missed_call_data' id='ring_group_missed_call_data' maxlength='255' value=\"$ring_group_missed_call_data\" style='min-width: 200px; width: 200px; ".(($ring_group_missed_call_app == '' || $ring_group_missed_call_data == '') ? "display: none;" : null)."'>\n";
echo "<br />\n";
echo $text['description-missed_call']."\n";
echo "</td>\n";
echo "</tr>\n";
}
if (if_group("superadmin")) {
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";