Re: [sr-dev] [kamailio/kamailio] kamailio crashes when attempting to query offline database (#1821)
Hello Daniel, Thank you for your reply. I have spent the last few weeks reviewing our system and have noticed that we have a few outdated shared libraries in use. Unixodbc seems a bit dated as well as the odbc client SDK for the informix database engine. I've updated the unix odbc libraries and have noticed that the segmentation fault appears to be occurring within the Informix csdk libraries. In particular, at a function call of SQLFreeHandle. A few online searches has shown that there is indeed a memory violation that occurs within that function call when a protocol issue is encountered. No further detail regarding protocol is mentioned but it seems to fit very closely to the issue at hand (TCP disconnect indicating a protocol issue and then a seg fault). The fix to this issue is within an updated Informix CSDK library which i am in the process of installing on my system. I am hoping this resolves the issue. Thank you again for taking a look into this; I will let you all know one way or another what the results are. -- 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/issues/1821#issuecomment-468811084___ Kamailio (SER) - Development Mailing List sr-dev@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
[sr-dev] [kamailio/kamailio] dialog module: option to choose between OPTIONS or INVITE on keep-alive (#1876)
### Description Enable dialog module to user choose between INVITE or OPTIONS on send Re-INVITE on keep-alive ### Expected behavior Make the dialog keep-alive through INVITE or OPTIONS. A user choice. ### Possible Solutions In function dlg_send_ka of dlg_req_within.c:445, provide an option to choose the value from module config var, pv value, dlg flag, etc. ``` File: dlg_req_within.c 435/* send keep-alive 436 * dlg - pointer to a struct dlg_cell 437 * dir - direction: the request will be sent to: 438 * DLG_CALLER_LEG (0): caller 439 * DLG_CALLEE_LEG (1): callee 440 */ 441int dlg_send_ka(dlg_cell_t *dlg, int dir) 442{ 443 uac_req_t uac_r; 444 dlg_t* di; 445 str met = {"INVITE", 6}; 446 int result; 447 dlg_iuid_t *iuid = NULL; ``` ### Additional Information Just for local tests, i changed dlg_req_within.c:445 from {"OPTIONS",7} to {"INVITE",6} and worked like a charm. I don't know if this change will affect other parts of kamailio. Let me know if this change affect something else. Thanks. -- 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/issues/1876___ Kamailio (SER) - Development Mailing List sr-dev@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
[sr-dev] git:master:90bcc49a: modules: readme files regenerated - dialplan ... [skip ci]
Module: kamailio Branch: master Commit: 90bcc49a7ec4e1c44ac94fd814d4ef41e79cb4f7 URL: https://github.com/kamailio/kamailio/commit/90bcc49a7ec4e1c44ac94fd814d4ef41e79cb4f7 Author: Kamailio Dev Committer: Kamailio Dev Date: 2019-03-01T15:46:42+01:00 modules: readme files regenerated - dialplan ... [skip ci] --- Modified: src/modules/dialplan/README --- Diff: https://github.com/kamailio/kamailio/commit/90bcc49a7ec4e1c44ac94fd814d4ef41e79cb4f7.diff Patch: https://github.com/kamailio/kamailio/commit/90bcc49a7ec4e1c44ac94fd814d4ef41e79cb4f7.patch --- diff --git a/src/modules/dialplan/README b/src/modules/dialplan/README index a63e4bfc7c..c5bdaea8eb 100644 --- a/src/modules/dialplan/README +++ b/src/modules/dialplan/README @@ -506,7 +506,8 @@ xlog("translated to var $var(y) \n"); 6.4. dp_reload() - Forces an update of the translation rules from the database. + Reload the translation rules from the database. Note that there is a + rate limiting of maximum one reload in five seconds. Name: dp_reload ___ Kamailio (SER) - Development Mailing List sr-dev@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
[sr-dev] git:master:34f92842: dialplan: docs - note about limiting to max 1 rpc reload in 5 seconds
Module: kamailio Branch: master Commit: 34f928427ecf315f638cd59fa512d59f4c64f22e URL: https://github.com/kamailio/kamailio/commit/34f928427ecf315f638cd59fa512d59f4c64f22e Author: Daniel-Constantin Mierla Committer: Daniel-Constantin Mierla Date: 2019-03-01T15:43:16+01:00 dialplan: docs - note about limiting to max 1 rpc reload in 5 seconds --- Modified: src/modules/dialplan/doc/dialplan_admin.xml --- Diff: https://github.com/kamailio/kamailio/commit/34f928427ecf315f638cd59fa512d59f4c64f22e.diff Patch: https://github.com/kamailio/kamailio/commit/34f928427ecf315f638cd59fa512d59f4c64f22e.patch --- diff --git a/src/modules/dialplan/doc/dialplan_admin.xml b/src/modules/dialplan/doc/dialplan_admin.xml index ed8bad4fae..371120fac4 100644 --- a/src/modules/dialplan/doc/dialplan_admin.xml +++ b/src/modules/dialplan/doc/dialplan_admin.xml @@ -620,7 +620,8 @@ xlog("translated to var $var(y) \n"); dp_reload() - Forces an update of the translation rules from the database. + Reload the translation rules from the database. Note that there is + a rate limiting of maximum one reload in five seconds. Name: dp_reload ___ 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] Kamailio crash while concurrent dialplan.reload (#1874)
Closed #1874. -- 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/issues/1874#event-2174189850___ 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] Kamailio crash while concurrent dialplan.reload (#1874)
OK, thanks for testing. Maybe another solution can be pushed over the time, for the moment should do it. I will backport these days. -- 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/issues/1874#issuecomment-468686607___ 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] Segmentation fault on tm:t_should_relay_response (#1875)
I compiled the master branch and i'm waiting to activate on my environment. I'll report a feedback soon. -- 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/issues/1875#issuecomment-468684766___ Kamailio (SER) - Development Mailing List sr-dev@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
[sr-dev] git:master:1fd9b508: pv: new variable $rcv(key)
Module: kamailio Branch: master Commit: 1fd9b508ccba3f52e68f04cd6e4580bc342489e6 URL: https://github.com/kamailio/kamailio/commit/1fd9b508ccba3f52e68f04cd6e4580bc342489e6 Author: Daniel-Constantin Mierla Committer: Daniel-Constantin Mierla Date: 2019-03-01T15:06:16+01:00 pv: new variable $rcv(key) - available inside event_route[core:msg-received] - get details of the received message - the key can be: * buf - received message * len - lenght of received message * srcip - source ip * rcvip - local ip where it was received * scrport - source port * rcvport - local port where it was received * proto - protocol as int id * sproto - protocol as string * af - address family --- Modified: src/modules/pv/pv.c Modified: src/modules/pv/pv_branch.c Modified: src/modules/pv/pv_branch.h --- Diff: https://github.com/kamailio/kamailio/commit/1fd9b508ccba3f52e68f04cd6e4580bc342489e6.diff Patch: https://github.com/kamailio/kamailio/commit/1fd9b508ccba3f52e68f04cd6e4580bc342489e6.patch --- diff --git a/src/modules/pv/pv.c b/src/modules/pv/pv.c index 0df9353606..24687d45a1 100644 --- a/src/modules/pv/pv.c +++ b/src/modules/pv/pv.c @@ -90,6 +90,8 @@ static pv_export_t mod_pvs[] = { pv_parse_snd_name, 0, 0, 0 }, { {"sndfrom", (sizeof("sndfrom")-1)}, PVT_OTHER, pv_get_sndfrom, 0, pv_parse_snd_name, 0, 0, 0 }, + { {"rcv", (sizeof("rcv")-1)}, PVT_OTHER, pv_get_rcv, 0, + pv_parse_rcv_name, 0, 0, 0 }, #ifdef WITH_XAVP { {"xavp", sizeof("xavp")-1}, /* xavp */ PVT_XAVP, pv_get_xavp, pv_set_xavp, diff --git a/src/modules/pv/pv_branch.c b/src/modules/pv/pv_branch.c index b0668c07f8..8100046b94 100644 --- a/src/modules/pv/pv_branch.c +++ b/src/modules/pv/pv_branch.c @@ -533,6 +533,110 @@ int pv_parse_snd_name(pv_spec_p sp, str *in) return -1; } +int pv_get_rcv(struct sip_msg *msg, pv_param_t *param, + pv_value_t *res) +{ + sr_net_info_t *neti = NULL; + str s; + + neti = ksr_evrt_rcvnetinfo_get(); + + if (neti==NULL || neti->rcv==NULL || neti->rcv->bind_address==NULL) + return pv_get_null(msg, param, res); + + switch(param->pvn.u.isname.name.n) + { + case 1: /* buf */ + s.s = neti->data.s; + s.len = neti->data.len; + return pv_get_strval(msg, param, res, ); + case 2: /* len */ + return pv_get_uintval(msg, param, res, + (int)neti->data.len); + case 3: /* proto */ + return pv_get_uintval(msg, param, res, (int)neti->rcv->proto); + case 4: /* srcip */ + s.s = ip_addr2a(>rcv->src_ip); + s.len = strlen(s.s); + return pv_get_strval(msg, param, res, ); + case 5: /* rcvip */ + s.s = ip_addr2a(>rcv->dst_ip); + s.len = strlen(s.s); + return pv_get_strval(msg, param, res, ); + case 6: /* sproto */ + if(get_valid_proto_string((int)neti->rcv->proto, + 0, 0, )<0) { + return pv_get_null(msg, param, res); + } + return pv_get_strval(msg, param, res, ); + case 7: /* srcport */ + return pv_get_uintval(msg, param, res, + (int)neti->rcv->src_port); + case 8: /* rcvport */ + return pv_get_uintval(msg, param, res, + (int)neti->rcv->dst_port); + default: + /* 0 - af */ + return pv_get_uintval(msg, param, res, + (int)neti->rcv->bind_address->address.af); + } + + return 0; +} + +int pv_parse_rcv_name(pv_spec_p sp, str *in) +{ + if(sp==NULL || in==NULL || in->len<=0) + return -1; + + switch(in->len) + { + case 2: + if(strncmp(in->s, "af", 2)==0) + sp->pvp.pvn.u.isname.name.n = 0; + else goto error; + break; + case 3: + if(strncmp(in->s, "buf", 3)==0) + sp->pvp.pvn.u.isname.name.n = 1; + else if(strncmp(in->s, "len", 3)==0) + sp->pvp.pvn.u.isname.name.n = 2; + else goto error; + break; + case 5: + if(strncmp(in->s, "proto", 5)==0) + sp->pvp.pvn.u.isname.name.n = 3; + else if(strncmp(in->s, "srcip", 5)==0) +
[sr-dev] git:master:01a02091: core: init actions context for running event_route[core:msg-received]
Module: kamailio Branch: master Commit: 01a02091835651d8eccdba05887a4f2e6f8af725 URL: https://github.com/kamailio/kamailio/commit/01a02091835651d8eccdba05887a4f2e6f8af725 Author: Daniel-Constantin Mierla Committer: Daniel-Constantin Mierla Date: 2019-03-01T15:05:36+01:00 core: init actions context for running event_route[core:msg-received] --- Modified: src/core/receive.c --- Diff: https://github.com/kamailio/kamailio/commit/01a02091835651d8eccdba05887a4f2e6f8af725.diff Patch: https://github.com/kamailio/kamailio/commit/01a02091835651d8eccdba05887a4f2e6f8af725.patch --- diff --git a/src/core/receive.c b/src/core/receive.c index 7f677865cd..dd9248c721 100644 --- a/src/core/receive.c +++ b/src/core/receive.c @@ -200,6 +200,7 @@ int ksr_evrt_received(char *buf, unsigned int len, receive_info_t *rcv_info) ksr_evrt_rcvnetinfo = set_route_type(REQUEST_ROUTE); fmsg = faked_msg_get_next(); + init_run_actions_ctx(_ctx); if(keng) { bctx = sr_kemi_act_ctx_get(); sr_kemi_act_ctx_set(_ctx); ___ Kamailio (SER) - Development Mailing List sr-dev@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
[sr-dev] git:master:bbcbd691: core: option to run event_route[core:msg-received] in incomming message
Module: kamailio Branch: master Commit: bbcbd691ce86d58e56c7620e6b06093349bd549b URL: https://github.com/kamailio/kamailio/commit/bbcbd691ce86d58e56c7620e6b06093349bd549b Author: Daniel-Constantin Mierla Committer: Daniel-Constantin Mierla Date: 2019-03-01T12:55:41+01:00 core: option to run event_route[core:msg-received] in incomming message - done before any major SIP parsing - on drop, processing of the message is stopped - enable with received_route_mode=yes (or 1) - for kemi, set the callback name via kemi.received_route_callback param --- Modified: src/core/cfg.lex Modified: src/core/cfg.y Modified: src/core/globals.h Modified: src/core/ip_addr.h Modified: src/core/receive.c --- Diff: https://github.com/kamailio/kamailio/commit/bbcbd691ce86d58e56c7620e6b06093349bd549b.diff Patch: https://github.com/kamailio/kamailio/commit/bbcbd691ce86d58e56c7620e6b06093349bd549b.patch ___ 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] Segmentation fault on tm:t_should_relay_response (#1875)
The person that reported a similar crash like your initial post confirmed that first tests with master branch do not crash kamailio anymore. Before, the crash could be reproduced after running specific stress tests for rather short time. However, your second crash could be due to your config and either not related to the previous one and its fix, or a side effect of the fix specific to your config. -- 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/issues/1875#issuecomment-468665956___ 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] Segmentation fault on tm:t_should_relay_response (#1875)
Ok, i'll try with master branch. -- 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/issues/1875#issuecomment-468648725___ 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] Segmentation fault on tm:t_should_relay_response (#1875)
Would you be able to try with latest master branch on a testbed or so? The uac field inside the has an invalid value: ``` uac = 0x64 ``` That is not something I touched, so it looks like an invalid write somewhere, might not be related or could be just because of other changes done meanwhile in master branch and not part of the backport. -- 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/issues/1875#issuecomment-468647665___ 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] Segmentation fault on tm:t_should_relay_response (#1875)
After applying the patch i started to get this new crash, and with only one transaction the crash was already occurring. When I removed the changes made by #1875, the segfault on tmx stopped happening again. ``` (gdb) frame 0 #0 0x7f4e5094a934 in pv_get_tm_reply_code (msg=0x7f4e2cd14cb8, param=0x7f4e55a61328, res=0x7fffd5915aa0) at t_var.c:528 528 code = t->uac[branch].last_received; (gdb) p *t $2 = {next_c = 0x7f4e2c7ae270, prev_c = 0x7f4e2cd11d88, hash_index = 12317, label = 1021694037, flags = 329, nr_of_outgoings = 1, fcount = 0, ref_count = {val = 1}, from = { s = 0x7f4e2cd0f831 "From: \"82065\" ;tag=as2d23aaa7\r\nTo: \r\nContact: \r\nCall-ID: 7b434108222cd5ef0c4b0b4b4e8ddad2@200"..., len = 63}, callid = { s = 0x7f4e2cd0f8cc "Call-ID: 7b434108222cd5ef0c4b0b4b4e8ddad2@X.X.X.132:5060\r\nCSeq: 102 INVITE\r\nUser-Agent: Asterisk PBX 11.22.0\r\nDate: Fri, 01 Mar 2019 05:20:01 GMT\r\nAllow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER,"..., len = 63}, cseq_n = { s = 0x7f4e2cd0f90b "CSeq: 102 INVITE\r\nUser-Agent: Asterisk PBX 11.22.0\r\nDate: Fri, 01 Mar 2019 05:20:01 GMT\r\nAllow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE\r\nSupported: replaces"..., len = 9}, to = { s = 0x7f4e2cd0f870 "To: \r\nContact: \r\nCall-ID: 7b434108222cd5ef0c4b0b4b4e8ddad2@X.X.X.132:5060\r\nCSeq: 102 INVITE\r\nUser-Agent: Asterisk PBX 11"..., len = 44}, method = { s = 0x7f4e2cd0f7a0 "INVITE sip:777045516992546314@X.X.X.38 SIP/2.0\r\nVia: SIP/2.0/UDP X.X.X.132:5060;TH=div;branch=z9hG4bK560e0ea1;rport\r\nMax-Forwards: 69\r\nFrom: \"82065\" ;tag=as2d"..., len = 6}, tmcb_hl = { first = 0x7f4e2cd113a8, reg_types = 1048738}, wait_timer = {next = 0x0, prev = 0x0, expire = 0, initial_timeout = 0, data = 0x7f4e2cd0d928, f = 0x7f4e50c2151b , flags = 1, slow_idx = 0}, uas = {request = 0x0, end_request = 0x7f4e2cd0f078 "\001", response = {rbtype = 1120, flags = 11473, t_active = 32590, branch = 0, buffer_len = 100, buffer = 0x174 , my_T = 0x7f4e2cd104c8, timer = {next = 0x7f4e2cd0d928, prev = 0x0, expire = 0, initial_timeout = 0, data = 0x0, f = 0x0, flags = 1354895338, slow_idx = 32590}, dst = {send_sock = 0x0, to = {s = {sa_family = 6952, sa_data = "\322TN\177\000\000\002\000\023\304\310b\201\204"}, sin = {sin_family = 6952, sin_port = 21714, sin_addr = {s_addr = 32590}, sin_zero = "\002\000\023\304\310b\201\204"}, sin6 = {sin6_family = 6952, sin6_port = 21714, sin6_flowinfo = 32590, sin6_addr = {__in6_u = {__u6_addr8 = "\002\000\023\304\310b\201\204\000\000\000\000\000\000\000", __u6_addr16 = {2, 50195, 25288, 33921, 0, 0, 0, 0}, __u6_addr32 = {3289579522, 2223071944, 0, 0}}}, sin6_scope_id = 0}}, id = 0, proto = 0 '\000', send_flags = {f = 0, blst_imask = 0}}, retr_expire = 1, fr_expire = 0}, local_totag = {s = 0x0, len = 751895980}, cancel_reas = 0x0, status = 0}, uac = 0x64, async_backup = {backup_route = 751885120, backup_branch = 32590, blind_uac = 0, ruri_new = 0}, fwded_totags = 0x0, uri_avps_from = 0x0, uri_avps_to = 0x7f4e2cd10ff8, user_avps_from = 0x0, user_avps_to = 0x0, domain_avps_from = 0x0, domain_avps_to = 0x0, xavps_list = 0x0, reply_mutex = {val = 0}, reply_locker_pid = {val = 0}, reply_rec_lock_level = 1, fr_timeout = 89742, fr_inv_timeout = 0, rt_t1_timeout_ms = 32, rt_t2_timeout_ms = 0, end_of_life = 96, relayed_reply_branch = 500, on_failure = 4000, on_branch_failure = 59989, on_reply = 3998, on_branch = 65534, on_branch_delayed = 0, md5 = 0x7f4e2cd0db18 ""} ``` -- 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/issues/1875#issuecomment-468643254___ 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] Kamailio crash while concurrent dialplan.reload (#1874)
Hi, Daniel. Now there are not Kamailio crashes. Just "ongoing reload" errors in 5sec period -- 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/issues/1874#issuecomment-468635987___ 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] Kamailio crash while concurrent dialplan.reload (#1874)
I just pushed a basic safety protection for concurrent rpc reload commands, with a rate limit of 5sec between the commands. Can you try the master branch? -- 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/issues/1874#issuecomment-468609152___ Kamailio (SER) - Development Mailing List sr-dev@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
[sr-dev] git:master:99d5da8d: dialplan: basic safety for concurent rpc reload
Module: kamailio Branch: master Commit: 99d5da8d595961063249f871a5d150474fa6f317 URL: https://github.com/kamailio/kamailio/commit/99d5da8d595961063249f871a5d150474fa6f317 Author: Daniel-Constantin Mierla Committer: Daniel-Constantin Mierla Date: 2019-03-01T10:51:29+01:00 dialplan: basic safety for concurent rpc reload - reported by GH #1874 --- Modified: src/modules/dialplan/dialplan.c --- Diff: https://github.com/kamailio/kamailio/commit/99d5da8d595961063249f871a5d150474fa6f317.diff Patch: https://github.com/kamailio/kamailio/commit/99d5da8d595961063249f871a5d150474fa6f317.patch --- diff --git a/src/modules/dialplan/dialplan.c b/src/modules/dialplan/dialplan.c index a96b246b72..d8685d52f2 100644 --- a/src/modules/dialplan/dialplan.c +++ b/src/modules/dialplan/dialplan.c @@ -88,6 +88,8 @@ int dp_fetch_rows = 1000; int dp_match_dynamic = 0; int dp_append_branch = 1; +static time_t *dp_rpc_reload_time = NULL; + static param_export_t mod_params[]={ { "db_url", PARAM_STR, _db_url }, { "table_name", PARAM_STR, _table_name }, @@ -185,6 +187,13 @@ static int mod_init(void) return -1; } + dp_rpc_reload_time = shm_malloc(sizeof(time_t)); + if(dp_rpc_reload_time == NULL) { + SHM_MEM_ERROR; + return -1; + } + *dp_rpc_reload_time = 0; + return 0; } @@ -202,6 +211,10 @@ static void mod_destroy(void) shm_free(default_par2); default_par2 = NULL; } + if(dp_rpc_reload_time!=NULL) { + shm_free(dp_rpc_reload_time); + dp_rpc_reload_time = 0; + } destroy_data(); } @@ -601,6 +614,17 @@ static const char* dialplan_rpc_reload_doc[2] = { */ static void dialplan_rpc_reload(rpc_t* rpc, void* ctx) { + if(dp_rpc_reload_time==NULL) { + LM_ERR("not ready for reload\n"); + rpc->fault(ctx, 500, "Not ready for reload"); + return; + } + if(*dp_rpc_reload_time!=0 && *dp_rpc_reload_time > time(NULL) - 5) { + LM_ERR("ongoing reload\n"); + rpc->fault(ctx, 500, "ongoing reload"); + return; + } + *dp_rpc_reload_time = time(NULL); if (dp_connect_db() < 0) { LM_ERR("failed to reload rules fron database (db connect)\n"); rpc->fault(ctx, 500, "DB Connection Error"); ___ Kamailio (SER) - Development Mailing List sr-dev@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev