Hi, I receive INVITE like this:
INVITE sip:client_xxx2004@domain.org SIP/2.0
and I get from an $avp(CLIENT) the value "client_xxx".
I need to strip from $rU the lenght of $avp(CLIENT), this is:
# Original $rU => client_xxx2004 strip($avp(CLIENT)); # New $rU => 2004
Unfortunatelly "strip()" doesn't accept a PV as parameter, but a static integer.
Any suggestion on how to achieve my goal? Thanks a lot.
2009/3/18 Iñaki Baz Castillo ibc@aliax.net:
Hi, I receive INVITE like this:
INVITE sip:client_xxx2004@domain.org SIP/2.0
and I get from an $avp(CLIENT) the value "client_xxx".
I need to strip from $rU the lenght of $avp(CLIENT), this is:
# Original $rU => client_xxx2004 strip($avp(CLIENT)); # New $rU => 2004
Unfortunatelly "strip()" doesn't accept a PV as parameter, but a static integer.
Great, s.substr does allow pv as parameters:
$(var(x){s.substr,$var(num),0})
Iñaki Baz Castillo writes:
INVITE sip:client_xxx2004@domain.org SIP/2.0
and I get from an $avp(CLIENT) the value "client_xxx".
I need to strip from $rU the lenght of $avp(CLIENT), this is:
# Original $rU => client_xxx2004 strip($avp(CLIENT)); # New $rU => 2004
Unfortunatelly "strip()" doesn't accept a PV as parameter, but a static integer.
does len() accept a pv argument? if it does, you can then uses s.substr transformation.
-- juha
2009/3/18 Juha Heinanen jh@tutpro.com:
Iñaki Baz Castillo writes:
> INVITE sip:client_xxx2004@domain.org SIP/2.0 > > and I get from an $avp(CLIENT) the value "client_xxx". > > I need to strip from $rU the lenght of $avp(CLIENT), this is: > > # Original $rU => client_xxx2004 > strip($avp(CLIENT)); > # New $rU => 2004 > > Unfortunatelly "strip()" doesn't accept a PV as parameter, but a > static integer.
does len() accept a pv argument? if it does, you can then uses s.substr transformation.
Yes, I already implemented it by using that:
$var(client_regex) = "^" + $avp(AVP_CLIENT) + "[0-9]+"; if $rU =~ $var(client_regex) { $rU = $(rU{s.substr,$(avp(AVP_CLIENT){s.len}),0}); xlog("L_DBG", "--- Replacing rU: $oU -> $rU \n"); }
Thanks.