[sr-dev] git:master:c17f410e: app_lua: extended kemi implementation to support routing function parameter

Daniel-Constantin Mierla miconda at gmail.com
Mon Nov 14 10:56:00 CET 2016


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2016-11-14T10:42:15+01:00

app_lua: extended kemi implementation to support routing function parameter

---

Modified: modules/app_lua/app_lua_mod.c

---

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

---

diff --git a/modules/app_lua/app_lua_mod.c b/modules/app_lua/app_lua_mod.c
index fea80bb..84bb0cd 100644
--- a/modules/app_lua/app_lua_mod.c
+++ b/modules/app_lua/app_lua_mod.c
@@ -108,13 +108,19 @@ struct module_exports exports = {
 /**
  *
  */
-int sr_kemi_config_engine_lua(sip_msg_t *msg, int rtype, str *rname)
+int sr_kemi_config_engine_lua(sip_msg_t *msg, int rtype, str *rname,
+		str *rparam)
 {
 	int ret;
 
 	ret = -1;
 	if(rtype==REQUEST_ROUTE) {
-		ret = app_lua_run_ex(msg, "ksr_request_route", NULL, NULL, NULL, 1);
+		if(rname!=NULL && rname->s!=NULL) {
+			ret = app_lua_run_ex(msg, rname->s,
+					(rparam && rparam->s)?rparam->s:NULL, NULL, NULL, 0);
+		} else {
+			ret = app_lua_run_ex(msg, "ksr_request_route", NULL, NULL, NULL, 1);
+		}
 	} else if(rtype==CORE_ONREPLY_ROUTE) {
 		ret = app_lua_run_ex(msg, "ksr_reply_route", NULL, NULL, NULL, 0);
 	} else if(rtype==BRANCH_ROUTE) {
@@ -137,7 +143,8 @@ int sr_kemi_config_engine_lua(sip_msg_t *msg, int rtype, str *rname)
 		ret = app_lua_run_ex(msg, "ksr_onsend_route", NULL, NULL, NULL, 0);
 	} else if(rtype==EVENT_ROUTE) {
 		if(rname!=NULL && rname->s!=NULL) {
-			ret = app_lua_run_ex(msg, rname->s, NULL, NULL, NULL, 0);
+			ret = app_lua_run_ex(msg, rname->s,
+					(rparam && rparam->s)?rparam->s:NULL, NULL, NULL, 0);
 		}
 	} else {
 		if(rname!=NULL) {




More information about the sr-dev mailing list