04-28-2016 08:40 AM - edited 03-19-2019 11:03 AM
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?
04-28-2016 01:42 PM
can you please provide me your lua script and what is the CUCm version you are try to implement this?
Br,
Nadeem
04-29-2016 05:16 AM
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
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide