Module: kamailio
Branch: master
Commit: d9dd2abeb82be8b992ddf534864b6d84594b7a47
URL:
https://github.com/kamailio/kamailio/commit/d9dd2abeb82be8b992ddf534864b6d8…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2020-08-20T16:16:56+02:00
core: kemi - exported core route function
---
Modified: src/core/kemi.c
---
Diff:
https://github.com/kamailio/kamailio/commit/d9dd2abeb82be8b992ddf534864b6d8…
Patch:
https://github.com/kamailio/kamailio/commit/d9dd2abeb82be8b992ddf534864b6d8…
---
diff --git a/src/core/kemi.c b/src/core/kemi.c
index 3cbeee6d08..6ca519e804 100644
--- a/src/core/kemi.c
+++ b/src/core/kemi.c
@@ -1482,6 +1482,41 @@ static int sr_kemi_core_get_debug(sip_msg_t *msg)
return get_cfg_debug_level();
}
+/**
+ *
+ */
+static int sr_kemi_core_route(sip_msg_t *msg, str *route)
+{
+ run_act_ctx_t tctx;
+ run_act_ctx_t *pctx = NULL;
+ int rtid = -1;
+ int ret = 0;
+
+ if(route == NULL || route->s == NULL) {
+ return -1;
+ }
+
+ rtid = route_lookup(&main_rt, route->s);
+ if (rtid < 0) {
+ return -1;
+ }
+
+ if(_sr_kemi_act_ctx != NULL) {
+ pctx = _sr_kemi_act_ctx;
+ } else {
+ init_run_actions_ctx(&tctx);
+ pctx = &tctx;
+ }
+
+ ret=run_actions(pctx, main_rt.rlist[rtid], msg);
+
+ if (pctx->run_flags & EXIT_R_F) {
+ return 0;
+ }
+
+ return ret;
+}
+
/**
*
*/
@@ -1881,6 +1916,11 @@ static sr_kemi_t _sr_kemi_core[] = {
{ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE,
SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
},
+ { str_init(""), str_init("route"),
+ SR_KEMIP_INT, sr_kemi_core_route,
+ { SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE,
+ SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
+ },
{ {0, 0}, {0, 0}, 0, NULL, { 0, 0, 0, 0, 0, 0 } }
};