Hi all, actually I test if the R-URI contains the value *44* with:
if (uri=~"^sip:*44*[0-9]+@") { ... }
Now I want to read the value 44 or *44* from an AVP. Tried using directly the avp or assigning it to a variable, without success. ex.: $var(x) = "sip:" + $avp(s:code) + "[0-9]+@";
How can I solve this problem? Thank you very much. Regards.
Sorry. I forgot to say that I'm using kamailio 1.4.4.
Regards.
Hello,
On 16.11.2009 18:41 Uhr, Antonio Reale wrote:
Hi all, actually I test if the R-URI contains the value *44* with:
if (uri=~"^sip:*44*[0-9]+@") { ... }
Now I want to read the value 44 or *44* from an AVP. Tried using directly the avp or assigning it to a variable, without success. ex.: $var(x) = "sip:" + $avp(s:code) + "[0-9]+@";
How can I solve this problem?
do you want to get the value in avp? or you have the value in the avp? I do not get it from your question. For first, it is not right. For the second is not right also.
If it is first, then see the transformations: - s.substr - s.select - re.subst http://www.kamailio.org/dokuwiki/doku.php/transformations:1.5.x
Cheers, Daniel
Hi Daniel, I have the value in the AVP, so I want to do something like this:
avp_db_load("$avp(s:caller_uuid)", "$avp(s:code)"); if (uri=~"^sip:$avp(code)[0-9]+@") { ... }
but I know that I can't use the avp in this way. Thank you.
On 16.11.2009 18:56 Uhr, Antonio Reale wrote:
Hi Daniel, I have the value in the AVP, so I want to do something like this:
avp_db_load("$avp(s:caller_uuid)", "$avp(s:code)"); if (uri=~"^sip:$avp(code)[0-9]+@") { ... }
but I know that I can't use the avp in this way.
try this one:
$var(x) = "^sip:" + $avp(code) + "[0-9]+@";
if($ru =~ $var(x)) { ... }
Cheers, Daniel
2009/11/16 Daniel-Constantin Mierla miconda@gmail.com:
try this one:
$var(x) = "^sip:" + $avp(code) + "[0-9]+@";
Already tried that: $var(x) = "^sip:" + $avp(s:code) + "[0-9]+@";
but in runtime I see in the log:
ERROR:core:eval_elem: invalid string operands ERROR:core:do_assign: no value in right expression ERROR:core:do_assign: error at line: 996
Cheers, Daniel
Thanks. Regards.
2009/11/16 Daniel-Constantin Mierla miconda@gmail.com:
try this one:
$var(x) = "^sip:" + $avp(code) + "[0-9]+@";
if($ru =~ $var(x)) { ... }
Sorry Daniel, it was my fault. The AVP was not loaded at that point of the script. Now works fine. Only a question. Previously I had if(uri =~ ...) but I can't compare it with var(x). I know that $ru is a pseudo variable and "uri" is a core keyword. Can I change all my "if(uri =~ ...)" with "if($ru ~ ...)" without impact the actual configuration?
Cheers, Daniel
Thank you very much. Regards.