kamailio.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
List overview
Download
sr-dev
April 2016
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
sr-dev@lists.kamailio.org
23 participants
430 discussions
Start a n
N
ew thread
git:master:f2c03790: tm: lookup if kemi engine is set for onreply_route callback
by Daniel-Constantin Mierla
Module: kamailio Branch: master Commit: f2c03790c4e7ec1976cb20ca06132eef0b4baa65 URL:
https://github.com/kamailio/kamailio/commit/f2c03790c4e7ec1976cb20ca06132ee…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2016-04-14T21:23:15+02:00 tm: lookup if kemi engine is set for onreply_route callback --- Modified: modules/tm/t_reply.c --- Diff:
https://github.com/kamailio/kamailio/commit/f2c03790c4e7ec1976cb20ca06132ee…
Patch:
https://github.com/kamailio/kamailio/commit/f2c03790c4e7ec1976cb20ca06132ee…
--- diff --git a/modules/tm/t_reply.c b/modules/tm/t_reply.c index dececd8..2fa3620 100644 --- a/modules/tm/t_reply.c +++ b/modules/tm/t_reply.c @@ -2341,6 +2341,7 @@ int reply_received( struct sip_msg *p_msg ) /* Pre- and post-script callbacks have already * been executed by the core. (Miklos) */ + keng = sr_kemi_eng_get(); if(unlikely(keng!=NULL)) { bctx = sr_kemi_act_ctx_get(); init_run_actions_ctx(&ctx);
8 years, 8 months
1
0
0
0
git:master:187a2960: app_lua: backup and restore the sip msg structure in lua env
by Daniel-Constantin Mierla
Module: kamailio Branch: master Commit: 187a29601037820fe79f18069caf5032c9a297c6 URL:
https://github.com/kamailio/kamailio/commit/187a29601037820fe79f18069caf503…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2016-04-14T18:45:44+02:00 app_lua: backup and restore the sip msg structure in lua env - nested execution of callbacks can happen (e.g., branch route callback executed inside the request_route callback) --- Modified: modules/app_lua/app_lua_api.c --- Diff:
https://github.com/kamailio/kamailio/commit/187a29601037820fe79f18069caf503…
Patch:
https://github.com/kamailio/kamailio/commit/187a29601037820fe79f18069caf503…
--- diff --git a/modules/app_lua/app_lua_api.c b/modules/app_lua/app_lua_api.c index 5a603df..ca1dee3 100644 --- a/modules/app_lua/app_lua_api.c +++ b/modules/app_lua/app_lua_api.c @@ -549,13 +549,15 @@ int app_lua_return_true(lua_State *L) /** * */ -int app_lua_dostring(struct sip_msg *msg, char *script) +int app_lua_dostring(sip_msg_t *msg, char *script) { int ret; char *txt; + sip_msg_t *bmsg; LM_DBG("executing Lua string: [[%s]]\n", script); LM_DBG("lua top index is: %d\n", lua_gettop(_sr_L_env.L)); + bmsg = _sr_L_env.msg; _sr_L_env.msg = msg; ret = luaL_dostring(_sr_L_env.L, script); if(ret!=0) @@ -564,20 +566,22 @@ int app_lua_dostring(struct sip_msg *msg, char *script) LM_ERR("error from Lua: %s\n", (txt)?txt:"unknown"); lua_pop (_sr_L_env.L, 1); } - _sr_L_env.msg = 0; + _sr_L_env.msg = bmsg; return (ret==0)?1:-1; } /** * */ -int app_lua_dofile(struct sip_msg *msg, char *script) +int app_lua_dofile(sip_msg_t *msg, char *script) { int ret; char *txt; + sip_msg_t *bmsg; LM_DBG("executing Lua file: [[%s]]\n", script); LM_DBG("lua top index is: %d\n", lua_gettop(_sr_L_env.L)); + bmsg = _sr_L_env.msg; _sr_L_env.msg = msg; ret = luaL_dofile(_sr_L_env.L, script); if(ret!=0) @@ -586,17 +590,18 @@ int app_lua_dofile(struct sip_msg *msg, char *script) LM_ERR("error from Lua: %s\n", (txt)?txt:"unknown"); lua_pop(_sr_L_env.L, 1); } - _sr_L_env.msg = 0; + _sr_L_env.msg = bmsg; return (ret==0)?1:-1; } /** * */ -int app_lua_runstring(struct sip_msg *msg, char *script) +int app_lua_runstring(sip_msg_t *msg, char *script) { int ret; char *txt; + sip_msg_t *bmsg; if(_sr_L_env.LL==NULL) { @@ -606,6 +611,7 @@ int app_lua_runstring(struct sip_msg *msg, char *script) LM_DBG("running Lua string: [[%s]]\n", script); LM_DBG("lua top index is: %d\n", lua_gettop(_sr_L_env.LL)); + bmsg = _sr_L_env.msg; _sr_L_env.msg = msg; ret = luaL_dostring(_sr_L_env.LL, script); if(ret!=0) @@ -614,7 +620,7 @@ int app_lua_runstring(struct sip_msg *msg, char *script) LM_ERR("error from Lua: %s\n", (txt)?txt:"unknown"); lua_pop (_sr_L_env.LL, 1); } - _sr_L_env.msg = 0; + _sr_L_env.msg = bmsg; return (ret==0)?1:-1; } @@ -627,6 +633,7 @@ int app_lua_run_ex(sip_msg_t *msg, char *func, char *p1, char *p2, int n; int ret; char *txt; + sip_msg_t *bmsg; if(_sr_L_env.LL==NULL) { @@ -676,9 +683,10 @@ int app_lua_run_ex(sip_msg_t *msg, char *func, char *p1, char *p2, } } } + bmsg = _sr_L_env.msg; _sr_L_env.msg = msg; ret = lua_pcall(_sr_L_env.LL, n, 0, 0); - _sr_L_env.msg = 0; + _sr_L_env.msg = bmsg; if(ret!=0) { LM_ERR("error executing: %s (err: %d)\n", func, ret);
8 years, 8 months
1
0
0
0
git:master:f1f0aad7: core: kemi - callbacks cache index stored in shared memory
by Daniel-Constantin Mierla
Module: kamailio Branch: master Commit: f1f0aad765fbb09e9cc50bdc177fa75bc6ee0197 URL:
https://github.com/kamailio/kamailio/commit/f1f0aad765fbb09e9cc50bdc177fa75…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2016-04-14T18:38:05+02:00 core: kemi - callbacks cache index stored in shared memory - reloads can change the values --- Modified: kemi.c --- Diff:
https://github.com/kamailio/kamailio/commit/f1f0aad765fbb09e9cc50bdc177fa75…
Patch:
https://github.com/kamailio/kamailio/commit/f1f0aad765fbb09e9cc50bdc177fa75…
--- diff --git a/kemi.c b/kemi.c index 6380877..3f45715 100644 --- a/kemi.c +++ b/kemi.c @@ -304,7 +304,7 @@ typedef struct sr_kemi_cbname { static gen_lock_t *_sr_kemi_cbname_lock = 0; static sr_kemi_cbname_t *_sr_kemi_cbname_list = NULL; -static int _sr_kemi_cbname_list_size = 0; +static int *_sr_kemi_cbname_list_size = NULL; /** * @@ -324,10 +324,20 @@ int sr_kemi_cbname_list_init(void) _sr_kemi_cbname_lock = NULL; return -1; } + _sr_kemi_cbname_list_size = shm_malloc(sizeof(int)); + if(_sr_kemi_cbname_list_size==NULL) { + lock_destroy(_sr_kemi_cbname_lock); + lock_dealloc(_sr_kemi_cbname_lock); + LM_ERR("no more shared memory\n"); + return -1; + } + *_sr_kemi_cbname_list_size = 0; _sr_kemi_cbname_list = shm_malloc(KEMI_CBNAME_LIST_SIZE*sizeof(sr_kemi_cbname_t)); if(_sr_kemi_cbname_list==NULL) { LM_ERR("no more shared memory\n"); + shm_free(_sr_kemi_cbname_list_size); + _sr_kemi_cbname_list_size = NULL; lock_destroy(_sr_kemi_cbname_lock); lock_dealloc(_sr_kemi_cbname_lock); _sr_kemi_cbname_lock = NULL; @@ -354,7 +364,7 @@ int sr_kemi_cbname_lookup_name(str *name) name->len, name->s, KEMI_CBNAME_MAX_LEN); return 0; } - n = _sr_kemi_cbname_list_size; + n = *_sr_kemi_cbname_list_size; for(i=0; i<n; i++) { if(_sr_kemi_cbname_list[i].name.len==name->len @@ -368,14 +378,14 @@ int sr_kemi_cbname_lookup_name(str *name) lock_get(_sr_kemi_cbname_lock); /* check if new callback were indexed meanwhile */ - for(; i<_sr_kemi_cbname_list_size; i++) { + for(; i<*_sr_kemi_cbname_list_size; i++) { if(_sr_kemi_cbname_list[i].name.len==name->len && strncmp(_sr_kemi_cbname_list[i].name.s, name->s, name->len)==0) { return i+1; } } - if(_sr_kemi_cbname_list_size>=KEMI_CBNAME_LIST_SIZE) { + if(*_sr_kemi_cbname_list_size>=KEMI_CBNAME_LIST_SIZE) { lock_release(_sr_kemi_cbname_lock); LM_ERR("no more space to index callbacks\n"); return 0; @@ -384,10 +394,10 @@ int sr_kemi_cbname_lookup_name(str *name) _sr_kemi_cbname_list[i].bname[name->len] = '\0'; _sr_kemi_cbname_list[i].name.s = _sr_kemi_cbname_list[i].bname; _sr_kemi_cbname_list[i].name.len = name->len; - _sr_kemi_cbname_list_size++; - n = _sr_kemi_cbname_list_size; + i++; + *_sr_kemi_cbname_list_size = i; lock_release(_sr_kemi_cbname_lock); - return n; + return i; } /** @@ -400,7 +410,7 @@ str* sr_kemi_cbname_lookup_idx(int idx) if(_sr_kemi_cbname_list==NULL) { return NULL; } - n = _sr_kemi_cbname_list_size; + n = *_sr_kemi_cbname_list_size; if(idx<1 || idx>n) { LM_ERR("index %d is out of range\n", idx); return NULL;
8 years, 8 months
1
0
0
0
git:master:19968a46: tm: init actions context for kemi execution
by Daniel-Constantin Mierla
Module: kamailio Branch: master Commit: 19968a464cbb668d9bef6c866f12eecb530ddb05 URL:
https://github.com/kamailio/kamailio/commit/19968a464cbb668d9bef6c866f12eec…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2016-04-14T18:16:32+02:00 tm: init actions context for kemi execution - needed to catch drop in onreply/branch route callbacks --- Modified: modules/tm/t_funcs.c Modified: modules/tm/t_fwd.c Modified: modules/tm/t_reply.c --- Diff:
https://github.com/kamailio/kamailio/commit/19968a464cbb668d9bef6c866f12eec…
Patch:
https://github.com/kamailio/kamailio/commit/19968a464cbb668d9bef6c866f12eec…
--- diff --git a/modules/tm/t_funcs.c b/modules/tm/t_funcs.c index e498713..f740a72 100644 --- a/modules/tm/t_funcs.c +++ b/modules/tm/t_funcs.c @@ -328,7 +328,7 @@ int t_relay_to( struct sip_msg *p_msg , struct proxy_l *proxy, int proto, ret=t_forward_nonack(t, p_msg, proxy, proto); handle_ret: if (ret<=0) { - DBG( "ERROR:tm:t_relay_to: t_forward_nonack returned error \n"); + DBG( "t_forward_nonack returned error %d (%d)\n", ret, ser_error); /* we don't want to pass upstream any reply regarding replicating * a request; replicated branch must stop at us*/ if (likely(!replicate)) { diff --git a/modules/tm/t_fwd.c b/modules/tm/t_fwd.c index dc97ad9..ba0b6d6 100644 --- a/modules/tm/t_fwd.c +++ b/modules/tm/t_fwd.c @@ -346,6 +346,7 @@ static int prepare_new_uac( struct cell *t, struct sip_msg *i_req, keng = sr_kemi_eng_get(); if(unlikely(keng!=NULL)) { bctx = sr_kemi_act_ctx_get(); + init_run_actions_ctx(&ctx); sr_kemi_act_ctx_set(&ctx); if(keng->froute(i_req, BRANCH_ROUTE, sr_kemi_cbname_lookup_idx(branch_route))<0) { diff --git a/modules/tm/t_reply.c b/modules/tm/t_reply.c index 4ef8da4..dececd8 100644 --- a/modules/tm/t_reply.c +++ b/modules/tm/t_reply.c @@ -2343,6 +2343,7 @@ int reply_received( struct sip_msg *p_msg ) */ if(unlikely(keng!=NULL)) { bctx = sr_kemi_act_ctx_get(); + init_run_actions_ctx(&ctx); sr_kemi_act_ctx_set(&ctx); keng->froute(p_msg, TM_ONREPLY_ROUTE, sr_kemi_cbname_lookup_idx(onreply_route));
8 years, 8 months
1
0
0
0
git:master:0328bc67: app_lua: safety checks for mandatory lua env attributes
by Daniel-Constantin Mierla
Module: kamailio Branch: master Commit: 0328bc671182374926c7dbbec4887a0f532aff63 URL:
https://github.com/kamailio/kamailio/commit/0328bc671182374926c7dbbec4887a0…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2016-04-14T18:16:02+02:00 app_lua: safety checks for mandatory lua env attributes --- Modified: modules/app_lua/app_lua_sr.c --- Diff:
https://github.com/kamailio/kamailio/commit/0328bc671182374926c7dbbec4887a0…
Patch:
https://github.com/kamailio/kamailio/commit/0328bc671182374926c7dbbec4887a0…
--- diff --git a/modules/app_lua/app_lua_sr.c b/modules/app_lua/app_lua_sr.c index 63edd5b..036642d 100644 --- a/modules/app_lua/app_lua_sr.c +++ b/modules/app_lua/app_lua_sr.c @@ -1451,6 +1451,11 @@ int sr_kemi_exec_func(lua_State* L, str *mname, int midx, str *fname) env_L = sr_lua_env_get(); + if(env_L==NULL || env_L->msg==NULL) { + LM_ERR("invalid Lua environment attributes\n"); + return app_lua_return_false(L); + } + ket = sr_kemi_lookup(mname, midx, fname); if(ket==NULL) { return app_lua_return_false(L); @@ -1462,11 +1467,11 @@ int sr_kemi_exec_func(lua_State* L, str *mname, int midx, str *fname) } argc = lua_gettop(L); - if(argc==0 && ket->ptypes[0]==SR_KEMIP_NONE) { + if(argc==pdelta && ket->ptypes[0]==SR_KEMIP_NONE) { ret = ((sr_kemi_fm_f)(ket->func))(env_L->msg); return sr_kemi_return(L, ket, ret); } - if(argc==0 && ket->ptypes[0]!=SR_KEMIP_NONE) { + if(argc==pdelta && ket->ptypes[0]!=SR_KEMIP_NONE) { LM_ERR("invalid number of parameters for: %.*s\n", fname->len, fname->s); return app_lua_return_false(L);
8 years, 8 months
1
0
0
0
git:master:5f740d7a: core: kemi - log message for drop action
by Daniel-Constantin Mierla
Module: kamailio Branch: master Commit: 5f740d7aca5baa500398d334a8e92aa59bbf62ab URL:
https://github.com/kamailio/kamailio/commit/5f740d7aca5baa500398d334a8e92aa…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2016-04-14T18:12:08+02:00 core: kemi - log message for drop action --- Modified: kemi.c --- Diff:
https://github.com/kamailio/kamailio/commit/5f740d7aca5baa500398d334a8e92aa…
Patch:
https://github.com/kamailio/kamailio/commit/5f740d7aca5baa500398d334a8e92aa…
--- diff --git a/kemi.c b/kemi.c index 1616c3d..6380877 100644 --- a/kemi.c +++ b/kemi.c @@ -122,6 +122,7 @@ static int lua_sr_kemi_drop(sip_msg_t *msg) { if(_sr_kemi_act_ctx==NULL) return 0; + LM_DBG("drop action executed inside embedded interpreter\n"); _sr_kemi_act_ctx->run_flags |= EXIT_R_F|DROP_R_F; return 0; }
8 years, 8 months
1
0
0
0
git:master:e6e4ec60: sl: use same function names as for cfg in kemi exports
by Daniel-Constantin Mierla
Module: kamailio Branch: master Commit: e6e4ec604981982ca1b7d2e5649ed25f387ec3b7 URL:
https://github.com/kamailio/kamailio/commit/e6e4ec604981982ca1b7d2e5649ed25…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2016-04-14T17:15:47+02:00 sl: use same function names as for cfg in kemi exports --- Modified: modules/sl/sl.c --- Diff:
https://github.com/kamailio/kamailio/commit/e6e4ec604981982ca1b7d2e5649ed25…
Patch:
https://github.com/kamailio/kamailio/commit/e6e4ec604981982ca1b7d2e5649ed25…
--- diff --git a/modules/sl/sl.c b/modules/sl/sl.c index 7028094..2cd780f 100644 --- a/modules/sl/sl.c +++ b/modules/sl/sl.c @@ -505,12 +505,12 @@ static int bind_sl(sl_api_t* api) * */ static sr_kemi_t sl_kemi_exports[] = { - { str_init("sl"), str_init("sreply"), + { str_init("sl"), str_init("sl_send_reply"), SR_KEMIP_INT, sl_send_reply_str, { SR_KEMIP_INT, SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE } }, - { str_init("sl"), str_init("freply"), + { str_init("sl"), str_init("send_reply"), SR_KEMIP_INT, send_reply, { SR_KEMIP_INT, SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
8 years, 8 months
1
0
0
0
git:master:2a7ba579: tm: implemented the execution of branch failure route callback via kemi
by Daniel-Constantin Mierla
Module: kamailio Branch: master Commit: 2a7ba57931ae4b40f36b946655a4abf49bdaa474 URL:
https://github.com/kamailio/kamailio/commit/2a7ba57931ae4b40f36b946655a4abf…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2016-04-14T15:13:57+02:00 tm: implemented the execution of branch failure route callback via kemi --- Modified: modules/tm/t_reply.c --- Diff:
https://github.com/kamailio/kamailio/commit/2a7ba57931ae4b40f36b946655a4abf…
Patch:
https://github.com/kamailio/kamailio/commit/2a7ba57931ae4b40f36b946655a4abf…
--- diff --git a/modules/tm/t_reply.c b/modules/tm/t_reply.c index 40f1d5c..4ef8da4 100644 --- a/modules/tm/t_reply.c +++ b/modules/tm/t_reply.c @@ -1022,6 +1022,7 @@ int run_branch_failure_handlers(struct cell *t, struct sip_msg *rpl, static struct sip_msg faked_req; struct sip_msg *shmem_msg = t->uas.request; int on_branch_failure; + sr_kemi_eng_t *keng = NULL; on_branch_failure = t->uac[picked_branch].on_branch_failure; @@ -1057,8 +1058,16 @@ int run_branch_failure_handlers(struct cell *t, struct sip_msg *rpl, t->on_branch_failure = 0; if (exec_pre_script_cb(&faked_req, BRANCH_FAILURE_CB_TYPE)>0) { /* run a branch_failure_route action if some was marked */ - if (run_top_route(event_rt.rlist[on_branch_failure], &faked_req, 0)<0) - LOG(L_ERR, "error in run_top_route\n"); + keng = sr_kemi_eng_get(); + if(unlikely(keng!=NULL)) { + if(keng->froute(&faked_req, BRANCH_FAILURE_ROUTE, + sr_kemi_cbname_lookup_idx(on_branch_failure))<0) { + LM_ERR("error running branch failure route kemi callback\n"); + } + } else { + if (run_top_route(event_rt.rlist[on_branch_failure], &faked_req, 0)<0) + LOG(L_ERR, "error in run_top_route\n"); + } exec_post_script_cb(&faked_req, BRANCH_FAILURE_CB_TYPE); } /* update message flags, if changed in branch_failure route */ @@ -2335,7 +2344,7 @@ int reply_received( struct sip_msg *p_msg ) if(unlikely(keng!=NULL)) { bctx = sr_kemi_act_ctx_get(); sr_kemi_act_ctx_set(&ctx); - keng->froute(p_msg, BRANCH_ROUTE, + keng->froute(p_msg, TM_ONREPLY_ROUTE, sr_kemi_cbname_lookup_idx(onreply_route)); sr_kemi_act_ctx_set(bctx); } else {
8 years, 8 months
1
0
0
0
git:master:d4103701: tm: implemented the execution of onreply_route callback via kemi
by Daniel-Constantin Mierla
Module: kamailio Branch: master Commit: d4103701b1a16784dadd5aeb21dc76f7aa4aca62 URL:
https://github.com/kamailio/kamailio/commit/d4103701b1a16784dadd5aeb21dc76f…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2016-04-14T14:53:27+02:00 tm: implemented the execution of onreply_route callback via kemi --- Modified: modules/tm/t_reply.c --- Diff:
https://github.com/kamailio/kamailio/commit/d4103701b1a16784dadd5aeb21dc76f…
Patch:
https://github.com/kamailio/kamailio/commit/d4103701b1a16784dadd5aeb21dc76f…
--- diff --git a/modules/tm/t_reply.c b/modules/tm/t_reply.c index 6022d50..40f1d5c 100644 --- a/modules/tm/t_reply.c +++ b/modules/tm/t_reply.c @@ -2144,6 +2144,8 @@ int reply_received( struct sip_msg *p_msg ) #endif struct tmcb_params onsend_params; struct run_act_ctx ctx; + struct run_act_ctx *bctx; + sr_kemi_eng_t *keng = NULL; /* make sure we know the associated transaction ... */ if (t_check( p_msg , &branch )==-1) @@ -2330,7 +2332,15 @@ int reply_received( struct sip_msg *p_msg ) /* Pre- and post-script callbacks have already * been executed by the core. (Miklos) */ - run_top_route(onreply_rt.rlist[onreply_route], p_msg, &ctx); + if(unlikely(keng!=NULL)) { + bctx = sr_kemi_act_ctx_get(); + sr_kemi_act_ctx_set(&ctx); + keng->froute(p_msg, BRANCH_ROUTE, + sr_kemi_cbname_lookup_idx(onreply_route)); + sr_kemi_act_ctx_set(bctx); + } else { + run_top_route(onreply_rt.rlist[onreply_route], p_msg, &ctx); + } /* restore brach last_received as before executing onreply_route */ uac->last_received = last_uac_status;
8 years, 8 months
1
0
0
0
git:master:a6fc13d6: core: kemi - implementation of a drop() alternative
by Daniel-Constantin Mierla
Module: kamailio Branch: master Commit: a6fc13d6f353e81420277a6caa85861d6db97304 URL:
https://github.com/kamailio/kamailio/commit/a6fc13d6f353e81420277a6caa85861…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com> Committer: Daniel-Constantin Mierla <miconda(a)gmail.com> Date: 2016-04-14T13:15:15+02:00 core: kemi - implementation of a drop() alternative - it doesn't stop the embedded interpreter, but it can trigger the drop() effects (e.g., dropping a branch) --- Modified: kemi.c Modified: kemi.h --- Diff:
https://github.com/kamailio/kamailio/commit/a6fc13d6f353e81420277a6caa85861…
Patch:
https://github.com/kamailio/kamailio/commit/a6fc13d6f353e81420277a6caa85861…
--- diff --git a/kemi.c b/kemi.c index 0fb8662..1616c3d 100644 --- a/kemi.c +++ b/kemi.c @@ -67,6 +67,27 @@ sr_kemi_module_t* sr_kemi_modules_get(void) /** * */ +static run_act_ctx_t *_sr_kemi_act_ctx = NULL; + +/** + * + */ +void sr_kemi_act_ctx_set(run_act_ctx_t *ctx) +{ + _sr_kemi_act_ctx = ctx; +} + +/** + * + */ +run_act_ctx_t* sr_kemi_act_ctx_get(void) +{ + return _sr_kemi_act_ctx; +} + +/** + * + */ static int lua_sr_kemi_dbg(sip_msg_t *msg, str *txt) { if(txt!=NULL && txt->s!=NULL) @@ -97,6 +118,17 @@ static int lua_sr_kemi_info(sip_msg_t *msg, str *txt) /** * */ +static int lua_sr_kemi_drop(sip_msg_t *msg) +{ + if(_sr_kemi_act_ctx==NULL) + return 0; + _sr_kemi_act_ctx->run_flags |= EXIT_R_F|DROP_R_F; + return 0; +} + +/** + * + */ static sr_kemi_t _sr_kemi_core[] = { { str_init(""), str_init("dbg"), SR_KEMIP_NONE, lua_sr_kemi_dbg, @@ -113,6 +145,11 @@ static sr_kemi_t _sr_kemi_core[] = { { SR_KEMIP_STR, SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE } }, + { str_init(""), str_init("drop"), + SR_KEMIP_NONE, lua_sr_kemi_drop, + { SR_KEMIP_NONE, 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 } } }; diff --git a/kemi.h b/kemi.h index ede9456..3c9e0e1 100644 --- a/kemi.h +++ b/kemi.h @@ -24,6 +24,7 @@ #include "str.h" #include "parser/msg_parser.h" +#include "action.h" #define SR_KEMIP_NONE (0) /* no type */ #define SR_KEMIP_INT (1<<0) /* type integer */ @@ -107,4 +108,7 @@ int sr_kemi_cbname_list_init(void); int sr_kemi_cbname_lookup_name(str *name); str* sr_kemi_cbname_lookup_idx(int idx); +void sr_kemi_act_ctx_set(run_act_ctx_t *ctx); +run_act_ctx_t* sr_kemi_act_ctx_get(void); + #endif
8 years, 8 months
1
0
0
0
← Newer
1
...
24
25
26
27
28
29
30
...
43
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
Results per page:
10
25
50
100
200