Update memcache.lua
Add server method, consumer CUSTOM event instead of MEMCACHE.
This commit is contained in:
parent
0afd070f3b
commit
61e4853108
|
|
@ -20,21 +20,26 @@
|
||||||
servers = {}
|
servers = {}
|
||||||
x = 0;
|
x = 0;
|
||||||
servers[x] = {}
|
servers[x] = {}
|
||||||
|
servers[x]['method'] = "curl";
|
||||||
servers[x]['username'] = "freeswitch";
|
servers[x]['username'] = "freeswitch";
|
||||||
servers[x]['password'] = "freeswitch";
|
servers[x]['password'] = "freeswitch";
|
||||||
servers[x]['hostname'] = "x.x.x.x";
|
servers[x]['hostname'] = "x.x.x.x";
|
||||||
servers[x]['port'] = "8787";
|
servers[x]['port'] = "8080";
|
||||||
x = x + 1;
|
x = x + 1;
|
||||||
servers[x] = {}
|
servers[x] = {}
|
||||||
|
servers[x]['method'] = "curl";
|
||||||
servers[x]['username'] = "freeswitch";
|
servers[x]['username'] = "freeswitch";
|
||||||
servers[x]['password'] = "freeswitch";
|
servers[x]['password'] = "freeswitch";
|
||||||
servers[x]['hostname'] = "x.x.x.x";
|
servers[x]['hostname'] = "x.x.x.x";
|
||||||
servers[x]['port'] = "8787";
|
servers[x]['port'] = "8080";
|
||||||
]]
|
]]
|
||||||
|
|
||||||
|
--includes config.lua which will include local.lua if it exists
|
||||||
|
require "resources.functions.config"
|
||||||
|
|
||||||
--subscribe to the events
|
--subscribe to the events
|
||||||
--events = freeswitch.EventConsumer("all");
|
--events = freeswitch.EventConsumer("all");
|
||||||
events = freeswitch.EventConsumer("MEMCACHE");
|
events = freeswitch.EventConsumer("CUSTOM");
|
||||||
|
|
||||||
--define trim
|
--define trim
|
||||||
function trim (s)
|
function trim (s)
|
||||||
|
|
@ -72,13 +77,16 @@
|
||||||
end
|
end
|
||||||
if (memcache_updated) then
|
if (memcache_updated) then
|
||||||
for key,row in pairs(servers) do
|
for key,row in pairs(servers) do
|
||||||
--cmd = [[ssh ]]..row.username..[[@]]..row.hostname..[[ "fs_cli -x 'memcache ]]..api_command_argument..[['"]];
|
if (row.method == "ssh") then
|
||||||
--freeswitch.consoleLog("INFO", "[notice] command: ".. cmd .. "\n");
|
cmd = [[ssh ]]..row.username..[[@]]..row.hostname..[[ "fs_cli -x 'memcache ]]..api_command_argument..[['"]];
|
||||||
--os.execute(cmd);
|
freeswitch.consoleLog("INFO", "[notice] command: ".. cmd .. "\n");
|
||||||
|
os.execute(cmd);
|
||||||
url = [[http://]]..row.username..[[:]]..row.password..[[@]]..row.hostname..[[:]]..row.port..[[/webapi/memcache?]]..api_command_argument;
|
end
|
||||||
response = api:execute("curl", url);
|
if (row.method == "curl") then
|
||||||
freeswitch.consoleLog("INFO", "[notice] ".. url .. " "..response.."\n");
|
url = [[http://]]..row.username..[[:]]..row.password..[[@]]..row.hostname..[[:]]..row.port..[[/webapi/memcache?]]..api_command_argument;
|
||||||
|
os.execute("curl "..url);
|
||||||
|
freeswitch.consoleLog("INFO", "[notice] curl ".. url .. " \n");
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue