When trying to pull a list of pipes and their current values by using pl.dump via the JSONRPC-S module, I am only getting the last result in the reply as opposed to an array. If I use the CLI RPC interface I get the data I expect.
Here's a sanitized example:
[root@server1 ~]# kamcmd pl.stats PIPE: id=user_1 load=0 counter=29 PIPE: id=user_2 load=0 counter=108 PIPE: id=user_3 load=0 counter=18 PIPE: id=user_4 load=0 counter=0 PIPE: id=user_5 load=0 counter=1 PIPE: id=user_6 load=0 counter=2 PIPE: id=user_7 load=0 counter=0 PIPE: id=user_8 load=0 counter=84 PIPE: id=user_9 load=0 counter=26 PIPE: id=user_10 load=0 counter=0 PIPE: id=user_11 load=0 counter=23 PIPE: id=user_12 load=0 counter=9 PIPE: id=user_13 load=0 counter=23 PIPE: id=user_14 load=0 counter=0 PIPE: id=user_15 load=0 counter=107 PIPE: id=user_16 load=0 counter=10 PIPE: id=user_17 load=0 counter=28 PIPE: id=user_18 load=0 counter=45 PIPE: id=user_19 load=0 counter=7 PIPE: id=user_20 load=0 counter=0 PIPE: id=user_21 load=0 counter=12 PIPE: id=user_22 load=0 counter=94 PIPE: id=user_23 load=0 counter=14 PIPE: id=user_24 load=0 counter=7 PIPE: id=user_25 load=0 counter=18 PIPE: id=user_26 load=0 counter=46 PIPE: id=user_27 load=0 counter=45 PIPE: id=user_28 load=0 counter=50 PIPE: id=user_29 load=0 counter=2 PIPE: id=user_30 load=0 counter=2
[root@server1 ~]# curl -s --header 'Content-Type: application/json' --data-binary '{"jsonrpc": "2.0", "method": "pl.stats"}' http://1.2.3.4:5060/jsonrpc {"jsonrpc":"2.0","result":"PIPE: id=user_30 load=0 counter=2"} [root@server1 ~]#
The jsonrpc config and event route is about as basic as you can get:
modparam("jsonrpc-s", "pretty_format", 0) modparam("jsonrpc-s", "transport", 1)
event_route[xhttp:request] { xlog("L_INFO", "[R-HTTP-REQUEST:$si] -> Got HTTP request\n"); if($hu =~ "^/jsonrpc") { xlog("L_INFO", "[R-XHTTP-REQUEST:$si] -> Handling JSON RPC request: $hu\n"); jsonrpc_dispatch(); } else { xhttp_reply("404", "Not Found", "text/html", ""); } }
Should the JSONRPC-S module be returning this as an array instead of just a single value?
Brooks Bridges | Sr. Voice Services Engineer O1 Communications 5190 Golden Foothill Pkwy El Dorado Hills, CA 95762 office: 916.235.2097 | main: 888.444.1111, Option 2 email: bbridges@o1.commailto:bbridges@o1.com | web: www.o1.comhttp://www.o1.com/
Indeed, I can confirm that this happens even with two entries, running 4.3:9506574:
[root@allegro-4 ~]# kamcmd -s /tmp/kamailio_ctl pl.stats PIPE: id=bg350_ingress load=0 counter=0 PIPE: id=bg208_ingress load=0 counter=0
[root@allegro-4 kamailio]# curl --digest --user:pass http://10.150.20.6:5060/csrp_rpc/ --data '{"jsonrpc": "2.0", "method":"pl.stats", "result": "0xd"}'; echo { "jsonrpc": "2.0", "result": "PIPE: id=bg208_ingress load=0 counter=0" }
-- Alex
I pushed a patch in master branch for now -- commit id 1c22f395df81dab09288ff945e97b0040894daaf
Can anyone test and see if solves it? Then, if all ok, I will backport.
Cheers, Daniel
On 17/03/16 22:14, Alex Balashov wrote:
Indeed, I can confirm that this happens even with two entries, running 4.3:9506574:
[root@allegro-4 ~]# kamcmd -s /tmp/kamailio_ctl pl.stats PIPE: id=bg350_ingress load=0 counter=0 PIPE: id=bg208_ingress load=0 counter=0
[root@allegro-4 kamailio]# curl --digest --user:pass http://10.150.20.6:5060/csrp_rpc/ --data '{"jsonrpc": "2.0", "method":"pl.stats", "result": "0xd"}'; echo { "jsonrpc": "2.0", "result": "PIPE: id=bg208_ingress load=0 counter=0" }
-- Alex
Thanks Daniel, I'll give this patch a try as soon as I'm back in the office Monday. I suspect it will sort out the issue as expected.
Brooks Bridges | Sr. Voice Services Engineer O1 Communications 5190 Golden Foothill Pkwy El Dorado Hills, CA 95762 office: 916.235.2097 | main: 888.444.1111, Option 2 email: bbridges@o1.com | web: www.o1.com
________________________________________ From: sr-users [sr-users-bounces@lists.sip-router.org] on behalf of Daniel-Constantin Mierla [miconda@gmail.com] Sent: Thursday, March 17, 2016 2:49 PM To: Kamailio (SER) - Users Mailing List Subject: Re: [SR-Users] Missing pipelimit values in data returned by JSONRPC-S
I pushed a patch in master branch for now -- commit id 1c22f395df81dab09288ff945e97b0040894daaf
Can anyone test and see if solves it? Then, if all ok, I will backport.
Cheers, Daniel
On 17/03/16 22:14, Alex Balashov wrote:
Indeed, I can confirm that this happens even with two entries, running 4.3:9506574:
[root@allegro-4 ~]# kamcmd -s /tmp/kamailio_ctl pl.stats PIPE: id=bg350_ingress load=0 counter=0 PIPE: id=bg208_ingress load=0 counter=0
[root@allegro-4 kamailio]# curl --digest --user:pass http://10.150.20.6:5060/csrp_rpc/ --data '{"jsonrpc": "2.0", "method":"pl.stats", "result": "0xd"}'; echo { "jsonrpc": "2.0", "result": "PIPE: id=bg208_ingress load=0 counter=0" }
-- Alex
-- Daniel-Constantin Mierla http://www.asipto.com http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda Kamailio World Conference, Berlin, May 18-20, 2016 - http://www.kamailioworld.com
_______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Seems to have broken something. The CLI is returning as expected, but jsonrpc-s is throwing an error now.
[root@dev-server pipelimit]# kamcmd pl.stats PIPE: id=user_1 load=0 counter=0 PIPE: id=user_2 load=0 counter=0
[root@dev-server pipelimit]# curl -s --header 'Content-Type: application/json' --data-binary '{"jsonrpc": "2.0", "method": "pl.stats"}' http://1.2.3.4:5060/jsonrpc {"jsonrpc":"2.0","error":{"code":-32000,"message":"Execution Error"}}
Brooks Bridges | Sr. Voice Services Engineer O1 Communications 5190 Golden Foothill Pkwy El Dorado Hills, CA 95762 office: 916.235.2097 | main: 888.444.1111, Option 2 email: bbridges@o1.com | web: www.o1.com
-----Original Message----- From: sr-users [mailto:sr-users-bounces@lists.sip-router.org] On Behalf Of Brooks Bridges Sent: Saturday, March 19, 2016 11:21 AM To: miconda@gmail.com; Kamailio (SER) - Users Mailing List Subject: Re: [SR-Users] Missing pipelimit values in data returned by JSONRPC-S
Thanks Daniel, I'll give this patch a try as soon as I'm back in the office Monday. I suspect it will sort out the issue as expected.
Brooks Bridges | Sr. Voice Services Engineer O1 Communications 5190 Golden Foothill Pkwy El Dorado Hills, CA 95762 office: 916.235.2097 | main: 888.444.1111, Option 2 email: bbridges@o1.com | web: www.o1.com
________________________________________ From: sr-users [sr-users-bounces@lists.sip-router.org] on behalf of Daniel-Constantin Mierla [miconda@gmail.com] Sent: Thursday, March 17, 2016 2:49 PM To: Kamailio (SER) - Users Mailing List Subject: Re: [SR-Users] Missing pipelimit values in data returned by JSONRPC-S
I pushed a patch in master branch for now -- commit id 1c22f395df81dab09288ff945e97b0040894daaf
Can anyone test and see if solves it? Then, if all ok, I will backport.
Cheers, Daniel
On 17/03/16 22:14, Alex Balashov wrote:
Indeed, I can confirm that this happens even with two entries, running 4.3:9506574:
[root@allegro-4 ~]# kamcmd -s /tmp/kamailio_ctl pl.stats PIPE: id=bg350_ingress load=0 counter=0 PIPE: id=bg208_ingress load=0 counter=0
[root@allegro-4 kamailio]# curl --digest --user:pass http://10.150.20.6:5060/csrp_rpc/ --data '{"jsonrpc": "2.0", "method":"pl.stats", "result": "0xd"}'; echo { "jsonrpc": "2.0", "result": "PIPE: id=bg208_ingress load=0 counter=0" }
-- Alex
-- Daniel-Constantin Mierla http://www.asipto.com http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda Kamailio World Conference, Berlin, May 18-20, 2016 - http://www.kamailioworld.com
_______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users _______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Ergh... never mind, stupid typo on my part. It appears to be working.
[root@dev-server ~]# curl -s --header 'Content-Type: application/json' --data-binary '{"jsonrpc": "2.0", "method": "pl.stats"}' http://1.2.3.4:5060/jsonrpc {"jsonrpc":"2.0","result":["PIPE: id=user_1 load=0 counter=0","PIPE: id=user_2 load=0 counter=0"]}
Thanks!
Brooks Bridges | Sr. Voice Services Engineer O1 Communications 5190 Golden Foothill Pkwy El Dorado Hills, CA 95762 office: 916.235.2097 | main: 888.444.1111, Option 2 email: bbridges@o1.com | web: www.o1.com
-----Original Message----- From: sr-users [mailto:sr-users-bounces@lists.sip-router.org] On Behalf Of Brooks Bridges Sent: Monday, March 21, 2016 7:59 AM To: Kamailio (SER) - Users Mailing List Subject: Re: [SR-Users] Missing pipelimit values in data returned by JSONRPC-S
Seems to have broken something. The CLI is returning as expected, but jsonrpc-s is throwing an error now.
[root@dev-server pipelimit]# kamcmd pl.stats PIPE: id=user_1 load=0 counter=0 PIPE: id=user_2 load=0 counter=0
[root@dev-server pipelimit]# curl -s --header 'Content-Type: application/json' --data-binary '{"jsonrpc": "2.0", "method": "pl.stats"}' http://1.2.3.4:5060/jsonrpc {"jsonrpc":"2.0","error":{"code":-32000,"message":"Execution Error"}}
Brooks Bridges | Sr. Voice Services Engineer O1 Communications 5190 Golden Foothill Pkwy El Dorado Hills, CA 95762 office: 916.235.2097 | main: 888.444.1111, Option 2 email: bbridges@o1.com | web: www.o1.com
-----Original Message----- From: sr-users [mailto:sr-users-bounces@lists.sip-router.org] On Behalf Of Brooks Bridges Sent: Saturday, March 19, 2016 11:21 AM To: miconda@gmail.com; Kamailio (SER) - Users Mailing List Subject: Re: [SR-Users] Missing pipelimit values in data returned by JSONRPC-S
Thanks Daniel, I'll give this patch a try as soon as I'm back in the office Monday. I suspect it will sort out the issue as expected.
Brooks Bridges | Sr. Voice Services Engineer O1 Communications 5190 Golden Foothill Pkwy El Dorado Hills, CA 95762 office: 916.235.2097 | main: 888.444.1111, Option 2 email: bbridges@o1.com | web: www.o1.com
________________________________________ From: sr-users [sr-users-bounces@lists.sip-router.org] on behalf of Daniel-Constantin Mierla [miconda@gmail.com] Sent: Thursday, March 17, 2016 2:49 PM To: Kamailio (SER) - Users Mailing List Subject: Re: [SR-Users] Missing pipelimit values in data returned by JSONRPC-S
I pushed a patch in master branch for now -- commit id 1c22f395df81dab09288ff945e97b0040894daaf
Can anyone test and see if solves it? Then, if all ok, I will backport.
Cheers, Daniel
On 17/03/16 22:14, Alex Balashov wrote:
Indeed, I can confirm that this happens even with two entries, running 4.3:9506574:
[root@allegro-4 ~]# kamcmd -s /tmp/kamailio_ctl pl.stats PIPE: id=bg350_ingress load=0 counter=0 PIPE: id=bg208_ingress load=0 counter=0
[root@allegro-4 kamailio]# curl --digest --user:pass http://10.150.20.6:5060/csrp_rpc/ --data '{"jsonrpc": "2.0", "method":"pl.stats", "result": "0xd"}'; echo { "jsonrpc": "2.0", "result": "PIPE: id=bg208_ingress load=0 counter=0" }
-- Alex
-- Daniel-Constantin Mierla http://www.asipto.com http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda Kamailio World Conference, Berlin, May 18-20, 2016 - http://www.kamailioworld.com
_______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users _______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
_______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
OK -- so all works, I backported to 4.4, will consider it for 4.3 with the next backports in that branch.
Cheers, Daniel
On 21/03/16 16:42, Brooks Bridges wrote:
Ergh... never mind, stupid typo on my part. It appears to be working.
[root@dev-server ~]# curl -s --header 'Content-Type: application/json' --data-binary '{"jsonrpc": "2.0", "method": "pl.stats"}' http://1.2.3.4:5060/jsonrpc {"jsonrpc":"2.0","result":["PIPE: id=user_1 load=0 counter=0","PIPE: id=user_2 load=0 counter=0"]}
Thanks!
Brooks Bridges | Sr. Voice Services Engineer O1 Communications 5190 Golden Foothill Pkwy El Dorado Hills, CA 95762 office: 916.235.2097 | main: 888.444.1111, Option 2 email: bbridges@o1.com | web: www.o1.com
-----Original Message----- From: sr-users [mailto:sr-users-bounces@lists.sip-router.org] On Behalf Of Brooks Bridges Sent: Monday, March 21, 2016 7:59 AM To: Kamailio (SER) - Users Mailing List Subject: Re: [SR-Users] Missing pipelimit values in data returned by JSONRPC-S
Seems to have broken something. The CLI is returning as expected, but jsonrpc-s is throwing an error now.
[root@dev-server pipelimit]# kamcmd pl.stats PIPE: id=user_1 load=0 counter=0 PIPE: id=user_2 load=0 counter=0
[root@dev-server pipelimit]# curl -s --header 'Content-Type: application/json' --data-binary '{"jsonrpc": "2.0", "method": "pl.stats"}' http://1.2.3.4:5060/jsonrpc {"jsonrpc":"2.0","error":{"code":-32000,"message":"Execution Error"}}
Brooks Bridges | Sr. Voice Services Engineer O1 Communications 5190 Golden Foothill Pkwy El Dorado Hills, CA 95762 office: 916.235.2097 | main: 888.444.1111, Option 2 email: bbridges@o1.com | web: www.o1.com
-----Original Message----- From: sr-users [mailto:sr-users-bounces@lists.sip-router.org] On Behalf Of Brooks Bridges Sent: Saturday, March 19, 2016 11:21 AM To: miconda@gmail.com; Kamailio (SER) - Users Mailing List Subject: Re: [SR-Users] Missing pipelimit values in data returned by JSONRPC-S
Thanks Daniel, I'll give this patch a try as soon as I'm back in the office Monday. I suspect it will sort out the issue as expected.
Brooks Bridges | Sr. Voice Services Engineer O1 Communications 5190 Golden Foothill Pkwy El Dorado Hills, CA 95762 office: 916.235.2097 | main: 888.444.1111, Option 2 email: bbridges@o1.com | web: www.o1.com
From: sr-users [sr-users-bounces@lists.sip-router.org] on behalf of Daniel-Constantin Mierla [miconda@gmail.com] Sent: Thursday, March 17, 2016 2:49 PM To: Kamailio (SER) - Users Mailing List Subject: Re: [SR-Users] Missing pipelimit values in data returned by JSONRPC-S
I pushed a patch in master branch for now -- commit id 1c22f395df81dab09288ff945e97b0040894daaf
Can anyone test and see if solves it? Then, if all ok, I will backport.
Cheers, Daniel
On 17/03/16 22:14, Alex Balashov wrote:
Indeed, I can confirm that this happens even with two entries, running 4.3:9506574:
[root@allegro-4 ~]# kamcmd -s /tmp/kamailio_ctl pl.stats PIPE: id=bg350_ingress load=0 counter=0 PIPE: id=bg208_ingress load=0 counter=0
[root@allegro-4 kamailio]# curl --digest --user:pass http://10.150.20.6:5060/csrp_rpc/ --data '{"jsonrpc": "2.0", "method":"pl.stats", "result": "0xd"}'; echo { "jsonrpc": "2.0", "result": "PIPE: id=bg208_ingress load=0 counter=0" }
-- Alex
-- Daniel-Constantin Mierla http://www.asipto.com http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda Kamailio World Conference, Berlin, May 18-20, 2016 - http://www.kamailioworld.com
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users _______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
Traced this, got it to work for 'pl.stats' ...
[root@allegro-4 pipelimit]# !curl curl --digest --user xxx:xxx http://10.150.20.6:5060/csrp_rpc/ --data '{"jsonrpc": "2.0", "method": "pl.stats", "id": "0xd"}'; echo { "jsonrpc": "2.0", "result": ["PIPE: id=bg350_ingress load=0 counter=0", "PIPE: id=bg208_ingress load=0 counter=0"], "id": "0xd" }
The problem is that the RPC function exports at the bottom of pipelimit.c are missing the RET_ARRAY flag:
--- static rpc_export_t rpc_methods[] = { {"pl.stats", rpc_pl_stats, rpc_pl_stats_doc, 0}, {"pl.get_pipes", rpc_pl_get_pipes, rpc_pl_get_pipes_doc, 0}, {"pl.set_pipe", rpc_pl_set_pipe, rpc_pl_set_pipe_doc, 0}, {"pl.get_pid", rpc_pl_get_pid, rpc_pl_get_pid_doc, 0}, {"pl.set_pid", rpc_pl_set_pid, rpc_pl_set_pid_doc, 0}, {"pl.push_load", rpc_pl_push_load, rpc_pl_push_load_doc, 0}, {0, 0, 0, 0} }; ---
Adding it to functions that return multiple values, e.g.
{"pl.stats", rpc_pl_stats, rpc_pl_stats_doc, RET_ARRAY}
should sort it. I'll submit a pull request.
-- Alex
Whoops, look like Daniel beat me to it. :-)
On 17/03/16 22:50, Alex Balashov wrote:
Whoops, look like Daniel beat me to it. :-)
EU still ahead of USA even with DST already active ...
But there can be other RPC commands that miss the flag, now we retire here, but you are just warmed up for working and plenty of time to midnight, so if you discover some of them, you can submit pull requests :-)
Daniel
On 03/17/2016 06:18 PM, Daniel-Constantin Mierla wrote:
EU still ahead of USA even with DST already active ...
Yep. There's no beating Bushido Blade Daniel. :-)