[sr-dev] [kamailio/kamailio] pua_json for KEMI framework (#2783)

Zhan Bazarov notifications at github.com
Wed Jun 16 11:54:09 CEST 2021


<!--
Kamailio Project uses GitHub Issues only for bugs in the code or feature requests. Please use this template only for feature requests.

If you have questions about using Kamailio or related to its configuration file, ask on sr-users mailing list:

  * http://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

If you have questions about developing extensions to Kamailio or its existing C code, ask on sr-dev mailing list:

  * http://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev

Please try to fill this template as much as possible for any issue. It helps the developers to troubleshoot the issue.

If you submit a feature request (or enhancement) add the description of what you would like to be added.

If there is no content to be filled in a section, the entire section can be removed.

You can delete the comments from the template sections when filling.

You can delete next line and everything above before submitting (it is a comment).
-->

 Hello everyone, is module pua_json going to be implemented for KEMI framework?
 I've tried to use KSR.x.modf("pua_json_publish", "json_here") and I'm getting error

### python code
```
    def ksr_xhttp_event(self, evmsg, evname):
        if evname == "xhttp:request":
            try:
                KSR.err("===== xhttp module triggered event: " + evname + "\n")
                if "/presence" in KSR.pv.get("$hu"):
                    rb = json.loads(KSR.kx.get_body())
                    if rb["Event-Package"] == "message-summary":
                        KSR.info("request received- " + rb["Call-ID"] + "update for: " + rb[
                            "From"] + "request body: " + json.dumps(rb) + "\n")
                        KSR.x.modf("pua_json_publish", json.dumps(rb));
                        KSR.xhttp.xhttp_reply(200, "OK", "text/html", "<html><body>Entity state updated</body></html>")
                        return 1
                if "/RCP" in KSR.pv.get("$hu"):
                    KSR.jsonrpcs.dispatch()
                    return 1
                else:
                    KSR.xhttp.xhttp_reply(200, "OK", "text/html", "<html><body>Wrong URL</body></html>")
                return 1
            except:
                KSR.err("===== unsupported " + evname + "\n")
                return -255
```

#### Debugging Data

```
 app_python [python_support.c:154]: python_handle_exception(): apy_exec: ksr_xhttp_event(xhttp:request): Unhandled exception in the Python code:
RuntimeError: self is NULL
```


  * **Kamailio Version** - output of `kamailio -v`

```
version: kamailio 5.4.5 (x86_64/linux) c46342
flags: USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES, TLS_PTHREAD_MUTEX_SHARED
ADAPTIVE_WAIT_LOOPS 1024, MAX_RECV_BUFFER_SIZE 262144, MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: c46342
compiled on 14:37:00 Apr 27 2021 with gcc 7.5.0
```

* **Operating System**:

<!--
Details about the operating system, the type: Linux (e.g.,: Debian 8.4, Ubuntu 16.04, CentOS 7.1, ...), MacOS, xBSD, Solaris, ...;
Kernel details (output of `uname -a`)
-->

```
Linux ip-10-199-240-110 4.15.0-1057-aws #59-Ubuntu SMP Wed Dec 4 10:02:00 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
```


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/2783
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20210616/7a58b736/attachment-0001.htm>


More information about the sr-dev mailing list