Recently playing with jsonrpcs I found an issue with core.sockets_list and core.aliases_list commands called via jsonrpc_dispatch.
The problem for the first is that the socket's list is that the JSON produced is like
{
"jsonrpc": "2.0",
"result": {
"socket": {
"proto": "udp",
"address": "XX.XX.XX.XX",
"ipaddress": "XX.XX.XX.XX",
"port": "5060",
"mcast": "no",
"mhomed": "no"
},
"socket": {
"proto": "udp",
"address": "XX.XX.XX.XX",
"ipaddress": "XX.XX.XX.XX",
"port": "5060",
"mcast": "no",
"mhomed": "no"
},
....
},
"id": 1
}
While this is a valid JSON document, the fact that the "socket" key is defined several time in the same object makes many parsers not to properly parse it and only keep the last value.
Solution for this is to set the RET_ARRAY flag for the rpc command core.sockets_list reply so that the jsonrpcs module will create an array for the sockets instead on an object.
Similar issue for the aliases list returned by the core.aliases_list command: in this case the proposed solution is to add an "aliases" array to the rpc reply.
You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/1185
-- Commit Summary --
* core: set RET_ARRAY flag for core.sockets_list command
* core: return aliases list as an array in core.aliases_list
-- File Changes --
M src/core/core_cmd.c (6)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/1185.patchhttps://github.com/kamailio/kamailio/pull/1185.diff
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/1185