Extensions: Missed Call notification option.

This commit is contained in:
Nate Jones 2015-05-23 02:11:26 +00:00
parent 2a8481888f
commit 46bbdeaa38
4 changed files with 138 additions and 0 deletions

View File

@ -76,6 +76,11 @@
$apps[$x]['permissions'][$y]['name'] = "extension_password";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$apps[$x]['permissions'][$y]['groups'][] = "admin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "extension_missed_call";
//$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
//$apps[$x]['permissions'][$y]['groups'][] = "admin";
$y++;
//schema details
$y = 0; //table array index
@ -211,6 +216,14 @@
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$apps[$x]['db'][$y]['fields'][$z]['deprecated'] = "true";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "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'] = "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'] = "user_context";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";

View File

@ -252,6 +252,15 @@ $text['label-user_context']['pl'] = "Kontekst";
$text['label-user_context']['uk'] = "Контекст";
$text['label-user_context']['sv-se'] = "Sammanhang";
$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-true']['en-us'] = "True";
$text['label-true']['es-cl'] = "Verdadero";
$text['label-true']['pt-pt'] = "Sim";
@ -270,6 +279,15 @@ $text['label-toll_allow']['pl'] = "Zezwalaj na drogie/szczególwe połaczenia";
$text['label-toll_allow']['uk'] = "";
$text['label-toll_allow']['sv-se'] = "Toll Allow";
$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-sip_force_expires']['en-us'] = "SIP Force Expires";
$text['label-sip_force_expires']['es-cl'] = "Forzado SIP Expira";
$text['label-sip_force_expires']['pt-pt'] = "Forçar o tempo de expiração SIP";
@ -405,6 +423,15 @@ $text['label-mwi_account']['pl'] = "Konto powiadomienia oczekującej poczty gło
$text['label-mwi_account']['uk'] = "";
$text['label-mwi_account']['sv-se'] = "MWI Konto";
$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-line']['en-us'] = "Line";
$text['label-line']['pt-pt'] = "Linha";
$text['label-line']['fr-fr'] = "Ligne";
@ -486,6 +513,15 @@ $text['label-emergency_caller_id_name']['pl'] = "Prezentacja nazwy dzwoniącego
$text['label-emergency_caller_id_name']['uk'] = "";
$text['label-emergency_caller_id_name']['sv-se'] = "Nöd Namnvisning";
$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-effective_caller_id_number']['en-us'] = "Effective Caller ID Number";
$text['label-effective_caller_id_number']['es-cl'] = "Número de Caller ID Efectivo";
$text['label-effective_caller_id_number']['pt-pt'] = "Número interno";
@ -873,6 +909,15 @@ $text['description-mwi_account']['pl'] = "Konto powiadomienia oczekującej uzytk
$text['description-mwi_account']['uk'] = "";
$text['description-mwi_account']['sv-se'] = "MWI konto med user@domain för den röstbrevlåda som skall monitoreras.";
$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-limit_max']['en-us'] = "Enter the max number of outgoing calls for this user.";
$text['description-limit_max']['es-cl'] = "Ingrese el número máximo de llamadas salientes para este usuario.";
$text['description-limit_max']['pt-pt'] = "Introduza o número máximo de chamadas de saída para este utilizador.";

View File

@ -70,6 +70,8 @@ else {
$limit_max = $row["limit_max"];
$limit_destination = $row["limit_destination"];
$user_context = $row["user_context"];
$missed_call_app = $row["missed_call_app"];
$missed_call_data = $row["missed_call_data"];
$toll_allow = $row["toll_allow"];
$call_timeout = $row["call_timeout"];
$call_group = $row["call_group"];
@ -110,6 +112,8 @@ else {
$sql .= "limit_max, ";
$sql .= "limit_destination, ";
$sql .= "user_context, ";
$sql .= "missed_call_app, ";
$sql .= "missed_call_data, ";
$sql .= "toll_allow, ";
$sql .= "call_timeout, ";
$sql .= "call_group, ";
@ -145,6 +149,8 @@ else {
if (strlen($limit_max) > 0) { $sql .= "'$limit_max', "; } else { $sql .= "null, "; }
$sql .= "'$limit_destination', ";
$sql .= "'$user_context', ";
$sql .= "'$missed_call_app', ";
$sql .= "'$missed_call_data', ";
$sql .= "'$toll_allow', ";
if (strlen($call_timeout) > 0) { $sql .= "'$call_timeout', "; } else { $sql .= "null, "; }
$sql .= "'$call_group', ";

View File

@ -121,6 +121,8 @@ else {
$user_context = check_str($_POST["user_context"]);
$range = check_str($_POST["range"]);
$autogen_users = check_str($_POST["autogen_users"]);
$missed_call_app = check_str($_POST["missed_call_app"]);
$missed_call_data = check_str($_POST["missed_call_data"]);
$toll_allow = check_str($_POST["toll_allow"]);
$call_timeout = check_str($_POST["call_timeout"]);
$call_group = check_str($_POST["call_group"]);
@ -136,6 +138,7 @@ else {
$dial_string = check_str($_POST["dial_string"]);
$enabled = check_str($_POST["enabled"]);
$description = check_str($_POST["description"]);
}
//delete the user from the v_extension_users
@ -345,6 +348,43 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
//add or update the database
if ($_POST["persistformvar"] != "true") {
//prep missed call values for db insert/update
switch ($missed_call_app) {
case 'email':
$missed_call_data = str_replace(';',',',$missed_call_data);
$missed_call_data = str_replace(' ','',$missed_call_data);
if (substr_count($missed_call_data, ',') > 0) {
$missed_call_data_array = explode(',', $missed_call_data);
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>";
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;
}
else {
echo "Single Email = ".$missed_call_data."<br>";
if (!valid_email($missed_call_data)) {
echo "Invalid Email<br><br>";
unset($missed_call_app, $missed_call_data);
}
}
break;
case 'text':
$missed_call_data = str_replace('-','',$missed_call_data);
$missed_call_data = str_replace('.','',$missed_call_data);
$missed_call_data = str_replace('(','',$missed_call_data);
$missed_call_data = str_replace(')','',$missed_call_data);
$missed_call_data = str_replace(' ','',$missed_call_data);
if (!is_numeric($missed_call_data)) { unset($missed_call_app, $missed_call_data); }
break;
}
//add the extension to the database
if ($action == "add" && permission_exists('extension_add')) {
$user_email = '';
@ -394,6 +434,10 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$sql .= "limit_max, ";
$sql .= "limit_destination, ";
$sql .= "user_context, ";
if (permission_exists('extension_missed_call')) {
$sql .= "missed_call_app, ";
$sql .= "missed_call_data, ";
}
if (permission_exists('extension_toll')) {
$sql .= "toll_allow, ";
}
@ -448,6 +492,10 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$sql .= "'$limit_max', ";
$sql .= "'$limit_destination', ";
$sql .= "'$user_context', ";
if (permission_exists('extension_missed_call')) {
$sql .= "'$missed_call_app', ";
$sql .= "'$missed_call_data', ";
}
if (permission_exists('extension_toll')) {
$sql .= "'$toll_allow', ";
}
@ -588,6 +636,10 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$sql .= "limit_max = '$limit_max', ";
$sql .= "limit_destination = '$limit_destination', ";
$sql .= "user_context = '$user_context', ";
if (permission_exists('extension_missed_call')) {
$sql .= "missed_call_app = '$missed_call_app', ";
$sql .= "missed_call_data = '$missed_call_data', ";
}
if (permission_exists('extension_toll')) {
$sql .= "toll_allow = '$toll_allow', ";
}
@ -769,6 +821,8 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$limit_max = $row["limit_max"];
$limit_destination = $row["limit_destination"];
$user_context = $row["user_context"];
$missed_call_app = $row["missed_call_app"];
$missed_call_data = $row["missed_call_data"];
$toll_allow = $row["toll_allow"];
$call_timeout = $row["call_timeout"];
$call_group = $row["call_group"];
@ -1526,6 +1580,26 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
echo "</tr>\n";
}
if (permission_exists('extension_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='missed_call_app' id='missed_call_app' onchange=\"if (this.selectedIndex != 0) { document.getElementById('missed_call_data').style.display = ''; document.getElementById('missed_call_data').focus(); } else { document.getElementById('missed_call_data').style.display='none'; }\">\n";
echo " <option value=''></option>\n";
echo " <option value='email' ".(($missed_call_app == "email" && $missed_call_data != '') ? "selected='selected'" : null).">".$text['label-email']."</option>\n";
//echo " <option value='text' ".(($missed_call_app == "text" && $missed_call_data != '') ? "selected='selected'" : null).">".$text['label-text']."</option>\n";
//echo " <option value='url' ".(($missed_call_app == "url" && $missed_call_data != '') ? "selected='selected'" : null).">".$text['label-url']."</option>\n";
echo " </select>\n";
$missed_call_data = ($missed_call_app == 'text') ? format_phone($missed_call_data) : $missed_call_data;
echo " <input class='formfld' type='text' name='missed_call_data' id='missed_call_data' maxlength='255' value=\"$missed_call_data\" style='min-width: 200px; width: 200px; ".(($missed_call_app == '' || $missed_call_data == '') ? "display: none;" : null)."'>\n";
echo "<br />\n";
echo $text['description-missed_call']."\n";
echo "</td>\n";
echo "</tr>\n";
}
if (permission_exists('extension_toll')) {
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";