Module: kamailio
Branch: master
Commit: dd0812196cede94aeea01f9c67ffe363a38ca100
URL: 
https://github.com/kamailio/kamailio/commit/dd0812196cede94aeea01f9c67ffe363a38ca100

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2024-11-26T12:58:40+01:00

async: exported async_tkv_emit() function

---

Modified: src/modules/async/async_mod.c

---

Diff:  
https://github.com/kamailio/kamailio/commit/dd0812196cede94aeea01f9c67ffe363a38ca100.diff
Patch: 
https://github.com/kamailio/kamailio/commit/dd0812196cede94aeea01f9c67ffe363a38ca100.patch

---

diff --git a/src/modules/async/async_mod.c b/src/modules/async/async_mod.c
index bd31880064f..5353082359f 100644
--- a/src/modules/async/async_mod.c
+++ b/src/modules/async/async_mod.c
@@ -63,6 +63,9 @@ static int w_async_task_group_data(
                sip_msg_t *msg, char *rt, char *gr, char *pdata);
 static int fixup_async_task_route(void **param, int param_no);
 
+static int w_async_tkv_emit(
+               sip_msg_t *msg, char *ptype, char *pkey, char *pval);
+
 /* tm */
 struct tm_binds tmb;
 
@@ -84,6 +87,8 @@ static cmd_export_t cmds[]={
                0, ANY_ROUTE},
        {"async_task_group_data", (cmd_function)w_async_task_group_data, 3, 
fixup_async_task_route,
                0, ANY_ROUTE},
+       {"async_tkv_emit", (cmd_function)w_async_tkv_emit, 3, fixup_iss,
+               fixup_free_iss, ANY_ROUTE},
 
        {0, 0, 0, 0, 0, 0}
 };
@@ -644,6 +649,34 @@ static int w_async_task_group_data(
        return ki_async_task_group_data(msg, &rn, &gn, &sdata);
 }
 
+/**
+ *
+ */
+static int w_async_tkv_emit(sip_msg_t *msg, char *ptype, char *pkey, char 
*pval)
+{
+       int ret = -1;
+       int vtype = 0;
+       str skey = STR_NULL;
+       str sval = STR_NULL;
+
+       if(fixup_get_ivalue(msg, (gparam_t *)ptype, &vtype) != 0) {
+               LM_ERR("failed getting type parameter\n");
+               return -1;
+       }
+       if(fixup_get_svalue(msg, (gparam_t *)pkey, &skey) != 0) {
+               LM_ERR("failed getting key parameter\n");
+               return -1;
+       }
+       if(fixup_get_svalue(msg, (gparam_t *)pval, &sval) != 0) {
+               LM_ERR("failed getting value parameter\n");
+               return -1;
+       }
+
+       ret = async_tkv_emit(vtype, skey.s, "%s", sval.s);
+
+       return (ret == 0) ? 1 : ret;
+}
+
 /**
  *
  */

_______________________________________________
Kamailio - Development Mailing List -- sr-dev@lists.kamailio.org
To unsubscribe send an email to sr-dev-le...@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the 
sender!

Reply via email to