accountcode now on fax, PCMU/A as absolute codec string

This commit is contained in:
luis daniel lucio quiroz
2015-01-26 19:54:52 +00:00
parent 632dbec005
commit 7f175b4985
5 changed files with 73 additions and 6 deletions

View File

@@ -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'] = "";
?>
?>

View File

@@ -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";
?>
?>

View File

@@ -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 "</td>\n";
echo "</tr>\n";
if (if_group("superadmin") || (if_group("admin") && $billing_app_exists)) {
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-accountcode'].":\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
if ($billing_app_exists) {
$sql_accountcode = "SELECT type_value FROM v_billings WHERE domain_uuid = '".$domain_uuid."'";
echo "<select name='accountcode' id='accountcode' class='formfld'>\n";
$prep_statement_accountcode = $db->prepare(check_sql($sql_accountcode));
$prep_statement_accountcode->execute();
$result_accountcode = $prep_statement_accountcode->fetchAll(PDO::FETCH_NAMED);
foreach ($result_accountcode as &$row_accountcode) {
$selected = '';
if (($action == "add") && ($row_accountcode['type_value'] == $_SESSION['domain_name'])){
$selected='selected="selected"';
}
elseif ($row_accountcode['type_value'] == $accountcode){
$selected='selected="selected"';
}
echo "<option value=\"".$row_accountcode['type_value']."\" $selected>".$row_accountcode['type_value']."</option>\n";
}
unset($sql_accountcode, $prep_statement_accountcode, $result_accountcode);
echo "</select>";
}
else {
if ($action == "add") { $accountcode = $_SESSION['domain_name']; }
echo "<input class='formfld' type='text' name='accountcode' maxlength='255' value=\"".$accountcode."\">\n";
}
echo "<br />\n";
echo $text['description-accountcode']."\n";
echo "</td>\n";
echo "</tr>\n";
}
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\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";
?>
?>

View File

@@ -23,6 +23,7 @@
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
James Rose <james.o.rose@gmail.com>
Luis Daniel Lucio Quiroz <dlucio@okay.com.mx>
*/
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) {
}
}
*/
?>
?>

View File

@@ -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