Hello Daniel,

 

Yes it's the only one and I don't get it.

Can you copy past the config you tried?

 

Indeed, for the space it's an error when I copied pasted.

Regards,

 

Igor.

 

 

De : Daniel-Constantin Mierla [mailto:miconda@gmail.com]
Envoyé : jeudi 5 février 2015 11:52
À : Igor Potjevlesch
Cc : 'Kamailio (SER) - Users Mailing List'
Objet : Re: [SR-Users] Multiple OR into a if

 

Hello,

I give it a try and I get the message from:

xlog("L_WARN","TU=06\n");

which is the only one that is true in this case. Don't you get it?

Btw, I noticed a space after @ in $tu, is it from the message or because you crafted the message for mailing list?

Cheers,
Daniel

On 05/02/15 11:28, Igor Potjevlesch wrote:

Hello Daniel,

 

Sorry, I was thinking that I have already replied with the result of this required test.

So, I tried with single condition. All fail (xlog with != is printed) with Request-URI and To-URI which looks like this: 0[0-9]{9}@sip.domain.tld:

 

        if ($rU=~"^33") {

                xlog("L_WARN","RU=33\n");

        } else {

                xlog("L_WARN","RU!=33\n");

        }

 

        if ($rU=~"^0033") {

                xlog("L_WARN","RU=0033\n");

        } else {

                xlog("L_WARN","RU!=0033\n");

        }

 

        if ($rU=~"^0[1-9]{9}") {

                xlog("L_WARN","RU=06\n");

        } else {

                xlog("L_WARN","RU!=06\n");

        }

 

        if ($rU=~"^\+33") {

                xlog("L_WARN","RU=+33\n");

        } else {

                xlog("L_WARN","RU!=+33\n");

        }

 

        if ($tu=~"^sip:33") {

                xlog("L_WARN","TU=33\n");

        } else {

                xlog("L_WARN","TU!=33\n");

        }

 

        if ($tu=~"^sip:0033") {

                xlog("L_WARN","TU=0033\n");

        } else {

                xlog("L_WARN","TU!=0033\n");

        }

 

        if ($tu=~"^sip:0[1-9]{9}") {

                xlog("L_WARN","TU=06\n");

        } else {

                xlog("L_WARN","TU!=06\n");

        }

 

        if ($tu=~"^sip:\+33") {

                xlog("L_WARN","TU=+33\n");

        } else {

                xlog("L_WARN","TU!=+33\n");

        }

 

An example of a log in reply_route:

 

time=[Thu Feb  5 11:11:07 2015] call id=[4Yir4nAmR7] call seq=[21] contact header=[<sip:0612345678@A.B.C.D:5060>] from uri=[sip:0987654321@sip.domain.tld] from tag=[tZ-n7k92e] request's method=[INVITE] request's uri=[<null>] to uri=[sip:0612345678@ sip.domain.tld] to tag=[a94c095b773be1dd6e8d668a785a9c84e15e43ea] sip message id=[1] process id=[14037] ip source=[A.B.C.D] flags=[2], TU!=06

 

I'm agree with you: in the case of REPLY, the Request-URI is null but To URI should match.

 

Thank you in advance for your help.

 

Regards,

 

Igor.

 

De : Daniel-Constantin Mierla [mailto:miconda@gmail.com]
Envoyé : mardi 3 février 2015 12:40
À : Igor Potjevlesch; 'Kamailio (SER) - Users Mailing List'
Objet : Re: [SR-Users] Multiple OR into a if

 

Hello,

I was traveling and had no time for it.

Anyhow, you compare $rU, which is request uri username -- the address in the first line of SIP requests. In the onreply_routes the SIP reply is processed and $rU is not a valid value.

I also asked you to see if you can break the expression into multiple IF with a single condition to see which one fails -- ie., change from:

if (exp1 || exp2 || ...) {
}

into

if(exp1) {
}

if(exp2) {
}

...

and put log messages to see which one is true or false.

Cheers,
Daniel

On 03/02/15 12:03, Igor Potjevlesch wrote:

Hello Daniel,

 

Do you had the opportunity to look at this?

I was thinking to try with () between each test?

 

Thank you!

 

Regards,

 

Igor.

 

De : Igor Potjevlesch [mailto:igor.potjevlesch@gmail.com]
Envoyé : mardi 27 janvier 2015 16:03
À :
miconda@gmail.com; 'Kamailio (SER) - Users Mailing List'
Objet : RE: [SR-Users] Multiple OR into a if

 

The To header looks like this (in compact form):

 

t: <sip:0123456789@sip.domain.tld>;tag=f15e211394273201512715012\r\n

 

Regards,

 

Igor.

 

De : Igor Potjevlesch [mailto:igor.potjevlesch@gmail.com]
Envoyé : mardi 27 janvier 2015 15:55
À :
miconda@gmail.com; 'Kamailio (SER) - Users Mailing List'
Objet : RE: [SR-Users] Multiple OR into a if

 

Hello Daniel,

 

Just to let you, it's in MANAGE_REPLY. Is that make any difference?

 

Regards,

 

Igor.

 

De : sr-users [mailto:sr-users-bounces@lists.sip-router.org] De la part de Daniel-Constantin Mierla
Envoyé : mardi 27 janvier 2015 10:32
À : Kamailio (SER) - Users Mailing List
Objet : Re: [SR-Users] Multiple OR into a if

 

Hello,

can you paste here the SIP message (or at least the To header and request URI) for such case? I would like to reproduce.

Also, you can try removing components of the expression in the second IF one by one to see where it breaks.

Cheers,
Daniel

On 27/01/15 09:45, Igor Potjevlesch wrote:

Hello,

 

I'm very disappointed because of the following behaviour:

 

     if ($tu=~"^sip:0[1-9]{9}") {

            […]

            In that case, Kamailio returns TRUE because the instructions in the block are executed.

        }

 

     if ($rU=~"^33" || $rU=~"^0033" || $rU=~"^0[1-9]{9}" || $rU=~"^\+33" || $tu=~"^sip:33" || $tu=~"^sip:0033" || $tu=~"^sip:0[1-9]{9}" || $tu=~"^sip:\+33" ) {

[…]

In that case, Kamailio should return FALSE because the instructions in the block are not executed.

        }

 

Am I missed something regarding 'OR' ?

 

Regards,

 

Igor.

 

_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users

 

-- 
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda




-- 
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda



-- 
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
Kamailio World Conference, May 27-29, 2015
Berlin, Germany - http://www.kamailioworld.com