|
@@ -25,7 +25,11 @@
|
|
-- POSSIBILITY OF SUCH DAMAGE.
|
|
-- POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
--set the time between loops in seconds
|
|
--set the time between loops in seconds
|
|
- sleep = 500;
|
|
|
|
|
|
+ sleep = 300;
|
|
|
|
+
|
|
|
|
+--set the debug level
|
|
|
|
+ debug["log"] = false;
|
|
|
|
+ debug["sql"] = false;
|
|
|
|
|
|
--include the lua script
|
|
--include the lua script
|
|
scripts_dir = string.sub(debug.getinfo(1).source,2,string.len(debug.getinfo(1).source)-(string.len(argv[0])+1));
|
|
scripts_dir = string.sub(debug.getinfo(1).source,2,string.len(debug.getinfo(1).source)-(string.len(argv[0])+1));
|
|
@@ -74,8 +78,10 @@
|
|
sql = [[select d.domain_name, f.call_flow_uuid, f.call_flow_extension, f.call_flow_feature_code, f.call_flow_status, f.call_flow_label, f.call_flow_anti_label
|
|
sql = [[select d.domain_name, f.call_flow_uuid, f.call_flow_extension, f.call_flow_feature_code, f.call_flow_status, f.call_flow_label, f.call_flow_anti_label
|
|
from v_call_flows as f, v_domains as d
|
|
from v_call_flows as f, v_domains as d
|
|
where f.domain_uuid = d.domain_uuid]]
|
|
where f.domain_uuid = d.domain_uuid]]
|
|
- --and call_flow_enabled = 'true'
|
|
|
|
- --freeswitch.consoleLog("notice", "SQL:" .. sql .. "\n");
|
|
|
|
|
|
+ --and call_flow_enabled = 'true'
|
|
|
|
+ if (debug["sql"]) then
|
|
|
|
+ freeswitch.consoleLog("notice", "SQL:" .. sql .. "\n");
|
|
|
|
+ end
|
|
x = 0;
|
|
x = 0;
|
|
dbh:query(sql, function(row)
|
|
dbh:query(sql, function(row)
|
|
domain_name = row.domain_name;
|
|
domain_name = row.domain_name;
|
|
@@ -103,7 +109,9 @@
|
|
event:addHeader("answer-state", "terminated");
|
|
event:addHeader("answer-state", "terminated");
|
|
event:fire();
|
|
event:fire();
|
|
--show in the console
|
|
--show in the console
|
|
- freeswitch.consoleLog("notice", "Call Flow: label="..call_flow_label..",status=true,uuid="..call_flow_uuid.."\n");
|
|
|
|
|
|
+ if (debug["log"]) then
|
|
|
|
+ freeswitch.consoleLog("notice", "Call Flow: label="..call_flow_label..",status=true,uuid="..call_flow_uuid.."\n");
|
|
|
|
+ end
|
|
else
|
|
else
|
|
--set presence in - turn lamp on
|
|
--set presence in - turn lamp on
|
|
event = freeswitch.Event("PRESENCE_IN");
|
|
event = freeswitch.Event("PRESENCE_IN");
|
|
@@ -120,7 +128,9 @@
|
|
event:addHeader("answer-state", "confirmed");
|
|
event:addHeader("answer-state", "confirmed");
|
|
event:fire();
|
|
event:fire();
|
|
--show in the console
|
|
--show in the console
|
|
- freeswitch.consoleLog("notice", "Call Flow: label="..call_flow_anti_label..",status=false,uuid="..call_flow_uuid.."\n");
|
|
|
|
|
|
+ if (debug["log"]) then
|
|
|
|
+ freeswitch.consoleLog("notice", "Call Flow: label="..call_flow_anti_label..",status=false,uuid="..call_flow_uuid.."\n");
|
|
|
|
+ end
|
|
end
|
|
end
|
|
end);
|
|
end);
|
|
|
|
|
|
@@ -131,4 +141,4 @@
|
|
|
|
|
|
--sleep a moment to prevent using unecessary resources
|
|
--sleep a moment to prevent using unecessary resources
|
|
freeswitch.msleep(sleep*1000);
|
|
freeswitch.msleep(sleep*1000);
|
|
- end
|
|
|
|
|
|
+ end
|