From f943254593737fbd20381b3a3eff3cc2a338e4f8 Mon Sep 17 00:00:00 2001 From: Nate Date: Tue, 10 Sep 2019 14:04:30 -0600 Subject: [PATCH] Update Call Broadcast --- app/call_broadcast/app_languages.php | 70 ++++++++++++---- app/call_broadcast/call_broadcast_edit.php | 49 +++++------ app/call_broadcast/call_broadcast_send.php | 94 +++++++++++----------- 3 files changed, 124 insertions(+), 89 deletions(-) diff --git a/app/call_broadcast/app_languages.php b/app/call_broadcast/app_languages.php index aad7c05c8e..4c670de57c 100644 --- a/app/call_broadcast/app_languages.php +++ b/app/call_broadcast/app_languages.php @@ -321,6 +321,46 @@ $text['label-accountcode']['ru-ru'] = "Код Авторизации"; $text['label-accountcode']['sv-se'] = "Accountcode"; $text['label-accountcode']['uk-ua'] = "Код облікового запису"; +$text['label-sample_file']['en-us'] = "Sample CSV File"; +$text['label-sample_file']['ar-eg'] = "Sample CSV File"; +$text['label-sample_file']['de-at'] = "Sample CSV File"; +$text['label-sample_file']['de-ch'] = "Sample CSV File"; +$text['label-sample_file']['de-de'] = "Sample CSV File"; +$text['label-sample_file']['es-cl'] = "Sample CSV File"; +$text['label-sample_file']['es-mx'] = "Sample CSV File"; +$text['label-sample_file']['fr-ca'] = "Sample CSV File"; +$text['label-sample_file']['fr-fr'] = "Sample CSV File"; +$text['label-sample_file']['he-il'] = "Sample CSV File"; +$text['label-sample_file']['it-it'] = "Sample CSV File"; +$text['label-sample_file']['nl-nl'] = "Sample CSV File"; +$text['label-sample_file']['pl-pl'] = "Sample CSV File"; +$text['label-sample_file']['pt-br'] = "Sample CSV File"; +$text['label-sample_file']['pt-pt'] = "Sample CSV File"; +$text['label-sample_file']['ro-ro'] = "Sample CSV File"; +$text['label-sample_file']['ru-ru'] = "Sample CSV File"; +$text['label-sample_file']['sv-se'] = "Sample CSV File"; +$text['label-sample_file']['uk-ua'] = "Sample CSV File"; + +$text['label-list_example']['en-us'] = "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'] = "Number|First,Last\nNumber|First,Last\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-timeout']['en-us'] = "Specify the absolute timeout in seconds."; $text['description-timeout']['ar-eg'] = ""; $text['description-timeout']['de-at'] = "Geben Sie die absolute Zeitüberschreitung in Sekunden an."; //copied from de-de @@ -341,25 +381,25 @@ $text['description-timeout']['ru-ru'] = "Время ожидания (в мил $text['description-timeout']['sv-se'] = "Specificera den absoluta timeout:en i sekunder."; $text['description-timeout']['uk-ua'] = ""; -$text['description-phone']['en-us'] = "Optional, set a list of phone numbers one per row in the following format: 123-123-1234|Last Name, First Name"; +$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']['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']['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']['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'] = ""; -$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']['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-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-name']['en-us'] = "Enter the name here."; $text['description-name']['ar-eg'] = ""; diff --git a/app/call_broadcast/call_broadcast_edit.php b/app/call_broadcast/call_broadcast_edit.php index 4f5f2366f8..049f4714e9 100644 --- a/app/call_broadcast/call_broadcast_edit.php +++ b/app/call_broadcast/call_broadcast_edit.php @@ -59,19 +59,19 @@ $filename=$_FILES["broadcast_phone_numbers_file"]["tmp_name"]; $file_extension = array('application/octet-stream','application/vnd.ms-excel','text/plain','text/csv','text/tsv'); if (in_array($_FILES['broadcast_phone_numbers_file']['type'],$file_extension)) { - $file = fopen($filename, "r"); - $count = 0; - while (($getData = fgetcsv($file, 0, "\n")) !== FALSE) - { - $count++; - if ($count == 1) { continue; } - $getData = preg_split('/[ ,|]/', $getData[0], null, PREG_SPLIT_NO_EMPTY); - $separator = $getData[0]; - $separator .= (isset($getData[1]) && $getData[1] != '')? '|'.$getData[1] : ''; - $separator .= (isset($getData[2]) && $getData[2] != '')? ','.$getData[2] : ''; - $separator .= '\n'; - $upload_csv .= $separator; - } + $file = fopen($filename, "r"); + $count = 0; + while (($getData = fgetcsv($file, 0, "\n")) !== FALSE) + { + $count++; + if ($count == 1) { continue; } + $getData = preg_split('/[ ,|]/', $getData[0], null, PREG_SPLIT_NO_EMPTY); + $separator = $getData[0]; + $separator .= (isset($getData[1]) && $getData[1] != '')? '|'.$getData[1] : ''; + $separator .= (isset($getData[2]) && $getData[2] != '')? ','.$getData[2] : ''; + $separator .= '\n'; + $upload_csv .= $separator; + } fclose($file); } else { @@ -79,15 +79,13 @@ } } if (!empty($broadcast_phone_numbers) && !empty($upload_csv)) { - $sql .= "E'"; $sql .= $broadcast_phone_numbers.'\n'.$upload_csv; - $sql .= "',"; } elseif (empty($broadcast_phone_numbers) && !empty($upload_csv)) { - $sql .= "E'$upload_csv', "; + $sql .= $upload_csv; } else { - $sql .= "E'$broadcast_phone_numbers', "; + $sql .= $broadcast_phone_numbers; } return array('code'=>true,'sql'=> $sql); } @@ -270,8 +268,8 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { echo " \n"; if ($action == "update") { echo "\n"; - echo "\n"; - echo "\n"; + echo "\n"; + echo "\n"; } echo " \n"; echo "\n"; @@ -455,16 +453,11 @@ if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { echo "\n"; echo "\n"; - echo " "; - echo "
"; - echo " OR "; - echo "
"; - echo " Sample File "; - echo "
"; - echo " (Upload TXT- Plain Text, CSV- Comma Separated Values file format only.)"; - echo "
"; + echo " "; + echo "

"; + echo " ".$text['label-sample_file'].""; + echo "

"; - echo "
\n"; echo "".$text['description-phone']."

\n"; echo "\n"; echo "\n"; diff --git a/app/call_broadcast/call_broadcast_send.php b/app/call_broadcast/call_broadcast_send.php index 9954ff45c1..f55d947579 100644 --- a/app/call_broadcast/call_broadcast_send.php +++ b/app/call_broadcast/call_broadcast_send.php @@ -153,55 +153,57 @@ function cmd_async($cmd) { //remove the number formatting $phone_1 = preg_replace('{\D}', '', $tmp_value_array[0]); - //get the dialplan variables and bridge statement - $dialplan = new dialplan; - $dialplan->domain_uuid = $_SESSION['domain_uuid']; - $dialplan->outbound_routes($phone_1); - $dialplan_variables = $dialplan->variables; - $bridge_array[0] = $dialplan->bridges; - //echo "var: ".$variables."\n"; - //echo "bridges: ".$bridges."\n"; + if (is_numeric($phone_1)) { + //get the dialplan variables and bridge statement + $dialplan = new dialplan; + $dialplan->domain_uuid = $_SESSION['domain_uuid']; + $dialplan->outbound_routes($phone_1); + $dialplan_variables = $dialplan->variables; + $bridge_array[0] = $dialplan->bridges; + //echo "var: ".$variables."\n"; + //echo "bridges: ".$bridges."\n"; - //prepare the string - $channel_variables = $dialplan_variables."ignore_early_media=true"; - $channel_variables .= ",origination_number=$phone_1"; - $channel_variables .= ",origination_caller_id_name='$broadcast_caller_id_name'"; - $channel_variables .= ",origination_caller_id_number=$broadcast_caller_id_number"; - $channel_variables .= ",domain_uuid=".$_SESSION['domain_uuid']; - $channel_variables .= ",domain=".$_SESSION['domain_name']; - $channel_variables .= ",domain_name=".$_SESSION['domain_name']; - $channel_variables .= ",accountcode='$broadcast_accountcode'"; - if ($broadcast_avmd == "true") { - $channel_variables .= ",execute_on_answer='avmd start'"; - } - $origination_url = "{".$channel_variables."}".$bridge_array[0]; - - //get the context - $context = $_SESSION['domain_name']; - - //set the command - $cmd = "bgapi sched_api +".$sched_seconds." ".$call_broadcast_uuid." bgapi originate ".$origination_url." ".$broadcast_destination_data." XML $context"; - - //if the event socket connection is lost then re-connect - if (!$fp) { - $fp = eventsocket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); - } - - //method 1 - $response = trim(event_socket_request($fp, 'api '.$cmd)); - - //method 2 - //cmd_async($_SESSION['switch']['bin']['dir']."/fs_cli -x \"".$cmd."\";"); - - //spread the calls out so that they are scheduled with different times - if (strlen($broadcast_concurrent_limit) > 0 && strlen($broadcast_timeout) > 0) { - if ($broadcast_concurrent_limit == $count) { - $sched_seconds = $sched_seconds + $broadcast_timeout; - $count=0; + //prepare the string + $channel_variables = $dialplan_variables."ignore_early_media=true"; + $channel_variables .= ",origination_number=$phone_1"; + $channel_variables .= ",origination_caller_id_name='$broadcast_caller_id_name'"; + $channel_variables .= ",origination_caller_id_number=$broadcast_caller_id_number"; + $channel_variables .= ",domain_uuid=".$_SESSION['domain_uuid']; + $channel_variables .= ",domain=".$_SESSION['domain_name']; + $channel_variables .= ",domain_name=".$_SESSION['domain_name']; + $channel_variables .= ",accountcode='$broadcast_accountcode'"; + if ($broadcast_avmd == "true") { + $channel_variables .= ",execute_on_answer='avmd start'"; } - } + $origination_url = "{".$channel_variables."}".$bridge_array[0]; - $count++; + //get the context + $context = $_SESSION['domain_name']; + + //set the command + $cmd = "bgapi sched_api +".$sched_seconds." ".$call_broadcast_uuid." bgapi originate ".$origination_url." ".$broadcast_destination_data." XML $context"; + + //if the event socket connection is lost then re-connect + if (!$fp) { + $fp = eventsocket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']); + } + + //method 1 + $response = trim(event_socket_request($fp, 'api '.$cmd)); + + //method 2 + //cmd_async($_SESSION['switch']['bin']['dir']."/fs_cli -x \"".$cmd."\";"); + + //spread the calls out so that they are scheduled with different times + if (strlen($broadcast_concurrent_limit) > 0 && strlen($broadcast_timeout) > 0) { + if ($broadcast_concurrent_limit == $count) { + $sched_seconds = $sched_seconds + $broadcast_timeout; + $count=0; + } + } + + $count++; + } } fclose($fp);