Skip to content

Commit

Permalink
SMS Broadcast and bug fix (#142)
Browse files Browse the repository at this point in the history
Basic start to a working SMS broadcast; Add DIDww as Carrier; fix email sending; update readme.

Co-authored-by: blackc2004 <[email protected]>
  • Loading branch information
blackc2004 and blackc2004 authored May 21, 2020
1 parent b2b1930 commit 8bb0682
Show file tree
Hide file tree
Showing 11 changed files with 915 additions and 21 deletions.
4 changes: 2 additions & 2 deletions sms/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
1. ```cd /usr/src/```
2. ```git clone https://github.com/fusionpbx/fusionpbx-apps```
3. ```cd fusionpbx-apps/; cp -R sms /var/www/fusionpbx/app/```
4. ```cd /var/www/fusionpbx/resources/install/scripts/app/```
4. ```cd /var/www/fusionpbx/app/scripts/resources/scripts/app```
5. ```ln -s /var/www/fusionpbx/app/sms/resources/install/scripts/app/sms```
6. Go to GUI
7. Upgrades -> SCHEMA; APP DEFAULTS; MENU DEFAULTS; PERMISSION DEFAULTS
Expand All @@ -25,4 +25,4 @@
Send and receive!

NOTE: It is not recommended to use this app with versions of Freeswitch prior to 1.8 if you are installing in a clustered environment.
There is a bug in earlier versions of Freeswitch that can cause it to crash in certain situation when using SMS.
There is a bug in earlier versions of Freeswitch that can cause it to crash in certain situation when using SMS.
63 changes: 63 additions & 0 deletions sms/app_config.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@
$apps[$x]['permissions'][$y]['name'] = "sms_enabled";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "sms_broadcast_add";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "sms_broadcast_delete";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;
$apps[$x]['permissions'][$y]['name'] = "sms_broadcast_edit";
$apps[$x]['permissions'][$y]['groups'][] = "superadmin";
$y++;


//default settings
$y = 0;
Expand Down Expand Up @@ -421,4 +431,57 @@
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;

$y=2;
$apps[$x]['db'][$y]['table']['name'] = "v_sms_broadcast";
$apps[$x]['db'][$y]['table']['parent'] = "";
$z=0;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "sms_broadcast_uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)";
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "primary";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "domain_uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "uuid";
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "char(36)";
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = "foreign";
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = "v_domains";
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = "domain_uuid";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "sms_broadcast_name";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['search'] = 'true';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name']['text'] = "sms_broadcast_description";
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = "broadcast_desc";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['search'] = 'true';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "start_stamp";
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = "timestamp";
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = "date";
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = "timestamp";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = "sms_broadcast_caller_id_number";
$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'] = "sms_broadcast_phone_numbers";
$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'] = "sms_broadcast_destination_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'] = "response";
$apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$z++;

?>
217 changes: 216 additions & 1 deletion sms/app_languages.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,19 @@
$text['label-destination']['ar-eg'] = "";
$text['label-destination']['he'] = "";

$text['label-message']['en-us'] = "Message";
$text['label-message']['es-cl'] = "";
$text['label-message']['pt-pt'] = "";
$text['label-message']['fr-fr'] = "";
$text['label-message']['pt-br'] = "";
$text['label-message']['pl'] = " ";
$text['label-message']['uk'] = "";
$text['label-message']['sv-se'] = "";
$text['label-message']['ro'] = "";
$text['label-message']['de-at'] = "";
$text['label-message']['ar-eg'] = "";
$text['label-message']['he'] = "";

$text['label-start']['en-us'] = "Time Stamp";
$text['label-start']['es-cl'] = "";
$text['label-start']['pt-pt'] = "";
Expand Down Expand Up @@ -195,4 +208,206 @@
$text['button-mdr']['ar-eg'] = "";
$text['button-mdr']['he'] = "";

?>
$text['button-broadcast']['en-us'] = "Broadcast";
$text['button-broadcast']['es-cl'] = "";
$text['button-broadcast']['pt-pt'] = "";
$text['button-broadcast']['fr-fr'] = "";
$text['button-broadcast']['pt-br'] = "";
$text['button-broadcast']['pl'] = " ";
$text['button-broadcast']['uk'] = "";
$text['button-broadcast']['sv-se'] = "";
$text['button-broadcast']['ro'] = "";
$text['button-broadcast']['de-at'] = "";
$text['button-broadcast']['ar-eg'] = "";
$text['button-broadcast']['he'] = "";

$text['title-call_broadcast']['en-us'] = "SMS Broadcast";
$text['title-call_broadcast']['en-gb'] = "SMS Broadcast";
$text['title-call_broadcast']['ar-eg'] = "";
$text['title-call_broadcast']['de-at'] = "Rundrufe"; //copied from de-de
$text['title-call_broadcast']['de-ch'] = "Rundrufe"; //copied from de-de
$text['title-call_broadcast']['de-de'] = "Rundrufe";
$text['title-call_broadcast']['es-cl'] = "Llamada Masiva (Broadcast)";
$text['title-call_broadcast']['es-mx'] = "Llamada Masiva (Broadcast)"; //copied from es-cl
$text['title-call_broadcast']['fr-ca'] = "Campagne d'appels"; //copied from fr-fr
$text['title-call_broadcast']['fr-fr'] = "Campagne d'appels";
$text['title-call_broadcast']['he-il'] = "הגדרת חשבון";
$text['title-call_broadcast']['it-it'] = "Chiamate Multiple";
$text['title-call_broadcast']['nl-nl'] = "Omroep";
$text['title-call_broadcast']['pl-pl'] = "Rozsyłanie rozmów";
$text['title-call_broadcast']['pt-br'] = "Configurações da Conta";
$text['title-call_broadcast']['pt-pt'] = "Chamadas de Broadcast";
$text['title-call_broadcast']['ro-ro'] = "";
$text['title-call_broadcast']['ru-ru'] = "Массовые вызовы";
$text['title-call_broadcast']['sv-se'] = "Samtalsdistributioner";
$text['title-call_broadcast']['uk-ua'] = "Трансляція дзвінків";

$text['title_description-call_broadcast']['en-us'] = "Manage the delivery of pre-recorded messages to mass recipients.";
$text['title_description-call_broadcast']['en-gb'] = "Manage the delivery of pre-recorded messages to mass recipients.";
$text['title_description-call_broadcast']['ar-eg'] = "";
$text['title_description-call_broadcast']['de-at'] = "";
$text['title_description-call_broadcast']['de-ch'] = "";
$text['title_description-call_broadcast']['de-de'] = "";
$text['title_description-call_broadcast']['es-cl'] = "";
$text['title_description-call_broadcast']['es-mx'] = "";
$text['title_description-call_broadcast']['fr-ca'] = "";
$text['title_description-call_broadcast']['fr-fr'] = "";
$text['title_description-call_broadcast']['he-il'] = "";
$text['title_description-call_broadcast']['it-it'] = "";
$text['title_description-call_broadcast']['nl-nl'] = "Beheer de aflevering van voor-opgenomen boodschappen naar meerdere ontvangers.";
$text['title_description-call_broadcast']['pl-pl'] = "";
$text['title_description-call_broadcast']['pt-br'] = "";
$text['title_description-call_broadcast']['pt-pt'] = "";
$text['title_description-call_broadcast']['ro-ro'] = "";
$text['title_description-call_broadcast']['ru-ru'] = "";
$text['title_description-call_broadcast']['sv-se'] = "";
$text['title_description-call_broadcast']['uk-ua'] = "";

$text['label-callerid-number']['en-us'] = "Caller ID Number";
$text['label-callerid-number']['en-gb'] = "Caller ID Number";
$text['label-callerid-number']['ar-eg'] = "";
$text['label-callerid-number']['de-at'] = "Anruferkennung (Nummer)"; //copied from de-de
$text['label-callerid-number']['de-ch'] = "Anruferkennung (Nummer)"; //copied from de-de
$text['label-callerid-number']['de-de'] = "Anruferkennung (Nummer)";
$text['label-callerid-number']['es-cl'] = "Número de Origen";
$text['label-callerid-number']['es-mx'] = "Número de Origen"; //copied from es-cl
$text['label-callerid-number']['fr-ca'] = "Numéro d'appelant"; //copied from fr-fr
$text['label-callerid-number']['fr-fr'] = "Numéro d'appelant";
$text['label-callerid-number']['he-il'] = "";
$text['label-callerid-number']['it-it'] = "Numero Chiamante";
$text['label-callerid-number']['nl-nl'] = "CID Nummer";
$text['label-callerid-number']['pl-pl'] = "Prezentacja numeru dzwoniącego";
$text['label-callerid-number']['pt-br'] = "Número do discador";
$text['label-callerid-number']['pt-pt'] = "Número do Chamador";
$text['label-callerid-number']['ro-ro'] = "";
$text['label-callerid-number']['ru-ru'] = "Caller ID Номер";
$text['label-callerid-number']['sv-se'] = "Caller ID Nummer";
$text['label-callerid-number']['uk-ua'] = "Caller ID Номер";

$text['description-caller-id-number']['en-us'] = "The number from which the SMS will be sent";
$text['description-caller-id-number']['en-gb'] = "";
$text['description-caller-id-number']['ar-eg'] = "";
$text['description-caller-id-number']['de-at'] = ""; //copied from de-de
$text['description-caller-id-number']['de-ch'] = ""; //copied from de-de
$text['description-caller-id-number']['de-de'] = "";
$text['description-caller-id-number']['es-cl'] = "";
$text['description-caller-id-number']['es-mx'] = "";
$text['description-caller-id-number']['fr-ca'] = "";
$text['description-caller-id-number']['fr-fr'] = "";
$text['description-caller-id-number']['he-il'] = "";
$text['description-caller-id-number']['it-it'] = "";
$text['description-caller-id-number']['nl-nl'] = "";
$text['description-caller-id-number']['pl-pl'] = "";
$text['description-caller-id-number']['pt-br'] = "";
$text['description-caller-id-number']['pt-pt'] = "";
$text['description-caller-id-number']['ro-ro'] = "";
$text['description-caller-id-number']['ru-ru'] = "";
$text['description-caller-id-number']['sv-se'] = "";
$text['description-caller-id-number']['uk-ua'] = "";

$text['label-phone']['en-us'] = "Phone Number List";
$text['label-phone']['en-gb'] = "Phone Number List";
$text['label-phone']['ar-eg'] = "";
$text['label-phone']['de-at'] = "Liste der Telefonnummern"; //copied from de-de
$text['label-phone']['de-ch'] = "Liste der Telefonnummern"; //copied from de-de
$text['label-phone']['de-de'] = "Liste der Telefonnummern";
$text['label-phone']['es-cl'] = "Lista de Números de Telefono";
$text['label-phone']['es-mx'] = "Lista de Números de Telefono"; //copied from es-cl
$text['label-phone']['fr-ca'] = "Liste de Numéros de téléphone"; //copied from fr-fr
$text['label-phone']['fr-fr'] = "Liste de Numéros de téléphone";
$text['label-phone']['he-il'] = "רשימת מספרי טלפון";
$text['label-phone']['it-it'] = "Lista Numeri di Telefono";
$text['label-phone']['nl-nl'] = "Telefoonnummer lijst";
$text['label-phone']['pl-pl'] = "Lista numerów telefonu";
$text['label-phone']['pt-br'] = "Lista de números de telefone";
$text['label-phone']['pt-pt'] = "Lista de Números de Telefone";
$text['label-phone']['ro-ro'] = "";
$text['label-phone']['ru-ru'] = "Список телефонних номеров";
$text['label-phone']['sv-se'] = "Lista Med Telefonnummer";
$text['label-phone']['uk-ua'] = "Список телефонних номерів";

$text['label-list_example']['en-us'] = "Number|First,Last\nNumber|First,Last\n...";
$text['label-list_example']['en-gb'] = "Number|First,Last\nNumber|First,Last\n...";
$text['label-list_example']['ar-eg'] = "Number|First,Last\nNumber|First,Last\n...";
$text['label-list_example']['de-at'] = "Number|First,Last\nNumber|First,Last\n...";
$text['label-list_example']['de-ch'] = "Number|First,Last\nNumber|First,Last\n...";
$text['label-list_example']['de-de'] = "Number|First,Last\nNumber|First,Last\n...";
$text['label-list_example']['es-cl'] = "Number|First,Last\nNumber|First,Last\n...";
$text['label-list_example']['es-mx'] = "Number|First,Last\nNumber|First,Last\n...";
$text['label-list_example']['fr-ca'] = "Number|First,Last\nNumber|First,Last\n...";
$text['label-list_example']['fr-fr'] = "Number|First,Last\nNumber|First,Last\n...";
$text['label-list_example']['he-il'] = "Number|First,Last\nNumber|First,Last\n...";
$text['label-list_example']['it-it'] = "Number|First,Last\nNumber|First,Last\n...";
$text['label-list_example']['nl-nl'] = "Nummer|Eerste,Laatste\nNummer|Eerste,Laatste\n...";
$text['label-list_example']['pl-pl'] = "Number|First,Last\nNumber|First,Last\n...";
$text['label-list_example']['pt-br'] = "Number|First,Last\nNumber|First,Last\n...";
$text['label-list_example']['pt-pt'] = "Number|First,Last\nNumber|First,Last\n...";
$text['label-list_example']['ro-ro'] = "Number|First,Last\nNumber|First,Last\n...";
$text['label-list_example']['ru-ru'] = "Number|First,Last\nNumber|First,Last\n...";
$text['label-list_example']['sv-se'] = "Number|First,Last\nNumber|First,Last\n...";
$text['label-list_example']['uk-ua'] = "Number|First,Last\nNumber|First,Last\n...";

$text['description-phone']['en-us'] = "Select a TXT/CSV file for upload, or enter Phone Numbers one per line in the format shown above.";
$text['description-phone']['en-gb'] = "Select a TXT/CSV file for upload, or enter Phone Numbers one per line in the format shown above.";
$text['description-phone']['ar-eg'] = "";
$text['description-phone']['de-at'] = "Optional: Ergänzen Sie eine Liste von Telefonnummern, eine Nummer pro Zeile im folgenden Format: 123-123-1234|Nachname,Vorname"; //copied from de-de
$text['description-phone']['de-ch'] = "Optional: Ergänzen Sie eine Liste von Telefonnummern, eine Nummer pro Zeile im folgenden Format: 123-123-1234|Nachname,Vorname"; //copied from de-de
$text['description-phone']['de-de'] = "Optional: Ergänzen Sie eine Liste von Telefonnummern, eine Nummer pro Zeile im folgenden Format: 123-123-1234|Nachname,Vorname";
$text['description-phone']['es-cl'] = "Opcional, definir una lista de números de telefono, uno por línea en el siguiente formato: 123-123-1234|Apellido,Nombre";
$text['description-phone']['es-mx'] = "Opcional, definir una lista de números de telefono, uno por línea en el siguiente formato: 123-123-1234|Apellido,Nombre"; //copied from es-cl
$text['description-phone']['fr-ca'] = "Optionnel, Insérer une liste de numéros de téléphone, un par ligne, dans le format suivant ; 0123456789|Nom,Prénom"; //copied from fr-fr
$text['description-phone']['fr-fr'] = "Optionnel, Insérer une liste de numéros de téléphone, un par ligne, dans le format suivant ; 0123456789|Nom,Prénom";
$text['description-phone']['he-il'] = "";
$text['description-phone']['it-it'] = "Opzionale, inserire una lista di numeri di telefono, uno per riga, nel formato 123-123-1234|Cognome,Nome";
$text['description-phone']['nl-nl'] = "Selecteer een TXT/CSV file om te 'uploaden' of voer Telefoonnummers in een per regel in het bovenstaande formaat.";
$text['description-phone']['pl-pl'] = "Opcjonalne - ułóż listę numerów (jeden pod drugim) w formacie: 123-123-1234|Nazwisko,Imię";
$text['description-phone']['pt-br'] = "Opcional, definir uma lista de números de telefone, um por linha, no seguinte formato: 210000000|Apelido,Primeiro Nome.";
$text['description-phone']['pt-pt'] = "Opcional, definir uma lista de números de telefone, um por linha, no seguinte formato: 210000000|Apelido,Primeiro Nome";
$text['description-phone']['ro-ro'] = "";
$text['description-phone']['ru-ru'] = "Дополнительно, задайте список телефонных номеров, по одному в ряд, в формате: 123-123-1234|Фамилия,Имя";
$text['description-phone']['sv-se'] = "Frivillig, fyll i en lista med nummer (ett per rad) i följande format: 123-123-1234|Efternamn,Förnamn";
$text['description-phone']['uk-ua'] = "Додатково, задайте список телефонних номерів по одному на рядок в наступному форматі: 123-123-1234|Прізвище,ім'я";

$text['description-info']['en-us'] = "Enter the description here.";
$text['description-info']['en-gb'] = "Enter the description here.";
$text['description-info']['ar-eg'] = "";
$text['description-info']['de-at'] = "Geben Sie eine Beschreibung an."; //copied from de-de
$text['description-info']['de-ch'] = "Geben Sie eine Beschreibung an."; //copied from de-de
$text['description-info']['de-de'] = "Geben Sie eine Beschreibung an.";
$text['description-info']['es-cl'] = "Ingrese descripción aquí.";
$text['description-info']['es-mx'] = "Ingrese descripción aquí."; //copied from es-cl
$text['description-info']['fr-ca'] = "Entrez la description ici";
$text['description-info']['fr-fr'] = "Entrez la description ici";
$text['description-info']['he-il'] = "הכנס תאור";
$text['description-info']['it-it'] = "Inserire la descrizione qui.";
$text['description-info']['nl-nl'] = "Voer de omschrijving hier in.";
$text['description-info']['pl-pl'] = "Wprowadź opis";
$text['description-info']['pt-br'] = "Inisra uma descrição";
$text['description-info']['pt-pt'] = "Insira a descrição aqui.";
$text['description-info']['ro-ro'] = "";
$text['description-info']['ru-ru'] = "Введите описание";
$text['description-info']['sv-se'] = "Ange beskrivning här.";
$text['description-info']['uk-ua'] = "Введіть опис";

$text['description-message']['en-us'] = "Enter the message here.";
$text['description-message']['en-gb'] = "Enter the message here.";
$text['description-message']['ar-eg'] = "";
$text['description-message']['de-at'] = "";
$text['description-message']['de-ch'] = "";
$text['description-message']['de-de'] = "";
$text['description-message']['es-cl'] = "";
$text['description-message']['es-mx'] = "";
$text['description-message']['fr-ca'] = "";
$text['description-message']['fr-fr'] = "";
$text['description-message']['he-il'] = "";
$text['description-message']['it-it'] = "";
$text['description-message']['nl-nl'] = "";
$text['description-message']['pl-pl'] = "";
$text['description-message']['pt-br'] = "";
$text['description-message']['pt-pt'] = "";
$text['description-message']['ro-ro'] = "";
$text['description-message']['ru-ru'] = "";
$text['description-message']['sv-se'] = "";
$text['description-message']['uk-ua'] = "";

?>
22 changes: 22 additions & 0 deletions sms/hook/sms_hook_didww.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

include "../root.php";

require_once "resources/require.php";
require_once "../sms_hook_common.php";

error_log(print_r($_POST,true));

if(strcasecmp($_SERVER['REQUEST_METHOD'], 'POST') != 0){
throw new Exception("Request method must be POST! $_SERVER[REQUEST_METHOD]");
}


$sms_from=$_POST['from'];
$sms_text=base64_decode($_POST['body']);
$sms_to_did_no=$_POST['to'];

route_and_send_sms($sms_from, $sms_to_did_no, $sms_text);

die("no");
?>
Loading

0 comments on commit 8bb0682

Please sign in to comment.