diff --git a/app/fax/app_config.php b/app/fax/app_config.php
index 68ae81ea5e..54efe79757 100644
--- a/app/fax/app_config.php
+++ b/app/fax/app_config.php
@@ -246,6 +246,10 @@
$apps[$x]['db'][$y]['fields'][$z]['name']['deprecated'] = "faxdescription";
$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'] = "accountcode";
+ $apps[$x]['db'][$y]['fields'][$z]['type'] = "text";
+ $apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
$y = 1; //table array index
$z = 0; //field array index
@@ -391,4 +395,4 @@
$apps[$x]['db'][$y]['fields'][$z]['type'] = "numeric";
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = "";
-?>
\ No newline at end of file
+?>
diff --git a/app/fax/app_languages.php b/app/fax/app_languages.php
index 920c6913d4..32a4dfaa71 100644
--- a/app/fax/app_languages.php
+++ b/app/fax/app_languages.php
@@ -804,6 +804,11 @@
$text['description-fax_epoch']['pt-pt'] = "";
$text['description-fax_epoch']['fr-fr'] = "";
+ $text['label-accountcode']['en-us'] = "Account Code";
+ $text['label-accountcode']['es-cl'] = "Código de Cuenta";
+ $text['label-accountcode']['pt-pt'] = "Código de Conta";
+ $text['label-accountcode']['fr-fr'] = "Centre de frais";
+
$text['message-add']['en-us'] = "Add Completed";
$text['message-add']['es-cl'] = "Añadir Completado";
$text['message-add']['pt-pt'] = "Adicionar Concluído";
@@ -834,4 +839,4 @@
$text['message-no_faxes_found']['pt-pt'] = "Não Faxes Encontrado";
$text['message-no_faxes_found']['fr-fr'] = "Aucun Télécopieurs Trouvés";
-?>
\ No newline at end of file
+?>
diff --git a/app/fax/fax_edit.php b/app/fax/fax_edit.php
index a24394f2f4..92c7d90f14 100644
--- a/app/fax/fax_edit.php
+++ b/app/fax/fax_edit.php
@@ -35,6 +35,14 @@ else {
exit;
}
+//detect billing app
+ $billing_app_exists = file_exists($_SERVER['DOCUMENT_ROOT'].PROJECT_PATH."/app/billing/app_config.php");
+
+ if ($billing_app_exists) {
+ require_once "app/billing/resources/functions/currency.php";
+ require_once "app/billing/resources/functions/rating.php";
+ }
+
//add multi-lingual support
$language = new text;
$text = $language->get();
@@ -96,6 +104,7 @@ else {
if (count($_POST)>0) {
$fax_name = check_str($_POST["fax_name"]);
$fax_extension = check_str($_POST["fax_extension"]);
+ $fax_accountcode = check_str($_POST["accountcode"]);
$fax_destination_number = check_str($_POST["fax_destination_number"]);
$fax_email = check_str($_POST["fax_email"]);
$fax_email_connection_type = check_str($_POST["fax_email_connection_type"]);
@@ -248,6 +257,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$sql .= "fax_uuid, ";
$sql .= "dialplan_uuid, ";
$sql .= "fax_extension, ";
+ $sql .= "accountcode, ";
$sql .= "fax_destination_number, ";
$sql .= "fax_name, ";
$sql .= "fax_email, ";
@@ -276,6 +286,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$sql .= "'$fax_uuid', ";
$sql .= "'$dialplan_uuid', ";
$sql .= "'$fax_extension', ";
+ $sql .= "'$fax_accountcode', ";
$sql .= "'$fax_destination_number', ";
$sql .= "'$fax_name', ";
$sql .= "'$fax_email', ";
@@ -313,6 +324,7 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$sql .= "dialplan_uuid = '".$dialplan_uuid."', ";
}
$sql .= "fax_extension = '$fax_extension', ";
+ $sql .= "accountcode = '$fax_accountcode', ";
$sql .= "fax_destination_number = '$fax_destination_number', ";
$sql .= "fax_name = '$fax_name', ";
$sql .= "fax_email = '$fax_email', ";
@@ -655,6 +667,42 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
echo "\n";
echo "\n";
+ if (if_group("superadmin") || (if_group("admin") && $billing_app_exists)) {
+ echo "
\n";
+ echo "| \n";
+ echo " ".$text['label-accountcode'].":\n";
+ echo " | \n";
+ echo "\n";
+ if ($billing_app_exists) {
+ $sql_accountcode = "SELECT type_value FROM v_billings WHERE domain_uuid = '".$domain_uuid."'";
+ echo "";
+ }
+ else {
+ if ($action == "add") { $accountcode = $_SESSION['domain_name']; }
+ echo "\n";
+ }
+
+ echo " \n";
+ echo $text['description-accountcode']."\n";
+ echo " | \n";
+ echo "
\n";
+ }
+
echo "\n";
echo "| \n";
echo " ".$text['label-destination-number']."\n";
@@ -1014,4 +1062,4 @@ if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//show the footer
require_once "resources/footer.php";
-?>
\ No newline at end of file
+?>
diff --git a/app/fax/fax_send.php b/app/fax/fax_send.php
index 6a413d0eab..55247b2eae 100644
--- a/app/fax/fax_send.php
+++ b/app/fax/fax_send.php
@@ -23,6 +23,7 @@
Contributor(s):
Mark J Crane
James Rose
+ Luis Daniel Lucio Quiroz
*/
if (!isset($included)) { $included = false; }
@@ -83,6 +84,7 @@ if (!$included) {
$fax_extension = $row["fax_extension"];
$fax_caller_id_name = $row["fax_caller_id_name"];
$fax_caller_id_number = $row["fax_caller_id_number"];
+ $fax_accountcode = $row["accountcode"];
//limit to one row
break;
}
@@ -541,7 +543,7 @@ if (!$included) {
$fax_uri = $route_array[0];
$t38 = "fax_enable_t38=true,fax_enable_t38_request=true,";
}
- $cmd = "api originate {domain_uuid=".$_SESSION["domain_uuid"].",domain_name=".$_SESSION["domain_name"].",mailto_address='".$mailto_address."',mailfrom_address='".$mailfrom_address."',origination_caller_id_name='".$fax_caller_id_name."',origination_caller_id_number='".$fax_caller_id_number."',fax_ident='".$fax_caller_id_number."',fax_header='".$fax_caller_id_name."',fax_uri=".$fax_uri.",fax_file='".$fax_file."',fax_retry_attempts=1,fax_retry_limit=20,fax_retry_sleep=180,fax_verbose=true,fax_use_ecm=off,".$t38."api_hangup_hook='lua fax_retry.lua'}".$fax_uri." &txfax('".$fax_file."')";
+ $cmd = "api originate {absolute_codec_string='PCMU,PCMA',accountcode='".$fax_accountcode."',domain_uuid=".$_SESSION["domain_uuid"].",domain_name=".$_SESSION["domain_name"].",mailto_address='".$mailto_address."',mailfrom_address='".$mailfrom_address."',origination_caller_id_name='".$fax_caller_id_name."',origination_caller_id_number='".$fax_caller_id_number."',fax_ident='".$fax_caller_id_number."',fax_header='".$fax_caller_id_name."',fax_uri=".$fax_uri.",fax_file='".$fax_file."',fax_retry_attempts=1,fax_retry_limit=20,fax_retry_sleep=180,fax_verbose=true,fax_use_ecm=off,".$t38."api_hangup_hook='lua fax_retry.lua'}".$fax_uri." &txfax('".$fax_file."')";
//send the command to event socket
$response = event_socket_request($fp, $cmd);
$response = str_replace("\n", "", $response);
@@ -888,4 +890,4 @@ function showgrid($pdf) {
}
}
*/
-?>
\ No newline at end of file
+?>
diff --git a/resources/install/scripts/fax_retry.lua b/resources/install/scripts/fax_retry.lua
index f1c4e5cb30..955a52c976 100644
--- a/resources/install/scripts/fax_retry.lua
+++ b/resources/install/scripts/fax_retry.lua
@@ -22,6 +22,7 @@
-- Contributor(s):
-- Mark J. Crane
-- James O. Rose
+-- Luis Daniel Lucio Quiroz
--set default variables
fax_retry_sleep = 30;
@@ -91,6 +92,7 @@
origination_caller_id_number = env:getHeader("origination_caller_id_number");
fax_bad_rows = env:getHeader("fax_bad_rows");
fax_transfer_rate = env:getHeader("fax_transfer_rate");
+ accountcode = env:getHeader("accountcode");
bridge_hangup_cause = env:getHeader("bridge_hangup_cause");
fax_result_code = env:getHeader("fax_result_code");
@@ -136,6 +138,11 @@
end);
end
+--be sure accountcode is not empty
+ if (accountcode == nil) then
+ accountcode = domain_name;
+ end
+
--get the domain_uuid using the domain name required for multi-tenant
if (domain_uuid ~= nil and fax_extension ~= nil) then
sql = "SELECT fax_uuid FROM v_fax ";
@@ -282,6 +289,7 @@
freeswitch.consoleLog("INFO","fax_retry_limit: " .. fax_retry_limit.. "\n");
freeswitch.consoleLog("INFO","fax_retry_sleep: " .. fax_retry_sleep.. "\n");
freeswitch.consoleLog("INFO","fax_uri: '" .. fax_uri.. "'\n");
+ freeswitch.consoleLog("INFO","accountcode: '" .. accountcode .. "'\n");
freeswitch.consoleLog("INFO","origination_caller_id_name: " .. origination_caller_id_name .. "\n");
freeswitch.consoleLog("INFO","origination_caller_id_number: " .. origination_caller_id_number .. "\n");
freeswitch.consoleLog("INFO","fax_result_code: ".. fax_result_code .."\n");
@@ -295,7 +303,7 @@
--email_cmd = "/bin/echo '"..email_message_fail.."' | /usr/bin/mail -s 'Fax to: "..number_dialed.." FAILED' -r "..from_address.." -a '"..fax_file.."' "..email_address;
--to keep the originate command shorter these are things we always send. One place to adjust for all.
- originate_same = "mailto_address='"..email_address.."',mailfrom_address='"..from_address.."',origination_caller_id_name='"..origination_caller_id_name.. "',origination_caller_id_number="..origination_caller_id_number..",fax_uri="..fax_uri..",fax_retry_limit="..fax_retry_limit..",fax_retry_sleep="..fax_retry_sleep..",fax_verbose=true,fax_file='"..fax_file.."'";
+ originate_same = "absolute_codec_string='PCMU,PCMA',accountcode='"..accountcode.."',mailto_address='"..email_address.."',mailfrom_address='"..from_address.."',origination_caller_id_name='"..origination_caller_id_name.. "',origination_caller_id_number="..origination_caller_id_number..",fax_uri="..fax_uri..",fax_retry_limit="..fax_retry_limit..",fax_retry_sleep="..fax_retry_sleep..",fax_verbose=true,fax_file='"..fax_file.."'";
if (fax_retry_attempts < fax_retry_limit) then
|