Module: kamailio
Branch: master
Commit: 781a53d3ed3e5e7e4b574c15e6d58db0a2ead376
URL:
https://github.com/kamailio/kamailio/commit/781a53d3ed3e5e7e4b574c15e6d58db…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2023-09-20T12:05:11+02:00
core: kemi - parameter for request route callback function name
- it can be set with: kemi.request_route_callback
- default: ksr_request_route
---
Modified: src/core/cfg.lex
Modified: src/core/cfg.y
Modified: src/core/kemi.c
Modified: src/core/kemi.h
---
Diff:
https://github.com/kamailio/kamailio/commit/781a53d3ed3e5e7e4b574c15e6d58db…
Patch:
https://github.com/kamailio/kamailio/commit/781a53d3ed3e5e7e4b574c15e6d58db…
---
diff --git a/src/core/cfg.lex b/src/core/cfg.lex
index 2151e7f88bd..9e338606c20 100644
--- a/src/core/cfg.lex
+++ b/src/core/cfg.lex
@@ -486,6 +486,7 @@ WAIT_WORKER1_TIME "wait_worker1_time"
WAIT_WORKER1_USLEEP "wait_worker1_usleep"
KEMI "kemi"
+REQUEST_ROUTE_CALLBACK "request_route_callback"
ONSEND_ROUTE_CALLBACK "onsend_route_callback"
REPLY_ROUTE_CALLBACK "reply_route_callback"
EVENT_ROUTE_CALLBACK "event_route_callback"
@@ -1032,6 +1033,7 @@ IMPORTFILE "import_file"
<INITIAL>{WAIT_WORKER1_USLEEP} { count(); yylval.strval=yytext; return
WAIT_WORKER1_USLEEP; }
<INITIAL>{SERVER_ID} { count(); yylval.strval=yytext; return SERVER_ID;}
<INITIAL>{KEMI} { count(); yylval.strval=yytext; return KEMI;}
+<INITIAL>{REQUEST_ROUTE_CALLBACK} { count(); yylval.strval=yytext; return
REQUEST_ROUTE_CALLBACK;}
<INITIAL>{REPLY_ROUTE_CALLBACK} { count(); yylval.strval=yytext; return
REPLY_ROUTE_CALLBACK;}
<INITIAL>{ONSEND_ROUTE_CALLBACK} { count(); yylval.strval=yytext; return
ONSEND_ROUTE_CALLBACK;}
<INITIAL>{EVENT_ROUTE_CALLBACK} { count(); yylval.strval=yytext; return
EVENT_ROUTE_CALLBACK;}
diff --git a/src/core/cfg.y b/src/core/cfg.y
index 45e2000fe59..f05eadb73be 100644
--- a/src/core/cfg.y
+++ b/src/core/cfg.y
@@ -518,6 +518,7 @@ extern char *default_routename;
%token CFG_DESCRIPTION
%token SERVER_ID
%token KEMI
+%token REQUEST_ROUTE_CALLBACK
%token ONSEND_ROUTE_CALLBACK
%token REPLY_ROUTE_CALLBACK
%token EVENT_ROUTE_CALLBACK
@@ -1912,6 +1913,14 @@ assign_stm:
| SERVER_ID EQUAL error { yyerror("number expected"); }
| RETURN_MODE EQUAL NUMBER { ksr_return_mode=$3; }
| RETURN_MODE EQUAL error { yyerror("number expected"); }
+ | KEMI DOT REQUEST_ROUTE_CALLBACK EQUAL STRING {
+ kemi_request_route_callback.s = $5;
+ kemi_request_route_callback.len = strlen($5);
+ if(kemi_request_route_callback.len==0) {
+ yyerror("empty name for request route callback function");
+ }
+ }
+ | KEMI DOT REQUEST_ROUTE_CALLBACK EQUAL error { yyerror("string expected"); }
| KEMI DOT ONSEND_ROUTE_CALLBACK EQUAL STRING {
kemi_onsend_route_callback.s = $5;
kemi_onsend_route_callback.len = strlen($5);
diff --git a/src/core/kemi.c b/src/core/kemi.c
index fccb5268873..8bf0aacb45f 100644
--- a/src/core/kemi.c
+++ b/src/core/kemi.c
@@ -47,6 +47,7 @@
#define SR_KEMI_HNAME_SIZE 128
/* names for kemi callback functions */
+str kemi_request_route_callback = str_init("ksr_request_route");
str kemi_onsend_route_callback = str_init("ksr_onsend_route");
str kemi_reply_route_callback = str_init("ksr_reply_route");
str kemi_event_route_callback = str_init("");
diff --git a/src/core/kemi.h b/src/core/kemi.h
index fd06f4f1cb4..2797d645f01 100644
--- a/src/core/kemi.h
+++ b/src/core/kemi.h
@@ -41,6 +41,7 @@
#define SR_KEMI_PARAMS_MAX 6
+extern str kemi_request_route_callback;
extern str kemi_onsend_route_callback;
extern str kemi_reply_route_callback;
extern str kemi_event_route_callback;