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

Author: gabrielgontariu <114484712+gabrielgonta...@users.noreply.github.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2025-05-27T09:31:56+02:00

dialog: Kemi export dlg_req_within

---

Modified: src/modules/dialog/dialog.c

---

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

---

diff --git a/src/modules/dialog/dialog.c b/src/modules/dialog/dialog.c
index 4539d1657e2..36af6f54404 100644
--- a/src/modules/dialog/dialog.c
+++ b/src/modules/dialog/dialog.c
@@ -2615,6 +2615,27 @@ static int ki_dlg_var_is_null(sip_msg_t *msg, str *name)
        return -1;
 }
 
+/**
+ *
+ */
+static int ki_dlg_req_within4(struct sip_msg *msg, str *side, str *method,
+               str *content_type, str *content)
+{
+       int n = 0;
+       if(side && side->len > 0) {
+               if(side->len == 6 && strncasecmp(side->s, "caller", 6) == 0) {
+                       n = 1;
+               } else if(side->len == 6 && strncasecmp(side->s, "callee", 6) 
== 0) {
+                       n = 2;
+               } else {
+                       return -1;
+               }
+       }
+
+       return ki_dlg_req_with_headers_and_content(
+                       msg, n, method, NULL, content_type, content);
+}
+
 /**
  *
  */
@@ -2780,6 +2801,11 @@ static sr_kemi_t sr_kemi_dialog_exports[] = {
                { SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_STR,
                        SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
        },
+       { str_init("dialog"), str_init("dlg_req_within4"),
+               SR_KEMIP_INT, ki_dlg_req_within4,
+               { SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_STR,
+                       SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE }
+       },
 
        { {0, 0}, {0, 0}, 0, NULL, { 0, 0, 0, 0, 0, 0 } }
 };

_______________________________________________
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