cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
278
Views
0
Helpful
2
Replies
Beginner

LUA logical and match

Hi all,

I have that diversion string:

Diversion: " XXX" < sip:+4945131012091@172.22.1.101> ;reason=no-answer;privacy=off;screen=yes
Diversion: " XXX" < sip:+4945131012092@172.22.1.101> ;reason=deflection;privacy=off;screen=yes

Now I want to match on "+4945131012092" and "deflection":

if (string.match(diversion, "+4945131012092") and string.match(diversion, "deflection")) then

But it does not work, if I just match on on "+4945131012092" it works and if I just match on "deflection" it works too.

If I try to match on "+4945131012092@172.22.1.101> ;reason=deflection" it does not work too.

If I test it in Lua-5.1.5, it works.

Can anybody help me?

Everyone's tags (1)
2 REPLIES 2
Highlighted
Cisco Employee

can you please provide me

can you please provide me your lua script and what is the CUCm version you are try to implement this?

Br,
Nadeem

Br, Nadeem Please rate all useful post.
Highlighted
Beginner

I had a logical mistake in my

I had a logical mistake in my scipt with:

if (string.match(diversion, "+4945131012092") and string.match(diversion, "deflection")) then

I had to change it to:

elseif string.match(diversion, "+4945131012092",string.find(diversion, ",")) and string.match(diversion, "deflection",string.find(diversion, ",")) then

because I had the same syntax with -2091 before in the script.

After I debugged the script and found out that the sting is not a multiline string, it is separated by ",", I am matching just after the "," with combination of math and find.

The debug output is:

//SIPLua/Script/trace_output: Diversion is "XXX" <sip:+4945131012091@172.22.1.101>;reason=no-answer;privacy=off;screen=yes,"XXX" <sip:+4945131012092@172.22.1.101>;reason=deflection;privacy=off;screen=yes

So I found out that the RTMT output was filled with spaces.

Next time I will immediately debug the strings.

Regards and thanks 4 reading,

Paul

CreatePlease to create content