Hi, I would like to share some experience using LCR under Kamailio 3.X
in which there is no longer OPTIONS-based gateways monitorization.
Now, the way to dissable a gateway is by calling defunct_gw() in a
failure_route block (i.e. when there is no response for a request and
fr_timer fires). So it's based on a single request processing. This is
dangerous and I will put a real example:
An ugly client sends us a request with a malformed P-Asserted-Identity
as follows:
P-Asserted-Identity(sip(a)domain.com
Note that it's an *invalid* header. But Kamailio "allows" it and the
request arrives to the GW. But the GW drops the request due to the
malformed header so it sends NO reply at all. Then timeout occurs in
the client transaction and failure_route block is called in which I
call to defunct_gw().
Conclusion: an attacker could dissable my gws just by sending a simple
malformed request. I strongly miss the monitorization feature in the
old LCR module. And ever worse, I could make my own monitorization
client by sending OPTIONS to all the gateways, but LCR module does not
include a simple MI command to enable/dissable a gw so, what should I
do? re-populate all the LCR tables and invoke LCR reload() MI command
every time I detect a gw is offline/online?
Regards.
--
Iñaki Baz Castillo
<ibc(a)aliax.net>
Hello Laura,
I applied most of the patches, apart the second one for hash.c, related
to checking for temporary dialog. I need to look a bit more at it, since
there was some work in this regard:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commitdiff;h=b93…
If I understood right, it is about NOTIFY getting processed faster than
200OK for SUBSCRIBE. Do I remember correctly, you are running 3.1.x? It
might not be in branch 3.1.
Cheers,
Daniel
On 12/28/11 6:15 PM, laura testi wrote:
> Hi Daniel,
> Yes, all patches are related to the PUA module. Please find the
> attachments for both diff files and new files with applied patches If
> you thinks they are useful. Now the old files should be the latest
> version of the master branch ;-) Unfortunately I can not use git here.
> We have tested the patches, now no memory leak any more; and no more
> error for NOTIFY (dialog not found)...Please note, our use case is the
> pua_xmpp, now it works fine. I don't know if rls has the same problem.
> Thank you veru much for your helps again.
>
> Some explanations:
>
> In the send_subscribe.c,
> - I just comment out the line 1172 so that the pua_free_tm_dlg(td)
> do the right job later as you done also in this case.
>
> In the hash.c,
> - in the get_dialog function, I add the check of "p->to_tag.len> 0"
> in the string compare conditions;
>
> - in the is_dialog function, instead of check only the real dialog,
> the check of also the temporary dialog is added, this also helps to
> avoid the error of no dialog found for the NOTIFY if the NOTIFY is
> received before the 202/200 OK of the SUBSCRIBE.
>
> in the pua.c,
> - a few changes in the update_pua function:
> - apply the same kind of free td and td->route_set, unfortunately
> I can not re-use pua_free_tm_dlg which is local for send_subscribe.c.
> - change from goto error to goto done
>
>
> Best Regards,
> Laura
>
>
>
> On Wed, Dec 28, 2011 at 2:39 PM, Daniel-Constantin Mierla
> <miconda(a)gmail.com> wrote:
>> Hello,
>>
>>
>> On 12/27/11 1:51 PM, laura testi wrote:
>>
>> Hi Daniel,
>> I tried the patch, it works partially. There are stil memory leak.
>> Based on your patch, I did find different places need the same kind of
>> patch both in send_subscribe,c and in pua,c
>>
>>
>> ok, thanks, I will look over. But how did you do the patches, since it does
>> not take my latest patch, seems to be against an older version, because the
>> indentation is not there?
>>
>> I cannot apply it like this, maybe you can tell the files and lines you
>> changed, otherwise is hard to track.
>>
>> Are both patches to the pua module? You are doing the patch with files only,
>> it is more convenient to call the diff with path to the module, in this way
>> is easy to spot in which module to apply the path -- i.e., use diff from
>> root folder of kamailio, like:
>>
>> diff -u modules/abc/oldfile modules/abc/newfile
>>
>> Since you are sending a lot of patches, maybe it will work better if you
>> just clone the git, make the patch against the master branch -- change the
>> file in the master branch and then just do:
>>
>> git diff> path/to/save/patch.file
>>
>> Some info that could be useful for working with git and patches, including
>> backporting, at:
>>
>> http://www.kamailio.org/wiki/devel/backporting-to-3.2.x
>>
>> Cheers,
>> Daniel
>>
>>
>>
>>
>> Please find the modified version of these files.
>>
>> Following are the differences:
>> # diff -u send_subscribe.c.orig send_subscribe.c
>> --- send_subscribe.c.orig 2011-12-27 13:31:06.000000000 +0100
>> +++ send_subscribe.c 2011-12-27 13:31:51.000000000 +0100
>> @@ -1151,7 +1151,6 @@
>> if (dbmode!=PUA_DB_ONLY)
>>
>> lock_release(&HashT->p_records[hash_code].lock);
>> ret= -1;
>> - pkg_free(td);
>> goto done;
>> }
>> if (dbmode!=PUA_DB_ONLY)
>>
>>
>>
>>
>>
>> # diff -u pua.c.orig pua.c
>> --- pua.c.orig 2011-12-27 13:15:47.000000000 +0100
>> +++ pua.c 2011-12-27 13:26:33.000000000 +0100
>> @@ -673,106 +673,145 @@
>>
>> int update_pua(ua_pres_t* p)
>> {
>> - str* str_hdr= NULL;
>> - int expires;
>> - int result;
>> - uac_req_t uac_r;
>> -
>> - if(p->desired_expires== 0)
>> - expires= 3600;
>> - else
>> - expires= p->desired_expires- (int)time(NULL);
>> + str* str_hdr= NULL;
>> + ua_pres_t* cb_param = NULL;
>>
>> - if(p->watcher_uri== NULL)
>> - {
>> - str met= {"PUBLISH", 7};
>> - ua_pres_t* cb_param;
>> -
>> - str_hdr = publ_build_hdr(expires, get_event(p->event), NULL,
>> -&p->etag, p->extra_headers, 0);
>> - if(str_hdr == NULL)
>> - {
>> - LM_ERR("while building extra_headers\n");
>> - goto error;
>> - }
>> - LM_DBG("str_hdr:\n%.*s\n ", str_hdr->len, str_hdr->s);
>> -
>> - cb_param= build_uppubl_cbparam(p);
>> - if(cb_param== NULL)
>> - {
>> - LM_ERR("while constructing publ callback param\n");
>> - goto error;
>> - }
>> -
>> - set_uac_req(&uac_r,&met, str_hdr, 0, 0,
>> TMCB_LOCAL_COMPLETED,
>> - publ_cback_func, (void*)cb_param);
>> -
>> - result= tmb.t_request(&uac_r,
>> - p->pres_uri,
>> /* Request-URI */
>> - p->pres_uri,
>> /* To */
>> - p->pres_uri,
>> /* From */
>> -&outbound_proxy
>> /* Outbound proxy*/
>> - );
>> - if(result< 0)
>> - {
>> - LM_ERR("in t_request function\n");
>> - shm_free(cb_param);
>> - goto error;
>> - }
>> -
>> - }
>> - else
>> - {
>> - str met= {"SUBSCRIBE", 9};
>> - dlg_t* td= NULL;
>> - ua_pres_t* cb_param= NULL;
>> -
>> - td= pua_build_dlg_t(p);
>> - if(td== NULL)
>> - {
>> - LM_ERR("while building tm dlg_t structure");
>> - goto error;
>> - };
>> -
>> - str_hdr= subs_build_hdr(&p->contact,
>> expires,p->event,p->extra_headers);
>> - if(str_hdr== NULL || str_hdr->s== NULL)
>> - {
>> - LM_ERR("while building extra headers\n");
>> - pkg_free(td);
>> - return -1;
>> - }
>> - cb_param= subs_cbparam_indlg(p, expires, REQ_ME);
>> - if(cb_param== NULL)
>> - {
>> - LM_ERR("while constructing subs callback param\n");
>> - goto error;
>> -
>> - }
>> -
>> - set_uac_req(&uac_r,&met, str_hdr, 0, td,
>> TMCB_LOCAL_COMPLETED,
>> - subs_cback_func, (void*)cb_param);
>> -
>> - result= tmb.t_request_within(&uac_r);
>> - if(result< 0)
>> - {
>> - LM_ERR("in t_request function\n");
>> - shm_free(cb_param);
>> - pkg_free(td);
>> - goto error;
>> - }
>> -
>> - pkg_free(td);
>> - td= NULL;
>> - }
>> -
>> - pkg_free(str_hdr);
>> - return 0;
>> -
>> -error:
>> - if(str_hdr)
>> - pkg_free(str_hdr);
>> - return -1;
>> + int expires;
>> + int result = 0;
>> + uac_req_t uac_r;
>> + str met = {NULL, 0};
>> + int ret_code = 0;
>> + dlg_t* td = NULL;
>> +
>> +
>> + if(p->desired_expires== 0)
>> + expires= default_expires;
>> + else
>> + expires= p->desired_expires- (int)time(NULL);
>> +
>> + if(p->watcher_uri== NULL)
>> + {
>> +
>> + str_hdr = publ_build_hdr(expires, get_event(p->event), NULL,
>> +&p->etag, p->extra_headers, 0);
>> +
>> + if(str_hdr == NULL)
>> + {
>> + LM_ERR("while building extra_headers\n");
>> + ret_code = -1;
>> + goto done;
>> + }
>> + LM_DBG("str_hdr:\n%.*s\n ", str_hdr->len, str_hdr->s);
>> +
>> + cb_param= build_uppubl_cbparam(p);
>> + if(cb_param== NULL)
>> + {
>> + LM_ERR("while constructing publ callback param\n");
>> + ret_code = -1;
>> + goto done;
>> + }
>> +
>> + met.s = (char*)pkg_malloc(8*sizeof(char));
>> + if(met.s == NULL) {
>> + LM_ERR("no memory for met.s(PUBLISH)\n");
>> + ret_code = -1;
>> + goto done;
>> + }
>> + memset(met.s, 0, 8);
>> + memcpy(met.s, "PUBLISH", 7);
>> + met.len = 7;
>> + set_uac_req(&uac_r,&met, str_hdr, 0, 0, TMCB_LOCAL_COMPLETED,
>> + publ_cback_func, (void*)cb_param);
>> +
>> + result= tmb.t_request(&uac_r,
>> + p->pres_uri, /* Request-URI */
>> + p->pres_uri, /* To */
>> + p->pres_uri, /* From */
>> +&outbound_proxy /* Outbound proxy*/
>> + );
>> + if(result< 0)
>> + {
>> + LM_ERR("in t_request function\n");
>> + shm_free(cb_param);
>> + cb_param = NULL;
>> + ret_code = -1;
>> + goto done;
>> + }
>> + }
>> + else
>> + {
>> + td= pua_build_dlg_t(p);
>> + if(td== NULL)
>> + {
>> + LM_ERR("while building tm dlg_t structure");
>> + ret_code = -1;
>> + goto done;
>> + };
>> +
>> + str_hdr= subs_build_hdr(&p->contact,
>> expires,p->event,p->extra_headers);
>> + if(str_hdr== NULL || str_hdr->s== NULL)
>> + {
>> + if(p->event!=0)
>> + LM_ERR("while building extra headers\n");
>> +
>> + ret_code = -1;
>> + goto done;
>> + }
>> +
>> + cb_param= subs_cbparam_indlg(p, expires, REQ_ME);
>> + if(cb_param== NULL)
>> + {
>> + LM_ERR("while constructing subs callback param\n");
>> + ret_code = -1;
>> + goto done;
>> + }
>> +
>> + met.s = (char*)pkg_malloc(10*sizeof(char));
>> + if(met.s == NULL) {
>> + LM_ERR("no memory for met.s(SUBSCRIBE)\n");
>> + ret_code = -1;
>> + goto done;
>> + }
>> + memset(met.s, 0, 10);
>> + memcpy(met.s, "SUBSCRIBE", 9);
>> + met.len = 9;
>> + set_uac_req(&uac_r,&met, str_hdr, 0, td, TMCB_LOCAL_COMPLETED,
>> + subs_cback_func, (void*)cb_param);
>> +
>> + result= tmb.t_request_within(&uac_r);
>> + if(result< 0)
>> + {
>> + LM_ERR("in t_request function\n");
>> + ret_code = -1;
>> + shm_free(cb_param);
>> + cb_param = NULL;
>> + goto done;
>> + }
>> + }
>> +
>> +
>> +done:
>> + if(td!=NULL)
>> + {
>> + if(td->route_set)
>> + free_rr(&td->route_set);
>> +
>> + pkg_free(td);
>> + td= NULL;
>> + }
>> +
>> + if(met.s != NULL) {
>> + pkg_free(met.s);
>> + met.s = NULL;
>> + met.len = 0;
>> + }
>> +
>> + if(str_hdr != NULL) {
>> + pkg_free(str_hdr);
>> + str_hdr = NULL;
>> + }
>>
>> + return ret_code;
>> }
>>
>> static void db_update(unsigned int ticks,void *param)
>>
>>
>> It seems a lot of change, but there are only a few lines changed,
>> probably in the file I modify I have convert the TAB to Space and the
>> diff does not recognize them. Another thing is I use dynamic memory
>> for the str SUBSCRIBE and PUBLISH.
>>
>>
>>
>>
>> Another thing for the management of NOTIFY arrives before the 202/200
>> OK of SUBSCRIBE, in addition to the patches done previously, maybe the
>> hash.c need to patch for the is_dialog function which is called for
>> the NOTIFY in PUA_XMPP module:
>>
>> # diff -u hash.c.orig hash.c
>> --- hash.c.orig 2011-12-27 13:38:06.000000000 +0100
>> +++ hash.c 2011-12-27 13:38:38.000000000 +0100
>> @@ -487,10 +487,11 @@
>> hash_code= core_hash(dialog->pres_uri, dialog->watcher_uri,
>> HASH_SIZE);
>> lock_get(&HashT->p_records[hash_code].lock);
>>
>> - if(get_dialog(dialog, hash_code)== NULL)
>> - ret_code= -1;
>> - else
>> + if(get_dialog(dialog, hash_code) ||
>> get_temporary_dialog(dialog, hash_code))
>> ret_code= 0;
>> + else
>> + ret_code= -1;
>> +
>> lock_release(&HashT->p_records[hash_code].lock);
>>
>> return ret_code;
>>
>>
>> Best Regards,
>> Laura
>>
>> On Fri, Dec 23, 2011 at 5:10 PM, laura testi<lau.testi(a)gmail.com> wrote:
>>
>> Ok, I'll try it.
>>
>> Thank you very much!
>>
>>
>>
>>
>> On Fri, Dec 23, 2011 at 1:20 PM, Daniel-Constantin Mierla
>> <miconda(a)gmail.com> wrote:
>>
>> Hello,
>>
>> can you try with this patch:
>>
>> http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=1b3cfa6…
>>
>> Cheers,
>> Daniel
>>
>>
>> On 12/23/11 12:36 PM, Daniel-Constantin Mierla wrote:
>>
>> Hello,
>>
>> looks like a leak in a module that is storing record-routes and use them
>> later, perhaps pua module, I will check it soon.
>>
>> Cheers,
>> Daniel
>>
>> On 12/23/11 11:31 AM, laura testi wrote:
>>
>> Hi Daniel,
>> I just follow the instruction in the link you sent
>> (http://www.asipto.com/pub/kamailio-devel-guide/#c04troubleshooting)
>> to use gdb to print PKG fragments. When I got the error in PUA:
>>
>> Dec 23 11:10:53 /.../sbin/kamailio[23276]: ERROR: pua
>> [send_subscribe.c:158]: No memory left for size:439
>> Dec 23 11:10:53 /.../sbin/kamailio[23276]: ERROR: pua [pua.c:747]:
>> while building tm dlg_t structure
>> Dec 23 11:10:53 /.../sbin/kamailio[23276]: ERROR: pua [pua.c:652]:
>> while updating record
>>
>>
>> The I run the command
>> gdb /.../sbin/kamailio 23276
>> and write the following commands in the gdb:
>>
>> set $i=0
>> set $a = mem_block->first_frag
>> while($i<10000)
>> if($i>2000)
>> if($a->u.is_free==0)
>> p *$a
>> end
>> end
>> set $a = ((struct qm_frag*)((char*)($a)+sizeof(struct
>> qm_frag)+((struct qm_frag*)$a)->size+sizeof(struct qm_frag_end)))
>> set $i = $i + 1
>> end
>> ...
>>
>> after a while I got a lot of prints on the screen like these:
>>
>> func = 0x5d7b00 "do_parse_rr_body", line = 74, check = 4042322160}
>> $1348 = {size = 72, u = {nxt_free = 0x0, is_free = 0},
>> file = 0x5d76c9 "<core>: parser/parse_rr.c",
>> func = 0x5d7b00 "do_parse_rr_body", line = 74, check = 4042322160}
>> $1349 = {size = 72, u = {nxt_free = 0x0, is_free = 0},
>> file = 0x5d76c9 "<core>: parser/parse_rr.c",
>> func = 0x5d7b00 "do_parse_rr_body", line = 74, check = 4042322160}
>> $1350 = {size = 72, u = {nxt_free = 0x0, is_free = 0},
>> file = 0x5d76c9 "<core>: parser/parse_rr.c",
>> func = 0x5d7b00 "do_parse_rr_body", line = 74, check = 4042322160}
>> $1351 = {size = 104, u = {nxt_free = 0x0, is_free = 0},
>> file = 0x5d76c9 "<core>: parser/parse_rr.c",
>> func = 0x5d7b00 "do_parse_rr_body", line = 74, check = 4042322160}
>> $1352 = {size = 104, u = {nxt_free = 0x0, is_free = 0},
>> file = 0x5d76c9 "<core>: parser/parse_rr.c",
>> func = 0x5d7b00 "do_parse_rr_body", line = 74, check = 4042322160}
>> $1353 = {size = 72, u = {nxt_free = 0x0, is_free = 0},
>> file = 0x5d76c9 "<core>: parser/parse_rr.c",
>> func = 0x5d7b00 "do_parse_rr_body", line = 74, check = 4042322160}
>> $1354 = {size = 72, u = {nxt_free = 0x0, is_free = 0},
>> ---Type<return> to continue, or q<return> to quit---
>>
>> ...
>>
>>
>> But I don't understand if these are normal or something goes wrong....
>>
>> Can you help
>>
>>
>> Best Regards,
>> Laura
>>
>> On Wed, Dec 21, 2011 at 12:18 PM, Daniel-Constantin Mierla
>> <miconda(a)gmail.com> wrote:
>>
>> Hello,
>>
>> pkg.stats was added in 3.2.0, iirc. For 3.1, you can walk the packets in
>> memory with gdb -- 3.1 has memory debug on, so you don't need to
>> recompile
>> (unless you turned it off).
>>
>> Just attach to the pid of a sip worker (gdb /path/to/kamailio
>> _pid_value_)
>> and run the gdb script.
>>
>> Cheers,
>> Daniel
>>
>>
>> On 12/21/11 11:58 AM, laura testi wrote:
>>
>> Hi Daniel,
>> I try the sercmd for pkg memory but it return 500 error:
>>
>>
>> # sercmd
>> sercmd 0.2
>> Copyright 2006 iptelorg GmbH
>> This is free software with ABSOLUTELY NO WARRANTY.
>> For details type `warranty'.
>> sercmd> pkg.stats
>> error: 500 - command pkg.stats not found
>> sercmd>
>>
>>
>>
>> Is it available only for 3.2.x and master branch? Because we are using
>> 3.1.5. But take the PUA module from master branch for the fetch_row
>> parameter you have patched ;-)
>>
>>
>> core.shmmem is ok.
>>
>>
>>
>> Thanks a lot
>>
>> Laura
>>
>> On Wed, Dec 21, 2011 at 10:58 AM, Daniel-Constantin Mierla
>> <miconda(a)gmail.com> wrote:
>>
>> Hello,
>>
>> you can see the available pkg via sercmd, sending command pkg.stats
>> (match
>> the entry for the pid printing the error). If there is no free memory,
>> then
>> might be a leak.
>>
>> You can attach with gdb to the pid printing these errors and walk to
>> pkg,
>> you see the commands for gdb at:
>>
>> http://www.asipto.com/pub/kamailio-devel-guide/#c04troubleshooting
>>
>> See if you have lot of allocated chunks from same place in source code
>> (ignore those at the beginning, mainly related to cfg parsing) and
>> send
>> the
>> details here.
>>
>> Cheers,
>> Daniel
>>
>>
>> On 12/21/11 10:44 AM, laura testi wrote:
>>
>> Hi,
>> we are using the PUA_XMPP and PUA modules from the master branch. When
>> the modules are started, everything are ok, the presence events from
>> XMPP are sent to kamailio SIP servers (PUBLISH/SUBSCRIBE) and cached
>> in the hash. But when there are several thousands records in the hash
>> tabel, the update_pua function called in the hashT_clean gives a lot
>> of "No memory left" error when the hashT_clean is waked up from the
>> time:
>>
>> ERROR: pua [send_subscribe.c]: No memory left
>> ERROR: pua [pua.c]: while building tm dlg_t structure
>>
>> The failed call is:
>> td = (dlg_t*)pkg_malloc(size);
>> if(td == NULL)
>> {
>> LM_ERR("No memory left\n");
>> return NULL;
>> }
>>
>> in dlg_t* pua_build_dlg_t(ua_pres_t* presentity) function in
>> send_subscribe.c. The size is about 400 and something... It's
>> strange.....
>>
>> Is it the memory leak in the PUA module?
>>
>>
>>
>> I also try to increase the pkg_memory from 4MB default to 16MB, but it
>> doesn't help.
>>
>>
>> Any Idea?
>>
>> Thanks in advanced
>>
>> Laura
>>
>> _______________________________________________
>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing
>> list
>> sr-users(a)lists.sip-router.org
>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>
>>
>> --
>> Daniel-Constantin Mierla -- http://www.asipto.com
>> http://linkedin.com/in/miconda -- http://twitter.com/miconda
>>
>> _______________________________________________
>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>> sr-users(a)lists.sip-router.org
>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>
>> --
>> Daniel-Constantin Mierla -- http://www.asipto.com
>> http://linkedin.com/in/miconda -- http://twitter.com/miconda
>>
>> --
>> Daniel-Constantin Mierla -- http://www.asipto.com
>> http://linkedin.com/in/miconda -- http://twitter.com/miconda
>>
>>
>>
>> _______________________________________________
>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>> sr-users(a)lists.sip-router.org
>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>>
>>
>> --
>> Daniel-Constantin Mierla -- http://www.asipto.com
>> http://linkedin.com/in/miconda -- http://twitter.com/miconda
>>
>>
>> _______________________________________________
>> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
>> sr-users(a)lists.sip-router.org
>> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
--
Daniel-Constantin Mierla -- http://www.asipto.comhttp://linkedin.com/in/miconda -- http://twitter.com/miconda
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
The following task has a new comment added:
FS#191 - bad sotket after re-register in location table
User who did this - David Kovarik (kovik)
----------
odorik.domain = "serz.odorik.cz" desc "nase_domena"
......
route[AUTH]{
$rd = $sel(cfg_get.odorik.domain); #musim mu nastavit ze vola na nas
if (is_method("REGISTER")){
#registrace pouze z CZ a SK
route(ONLYCZ);
#auth limit
#kdyz posle registraci vic nez 5* za 5minut
if($sht(auth=>$au::auth_count)==10){
$var(exp) = $Ts - 300; #zablokuje na 5 minut
if($sht(auth=>$au::last_auth) > $var(exp)){
sl_send_reply("403", "Try later");
xlog("L_INFO","Prekrocil limit registraci $var(exp) - $sht(auth=>$au::last_auth) - auth: $au, src ip: $si\n");
exit;
}else{
$sht(auth=>$au::auth_count) = 0;
sql_query("seru","UPDATE subscriber SET reg_expire=0 WHERE user='$au'","nic");
sql_result_free("nic");
}
}
#/auth limit
if (!www_authorize("$td", "subscriber")){
#if (!www_authorize('$sel(cfg_get.odorik.domain)', "subscriber")){
#auth limit
switch ($retcode) {
case -1: #invalid user
sl_send_reply("403", "Forbidden");
$var(reg_mess)="INVALID USER";
route(REGISTER_LOG);
xlog("L_INFO","Invalid user: $au, src ip: $si");
exit;
case -2: #invalid password
$var(reg_mess)="INVALID PASSWORD";
route(REGISTER_LOG);
if($sht(auth=>$au::auth_count) == $null){
$sht(auth=>$au::auth_count) = 0;
}
xlog("L_INFO","Invalid password - auth: $au, src ip: $si -- count=$sht(auth=>$au::auth_count)");
$sht(auth=>$au::auth_count) = $sht(auth=>$au::auth_count) + 1;
if($sht(auth=>$au::auth_count) == 10){
xlog("L_INFO","Prekrocil limit registraci - auth: $au, src ip: $si -- count=$sht(auth=>$au::auth_count) -- last:$sht(auth=>$au::last_auth) = $Ts \n");
sql_query("seru","UPDATE subscriber SET datum_zmeny=NOW(),reg_expire=NOW(),reg_expire_ip='$si' WHERE user='$au'","nic");
sql_result_free("nic");
}
$sht(auth=>$au::last_auth) = $Ts;
sl_send_reply("403", "Forbidden");
break;
}
#/auth limit
www_challenge("$td", "1");
#www_challenge('$sel(cfg_get.odorik.domain)', "1");
exit;
}
#prosel smazu z sht
$sht(auth=>$au::auth_count) = $null;
$sht(auth=>$au::last_auth) = $null;
xlog("L_INFO","AUTH-REGISTER prosel-$rm - $ci - $fU - $rU - $au=$tU");
if ($au!=$tU)
{
sl_send_reply("403","Forbidden");
$var(reg_mess)="INVALID AUTH ID";
route(REGISTER_LOG);
xlog("L_INFO","AUTH FORBIDDEN $ci - $fU - $rU - $au != $tU");
exit;
}
$var(reg_mess)="OK";
route(REGISTER_LOG);
sql_query("seru","UPDATE subscriber SET datum_zmeny=NOW() WHERE user='$au'","nic");
sql_result_free("nic");
}else{
.....
route[REGISTER_LOG]{
sql_query("seru","insert into register_log set time_stamp=now(), src_ip='$si',auth_user='$au',from_user='$fU',from_uri='$fu',contact_header='$ct',user_agent='$ua',pozn='$var(reg_mess)',packet='$mb' ON DUPLICATE KEY UPDATE time_stamp=now(),auth_user='$au',from_user='$fU',from_uri='$fu',contact_header='$ct',user_agent='$ua',pozn='$var(reg_mess)',packet='$mb'","nil");
sql_result_free("nil");
}
route[ONLYCZ]{
#muze volat jenom z CZ nebo SK
#pridat do hlavnidb atributy a potom je preposlat odoriku exe
if($sht(set=>$au) & 2){
if(geoip_match("$si", "src")){
if !($gip(src=>cc) =~ "CZ|SK"){
xlog("L_INFO","ONLYCZ -- $fU -- forbidden $ru -- $rm from:$si =$gip(src=>cc)-");
sl_send_reply("403","CZ_ONLY");
exit;
}
}
}
}
.....
grep -i location ./kamailio.cfg
# *** To enable persistent user location execute:
# set paths to location of modules
modparam("usrloc", "preload", "location")
#/* uncomment the next line to disable parallel forking via location */
/* enable DB persistency for location entries */
#lookup("location");
# user location service
route(LOCATION);
if (!save("location"))
# USER location service
route[LOCATION]{
if (!lookup("location")) {
$var(tmp)="LOCATION 404";
$var(tmp)="LOCATION 405";
......
grep \:5 ./kamailio.cfg
listen=udp:81.31.45.57:5060
listen=tcp:81.31.45.57:5060
#listen=udp: serz.odorik.cz:5060
#listen=tcp: serz.odorik.cz:5060
modparam("siptrace", "duplicate_uri","sip:81.31.45.55:5066")
----------
More information can be found at the following URL:
http://sip-router.org/tracker/index.php?do=details&task_id=191#comment482
You are receiving this message because you have requested it from the Flyspray bugtracking system. If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.
would it be a big deal to extend onsend route to work also on replies or
introduce a new onsend_reply_route for that purpose?
for example, i would like to be able to change response code/reason to
something else in such a route based on some conditions (flags, avp
values).
-- juha
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
The following task has a new comment added:
FS#193 - no avpops bigint handling breaks custom select queries
User who did this - Daniel-Constantin Mierla (miconda)
----------
It is a matter of perspective, the issue is still here in a tracker, marked as an improvement request, so as soon someone will provide a patch or a developer will commit the enhancement, it will be closed, till then will be here.
AVPs are from their beginning dealing with string or int values, someone has to know the underline db system to return such values if they are going to be stored in AVPs -- reason I don't see it as a bug, but enhancement request. Even now, there are so many DB types unsupported internally, as each db system has different types, not all standard.
We cannot go through all possible db data types, for each version of db systems -- they change, new appear, a.s.o.
----------
More information can be found at the following URL:
http://sip-router.org/tracker/index.php?do=details&task_id=193#comment481
You are receiving this message because you have requested it from the Flyspray bugtracking system. If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
The following task has a new comment added:
FS#193 - no avpops bigint handling breaks custom select queries
User who did this - Walter Doekes (wdoekes)
----------
> I am changing it in feature request, since avps are data structs to handle int and str values.
I think that's a bit short sighted. Remember that I don't want any bigints. They're imposed on me by the SQL backend and/or driver, without any warning and without non-trivial workarounds. Having to create a mysql function that casts to a smaller int is not something immediately obvious when results are simply returned as <null> instead of an expected integer.
I think it's a bug until it is transparently handled OR until the user is warned (a) that there is a problem (no bigint handling) and preferably (b) how to solve it.
Regards,
Walter
----------
More information can be found at the following URL:
http://sip-router.org/tracker/index.php?do=details&task_id=193#comment480
You are receiving this message because you have requested it from the Flyspray bugtracking system. If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.
THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.
The following task has been changed. The changes are listed below. For full information about what has changed, visit the URL and click the History tab.
FS#194 - Record-Route and msg_apply_changes()
User who did this: Daniel-Constantin Mierla (miconda)
Task Type: Bug Report -> Improvement
More information can be found at the following URL:
http://sip-router.org/tracker/index.php?do=details&task_id=194
You are receiving this message because you have requested it from the Flyspray bugtracking system. If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.