From 404e1e1de066e86ff0f99cb1546af4400d92eef9 Mon Sep 17 00:00:00 2001 From: Daniel-Constantin Mierla Date: Mon, 14 Nov 2016 10:42:49 +0100 Subject: [PATCH] app_python: extended kemi implementation to support routing function parameter --- modules/app_python/apy_kemi.c | 13 ++++++++++--- modules/app_python/apy_kemi.h | 3 ++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/modules/app_python/apy_kemi.c b/modules/app_python/apy_kemi.c index fd4ed7ff3ab..859bebc8943 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 8840cd2302c..e34cdf5e992 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);