Fix the white space and tabs issues with fax_retry.lua.

This commit is contained in:
Mark Crane
2014-02-19 06:15:53 +00:00
parent 9729c9ef0b
commit b12c258e05

View File

@@ -7,7 +7,7 @@
api = freeswitch.API();
-- show all channel variables
--dat = env:serialize()
--dat = env:serialize()
--freeswitch.consoleLog("INFO","info:\n" .. dat .. "\n")
-- example channel variables relating to fax
@@ -115,7 +115,7 @@
if (fax_retry_attempts < fax_retry_limit) then
--timed out waitng for comm or on first message, or busy code
if (fax_result_code == "2" or fax_result_code == "3" or hangup_cause_q850 == 17) then
--do nothing. don't want to increment
@@ -174,17 +174,16 @@
--bad number
elseif (fax_retry_attempts == 10) then
freeswitch.consoleLog("INFO","FAX_RETRY FAILED: BAD NUMBER\n");
freeswitch.consoleLog("INFO", "FAX_RETRY_STATS FAILURE BAD NUMBER: GATEWAY[".. fax_uri .."]");
email_message_fail = email_message_fail.."We tried sending, but the number entered was not a working phone number "
email_address = email_address:gsub("\\,", ",");
freeswitch.email("",
"",
"To: "..email_address.."\nFrom: "..from_address.."\nSubject: Fax to: "..number_dialed.." was INVALID",
email_message_fail ,
fax_file
);
freeswitch.consoleLog("INFO","FAX_RETRY FAILED: BAD NUMBER\n");
freeswitch.consoleLog("INFO", "FAX_RETRY_STATS FAILURE BAD NUMBER: GATEWAY[".. fax_uri .."]");
email_message_fail = email_message_fail.."We tried sending, but the number entered was not a working phone number "
email_address = email_address:gsub("\\,", ",");
freeswitch.email("",
"",
"To: "..email_address.."\nFrom: "..from_address.."\nSubject: Fax to: "..number_dialed.." was INVALID",
email_message_fail ,
fax_file
);
--busy number
elseif (fax_retry_attempts == 17) then
@@ -193,11 +192,11 @@
email_message_fail = email_message_fail.." We tried sending, but the call was busy "..fax_busy_attempts.." of those times."
email_address = email_address:gsub("\\,", ",");
freeswitch.email("",
"",
"To: "..email_address.."\nFrom: "..from_address.."\nSubject: Fax to: "..number_dialed.." was BUSY",
email_message_fail ,
fax_file
);
"",
"To: "..email_address.."\nFrom: "..from_address.."\nSubject: Fax to: "..number_dialed.." was BUSY",
email_message_fail ,
fax_file
);
else
--the fax failed completely. send a message
@@ -205,21 +204,17 @@
freeswitch.consoleLog("INFO", "FAX_RETRY_STATS FAILURE: GATEWAY[".. fax_uri .."], tried 5 combinations without success");
email_message_fail = email_message_fail.." We tried sending 5 times ways. You may also want to know that the call was busy "..fax_busy_attempts.." of those times."
email_address = email_address:gsub("\\,", ",");
freeswitch.email("",
"",
"To: "..email_address.."\nFrom: "..from_address.."\nSubject: Fax to: "..number_dialed.." FAILED",
email_message_fail ,
fax_file
);
"",
"To: "..email_address.."\nFrom: "..from_address.."\nSubject: Fax to: "..number_dialed.." FAILED",
email_message_fail ,
fax_file
);
fax_retry_attempts = fax_retry_attempts + 1;
end
api = freeswitch.API();
if ( not cmd ) then
@@ -242,16 +237,16 @@
fax_trial = "fax_use_ecm=true,fax_enable_t38=true,fax_enable_t38_request=true,fax_disable_v17=true";
elseif (fax_retry_attempts == 4) then
fax_trial = "fax_use_ecm=false,fax_enable_t38=false,fax_enable_t38_request=false,fax_disable_v17=false";
else
else
fax_trial = "fax_retry had an issue and tried more than 5 times"
end
freeswitch.consoleLog("INFO", "FAX_RETRY_STATS SUCCESS: GATEWAY[".. fax_uri .."] VARS[" .. fax_trial .. "]");
email_address = email_address:gsub("\\,", ",");
freeswitch.email("",
"",
"To: "..email_address.."\nFrom: "..from_address.."\nSubject: Fax to: "..number_dialed.." SENT",
email_message_success ,
fax_file
);
"",
"To: "..email_address.."\nFrom: "..from_address.."\nSubject: Fax to: "..number_dialed.." SENT",
email_message_success ,
fax_file
);
end