Hello,

I have a problem with jsonrpcc module.

OS is Debian Jessie. I tried with packeged kamailio 4.4 and compiled kamailio 5.0. 

Kamailio starts properly. Routing block is very simple:

route {
jsonrpc_request("get_source", "{'ipv4': '$si', 'port': $sp}", "RESPONSE", "ERROR", "$var(result)");
exit;
}

route[RESPONSE] {
xlog("Result received: $var(result)");
}

route[ERROR] {
xlog("Error received: $var(result)");
}

If any message arrives, kamailio sends it to my rpc_server (netstring encoded):


106:{'id': 2, 'jsonrpc': '2.0', 'method': 'get_source', 'params': {'ipv4': '10.20.121.231', 'port': 5060}},

My server decodes the message and immediately answers with netstring encoded response:

47:{"jsonrpc": "2.0", "result": "200 OK", "id": 2},

At this moment kamailio logs errors and disconnects from rpc server:

root@kamailio-test:/etc/kamailio#  4(925) DEBUG: <core> [parser/msg_parser.c:595]: parse_msg(): SIP Request:
 4(925) DEBUG: <core> [parser/msg_parser.c:597]: parse_msg():  method:  <REGISTER>
 4(925) DEBUG: <core> [parser/msg_parser.c:599]: parse_msg():  uri:     <sip:kamailio.conpeek.com>
 4(925) DEBUG: <core> [parser/msg_parser.c:601]: parse_msg():  version: <SIP/2.0>
 4(925) DEBUG: <core> [parser/parse_via.c:1303]: parse_via_param(): Found param type 232, <branch> = <z9hG4bK1033201528>; state=16
 4(925) DEBUG: <core> [parser/parse_via.c:2639]: parse_via(): end of header reached, state=5
 4(925) DEBUG: <core> [parser/msg_parser.c:486]: parse_headers(): Via found, flags=2
 4(925) DEBUG: <core> [parser/msg_parser.c:488]: parse_headers(): this is the first via
 4(925) DEBUG: <core> [receive.c:178]: receive_msg(): After parse_msg...
 4(925) DEBUG: <core> [receive.c:221]: receive_msg(): preparing to run routing scripts...
 4(925) DEBUG: tm [t_lookup.c:1312]: t_newtran(): DEBUG: t_newtran: msg id=1 , global msg id=0 , T on entrance=0xffffffffffffffff
 4(925) DEBUG: <core> [parser/parse_addr_spec.c:864]: parse_addr_spec(): end of header reached, state=10
 4(925) DEBUG: <core> [parser/msg_parser.c:171]: get_hdr_field(): <To> [40]; uri=[sip:1000@kamailio.conpeek.com]
 4(925) DEBUG: <core> [parser/msg_parser.c:172]: get_hdr_field(): to body ["1000" <sip:1000@kamailio.conpeek.com>
]
 4(925) DEBUG: <core> [parser/msg_parser.c:152]: get_hdr_field(): cseq <CSeq>: <1> <REGISTER>
 4(925) DEBUG: <core> [parser/msg_parser.c:183]: get_hdr_field(): content_length=0
 4(925) DEBUG: <core> [parser/msg_parser.c:89]: get_hdr_field(): found end of header
 4(925) DEBUG: tm [t_lookup.c:466]: t_lookup_request(): t_lookup_request: start searching: hash=43020, isACK=0
 4(925) DEBUG: tm [t_lookup.c:424]: matching_3261(): DEBUG: RFC3261 transaction matching failed
 4(925) DEBUG: tm [t_lookup.c:648]: t_lookup_request(): DEBUG: t_lookup_request: no transaction found
 4(925) DEBUG: <core> [md5utils.c:67]: MD5StringArray(): MD5 calculated: 920bfe28c581e1bf18554e3a9b234ceb
 4(925) DEBUG: <core> [usr_avp.c:631]: destroy_avp_list(): destroying list (nil)
 4(925) DEBUG: <core> [usr_avp.c:631]: destroy_avp_list(): destroying list (nil)
 4(925) DEBUG: <core> [usr_avp.c:631]: destroy_avp_list(): destroying list (nil)
 4(925) DEBUG: <core> [usr_avp.c:631]: destroy_avp_list(): destroying list (nil)
 4(925) DEBUG: <core> [usr_avp.c:631]: destroy_avp_list(): destroying list (nil)
 4(925) DEBUG: <core> [usr_avp.c:631]: destroy_avp_list(): destroying list (nil)
 4(925) DEBUG: <core> [xavp.c:446]: xavp_destroy_list(): destroying xavp list (nil)
 4(925) DEBUG: <core> [receive.c:318]: receive_msg(): cleaning up
 0(921) ALERT: <core> [main.c:740]: handle_sigs(): child process 929 exited by a signal 11
 0(921) ALERT: <core> [main.c:743]: handle_sigs(): core was generated
 0(921) INFO: <core> [main.c:755]: handle_sigs(): terminating due to SIGCHLD
 0(921) DEBUG: <core> [main.c:757]: handle_sigs(): terminating due to SIGCHLD
 7(928) INFO: <core> [main.c:810]: sig_usr(): signal 15 received
 6(927) INFO: <core> [main.c:810]: sig_usr(): signal 15 received
 5(926) INFO: <core> [main.c:810]: sig_usr(): signal 15 received
 4(925) INFO: <core> [main.c:810]: sig_usr(): signal 15 received
 3(924) INFO: <core> [main.c:810]: sig_usr(): signal 15 received
 2(923) INFO: <core> [main.c:810]: sig_usr(): signal 15 received
 1(922) INFO: <core> [main.c:810]: sig_usr(): signal 15 received
 0(921) DEBUG: tm [t_funcs.c:86]: tm_shutdown(): DEBUG: tm_shutdown : start
 0(921) DEBUG: tm [t_funcs.c:89]: tm_shutdown(): DEBUG: tm_shutdown : emptying hash table
 0(921) DEBUG: tm [h_table.c:127]: free_cell_helper(): freeing transaction 0x7fb99a822350 from h_table.c:449
 0(921) DEBUG: tm [t_funcs.c:91]: tm_shutdown(): DEBUG: tm_shutdown : removing semaphores
 0(921) DEBUG: tm [t_funcs.c:93]: tm_shutdown(): DEBUG: tm_shutdown : destroying tmcb lists
 0(921) DEBUG: tm [t_funcs.c:96]: tm_shutdown(): DEBUG: tm_shutdown : done
 0(921) INFO: <core> [sctp_core.c:53]: sctp_core_destroy(): SCTP API not initialized
 0(921) DEBUG: <core> [mem/shm.c:174]: shm_core_lock_destroy(): destroying the shared memory lock
 0(921) DEBUG: <core> [mem/shm.c:266]: shm_destroy_manager(): destroying memory manager: f_malloc
 0(921) DEBUG: <core> [mem/pkg.c:89]: pkg_destroy_manager(): destroying memory manager: f_malloc

The problem occures also if rpc server does not reply, i think when trying to start ERROR route.

If I try with jsonrpc_notification, everything is OK.


Any help ?

Regards Adam