Module: kamailio
Branch: master
Commit: 7e710287c2b1894f322e9f76cd317d0cae0c4e31
URL:
https://github.com/kamailio/kamailio/commit/7e710287c2b1894f322e9f76cd317d0…
Author: Luis Azedo <luis(a)2600hz.com>
Committer: Luis Azedo <luis(a)2600hz.com>
Date: 2017-03-03T20:05:09Z
kazoo : add specific pua helpers
---
Modified: src/modules/kazoo/kazoo.c
Modified: src/modules/kazoo/kz_pua.c
Modified: src/modules/kazoo/kz_pua.h
---
Diff:
https://github.com/kamailio/kamailio/commit/7e710287c2b1894f322e9f76cd317d0…
Patch:
https://github.com/kamailio/kamailio/commit/7e710287c2b1894f322e9f76cd317d0…
---
diff --git a/src/modules/kazoo/kazoo.c b/src/modules/kazoo/kazoo.c
index ee4213f..bf35a5f 100644
--- a/src/modules/kazoo/kazoo.c
+++ b/src/modules/kazoo/kazoo.c
@@ -138,6 +138,9 @@ static cmd_export_t cmds[] = {
{"kazoo_query", (cmd_function) kz_amqp_query, 4, fixup_kz_amqp,
fixup_kz_amqp_free, ANY_ROUTE},
{"kazoo_query", (cmd_function) kz_amqp_query_ex, 3, fixup_kz_amqp,
fixup_kz_amqp_free, ANY_ROUTE},
{"kazoo_pua_publish", (cmd_function) kz_pua_publish, 1, 0, 0, ANY_ROUTE},
+ {"kazoo_pua_publish_mwi", (cmd_function) kz_pua_publish_mwi, 1, 0, 0,
ANY_ROUTE},
+ {"kazoo_pua_publish_presence", (cmd_function) kz_pua_publish_presence, 1,
0, 0, ANY_ROUTE},
+ {"kazoo_pua_publish_dialoginfo", (cmd_function) kz_pua_publish_dialoginfo,
1, 0, 0, ANY_ROUTE},
{"kazoo_subscribe", (cmd_function) kz_amqp_subscribe, 1, fixup_kz_amqp4,
fixup_kz_amqp4_free, ANY_ROUTE},
{"kazoo_subscribe", (cmd_function) kz_amqp_subscribe_simple, 4,
fixup_kz_amqp4, fixup_kz_amqp4_free, ANY_ROUTE},
diff --git a/src/modules/kazoo/kz_pua.c b/src/modules/kazoo/kz_pua.c
index a16106e..60b89dc 100644
--- a/src/modules/kazoo/kz_pua.c
+++ b/src/modules/kazoo/kz_pua.c
@@ -511,3 +511,80 @@ int kz_pua_publish(struct sip_msg* msg, char *json) {
return ret;
}
+int kz_pua_publish_mwi(struct sip_msg* msg, char *json) {
+ struct json_object *json_obj = NULL;
+ int ret = 1;
+
+ if(dbk_pua_mode != 1) {
+ LM_ERR("pua_mode must be 1 to publish\n");
+ ret = -1;
+ goto error;
+ }
+
+ /* extract info from json and construct xml */
+ json_obj = kz_json_parse(json);
+ if (json_obj == NULL) {
+ ret = -1;
+ goto error;
+ }
+
+ ret = kz_pua_publish_mwi_to_presentity(json_obj);
+
+error:
+ if(json_obj)
+ json_object_put(json_obj);
+
+ return ret;
+}
+
+int kz_pua_publish_presence(struct sip_msg* msg, char *json) {
+ struct json_object *json_obj = NULL;
+ int ret = 1;
+
+ if(dbk_pua_mode != 1) {
+ LM_ERR("pua_mode must be 1 to publish\n");
+ ret = -1;
+ goto error;
+ }
+
+ /* extract info from json and construct xml */
+ json_obj = kz_json_parse(json);
+ if (json_obj == NULL) {
+ ret = -1;
+ goto error;
+ }
+
+ ret = kz_pua_publish_presence_to_presentity(json_obj);
+
+error:
+ if(json_obj)
+ json_object_put(json_obj);
+
+ return ret;
+}
+
+int kz_pua_publish_dialoginfo(struct sip_msg* msg, char *json) {
+ struct json_object *json_obj = NULL;
+ int ret = 1;
+
+ if(dbk_pua_mode != 1) {
+ LM_ERR("pua_mode must be 1 to publish\n");
+ ret = -1;
+ goto error;
+ }
+
+ /* extract info from json and construct xml */
+ json_obj = kz_json_parse(json);
+ if (json_obj == NULL) {
+ ret = -1;
+ goto error;
+ }
+
+ ret = kz_pua_publish_dialoginfo_to_presentity(json_obj);
+
+error:
+ if(json_obj)
+ json_object_put(json_obj);
+
+ return ret;
+}
diff --git a/src/modules/kazoo/kz_pua.h b/src/modules/kazoo/kz_pua.h
index 2e6fbdd..47e16f6 100644
--- a/src/modules/kazoo/kz_pua.h
+++ b/src/modules/kazoo/kz_pua.h
@@ -27,6 +27,9 @@
int kz_initialize_pua();
int kz_pua_publish(struct sip_msg* msg, char *json);
+int kz_pua_publish_mwi(struct sip_msg* msg, char *json);
+int kz_pua_publish_presence(struct sip_msg* msg, char *json);
+int kz_pua_publish_dialoginfo(struct sip_msg* msg, char *json);
#endif