Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt some core rpc command to json #1185

Merged
merged 2 commits into from Jul 12, 2017

Conversation

grumvalski
Copy link
Contributor

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.

@miconda
Copy link
Member

miconda commented Jul 12, 2017

Thanks! It can be merged and backported.

@grumvalski grumvalski merged commit 272783e into kamailio:master Jul 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants