Gents,
I’ve stumbled upon a coredump when using jsonrpc_request.
I might be expecting the wrong things from jsonrpc_request. I was hoping to use it in combination with CNXCC, and have jsonrpc_request get a maximum duration for every call, as a fraud avoidance mechanism.
I tried this with the branch 4.1 and master. Both behave identical.
So from the kamailio-basic.cfg example, I just added this line around line 350 (just above route(SIPOUT)):
jsonrpc_request("bar.sendsms", "{'ru':'$rU','rb':'$rb'}", "JSONRESPONSE", "JSONERROR", "$var(result)");
Doing a ngrep on the netstrings I have:
interface: venet0 (127.0.0.2/255.255.255.255) filter: (ip or ip6) and ( port 7080 ) # T 10.66.8.42:44995 -> 192.168.60.45:7080 [AP] 94:{ "id": 2, "jsonrpc": "2.0", "method": "bar.sendsms", "params": { "ru": "", "rb": "" } }, ## T 192.168.60.45:7080 -> 10.66.8.42:44995 [AP] 43:{"jsonrpc": "2.0", "result": "12", "id": 2}, ####^Cexit 7 received, 0 dropped
I do get some results from the JSONRESPONSE route.
But when launching a call, or when sending just a register packet, kamailio gives up with:
Feb 26 06:29:11 SBC01 kamailio[18043]: WARNING: tm [t_lookup.c:1537]: t_unref(): WARNING: script writer didn't release transaction Feb 26 06:29:12 SBC01 kamailio[18033]: : [mem/q_malloc.c:468]: qm_free(): BUG: qm_free: freeing already freed pointer (0xb4c01624), called from tm: h_table.c: free_cell(157), first free tm: h_table.c: free_cell(157) - aborting Feb 26 06:29:12 SBC01 kamailio[18023]: ALERT: [main.c:775]: handle_sigs(): child process 18033 exited by a signal 6 Feb 26 06:29:12 SBC01 kamailio[18023]: ALERT: [main.c:778]: handle_sigs(): core was generated Feb 26 06:29:12 SBC01 kamailio[18023]: INFO: [main.c:790]: handle_sigs(): INFO: terminating due to SIGCHLD Feb 26 06:29:12 SBC01 kamailio[18041]: INFO: [main.c:841]: sig_usr(): INFO: signal 15 received
Feb 26 06:29:12 SBC01 kamailio[18047]: INFO: [main.c:841]: sig_usr(): INFO: signal 15 received Feb 26 06:29:12 SBC01 kamailio[18043]: INFO: [main.c:841]: sig_usr(): INFO: signal 15 received Feb 26 06:29:12 SBC01 kamailio[18048]: INFO: [main.c:841]: sig_usr(): INFO: signal 15 received Feb 26 06:29:12 SBC01 kamailio[18023]: : [mem/q_malloc.c:468]: qm_free(): BUG: qm_free: freeing already freed pointer (0xb4c01624), called from tm: h_table.c: free_cell(157), first free tm: h_table.c: free_cell(157) - aborting
Using the jsonrpc_notification works like a charm.
I got coredumps of it, if someone is interested.
Side questions are offcourse, am I aiming to use jsonrpc_request for the correct purpose? Are there any other good alternatives? (next to using plain db queries?)
Grtz, Davy
-- davy van de moere