Skip to content

Commit

Permalink
Reduce size of fax originate command.
Browse files Browse the repository at this point in the history
Originate command is limited to around 1130 characters. So this work was to reduce the size. Single quotes aren't needed on everything as this is not a command line. Its an even socket command. Also moving fax_variables into the fax options prevents variable duplicates.
  • Loading branch information
markjcrane committed Sep 16, 2022
1 parent b5ba126 commit de21143
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions app/fax_queue/resources/job/fax_send.php
Expand Up @@ -306,30 +306,36 @@ function process_exists($file = false) {

//fax options, first attempt use the fax variables from settings
if ($fax_retry_count == 0) {
$fax_options = "";
$fax_options = '';
}
elseif ($fax_retry_count == 1) {
$fax_options = "fax_use_ecm=false,fax_enable_t38=true,fax_enable_t38_request=true,fax_disable_v17=default";
if ($fax_retry_count == 1) {
$fax_options = '';
foreach($_SESSION['fax']['variable'] as $variable) {
$fax_options .= $variable.",";
}
}
elseif ($fax_retry_count == 2) {
$fax_options = "fax_use_ecm=true,fax_enable_t38=true,fax_enable_t38_request=true,fax_disable_v17=false";
$fax_options = "fax_use_ecm=false,fax_enable_t38=true,fax_enable_t38_request=true";
}
elseif ($fax_retry_count == 3) {
$fax_options = "fax_use_ecm=true,fax_enable_t38=false,fax_enable_t38_request=false,fax_disable_v17=false";
$fax_options = "fax_use_ecm=true,fax_enable_t38=true,fax_enable_t38_request=true,fax_disable_v17=false";
}
elseif ($fax_retry_count == 4) {
$fax_options = "fax_use_ecm=true,fax_enable_t38=true,fax_enable_t38_request=true,fax_disable_v17=true";
$fax_options = "fax_use_ecm=true,fax_enable_t38=false,fax_enable_t38_request=false,fax_disable_v17=false";
}
elseif ($fax_retry_count == 5) {
$fax_options = "fax_use_ecm=true,fax_enable_t38=true,fax_enable_t38_request=true,fax_disable_v17=true";
}
elseif ($fax_retry_count == 6) {
$fax_options = "fax_use_ecm=false,fax_enable_t38=false,fax_enable_t38_request=false,fax_disable_v17=false";
}

//define the fax file
$common_variables = "for_fax=1,";
$common_variables .= "accountcode='" . $fax_accountcode . "',";
$common_variables .= "sip_h_X-accountcode='" . $fax_accountcode . "',";
$common_variables .= "domain_uuid='" . $domain_uuid . "',";
$common_variables .= "domain_name='" . $domain_name . "',";
$common_variables = '';
$common_variables = "accountcode='" . $fax_accountcode . "',";
$common_variables .= "sip_h_accountcode='" . $fax_accountcode . "',";
$common_variables .= "domain_uuid=" . $domain_uuid . ",";
$common_variables .= "domain_name=" . $domain_name . ",";
$common_variables .= "origination_caller_id_name='" . $fax_caller_id_name . "',";
$common_variables .= "origination_caller_id_number='" . $fax_caller_id_number . "',";
$common_variables .= "fax_ident='" . $fax_caller_id_number . "',";
Expand All @@ -347,15 +353,10 @@ function process_exists($file = false) {
if (count($route_array) == 0) {
//send the internal call to the registered extension
$fax_uri = "user/".$fax_number."@".$domain_name;
$fax_variables = "";
}
else {
//send the external call
$fax_uri = $route_array[0];
$fax_variables = "";
foreach($_SESSION['fax']['variable'] as $variable) {
$fax_variables .= $variable.",";
}
}

//set the fax file name without the extension
Expand All @@ -366,7 +367,6 @@ function process_exists($file = false) {

//build a list of fax variables
$dial_string = $common_variables;
$dial_string .= $fax_variables;
$dial_string .= $fax_options.",";
$dial_string .= "origination_uuid=" . $origination_uuid. ",";
$dial_string .= "fax_uuid=" . $fax_uuid. ",";
Expand Down

0 comments on commit de21143

Please sign in to comment.