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

Author: Daniel-Constantin Mierla <mico...@gmail.com>
Committer: Daniel-Constantin Mierla <mico...@gmail.com>
Date: 2016-11-14T10:42:49+01:00

app_python: extended kemi implementation to support routing function parameter

---

Modified: modules/app_python/apy_kemi.c
Modified: modules/app_python/apy_kemi.h

---

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

---

diff --git a/modules/app_python/apy_kemi.c b/modules/app_python/apy_kemi.c
index fd4ed7f..859bebc 100644
--- a/modules/app_python/apy_kemi.c
+++ b/modules/app_python/apy_kemi.c
@@ -39,13 +39,19 @@
 /**
  *
  */
-int sr_kemi_config_engine_python(sip_msg_t *msg, int rtype, str *rname)
+int sr_kemi_config_engine_python(sip_msg_t *msg, int rtype, str *rname,
+               str *rparam)
 {
        int ret;
 
        ret = -1;
        if(rtype==REQUEST_ROUTE) {
-               ret = apy_exec(msg, "ksr_request_route", NULL, 1);
+               if(rname!=NULL && rname->s!=NULL) {
+                       ret = apy_exec(msg, rname->s,
+                                       (rparam && rparam->s)?rparam->s:NULL, 
0);
+               } else {
+                       ret = apy_exec(msg, "ksr_request_route", NULL, 1);
+               }
        } else if(rtype==CORE_ONREPLY_ROUTE) {
                ret = apy_exec(msg, "ksr_reply_route", NULL, 0);
        } else if(rtype==BRANCH_ROUTE) {
@@ -68,7 +74,8 @@ int sr_kemi_config_engine_python(sip_msg_t *msg, int rtype, 
str *rname)
                ret = apy_exec(msg, "ksr_onsend_route", NULL, 0);
        } else if(rtype==EVENT_ROUTE) {
                if(rname!=NULL && rname->s!=NULL) {
-                       ret = apy_exec(msg, rname->s, NULL, 0);
+                       ret = apy_exec(msg, rname->s,
+                                       (rparam && rparam->s)?rparam->s:NULL, 
0);
                }
        } else {
                if(rname!=NULL) {
diff --git a/modules/app_python/apy_kemi.h b/modules/app_python/apy_kemi.h
index 8840cd2..e34cdf5 100644
--- a/modules/app_python/apy_kemi.h
+++ b/modules/app_python/apy_kemi.h
@@ -27,7 +27,8 @@
 
 int sr_apy_init_ksr(void);
 void sr_apy_destroy_ksr(void);
-int sr_kemi_config_engine_python(sip_msg_t *msg, int rtype, str *rname);
+int sr_kemi_config_engine_python(sip_msg_t *msg, int rtype, str *rname,
+               str *rparam);
 
 PyObject *sr_apy_kemi_exec_func(PyObject *self, PyObject *args, int idx);
 


_______________________________________________
sr-dev mailing list
sr-dev@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

Reply via email to