[sr-dev] git:master:1576dc7c: app_lua: new KEMI pv functions KSR.pv.getvn(...) and KSR.pv.getvs(...)
Module: kamailio Branch: master Commit: 1576dc7cf504a3a30e83919222f1b8441e4207b5 URL: https://github.com/kamailio/kamailio/commit/1576dc7cf504a3a30e83919222f1b8441e4207b5 Author: Daniel-Constantin Mierla Committer: Daniel-Constantin Mierla Date: 2018-08-24T11:43:53+02:00 app_lua: new KEMI pv functions KSR.pv.getvn(...) and KSR.pv.getvs(...) - KSR.pv.getvn(pv, ival) - return the value of pv if not null, otherwise return the int value ival - KSR.pv.getvs(pv, sval) - return the value of pv if not null, otherwise return the str value sval --- Modified: src/modules/app_lua/app_lua_sr.c --- Diff: https://github.com/kamailio/kamailio/commit/1576dc7cf504a3a30e83919222f1b8441e4207b5.diff Patch: https://github.com/kamailio/kamailio/commit/1576dc7cf504a3a30e83919222f1b8441e4207b5.patch --- diff --git a/src/modules/app_lua/app_lua_sr.c b/src/modules/app_lua/app_lua_sr.c index a57f94fcc7..61c661852d 100644 --- a/src/modules/app_lua/app_lua_sr.c +++ b/src/modules/app_lua/app_lua_sr.c @@ -901,6 +901,19 @@ static int lua_sr_pv_push_val_null (lua_State *L, int rmode) } } +/** + * + */ +static int lua_sr_pv_push_valx (lua_State *L, int rmode, int vi, str *vs) +{ + if(rmode==1) { + lua_pushlstring(L, vs->s, vs->len); + } else { + lua_pushinteger(L, vi); + } + return 1; +} + /** * */ @@ -971,6 +984,89 @@ static int lua_sr_pv_gete (lua_State *L) return lua_sr_pv_get_val(L, 2); } +/** + * + */ +static int lua_sr_pv_get_valx (lua_State *L, int rmode) +{ + str pvn; + pv_spec_t *pvs; + pv_value_t val; + sr_lua_env_t *env_L; + int pl; + int xival = 0; + str xsval = str_init(""); + + env_L = sr_lua_env_get(); + + if(lua_gettop(L)<2) { + LM_ERR("to few parameters [%d]\n", lua_gettop(L)); + return lua_sr_pv_push_val_null(L, 0); + } + if(rmode==1) { + if(!lua_isnumber(L, -1)) { + LM_ERR("invalid int parameter\n"); + return lua_sr_pv_push_val_null(L, 0); + } + xival = lua_tointeger(L, -1); + } else { + if(!lua_isstring(L, -1)) { + LM_ERR("invalid str parameter\n"); + return lua_sr_pv_push_val_null(L, 0); + } + xsval.s = (char*)lua_tostring(L, -1); + xsval.len = strlen(xsval.s); + } + + pvn.s = (char*)lua_tostring(L, -2); + if(pvn.s==NULL || env_L->msg==NULL) + return lua_sr_pv_push_valx(L, rmode, xival, ); + + pvn.len = strlen(pvn.s); + LM_DBG("pv set: %s\n", pvn.s); + pl = pv_locate_name(); + if(pl != pvn.len) { + LM_ERR("invalid pv [%s] (%d/%d)\n", pvn.s, pl, pvn.len); + return lua_sr_pv_push_valx(L, rmode, xival, ); + } + pvs = pv_cache_get(); + if(pvs==NULL) { + LM_ERR("cannot get pv spec for [%s]\n", pvn.s); + return lua_sr_pv_push_valx(L, rmode, xival, ); + } + + memset(, 0, sizeof(pv_value_t)); + if(pv_get_spec_value(env_L->msg, pvs, ) != 0) { + LM_ERR("unable to get pv value for [%s]\n", pvn.s); + return lua_sr_pv_push_valx(L, rmode, xival, ); + } + if(val.flags_VAL_NULL) { + return lua_sr_pv_push_valx(L, rmode, xival, ); + } + if(val.flags_TYPE_INT) { + lua_pushinteger(L, val.ri); + return 1; + } + lua_pushlstring(L, val.rs.s, val.rs.len); + return 1; +} + +/** + * + */ +static int lua_sr_pv_getvs (lua_State *L) +{ + return lua_sr_pv_get_valx(L, 0); +} + +/** + * + */ +static int lua_sr_pv_getvn (lua_State *L) +{ + return lua_sr_pv_get_valx(L, 1); +} + /** * */ @@ -1179,6 +1275,8 @@ static const luaL_Reg _sr_pv_Map [] = { {"get", lua_sr_pv_get}, {"getw", lua_sr_pv_getw}, {"gete", lua_sr_pv_gete}, + {"getvn",lua_sr_pv_getvn}, + {"getvs",lua_sr_pv_getvs}, {"seti", lua_sr_pv_seti}, {"sets", lua_sr_pv_sets}, {"unset",lua_sr_pv_unset}, ___ Kamailio (SER) - Development Mailing List sr-dev@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
[sr-dev] git:master:e361e5ec: tm: added fcount field for free operations debugging
Module: kamailio Branch: master Commit: e361e5ec2883775d14d92d46659d062b31c45f33 URL: https://github.com/kamailio/kamailio/commit/e361e5ec2883775d14d92d46659d062b31c45f33 Author: Daniel-Constantin Mierla Committer: Daniel-Constantin Mierla Date: 2018-08-24T11:02:32+02:00 tm: added fcount field for free operations debugging --- Modified: src/modules/tm/h_table.c Modified: src/modules/tm/h_table.h --- Diff: https://github.com/kamailio/kamailio/commit/e361e5ec2883775d14d92d46659d062b31c45f33.diff Patch: https://github.com/kamailio/kamailio/commit/e361e5ec2883775d14d92d46659d062b31c45f33.patch --- diff --git a/src/modules/tm/h_table.c b/src/modules/tm/h_table.c index ee79b91fd3..998bdfad8e 100644 --- a/src/modules/tm/h_table.c +++ b/src/modules/tm/h_table.c @@ -143,7 +143,10 @@ void free_cell_helper( unlink_timers(dead_cell); remove_from_hash_table_unsafe(dead_cell); } - release_cell_lock(dead_cell); + release_cell_lock(dead_cell); /* does nothing */ + + dead_cell->fcount++; + if(unlikely(has_tran_tmcbs(dead_cell, TMCB_DESTROY))) run_trans_callbacks(TMCB_DESTROY, dead_cell, 0, 0, 0); diff --git a/src/modules/tm/h_table.h b/src/modules/tm/h_table.h index 7d61ae3673..a60fb9c754 100644 --- a/src/modules/tm/h_table.h +++ b/src/modules/tm/h_table.h @@ -366,6 +366,9 @@ typedef struct cell /* number of forks */ short nr_of_outgoings; + /* free operations counter - debug */ + int fcount; + #ifdef TM_DEL_UNREF /* every time the transaction/cell is referenced from somewhere this * ref_count should be increased (via REF()) and every time the reference ___ Kamailio (SER) - Development Mailing List sr-dev@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
[sr-dev] git:master:927d738d: tm: more debug messages for reply relay
Module: kamailio Branch: master Commit: 927d738d0e1585ccbccc878ab55c219ae737091d URL: https://github.com/kamailio/kamailio/commit/927d738d0e1585ccbccc878ab55c219ae737091d Author: Daniel-Constantin Mierla Committer: Daniel-Constantin Mierla Date: 2018-08-24T10:52:26+02:00 tm: more debug messages for reply relay --- Modified: src/modules/tm/t_reply.c --- Diff: https://github.com/kamailio/kamailio/commit/927d738d0e1585ccbccc878ab55c219ae737091d.diff Patch: https://github.com/kamailio/kamailio/commit/927d738d0e1585ccbccc878ab55c219ae737091d.patch --- diff --git a/src/modules/tm/t_reply.c b/src/modules/tm/t_reply.c index 474851aa7c..2f5488a309 100644 --- a/src/modules/tm/t_reply.c +++ b/src/modules/tm/t_reply.c @@ -315,7 +315,7 @@ inline static int update_totag_set(struct cell *t, struct sip_msg *ok) return 0; } memset(n, 0, sizeof(struct totag_elem)); - memcpy(s, tag->s, tag->len ); + memcpy(s, tag->s, tag->len); n->tag.s=s;n->tag.len=tag->len; n->next=t->fwded_totags; membar_write(); /* make sure all the changes to n are visible on all cpus @@ -328,7 +328,7 @@ inline static int update_totag_set(struct cell *t, struct sip_msg *ok) * the "readers" (unmatched_tags()) do not use locks and * can be called simultaneously on another cpu.*/ t->fwded_totags=n; - LM_DBG("new totag \n"); + LM_DBG("new totag [%.*s]\n", tag->len, tag->s); return 0; } @@ -1995,6 +1995,7 @@ enum rps relay_reply( struct cell *t, struct sip_msg *p_msg, int branch, if (likely(uas_rb->dst.send_sock)) { if (SEND_PR_BUFFER( uas_rb, buf, res_len ) >= 0){ + LM_DBG("reply buffer sent out\n"); if (unlikely(!totag_retr && has_tran_tmcbs(t, TMCB_RESPONSE_OUT))){ LOCK_REPLIES( t ); @@ -2059,6 +2060,7 @@ enum rps relay_reply( struct cell *t, struct sip_msg *p_msg, int branch, /* a serious error occurred -- attempt to send an error reply; * it will take care of clean-ups */ + LM_DBG("reply relay failure\n"); /* failure */ return RPS_ERROR; } ___ Kamailio (SER) - Development Mailing List sr-dev@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
Re: [sr-dev] [kamailio/kamailio] smsops: Add support for concatenated SMS in decode_3gpp_sms() (#1617)
Hi @tdimitrov @ngvoice Do you have any updated example script files (.cfg) and perhaps a sql table definition? I have several errors with the current example script file. Even if fixing the small errors, I am unsure if it will work out of the box for concatenated SMS? Best Regards Lars -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/1617#issuecomment-415684066___ Kamailio (SER) - Development Mailing List sr-dev@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
[sr-dev] git:master:e4d2ca28: core: debug message when dropping a sip reply
Module: kamailio Branch: master Commit: e4d2ca28ee2d42683d7604c6a767a201b6babbed URL: https://github.com/kamailio/kamailio/commit/e4d2ca28ee2d42683d7604c6a767a201b6babbed Author: Daniel-Constantin Mierla Committer: Daniel-Constantin Mierla Date: 2018-08-24T08:50:36+02:00 core: debug message when dropping a sip reply --- Modified: src/core/receive.c --- Diff: https://github.com/kamailio/kamailio/commit/e4d2ca28ee2d42683d7604c6a767a201b6babbed.diff Patch: https://github.com/kamailio/kamailio/commit/e4d2ca28ee2d42683d7604c6a767a201b6babbed.patch --- diff --git a/src/core/receive.c b/src/core/receive.c index 9a385e4b85..df8db65ca6 100644 --- a/src/core/receive.c +++ b/src/core/receive.c @@ -415,10 +415,11 @@ int receive_msg(char *buf, unsigned int len, struct receive_info *rcv_info) goto error_rpl; } else #endif /* NO_ONREPLY_ROUTE_ERROR */ - if(unlikely(ret == 0 || (ctx.run_flags & DROP_R_F))) { - STATS_RPL_FWD_DROP(); - goto skip_send_reply; /* drop the message, no error */ - } + if(unlikely(ret == 0 || (ctx.run_flags & DROP_R_F))) { + STATS_RPL_FWD_DROP(); + LM_DBG("drop flag set - skip forwarding the reply\n"); + goto skip_send_reply; /* drop the message, no error */ + } } /* send the msg */ forward_reply(msg); ___ Kamailio (SER) - Development Mailing List sr-dev@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
[sr-dev] git:master:f3312715: app_lua: split function for returning pv null value
Module: kamailio Branch: master Commit: f3312715943867f76c8753eba992dad5859d8c2f URL: https://github.com/kamailio/kamailio/commit/f3312715943867f76c8753eba992dad5859d8c2f Author: Daniel-Constantin Mierla Committer: Daniel-Constantin Mierla Date: 2018-08-24T08:38:00+02:00 app_lua: split function for returning pv null value --- Modified: src/modules/app_lua/app_lua_sr.c --- Diff: https://github.com/kamailio/kamailio/commit/f3312715943867f76c8753eba992dad5859d8c2f.diff Patch: https://github.com/kamailio/kamailio/commit/f3312715943867f76c8753eba992dad5859d8c2f.patch --- diff --git a/src/modules/app_lua/app_lua_sr.c b/src/modules/app_lua/app_lua_sr.c index dc2aa8644f..a57f94fcc7 100644 --- a/src/modules/app_lua/app_lua_sr.c +++ b/src/modules/app_lua/app_lua_sr.c @@ -885,6 +885,22 @@ static const luaL_Reg _sr_hdr_Map [] = { }; +/** + * + */ +static int lua_sr_pv_push_val_null (lua_State *L, int rmode) +{ + if(rmode==1) { + lua_pushlstring(L, "<>", 8); + return 1; + } else if(rmode==2) { + lua_pushlstring(L, "", 0); + return 1; + } else { + return 0; + } +} + /** * */ @@ -900,15 +916,7 @@ static int lua_sr_pv_get_val (lua_State *L, int rmode) pvn.s = (char*)lua_tostring(L, -1); if(pvn.s==NULL || env_L->msg==NULL) { - if(rmode==1) { - lua_pushlstring(L, "<>", 8); - return 1; - } else if(rmode==2) { - lua_pushlstring(L, "", 0); - return 1; - } else { - return 0; - } + return lua_sr_pv_push_val_null(L, rmode); } pvn.len = strlen(pvn.s); @@ -916,52 +924,20 @@ static int lua_sr_pv_get_val (lua_State *L, int rmode) pl = pv_locate_name(); if(pl != pvn.len) { LM_ERR("invalid pv [%s] (%d/%d)\n", pvn.s, pl, pvn.len); - if(rmode==1) { - lua_pushlstring(L, "<>", 8); - return 1; - } else if(rmode==2) { - lua_pushlstring(L, "", 0); - return 1; - } else { - return 0; - } + return lua_sr_pv_push_val_null(L, rmode); } pvs = pv_cache_get(); if(pvs==NULL) { LM_ERR("cannot get pv spec for [%s]\n", pvn.s); - if(rmode==1) { - lua_pushlstring(L, "<>", 8); - return 1; - } else if(rmode==2) { - lua_pushlstring(L, "", 0); - return 1; - } else { - return 0; - } + return lua_sr_pv_push_val_null(L, rmode); } memset(, 0, sizeof(pv_value_t)); if(pv_get_spec_value(env_L->msg, pvs, ) != 0) { LM_ERR("unable to get pv value for [%s]\n", pvn.s); - if(rmode==1) { - lua_pushlstring(L, "<>", 8); - return 1; - } else if(rmode==2) { - lua_pushlstring(L, "", 0); - return 1; - } else { - return 0; - } + return lua_sr_pv_push_val_null(L, rmode); } if(val.flags_VAL_NULL) { - if(rmode==1) { - lua_pushlstring(L, "<>", 8); - return 1; - } else if(rmode==2) { - lua_pushlstring(L, "", 0); - return 1; - } else { - return 0; - } + return lua_sr_pv_push_val_null(L, rmode); } if(val.flags_TYPE_INT) { lua_pushinteger(L, val.ri); ___ Kamailio (SER) - Development Mailing List sr-dev@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
[sr-dev] git:master:b98cb43b: app_lua: kemi - exported KSR.pv.getw("$...")
Module: kamailio Branch: master Commit: b98cb43b1ea33706fe133f6585c0705892663ae6 URL: https://github.com/kamailio/kamailio/commit/b98cb43b1ea33706fe133f6585c0705892663ae6 Author: Daniel-Constantin Mierla Committer: Daniel-Constantin Mierla Date: 2018-08-24T08:20:17+02:00 app_lua: kemi - exported KSR.pv.getw("$...") - get the value of the pseudo-variable if it is not $null and the empty string ("") if it is $null --- Modified: src/modules/app_lua/app_lua_sr.c --- Diff: https://github.com/kamailio/kamailio/commit/b98cb43b1ea33706fe133f6585c0705892663ae6.diff Patch: https://github.com/kamailio/kamailio/commit/b98cb43b1ea33706fe133f6585c0705892663ae6.patch --- diff --git a/src/modules/app_lua/app_lua_sr.c b/src/modules/app_lua/app_lua_sr.c index 4414bd83a2..dc2aa8644f 100644 --- a/src/modules/app_lua/app_lua_sr.c +++ b/src/modules/app_lua/app_lua_sr.c @@ -900,9 +900,12 @@ static int lua_sr_pv_get_val (lua_State *L, int rmode) pvn.s = (char*)lua_tostring(L, -1); if(pvn.s==NULL || env_L->msg==NULL) { - if(rmode) { + if(rmode==1) { lua_pushlstring(L, "<>", 8); return 1; + } else if(rmode==2) { + lua_pushlstring(L, "", 0); + return 1; } else { return 0; } @@ -913,9 +916,12 @@ static int lua_sr_pv_get_val (lua_State *L, int rmode) pl = pv_locate_name(); if(pl != pvn.len) { LM_ERR("invalid pv [%s] (%d/%d)\n", pvn.s, pl, pvn.len); - if(rmode) { + if(rmode==1) { lua_pushlstring(L, "<>", 8); return 1; + } else if(rmode==2) { + lua_pushlstring(L, "", 0); + return 1; } else { return 0; } @@ -923,9 +929,12 @@ static int lua_sr_pv_get_val (lua_State *L, int rmode) pvs = pv_cache_get(); if(pvs==NULL) { LM_ERR("cannot get pv spec for [%s]\n", pvn.s); - if(rmode) { + if(rmode==1) { lua_pushlstring(L, "<>", 8); return 1; + } else if(rmode==2) { + lua_pushlstring(L, "", 0); + return 1; } else { return 0; } @@ -933,17 +942,23 @@ static int lua_sr_pv_get_val (lua_State *L, int rmode) memset(, 0, sizeof(pv_value_t)); if(pv_get_spec_value(env_L->msg, pvs, ) != 0) { LM_ERR("unable to get pv value for [%s]\n", pvn.s); - if(rmode) { + if(rmode==1) { lua_pushlstring(L, "<>", 8); return 1; + } else if(rmode==2) { + lua_pushlstring(L, "", 0); + return 1; } else { return 0; } } if(val.flags_VAL_NULL) { - if(rmode) { + if(rmode==1) { lua_pushlstring(L, "<>", 8); return 1; + } else if(rmode==2) { + lua_pushlstring(L, "", 0); + return 1; } else { return 0; } @@ -972,6 +987,14 @@ static int lua_sr_pv_getw (lua_State *L) return lua_sr_pv_get_val(L, 1); } +/** + * + */ +static int lua_sr_pv_gete (lua_State *L) +{ + return lua_sr_pv_get_val(L, 2); +} + /** * */ @@ -1179,6 +1202,7 @@ static int lua_sr_pv_is_null (lua_State *L) static const luaL_Reg _sr_pv_Map [] = { {"get", lua_sr_pv_get}, {"getw", lua_sr_pv_getw}, + {"gete", lua_sr_pv_gete}, {"seti", lua_sr_pv_seti}, {"sets", lua_sr_pv_sets}, {"unset",lua_sr_pv_unset}, ___ Kamailio (SER) - Development Mailing List sr-dev@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev