Hello!

Are you able to generate PUBLISH message with jsonrpcs? I can only do it with xmlrpc. Kamailio version is 5.2.1.

When I use jsonrpc:
# curl -H "Content-Type: application/json" -X POST -d '{"jsonrpc": "2.0", "method": "pua.publish", "params": {"presentity_uri": "sip:jh@test.tutpro.com", "expires": "600", "event package": "message-summary", "content type": "application/simple-message-summary", "id": ".", "ETag": ".", "outbound proxy": "sip:127.0.0.1:5060;transport=udp", "extra_headers": "P-Flags: 0", "body": "."}}' http://172.16.30.151:5060/JSON_RPC
I get:
{
        "jsonrpc":      "2.0",
        "error":        {
                "code": 500,
                "message":      "Internal error: failed to create context"
        }

Debug output:
Jan 21 19:37:58 test kamailio: 13(25583) DEBUG: <script>: == TRACE. xhttp:request
Jan 21 19:37:58 test kamailio: 13(25583) DEBUG: <script>: == TRACE. xhttp:request. /JSON_RPC
Jan 21 19:37:58 test kamailio: 13(25583) DEBUG: <core> [core/parser/msg_parser.c:185]: get_hdr_field(): content_length=329
Jan 21 19:37:58 test kamailio: 13(25583) DEBUG: <core> [core/parser/msg_parser.c:89]: get_hdr_field(): found end of header
Jan 21 19:37:58 test kamailio: 13(25583) DEBUG: pua_rpc [pua_rpc.c:155]: pua_rpc_publish_mode(): rpc publishing ...
Jan 21 19:37:58 test kamailio: 13(25583) DEBUG: pua_rpc [pua_rpc.c:178]: pua_rpc_publish_mode(): presentity uri 'sip:jh@test.tutpro.com'
Jan 21 19:37:58 test kamailio: 13(25583) DEBUG: pua_rpc [pua_rpc.c:193]: pua_rpc_publish_mode(): expires '600'
Jan 21 19:37:58 test kamailio: 13(25583) DEBUG: pua_rpc [pua_rpc.c:195]: pua_rpc_publish_mode(): event 'message-summary'
Jan 21 19:37:58 test kamailio: 13(25583) DEBUG: pua_rpc [pua_rpc.c:197]: pua_rpc_publish_mode(): content type 'application/simple-message-summary'
Jan 21 19:37:58 test kamailio: 13(25583) DEBUG: pua_rpc [pua_rpc.c:199]: pua_rpc_publish_mode(): id '.'
Jan 21 19:37:58 test kamailio: 13(25583) DEBUG: pua_rpc [pua_rpc.c:201]: pua_rpc_publish_mode(): ETag '.'
Jan 21 19:37:58 test kamailio: 13(25583) DEBUG: pua_rpc [pua_rpc.c:203]: pua_rpc_publish_mode(): outbound_proxy 'sip:127.0.0.1:5060;transport=udp'
Jan 21 19:37:58 test kamailio: 13(25583) DEBUG: pua_rpc [pua_rpc.c:205]: pua_rpc_publish_mode(): extra headers 'P-Flags: 0'
Jan 21 19:37:58 test kamailio: 13(25583) DEBUG: pua_rpc [pua_rpc.c:207]: pua_rpc_publish_mode(): body '.'
Jan 21 19:37:58 test kamailio: 13(25583) ERROR: jsonrpcs [jsonrpcs_mod.c:1010]: jsonrpc_delayed_ctx_new(): id attribute is missing
Jan 21 19:37:58 test kamailio: 13(25583) ERROR: pua_rpc [pua_rpc.c:256]: pua_rpc_publish_mode(): internal error: failed to create context
Jan 21 19:37:58 test kamailio: 13(25583) DEBUG: jsonrpcs [jsonrpcs_mod.c:423]: jsonrpc_send(): sending response with body: 0x7fffc28e6e80 - 500 Internal error: failed to create context
Jan 21 19:37:58 test kamailio: 13(25583) DEBUG: xhttp [xhttp_mod.c:429]: xhttp_send_reply(): response with content-type: application/json
Jan 21 19:37:58 test kamailio: 13(25583) DEBUG: xhttp [xhttp_mod.c:439]: xhttp_send_reply(): response with body: {
Jan 21 19:37:58 test kamailio: "jsonrpc":#011"2.0",
Jan 21 19:37:58 test kamailio: "error":#011{
Jan 21 19:37:58 test kamailio: "code":#011500,
Jan 21 19:37:58 test kamailio: "message":#011"Internal error: failed to create context"
Jan 21 19:37:58 test kamailio: }
Jan 21 19:37:58 test kamailio: }
Jan 21 19:37:58 test kamailio: 13(25583) DEBUG: xhttp [xhttp_mod.c:441]: xhttp_send_reply(): sending out response: 500 Internal error: failed to create context
Jan 21 19:37:58 test kamailio: 13(25583) DEBUG: <core> [core/msg_translator.c:162]: check_via_address(): (172.16.30.151, 172.16.30.151, 0)
Jan 21 19:37:58 test kamailio: 13(25583) DEBUG: <core> [core/tcp_main.c:2226]: tcpconn_send_put(): send from reader (25583 (13)), reusing fd
Jan 21 19:37:58 test kamailio: 13(25583) DEBUG: <core> [core/tcp_main.c:2460]: tcpconn_do_send(): sending...
Jan 21 19:37:58 test kamailio: 13(25583) DEBUG: <core> [core/tcp_main.c:2494]: tcpconn_do_send(): after real write: c= 0x7f7af5a39888 n=297 fd=8
Jan 21 19:37:58 test kamailio: 13(25583) DEBUG: <core> [core/tcp_main.c:2495]: tcpconn_do_send(): buf=
Jan 21 19:37:58 test kamailio: HTTP/1.1 500 Internal error: failed to create context
Jan 21 19:37:58 test kamailio: Sia: SIP/2.0/TCP 172.16.30.151:44122
Jan 21 19:37:58 test kamailio: Content-Type: application/json
Jan 21 19:37:58 test kamailio: Server: kamailio (5.2.1 (x86_64/linux))
Jan 21 19:37:58 test kamailio: Content-Length: 108
Jan 21 19:37:58 test kamailio: {
Jan 21 19:37:58 test kamailio: "jsonrpc":#011"2.0",
Jan 21 19:37:58 test kamailio: "error":#011{
Jan 21 19:37:58 test kamailio: "code":#011500,
Jan 21 19:37:58 test kamailio: "message":#011"Internal error: failed to create context"
Jan 21 19:37:58 test kamailio: }
Jan 21 19:37:58 test kamailio: }

Thanks!

пн, 17 вер. 2018 о 09:18 Juha Heinanen <jh@tutpro.com> пише:
willy writes:

> Have anyone tried to use pua.publish to send MWI notification? Can it
> work at all?
>
> I'm sending request through jsonrpc server, but it is not dispatched by
> handle_publish.

It works fine here.  Last week I noticed an issue with pua.publish over
jsonrpc and it was fixed.  Even before the fix, pua.publish worked, but
an error message was issued.

-- Juha

_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users@lists.kamailio.org
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users