looks like usrloc flags don't work either

17 messages Options
Embed this post
Permalink
Juha Heinanen

looks like usrloc flags don't work either

Reply Threaded More More options
Print post
Permalink
i have twinkle registered from behind nat and when i check in location
table my nat flag

modparam("usrloc", "nat_bflag", 1)

is set, i.e. flag column of twinkle contact in location table has value
2.

but when i check after lookup():

        lookup("location");
        switch ($rc) {
        case 1:
                if (isbflagset(1)) {
                xlog("L_INFO", "Branch Flag 1 is set\n");
                };

nothing gets printed to syslog.  i have not changed any of this config
code since k.

is this a compatibility issue or a bug?

-- juha

_______________________________________________
sr-dev mailing list
[hidden email]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
Daniel-Constantin Mierla

Re: looks like usrloc flags don't work either

Reply Threaded More More options
Print post
Permalink
Hello,

On 30.10.2009 10:22 Uhr, Juha Heinanen wrote:

> i have twinkle registered from behind nat and when i check in location
> table my nat flag
>
> modparam("usrloc", "nat_bflag", 1)
>
> is set, i.e. flag column of twinkle contact in location table has value
> 2.
>
> but when i check after lookup():
>
> lookup("location");
> switch ($rc) {
> case 1:
> if (isbflagset(1)) {
>  
put the parameter between double quotes:

isbflagset("1")

- let me know if works now.

Cheers,
Daniel

>        xlog("L_INFO", "Branch Flag 1 is set\n");
> };
>
> nothing gets printed to syslog.  i have not changed any of this config
> code since k.
>
> is this a compatibility issue or a bug?
>
> -- juha
>
> _______________________________________________
> sr-dev mailing list
> [hidden email]
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
>
>  

--
Daniel-Constantin Mierla
* Kamailio SIP Masterclass, Nov 9-13, 2009, Berlin
* http://www.asipto.com/index.php/sip-router-masterclass/


_______________________________________________
sr-dev mailing list
[hidden email]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
Juha Heinanen

Re: looks like usrloc flags don't work either

Reply Threaded More More options
Print post
Permalink
Daniel-Constantin Mierla writes:

 > put the parameter between double quotes:
 >
 > isbflagset("1")
 >
 > - let me know if works now.

no change, i.e., still the test fails.

-- juha

        lookup("location");
        switch ($rc) {
        case 1:
                if (isbflagset("1")) {
                xlog("L_INFO", "Branch Flag 1 is set\n");
                };

_______________________________________________
sr-dev mailing list
[hidden email]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
Juha Heinanen

looks like usrloc flags don't work either

Reply Threaded More More options
Print post
Permalink
In reply to this post by Juha Heinanen
Juha Heinanen writes:

 > is set, i.e. flag column of twinkle contact in location table has value
 > 2.

may be it is cflags column that is used for branch flags?  if so, cflag
column has value 0.

-- juha

_______________________________________________
sr-dev mailing list
[hidden email]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
Daniel-Constantin Mierla

Re: looks like usrloc flags don't work either

Reply Threaded More More options
Print post
Permalink


On 30.10.2009 10:37 Uhr, Juha Heinanen wrote:
> Juha Heinanen writes:
>
>  > is set, i.e. flag column of twinkle contact in location table has value
>  > 2.
>
> may be it is cflags column that is used for branch flags?  if so, cflag
> column has value 0.
>
>  
it is cflags -- per contact flags.
http://kamailio.org/docs/db-tables/kamailio-db-1.5.x.html#AEN5835

Cheers,
Daniel

--
Daniel-Constantin Mierla
* Kamailio SIP Masterclass, Nov 9-13, 2009, Berlin
* http://www.asipto.com/index.php/sip-router-masterclass/


_______________________________________________
sr-dev mailing list
[hidden email]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
Juha Heinanen

Re: looks like usrloc flags don't work either

Reply Threaded More More options
Print post
Permalink
Daniel-Constantin Mierla writes:

 > it is cflags -- per contact flags.
 > http://kamailio.org/docs/db-tables/kamailio-db-1.5.x.html#AEN5835

fine, but then there is something wrong in save function, because it
does not set cflags:

        if (isflagset(9)) {
                fix_nated_register();
                xlog("L_INFO", "Setting bflag 1\n");
                setbflag(1);
        };

        if (allow_register("permissions")) {
                save("location");

i get to syslog

Oct 30 11:43:22 localhost /usr/sbin/sip-proxy[15251]: INFO: Setting bflag 1

but still cflags is 0.

-- juha

_______________________________________________
sr-dev mailing list
[hidden email]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
Daniel-Constantin Mierla

Re: looks like usrloc flags don't work either

Reply Threaded More More options
Print post
Permalink


On 30.10.2009 10:46 Uhr, Juha Heinanen wrote:

> Daniel-Constantin Mierla writes:
>
>  > it is cflags -- per contact flags.
>  > http://kamailio.org/docs/db-tables/kamailio-db-1.5.x.html#AEN5835
>
> fine, but then there is something wrong in save function, because it
> does not set cflags:
>
> if (isflagset(9)) {
> fix_nated_register();
> xlog("L_INFO", "Setting bflag 1\n");
> setbflag(1);
> };
>
> if (allow_register("permissions")) {
> save("location");
>
> i get to syslog
>
> Oct 30 11:43:22 localhost /usr/sbin/sip-proxy[15251]: INFO: Setting bflag 1
>
> but still cflags is 0.
>  
use quotes around the parameter of bflag functions.

The grammar of sr cfg language allow module functions with integer
parameters (now bflags functions are in kex module so they accept PV in
parameters). This is wrong since all modules expect string there and
there is no error thrown if function name and number of parameters
matches -- it was discussed long time ago, but forgotten. I will fix it.

Cheers,
Daniel

--
Daniel-Constantin Mierla
* Kamailio SIP Masterclass, Nov 9-13, 2009, Berlin
* http://www.asipto.com/index.php/sip-router-masterclass/


_______________________________________________
sr-dev mailing list
[hidden email]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
Juha Heinanen

Re: looks like usrloc flags don't work either

Reply Threaded More More options
Print post
Permalink
In reply to this post by Juha Heinanen
Juha Heinanen writes:

 > fine, but then there is something wrong in save function, because it
 > does not set cflags:
 >
 > if (isflagset(9)) {
 > fix_nated_register();
 > xlog("L_INFO", "Setting bflag 1\n");
 > setbflag(1);
 > };
 >
 > if (allow_register("permissions")) {
 > save("location");
 >
 > i get to syslog
 >
 > Oct 30 11:43:22 localhost /usr/sbin/sip-proxy[15251]: INFO: Setting bflag 1
 >
 > but still cflags is 0.

i also tested with quotes

                setbflag("1");

and the result it the same, i.e., cflags col value stays as 0.

perhaps this has something to do with major hassle that i'm experiencing
with anything related to branches.

-- juha

_______________________________________________
sr-dev mailing list
[hidden email]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
Daniel-Constantin Mierla

Re: looks like usrloc flags don't work either

Reply Threaded More More options
Print post
Permalink


On 30.10.2009 10:51 Uhr, Juha Heinanen wrote:

> Juha Heinanen writes:
>
>  > fine, but then there is something wrong in save function, because it
>  > does not set cflags:
>  >
>  > if (isflagset(9)) {
>  > fix_nated_register();
>  > xlog("L_INFO", "Setting bflag 1\n");
>  > setbflag(1);
>  > };
>  >
>  > if (allow_register("permissions")) {
>  > save("location");
>  >
>  > i get to syslog
>  >
>  > Oct 30 11:43:22 localhost /usr/sbin/sip-proxy[15251]: INFO: Setting bflag 1
>  >
>  > but still cflags is 0.
>
> i also tested with quotes
>
> setbflag("1");
>
> and the result it the same, i.e., cflags col value stays as 0.
>
> perhaps this has something to do with major hassle that i'm experiencing
> with anything related to branches.
>  
I am going to test right now, I do not see how these could be related
since you do this part in main route and is basically only usrloc module
at this point.

Cheers,
Daniel

--
Daniel-Constantin Mierla
* Kamailio SIP Masterclass, Nov 9-13, 2009, Berlin
* http://www.asipto.com/index.php/sip-router-masterclass/


_______________________________________________
sr-dev mailing list
[hidden email]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
Juha Heinanen

Re: looks like usrloc flags don't work either

Reply Threaded More More options
Print post
Permalink
In reply to this post by Daniel-Constantin Mierla
Daniel-Constantin Mierla writes:

 > use quotes around the parameter of bflag functions.
 >
 > The grammar of sr cfg language allow module functions with integer
 > parameters (now bflags functions are in kex module so they accept PV in
 > parameters). This is wrong since all modules expect string there and
 > there is no error thrown if function name and number of parameters
 > matches -- it was discussed long time ago, but forgotten. I will fix
 > it.

it is very important from finding problems' point of view that an error
is generated if parameter to a function has wrong type.

this lookup/cflags issue is something else though, because even with
quotes, cflags remains 0.

-- juha

_______________________________________________
sr-dev mailing list
[hidden email]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
Juha Heinanen

Re: looks like usrloc flags don't work either

Reply Threaded More More options
Print post
Permalink
In reply to this post by Daniel-Constantin Mierla
Daniel-Constantin Mierla writes:

 > use quotes around the parameter of bflag functions.

is it so that bflag functions require quotes and in other flag function
quotes are not allowed?

looks like it because i'm now getting syntax error on this line:

                        isflagset("11")) {

 0(16211) : <core> [cfg.y:3209]: parse error in config file /etc/sip-proxy/sip-proxy.cfg, line 950, column 18: flag not declared

in order to avoid errors like this, all flag functions should take same
kind of parameters.

-- juha

_______________________________________________
sr-dev mailing list
[hidden email]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
Daniel-Constantin Mierla

Re: looks like usrloc flags don't work either

Reply Threaded More More options
Print post
Permalink


On 30.10.2009 11:16 Uhr, Juha Heinanen wrote:

> Daniel-Constantin Mierla writes:
>
>  > use quotes around the parameter of bflag functions.
>
> is it so that bflag functions require quotes and in other flag function
> quotes are not allowed?
>
> looks like it because i'm now getting syntax error on this line:
>
> isflagset("11")) {
>
>  0(16211) : <core> [cfg.y:3209]: parse error in config file /etc/sip-proxy/sip-proxy.cfg, line 950, column 18: flag not declared
>
> in order to avoid errors like this, all flag functions should take same
> kind of parameters.
>  
only branch and script flags functions (kamailio specific) require
quotes, being implemented in kex module and can have PV parameters, not
only integers.

Daniel

_______________________________________________
sr-dev mailing list
[hidden email]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
Juha Heinanen

Re: looks like usrloc flags don't work either

Reply Threaded More More options
Print post
Permalink
Daniel-Constantin Mierla writes:

 > only branch and script flags functions (kamailio specific) require
 > quotes, being implemented in kex module and can have PV parameters, not
 > only integers.

did that now, but the problem still remains that cfags column is not
set, when save() is called and nat_bflag is set.

-- juha

_______________________________________________
sr-dev mailing list
[hidden email]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
Daniel-Constantin Mierla

Re: looks like usrloc flags don't work either

Reply Threaded More More options
Print post
Permalink


On 30.10.2009 11:30 Uhr, Juha Heinanen wrote:
> Daniel-Constantin Mierla writes:
>
>  > only branch and script flags functions (kamailio specific) require
>  > quotes, being implemented in kex module and can have PV parameters, not
>  > only integers.
>
> did that now, but the problem still remains that cfags column is not
> set, when save() is called and nat_bflag is set.
>  
I found the bug and fixed it in kamailio_3.0. I am merging it in sr_3.0
right now.

It was a typo when migration was done -- cflags got replaced with flags
in save function

Cheers,
Daniel


_______________________________________________
sr-dev mailing list
[hidden email]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
Juha Heinanen

Re: looks like usrloc flags don't work either

Reply Threaded More More options
Print post
Permalink
Daniel-Constantin Mierla writes:

 > I found the bug and fixed it in kamailio_3.0. I am merging it in sr_3.0
 > right now.
 >
 > It was a typo when migration was done -- cflags got replaced with flags
 > in save function

daniel,

thanks for the rapid fix. cflags are now set properly in location table.

-- juha

_______________________________________________
sr-dev mailing list
[hidden email]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
Andrei Pelinescu-Onciul

Re: looks like usrloc flags don't work either

Reply Threaded More More options
Print post
Permalink
In reply to this post by Daniel-Constantin Mierla
On Oct 30, 2009 at 10:50, Daniel-Constantin Mierla <[hidden email]> wrote:

>
>
> On 30.10.2009 10:46 Uhr, Juha Heinanen wrote:
> >Daniel-Constantin Mierla writes:
> >
> > > it is cflags -- per contact flags.
> > > http://kamailio.org/docs/db-tables/kamailio-db-1.5.x.html#AEN5835
> >
> >fine, but then there is something wrong in save function, because it
> >does not set cflags:
> >
> > if (isflagset(9)) {
> > fix_nated_register();
> > xlog("L_INFO", "Setting bflag 1\n");
> > setbflag(1);
> > };
> >
> > if (allow_register("permissions")) {
> > save("location");
> >
> >i get to syslog
> >
> >Oct 30 11:43:22 localhost /usr/sbin/sip-proxy[15251]: INFO: Setting bflag
> >1
> >but still cflags is 0.
> >  
> use quotes around the parameter of bflag functions.
>
> The grammar of sr cfg language allow module functions with integer
> parameters (now bflags functions are in kex module so they accept PV in
> parameters). This is wrong since all modules expect string there and
> there is no error thrown if function name and number of parameters
> matches -- it was discussed long time ago, but forgotten. I will fix it.

It's not wrong. The integers are internally converted to string
(fix_actions()), the module nevers sees them as integers, it always sees
them as strings.  

Andrei

_______________________________________________
sr-dev mailing list
[hidden email]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
Andrei Pelinescu-Onciul

Re: looks like usrloc flags don't work either

Reply Threaded More More options
Print post
Permalink
In reply to this post by Juha Heinanen
On Oct 30, 2009 at 12:16, Juha Heinanen <[hidden email]> wrote:

> Daniel-Constantin Mierla writes:
>
>  > use quotes around the parameter of bflag functions.
>
> is it so that bflag functions require quotes and in other flag function
> quotes are not allowed?
>
> looks like it because i'm now getting syntax error on this line:
>
> isflagset("11")) {
>
>  0(16211) : <core> [cfg.y:3209]: parse error in config file /etc/sip-proxy/sip-proxy.cfg, line 950, column 18: flag not declared
>
> in order to avoid errors like this, all flag functions should take same
> kind of parameters.

You can skip "" for all the integers passed to modules. They are
converted to strings internally, so it doesn't really matter if you use
the "" or not.

Andrei

_______________________________________________
sr-dev mailing list
[hidden email]
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev