Hey Guys,
I have been playing with jsonrpc-s module and it appears that for some reason it does not properly encapsulate replies containing more than one item.
Sample return via kamcmd: ``` root@iPBXDev1:~# kamcmd -s tcp:127.0.0.1:2046 uac.reg_dump { l_uuid: rsua2 l_username: rsua2 l_domain: 172.16.254.101 r_username: cust_sua2 r_domain: 172.16.254.102 realm: auth_username: cust_sua2 auth_password: check123 auth_proxy: sip:172.16.254.102 expires: 3600 flags: 12 diff_expires: 3558 timer_expires: 1444499546 } { l_uuid: rsua1 l_username: rsua1 l_domain: 172.16.254.101 r_username: cust_sua1 r_domain: 172.16.254.102 realm: auth_username: cust_sua1 auth_password: check123 auth_proxy: sip:172.16.254.102 expires: 3600 flags: 4 diff_expires: 3558 timer_expires: 1444499546 } ```
Sample return via jsonrpc: ``` T 2015/10/10 18:49:49.250401 172.16.254.102:35371 -> 172.16.254.101:5090 [AP] POST /jsonrpc HTTP/1.1. Host: 172.16.254.101:5090. User-Agent: Go-http-client/1.1. Content-Length: 60. Content-Type: application/json. Accept-Encoding: gzip. . {"jsonrpc":"2.0","method":"uac.reg_dump","params":[],"id":0} ## T 2015/10/10 18:49:49.251097 172.16.254.101:5090 -> 172.16.254.102:35371 [AP] HTTP/1.1 200 OK. Sia: SIP/2.0/TCP 172.16.254.102:35371. Content-Type: application/json. Server: Sipean-RP 4.3.2. Content-Length: 325. . {"jsonrpc":"2.0","result":{"l_uuid":"rsua1","l_username":"rsua1","l_domain":"172.16.254.101","r_username":"cust_sua1","r_domain":"172.16.254.102","realm":"","auth_username":"cust_sua1","auth_password":"check123","auth_proxy":"sip:172.16.254.102","expires":3600,"flags":0,"diff_expires":217,"timer_expires":1444496006},"id":0} ```
It appears that in second case there is only one item returned (so items overwrite each other).
DanB
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/368
Closed #368.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/368#event-432354287
Thanks, the issue was in the rpc command export, it didn't advertise it returns an array. Should be fixed now in master and 4.3 branches. Re-open if the issue is still there.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/368#issuecomment-147189907
Cool,
Thanks Daniel for so fast reaction.
If anyone interested, we have published a golang library implementing JSON-RPC support bindings for Kamailio from Go language (as MPL). It has general Call command for generic commands and particular uac RPC commands for uac methods (more to come as soon as we or others are in need of them).
You can find it here: https://github.com/cgrates/kamjsonrpc
DanB
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/368#issuecomment-147190626