[sr-dev] [kamailio/kamailio] json_pua: new module (#1408)

Emmanuel Schmidbauer notifications at github.com
Wed Jan 24 13:49:47 CET 2018


this module adds a new function `json_pua_publish()` which allows json data objects to be parsed and inserted into the presentity table. 
the function is borrowed from the nsq and kazoo modules. it allows presence to be controlled without loading the nsq or kazoo modules. 
this can be quite powerful as it will allow users to control presence by sending http json data objects to kamailio, for example:
```
event_route[xhttp:request] {
    $var(call-id) = $(rb{json.parse,Call-ID});
    if ($(rb{json.parse,Event-Package}) == "dialog") {
            json_pua_publish($rb);
            pres_refresh_watchers("$(rb{json.parse,From})", "$(rb{json.parse,Event-Package})", 1);
    }
    xhttp_reply("200", "OK", "text/html", "$rb");
}
```

example curl request to send presence update:
```
curl -d '{"Call-ID":"user01 at my.domain.io","Event-Category":"presence","Event-Name":"update","Event-Package":"dialog","Expires":"3600","From":"sip:user01 at my.domain.io","From-User":"user01","From-Realm":"my.domain.io","To":"sip:park+6003 at my.domain.io","To-User":"park+6003","To-Realm":"my.domain.io","State":"confirmed"}' http://localhost:8080/presence/
```
You can view, comment on, or merge this pull request online at:

  https://github.com/kamailio/kamailio/pull/1408

-- Commit Summary --

  * json_pua: new module

-- File Changes --

    M src/modules/json/json_funcs.c (33)
    M src/modules/json/json_funcs.h (35)
    A src/modules/json_pua/Makefile (20)
    A src/modules/json_pua/README (0)
    A src/modules/json_pua/defs.h (130)
    A src/modules/json_pua/doc/Makefile (4)
    A src/modules/json_pua/doc/json_pua.xml (37)
    A src/modules/json_pua/doc/json_pua_admin.xml (170)
    A src/modules/json_pua/json_pua_mod.c (125)
    A src/modules/json_pua/json_pua_mod.h (50)
    A src/modules/json_pua/json_pua_publish.c (538)
    A src/modules/json_pua/json_pua_publish.h (32)

-- Patch Links --

https://github.com/kamailio/kamailio/pull/1408.patch
https://github.com/kamailio/kamailio/pull/1408.diff

-- 
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/pull/1408
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20180124/3a5e2f74/attachment.html>


More information about the sr-dev mailing list