[SR-Users] Execution Error while getting profile size with jsonrpc-s

Daniel-Constantin Mierla miconda at gmail.com
Fri Nov 11 14:09:29 CET 2016


Hello,

you provide only one parameter to the rpc command.

You can try with:

{"jsonrpc": "2.0", "method": "dlg.profile_get_size","params":{"profile":
"accountno", "value": "1234567"}, "id": "0deadb33f"}

The name of parameters doesn't matter, the order is important, so you
can also try with:

{"jsonrpc": "2.0", "method":
"dlg.profile_get_size","params":["accountno","1234567"], "id": "0deadb33f"}

Cheers,
Daniel

On 11/11/16 08:08, Aqs Younas wrote:
> Any thoughts?
>
> On 10 November 2016 at 15:02, Aqs Younas <aqsyounas at gmail.com
> <mailto:aqsyounas at gmail.com>> wrote:
>
>     Many thanks for the prompt reply. Below are requested logs. 
>
>     root at debian:/usr/local/kamailio/sbin# Nov 10 04:56:34 debian
>     ./kamailio[5527]: DEBUG: <core> [ip_addr.c:229]: print_ip():
>     tcpconn_new: new tcp connection: 127.0.0.1
>     Nov 10 04:56:34 debian ./kamailio[5527]: DEBUG: <core>
>     [tcp_main.c:985]: tcpconn_new(): on port 49396, type 2
>     Nov 10 04:56:34 debian ./kamailio[5527]: DEBUG: <core>
>     [tcp_main.c:1295]: tcpconn_add(): hashes: 395:373:662, 1
>     Nov 10 04:56:34 debian ./kamailio[5527]: DEBUG: <core>
>     [io_wait.h:376]: io_watch_add(): DBG: io_watch_add(0xa1d280, 38,
>     2, 0x7f5abcd36708), fd_no=31
>     Nov 10 04:56:34 debian ./kamailio[5527]: DEBUG: <core>
>     [io_wait.h:598]: io_watch_del(): DBG: io_watch_del (0xa1d280, 38,
>     -1, 0x0) fd_no=32 called
>     Nov 10 04:56:34 debian ./kamailio[5527]: DEBUG: <core>
>     [tcp_main.c:4131]: handle_tcpconn_ev(): sending to child, events 1
>     Nov 10 04:56:34 debian ./kamailio[5527]: DEBUG: <core>
>     [tcp_main.c:3813]: send2child(): selected tcp worker 0 15(5515)
>     for activity on [tcp:0.0.0.0:5060 <http://0.0.0.0:5060>],
>     0x7f5abcd3670
>     8
>     Nov 10 04:56:34 debian ./kamailio[5515]: DEBUG: <core>
>     [tcp_read.c:1566]: handle_io(): received n=8 con=0x7f5abcd36708, fd=10
>     Nov 10 04:56:34 debian ./kamailio[5515]: DEBUG: <core>
>     [tcp_read.c:1366]: tcp_read_req(): content-length=105
>     Nov 10 04:56:34 debian ./kamailio[5515]: DEBUG: <core>
>     [parser/msg_parser.c:608]: parse_msg(): SIP Request:
>     Nov 10 04:56:34 debian ./kamailio[5515]: DEBUG: <core>
>     [parser/msg_parser.c:610]: parse_msg():  method:  <POST>
>     Nov 10 04:56:34 debian ./kamailio[5515]: DEBUG: <core>
>     [parser/msg_parser.c:612]: parse_msg():  uri:     </rpc_path/>
>     Nov 10 04:56:34 debian ./kamailio[5515]: DEBUG: <core>
>     [parser/msg_parser.c:614]: parse_msg():  version: <HTTP/1.1>
>     Nov 10 04:56:34 debian ./kamailio[5515]: DEBUG: <core>
>     [parser/msg_parser.c:187]: get_hdr_field(): DEBUG: get_hdr_body :
>     content_length=105
>     Nov 10 04:56:34 debian ./kamailio[5515]: DEBUG: <core>
>     [parser/msg_parser.c:89]: get_hdr_field(): found end of header
>     Nov 10 04:56:34 debian ./kamailio[5515]: DEBUG: <core>
>     [receive.c:178]: receive_msg(): After parse_msg...
>     Nov 10 04:56:34 debian ./kamailio[5515]: DEBUG: xhttp
>     [xhttp_mod.c:356]: xhttp_handler(): new fake msg created (296
>     bytes):#012<POST /rpc_path/ HTTP/1.1#015#012Via: SIP
>     /2.0/TCP 127.0.0.1:49396#015#012User-Agent
>     <http://127.0.0.1:49396#015%23012User-Agent>:
>     curl/7.38.0#015#012Host: 127.0.0.1:5060#015#012Accept
>     <http://127.0.0.1:5060#015%23012Accept>: */*#015#012Content-Type:
>     application/json#015#012Call-ID: abc12#015#0
>     12Content-Length: 105#015#012#015#012{"jsonrpc": "2.0", "method":
>     "dlg.profile_get_size","params":{"accountno": "1234567"}, "id":
>     "0deadb33f"}>
>     Nov 10 04:56:34 debian ./kamailio[5515]: DEBUG: <core>
>     [parser/msg_parser.c:608]: parse_msg(): SIP Request:
>     Nov 10 04:56:34 debian ./kamailio[5515]: DEBUG: <core>
>     [parser/msg_parser.c:610]: parse_msg():  method:  <POST>
>     Nov 10 04:56:34 debian ./kamailio[5515]: DEBUG: <core>
>     [parser/msg_parser.c:612]: parse_msg():  uri:     </rpc_path/>
>     Nov 10 04:56:34 debian ./kamailio[5515]: DEBUG: <core>
>     [parser/msg_parser.c:614]: parse_msg():  version: <HTTP/1.1>
>     Nov 10 04:56:34 debian ./kamailio[5515]: DEBUG: <core>
>     [parser/parse_via.c:2642]: parse_via(): end of header reached, state=5
>     Nov 10 04:56:34 debian ./kamailio[5515]: DEBUG: <core>
>     [parser/msg_parser.c:496]: parse_headers(): parse_headers: Via
>     found, flags=2
>     Nov 10 04:56:34 debian ./kamailio[5515]: DEBUG: <core>
>     [parser/msg_parser.c:498]: parse_headers(): parse_headers: this is
>     the first via
>     Nov 10 04:56:34 debian ./kamailio[5515]: DEBUG: <core>
>     [parser/msg_parser.c:187]: get_hdr_field(): DEBUG: get_hdr_body :
>     content_length=105
>     Nov 10 04:56:34 debian ./kamailio[5515]: DEBUG: <core>
>     [parser/msg_parser.c:89]: get_hdr_field(): found end of header
>     Nov 10 04:56:34 debian ./kamailio[5515]: DEBUG: sl [sl.c:280]:
>     send_reply(): reply in stateless mode (sl)
>     Nov 10 04:56:34 debian ./kamailio[5515]: DEBUG: <core>
>     [msg_translator.c:158]: check_via_address(): (127.0.0.1, 127.0.0.1, 0)
>     Nov 10 04:56:34 debian ./kamailio[5515]: DEBUG: <core>
>     [tcp_main.c:2196]: tcpconn_send_put(): send from reader (5515
>     (15)), reusing fd
>     Nov 10 04:56:34 debian ./kamailio[5515]: DEBUG: <core>
>     [tcp_main.c:2430]: tcpconn_do_send(): sending...
>     Nov 10 04:56:34 debian ./kamailio[5515]: DEBUG: <core>
>     [tcp_main.c:2464]: tcpconn_do_send(): after real write: c=
>     0x7f5abcd36708 n=293 fd=10
>     Nov 10 04:56:34 debian ./kamailio[5515]: DEBUG: <core>
>     [tcp_main.c:2465]: tcpconn_do_send(): buf=#012HTTP/1.1 404 Profile
>     not found: 1234567#015#012Sia: SIP/2.0/TCP
>     127.0.0.1:49396#015#012Call-ID
>     <http://127.0.0.1:49396#015%23012Call-ID>:
>     abc12#015#012Content-Type: application/json#015#012Server:
>     kamailio (4.4.1 (x86_64/linux))#015#012Content-Length:
>     106#015#012#015#012{#012#011"jsonrpc":#011"2.0",#012#011"error":#011{#012#011#011"code":#011-32000,#012#011#011"message":#011"Execution
>     Error"#012#011},#012#011"id":#011"0deadb33f"#012}
>     Nov 10 04:56:34 debian ./kamailio[5515]: DEBUG: <core>
>     [usr_avp.c:631]: destroy_avp_list(): destroying list (nil)
>     Nov 10 04:56:34 debian ./kamailio[5515]: DEBUG: <core>
>     [usr_avp.c:631]: destroy_avp_list(): destroying list (nil)
>     Nov 10 04:56:34 debian ./kamailio[5515]: DEBUG: <core>
>     [usr_avp.c:631]: destroy_avp_list(): destroying list (nil)
>     Nov 10 04:56:34 debian ./kamailio[5515]: DEBUG: <core>
>     [usr_avp.c:631]: destroy_avp_list(): destroying list (nil)
>     Nov 10 04:56:34 debian ./kamailio[5515]: DEBUG: <core>
>     [usr_avp.c:631]: destroy_avp_list(): destroying list (nil)
>     Nov 10 04:56:34 debian ./kamailio[5515]: DEBUG: <core>
>     [usr_avp.c:631]: destroy_avp_list(): destroying list (nil)
>     Nov 10 04:56:34 debian ./kamailio[5515]: DEBUG: <core>
>     [xavp.c:446]: xavp_destroy_list(): destroying xavp list (nil)
>     Nov 10 04:56:34 debian ./kamailio[5515]: DEBUG: <core>
>     [receive.c:322]: receive_msg(): cleaning up
>     Nov 10 04:56:34 debian ./kamailio[5515]: DEBUG: <core>
>     [io_wait.h:376]: io_watch_add(): DBG: io_watch_add(0xa76680, 10,
>     2, 0x7f5abcd36708), fd_no=1
>     Nov 10 04:56:34 debian ./kamailio[5515]: DEBUG: <core>
>     [tcp_read.c:195]: tcp_make_closed_event(): TCP closed event
>     creation triggered
>     Nov 10 04:56:34 debian ./kamailio[5515]: DEBUG: <core>
>     [tcp_read.c:203]: tcp_make_closed_event(): no callback registering
>     for handling TCP closed event - dropping!
>     Nov 10 04:56:34 debian ./kamailio[5515]: DEBUG: <core>
>     [tcp_read.c:310]: tcp_read_data(): EOF on 0x7f5abcd36708, FD 10
>     ([127.0.0.1]:49396 -> [127.0.0.1]:5060)
>     Nov 10 04:56:34 debian ./kamailio[5515]: DEBUG: <core>
>     [tcp_read.c:1342]: tcp_read_req(): EOF
>     Nov 10 04:56:34 debian ./kamailio[5515]: DEBUG: <core>
>     [io_wait.h:598]: io_watch_del(): DBG: io_watch_del (0xa76680, 10,
>     -1, 0x10) fd_no=2 called
>     Nov 10 04:56:34 debian ./kamailio[5515]: DEBUG: <core>
>     [tcp_read.c:1490]: release_tcpconn(): releasing con
>     0x7f5abcd36708, state -1, fd=10, id=1 ([127.0.0.1]:49396 ->
>     [127.0.0.1]:5060)
>     Nov 10 04:56:34 debian ./kamailio[5515]: DEBUG: <core>
>     [tcp_read.c:1491]: release_tcpconn(): extra_data (nil)
>     Nov 10 04:56:34 debian ./kamailio[5527]: DEBUG: <core>
>     [tcp_main.c:3243]: handle_tcp_child(): reader response=
>     7f5abcd36708, -1 from 0
>
>     Let me know if you need anything else. 
>     Best Regards. 
>
>     On 10 November 2016 at 13:47, Daniel-Constantin Mierla
>     <miconda at gmail.com <mailto:miconda at gmail.com>> wrote:
>
>         Hello,
>
>         can you get the log messages with debug=3 in kamailio.cfg for
>         the execution of the rpc command?
>
>         Cheers,
>         Daniel
>
>
>         On 10/11/16 09:35, Aqs Younas wrote:
>>         Greetings list, 
>>
>>         I am trying to get profile size with jsonrpc-s module. Below
>>         is jsonrpc-s configuration and a curl command to get the
>>         profile  size. 
>>
>>         listen=tcp:0.0.0.0:5060 <http://0.0.0.0:5060/>
>>
>>         loadmodule "xhttp"
>>         loadmodule "jsonrpc-s"
>>
>>         modparam("xhttp", "url_match", "^/rpc_path/")
>>         modparam("jsonrpc-s", "pretty_format", 1)
>>
>>         event_route[xhttp:request] {
>>            if($hu =~ "^/rpc_path")
>>               jsonrpc_dispatch();
>>            else
>>               xhttp_reply("404", "Not Found", "text/html", "");
>>         }
>>
>>         curl -v -H 'Content-Type: application/json' -H 'Call-ID:
>>         abc12' -d '{"jsonrpc": "2.0", "method":
>>         "dlg.profile_get_size","params":{"accountno": "1234567"},
>>         "id": "0deadb33f"}' http://127.0.0.1:5060/rpc_path/
>>         <http://127.0.0.1:5060/rpc_path/>
>>
>>         I am getting this in respose.
>>
>>          * Hostname was NOT found in DNS cache
>>         *   Trying 127.0.0.1...
>>         * Connected to 127.0.0.1 (127.0.0.1) port 5060 (#0)
>>         > POST /rpc_path/ HTTP/1.1
>>         > User-Agent: curl/7.38.0
>>         > Host: 127.0.0.1:5060 <http://127.0.0.1:5060>
>>         > Accept: */*
>>         > Content-Type: application/json
>>         > Call-ID: abc12
>>         > Content-Length: 106
>>         >
>>         * upload completely sent off: 106 out of 106 bytes
>>         *< HTTP/1.1 404 Profile not found: 1234567*
>>         < Sia: SIP/2.0/TCP 127.0.0.1:49374 <http://127.0.0.1:49374>
>>         < Call-ID: abc12
>>         < Content-Type: application/json
>>         * Server kamailio (4.4.1 (x86_64/linux)) is not blacklisted
>>         < Server: kamailio (4.4.1 (x86_64/linux))
>>         < Content-Length: 106
>>         <
>>         {
>>                 "jsonrpc":      "2.0",
>>                 "error":        {
>>                         "code": -32000,
>>                         "message":      "Execution Error"
>>                 },
>>                 "id":   "0deadb33f"
>>         * Connection #0 to host 127.0.0.1 left intact
>>
>>         Whereas fifo command gives me this. 
>>         root at debian:/usr/local/kamailio/sbin# ./kamctl fifo
>>         profile_get_size accountno 1234567
>>         profile::  name=accountno value=1234567 count=2
>>
>>
>>         Why jsonrpc-s is search for profile 1234567 whereas profile
>>         should be accountno. 
>>
>>         Anyhelp what i am doing wrong here is much appreciated. 
>>
>>         Best Regards. 
>>
>>
>>         _______________________________________________
>>         SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>>         sr-users at lists.sip-router.org
>>         <mailto:sr-users at lists.sip-router.org>
>>         http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>         <http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users>
>
>         -- 
>         Daniel-Constantin Mierla
>         http://twitter.com/#!/miconda <http://twitter.com/#%21/miconda> - http://www.linkedin.com/in/miconda
>         <http://www.linkedin.com/in/miconda>
>         Kamailio Advanced Training, Berlin, Nov 28-30, 2016 - http://www.asipto.com
>
>         _______________________________________________ SIP Express
>         Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>         sr-users at lists.sip-router.org
>         <mailto:sr-users at lists.sip-router.org>
>         http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>         <http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users> 
>
-- 
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio Advanced Training, Berlin, Nov 28-30, 2016 - http://www.asipto.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20161111/fe5ef1dd/attachment.html>


More information about the sr-users mailing list