Hello.
There is 1700 calls daily. Max 20 simultaneous calls, usually 1-2.
And freeswitch crashed about 2 times a day.
There is Python script that polls the database and creates calls via the console command using a Lua script
>>>
proc = subprocess.Popen(shlex.split('fs_cli -x "lua out_confirm_order.lua ' + phone + ' ' + phone7 + ' ' + str(id) + ' ' + str(iscell) + ' \'' + streetname + '\' \'' + housename + '\'"'))
<<<
Lua:
>>>
function save_status_out_call(id, hcause)
local dbh = freeswitch.Dbh(freeswitch.getGlobalVariable("db_connection"))
if (hcause == "ORIGINATOR_CANCEL" or hcause == "NORMAL_UNSPECIFIED") then
hcause = "rej"
elseif (hcause == "USER_BUSY") then
hcause = "busy"
elseif (hcause == "NO_ANSWER") then
hcause = "noans"
elseif (hcause == "NORMAL_CLEARING") then
hcause = "clear"
else
--hcause = "rej"
end
assert(dbh:connected())
dbh:query("select cc.proc_call_center_out_reject(" .. id .. ",'" .. hcause .. "')", function(row)
end)
dbh:release()
end
local phone = argv[1]
local phone7 = argv[2]
local id = argv[3]
local iscell = argv[4]
local streetname = argv[5]
local housename = argv[6]
originate_str1 = "{origination_caller_id_name='',originate_timeout=50,origination_caller_id_number=+79997771111,ignore_early_media=true}sofia/gateway/mobile_st/" .. phone7
freeswitch.consoleLog("notice", "OUT CALL START to " .. phone .. " " .. phone7 .. " iscell " .. iscell .. " by id " .. id .. "\n");
start_time = os.time()
local session1 = freeswitch.Session(originate_str1);
freeswitch.consoleLog("notice", string.format("\n OUT CALL DIF4 %s ID %s \n", os.difftime(os.time(),start_time), id));
if (session1:ready()) then
session1:setVariable("outCallsID", id);
session1:execute("start_dtmf");
session1:setVariable("dataRowStreet", streetname);
session1:setVariable("dataRowHouse", housename);
session1:execute("ivr","menu_out_call_confirm_order_ivr");
hcause = session1:hangupCause();
if not session1:getVariable("delOutOrder") then
freeswitch.consoleLog("notice", "OUT 1 by id " .. id .. "\n");
if hcause == "SUCCESS" then
freeswitch.consoleLog("notice", "OUT 2 by id " .. id .. "\n");
local dbh = freeswitch.Dbh(freeswitch.getGlobalVariable("db_connection"))
assert(dbh:connected())
dbh:query("select cc.proc_call_center_order_extend(" .. id .. ")", function(row)
end)
dbh:release()
else
freeswitch.consoleLog("notice", "OUT 3 by id " .. id .. "\n");
save_status_out_call(id,hcause);
end
end
freeswitch.consoleLog("notice",string.format("\n OUT CALL END4 %s ID %s \n", session1:getState(), id));
freeswitch.consoleLog("notice", "OUT CALL END1 to " .. phone .. " by id " .. id .. " WITH hangupCause " .. hcause .. "\n");
else
hcause = session1:hangupCause();
save_status_out_call(id,hcause);
freeswitch.consoleLog("notice",string.format("\n OUT CALL END3 %s ID %s \n", session1:getState(), id));
freeswitch.consoleLog("notice", "OUT CALL END2 to " .. phone .. " by id " .. id .. " WITH hangupCause " .. hcause .. "\n");
end
return;
<<<
Dump of crash:
>>>
#0 hash (h=h@entry=0x0, k=0x7f45e46a1080) at ./src/include/private/switch_hashtable_private.h:53
i = <optimized out>
#1 switch_hashtable_insert_destructor (h=h@entry=0x0, k=0x7f45e46a1080, v=v@entry=0x0, flags=flags@entry=(HASHTABLE_FLAG_FREE_KEY | HASHTABLE_DUP_CHECK), destructor=destructor@entry=0x0) at src/switch_hashtable.c:197
e = <optimized out>
hashvalue = 0
index = <optimized out>
#2 0x00007f46d454479b in switch_core_hash_insert_destructor (hash=hash@entry=0x0, key=key@entry=0x7f4646c9fa08 "CoreSession", data=data@entry=0x0, destructor=destructor@entry=0x0) at src/switch_core_hash.c:60
No locals.
#3 0x00007f46d45447e5 in switch_core_hash_insert_locked (hash=0x0, key=0x7f4646c9fa08 "CoreSession", data=0x0, mutex=0x7f45e42ad378) at src/switch_core_hash.c:71
No locals.
#4 0x00007f46d4528899 in switch_channel_set_private (channel=<optimized out>, key=<optimized out>, private_info=<optimized out>) at src/switch_channel.c:1029
__PRETTY_FUNCTION__ = "switch_channel_set_private"
#5 0x00007f4646c68044 in LUA::Session::destroy (this=0x7f45e430e5b0, err=0x0) at freeswitch_lua.cpp:41
err = 0x0
this = 0x7f45e430e5b0
#6 0x00007f4646c6814a in LUA::Session::~Session (this=0x7f45e430e5b0, __in_chrg=<optimized out>) at freeswitch_lua.cpp:63
No locals.
#7 0x00007f4646c68179 in LUA::Session::~Session (this=0x7f45e430e5b0, __in_chrg=<optimized out>) at freeswitch_lua.cpp:64
No locals.
#8 0x00007f4646c6a301 in SWIG_Lua_class_destruct (L=0x7f45e4702470) at mod_lua_wrap.cpp:1396
usr = <optimized out>
clss = <optimized out>
#9 0x00007f4646c855c5 in luaD_precall (L=L@entry=0x7f45e4702470, func=<optimized out>, nresults=0) at lua/ldo.c:318
f = 0x7f4646c6a2c0 <SWIG_Lua_class_destruct(lua_State*)>
ci = <optimized out>
n = <optimized out>
funcr = <optimized out>
#10 0x00007f4646c8588d in luaD_call (L=0x7f45e4702470, func=<optimized out>, nResults=<optimized out>, allowyield=0) at lua/ldo.c:394
No locals.
#11 0x00007f4646c84f1c in luaD_rawrunprotected (L=L@entry=0x7f45e4702470, f=f@entry=0x7f4646c86c70 <dothecall>, ud=ud@entry=0x0) at lua/ldo.c:131
oldnCcalls = 0
lj = {previous = 0x0, b = {{__jmpbuf = {139938162025584, -8284848512000002007, 0, 1, 0, 139938162025712, -8286327603693815767, -8286329346556102615}, __mask_was_saved = 0, __saved_mask = {__val = {12422489200, 139939811989869,
33, 139938162025584, 0, 4294967224, 33, 139938162025584, 0, 139939812024569, 12422489504, 139939811989869, 139938162025792, 139938162025584, 139938162025792, 32}}}}, status = 0}
#12 0x00007f4646c85ad1 in luaD_pcall (L=L@entry=0x7f45e4702470, func=func@entry=0x7f4646c86c70 <dothecall>, u=u@entry=0x0, old_top=48, ef=ef@entry=0) at lua/ldo.c:595
status = <optimized out>
old_ci = 0x7f45e47024f0
old_allowhooks = 0 '\000'
old_nny = 1
old_errfunc = 0
#13 0x00007f4646c86bd9 in GCTM (L=L@entry=0x7f45e4702470, propagateerrors=propagateerrors@entry=1) at lua/lgc.c:817
status = <optimized out>
oldah = 1 '\001'
running = 1
g = 0x7f45e4702540
tm = <optimized out>
v = {value_ = {gc = 0x7f45e4451240, p = 0x7f45e4451240, b = -465235392, f = 0x7f45e4451240, n = 6,9138637004406086e-310}, tt_ = 71}
#14 0x00007f4646c86c5f in callallpendingfinalizers (L=0x7f45e4702470, propagateerrors=propagateerrors@entry=1) at lua/lgc.c:971
g = 0x7f45e4702540
#15 0x00007f4646c8828b in luaC_fullgc (L=<optimized out>, isemergency=isemergency@entry=0) at lua/lgc.c:1208
g = <optimized out>
origkind = <optimized out>
#16 0x00007f4646c81e0f in lua_gc (L=0x7f45e4702470, what=<optimized out>, data=<optimized out>) at lua/lapi.c:1037
res = 0
g = 0x7f45e4702540
#17 0x00007f4646c65dd0 in lua_uninit (L=0x7f45e4702470) at mod_lua.cpp:62
No locals.
#18 0x00007f4646c66cea in lua_api_function (cmd=<optimized out>, session=<optimized out>, stream=0x7f46451f5bf0) at mod_lua.cpp:554
L = <optimized out>
mycmd = 0x7f45e4198af0 "out_confirm_order.lua"
error = <optimized out>
__PRETTY_FUNCTION__ = "switch_status_t lua_api_function(const char*, switch_core_session_t*, switch_stream_handle_t*)"
#19 0x00007f46d4590c0c in switch_api_execute (cmd=cmd@entry=0x7f45e44bddb0 "lua", arg=arg@entry=0x7f45e44bddb4 "out_confirm_order.lua 89992354545 +79992354545 38929 True 'Сарыарка Пр. ' '1Б'", session=session@entry=0x0,
stream=stream@entry=0x7f46451f5bf0) at src/switch_loadable_module.c:2438
api = 0x27769a0
status = <optimized out>
arg_used = 0x7f45e4a30d50 "out_confirm_order.lua 89992354545 +79992354545 38929 True 'Сарыарка Пр. ' '1Б'"
cmd_used = 0x7f45e429f920 "lua"
__PRETTY_FUNCTION__ = "switch_api_execute"
__func__ = "switch_api_execute"
#20 0x00007f46d4535714 in switch_console_execute (xcmd=<optimized out>, rec=rec@entry=0, istream=istream@entry=0x7f46451f5bf0) at src/switch_console.c:391
arg = 0x7f45e44bddb4 "out_confirm_order.lua 89992354545 +79992354545 38929 True 'Сарыарка Пр. ' '1Б'"
alias = 0x7f45e44bddb0 "lua"
delim = 0x7f46d4634a4e ";;"
argc = <optimized out>
argv = {0x7f45e44bddb0 "lua", 0x0 <repeats 102 times>, 0x400 <error: Cannot access memory at address 0x400>, 0xffff80b9bae0a4b1 <error: Cannot access memory at address 0xffff80b9bae0a4b1>,
0x41 <error: Cannot access memory at address 0x41>, 0x10 <error: Cannot access memory at address 0x10>, 0x40 <error: Cannot access memory at address 0x40>, 0x7f46451f5b50 "", 0x2 <error: Cannot access memory at address 0x2>,
0x5d00000000 <error: Cannot access memory at address 0x5d00000000>, 0x0, 0x0, 0x770000006e <error: Cannot access memory at address 0x770000006e>, 0x0, 0x7f46451f5b4f "", 0x0, 0x0,
0x7c <error: Cannot access memory at address 0x7c>, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x7f45e4000020 "", 0x400 <error: Cannot access memory at address 0x400>, 0x0}
x = <optimized out>
dup = 0x7f45e44bddb0 "lua"
cmd = 0x7f45e44bddb0 "lua"
status = SWITCH_STATUS_FALSE
__func__ = "switch_console_execute"
#21 0x00007f46bef8e3e5 in api_exec (thread=thread@entry=0x0, obj=obj@entry=0x7f46451f6590) at mod_event_socket.c:1504
acs = 0x7f46451f6590
stream = {read_function = 0x0, write_function = 0x7f46d4534da0 <switch_console_stream_write>, raw_write_function = 0x7f46d4534d10 <switch_console_stream_raw_write>, data = 0x7f45e40893e0, end = 0x7f45e40893e0, data_size = 1024,
data_len = 0, alloc_len = 1024, alloc_chunk = 1024, param_event = 0x7f45e4170170}
reply = <optimized out>
freply = 0x0
status = <optimized out>
__func__ = "api_exec"
__PRETTY_FUNCTION__ = "api_exec"
#22 0x00007f46bef90ee0 in parse_command (listener=listener@entry=0x7f4640013d88, event=event@entry=0x7f46451f6820, reply=reply@entry=0x7f46451f6850 "", reply_len=512) at mod_event_socket.c:2254
acs = {api_cmd = 0x7f45e4179774 "lua out_confirm_order.lua 89992354545 +79992354545 38929 True 'Сарыарка Пр. ' '1Б'", arg = 0x0, listener = 0x7f4640013d88, uuid_str = '\000' <repeats 256 times>, bg = 0, ack = 1,
console_execute = 1, pool = 0x0}
console_execute = 0x7f45e42fffe0 "true"
api_cmd = 0x7f45e4179774 "lua out_confirm_order.lua 89992354545 +79992354545 38929 True 'Сарыарка Пр. ' '1Б'"
arg = <optimized out>
status = SWITCH_STATUS_SUCCESS
cmd = 0x7f45e4179770 "api lua out_confirm_order.lua 89992354545 +79992354545 38929 True 'Сарыарка Пр. ' '1Б'"
unload_cheat = "api bgapi unload mod_event_socket"
reload_cheat = "api bgapi reload mod_event_socket"
#23 0x00007f46bef92300 in listener_run (thread=<optimized out>, obj=0x7f4640013d88) at mod_event_socket.c:2678
listener = 0x7f4640013d88
buf = '\000' <repeats 1023 times>
len = 1024
status = <optimized out>
event = 0x0
reply = "\000OK accepted", '\000' <repeats 499 times>
session = 0x0
channel = 0x0
revent = 0x7f45e44512b0
var = <optimized out>
locked = 1
__PRETTY_FUNCTION__ = "listener_run"
__func__ = "listener_run"
#24 0x00007f46d40ca184 in start_thread (arg=0x7f46451f7700) at pthread_create.c:312
__res = <optimized out>
pd = 0x7f46451f7700
now = <optimized out>
unwind_buf = {cancel_jmp_buf = {{jmp_buf = {139939784128256, 8326459497492052009, 0, 0, 139939784128960, 139939784128256, -8286327601737172951, -8286571820217599959}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0},
data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
not_first_call = <optimized out>
pagesize_m1 = <optimized out>
sp = <optimized out>
freesize = <optimized out>
__PRETTY_FUNCTION__ = "start_thread"
#25 0x00007f46d3df6ffd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111
<<<
Log of freeswitch:
>>>
2017-09-13 03:26:13.397245 [NOTICE] switch_cpp.cpp:1328 OUT 2 by id 38929
2017-09-13 03:26:13.417252 [NOTICE] switch_cpp.cpp:1328
OUT CALL END4 CS_DESTROY ID 38929
2017-09-13 03:26:13.417252 [NOTICE] switch_cpp.cpp:1328 OUT CALL END1 to 89992354545 by id 38929 WITH hangupCause SUCCESS
<<<<<<<<<<<<<<<<<MY COMMENT : THIS IS MOMENT OF CRASH>>>>>>>>>>>>>>>
2017-09-13 03:26:35.732994 [NOTICE] switch_loadable_module.c:227 Adding Dialplan 'enum'
2017-09-13 03:26:35.733019 [NOTICE] switch_loadable_module.c:269 Adding Application 'enum'
2017-09-13 03:26:35.733043 [NOTICE] switch_loadable_module.c:315 Adding API Function 'enum'
<<<
It's crashed right after Lua script is done. This is last console log from Lua:
>>>2017-09-13 03:26:13.417252 [NOTICE] switch_cpp.cpp:1328 OUT CALL END1 to 89992354545 by id 38929 WITH hangupCause SUCCESS
Add then first message from freeswitch that it try to start:
>>>2017-09-13 03:26:35.732994 [NOTICE] switch_loadable_module.c:227 Adding Dialplan 'enum'