Hello everyone,
I'm wondering what the easiest method would be to grab how long the RURI is and strip based on that information... or would I have to actually use regex, or is there an easier STRLEN() or LENGTH() operation? Any ideas, or is this something that could be implemented? Thanks.
i.e. strip_tail(strlen($ru) - 2); ... or something like such.
Brandon Armstead writes:
I'm wondering what the easiest method would be to grab how long the RURI
is and strip based on that information... or would I have to actually use regex, or is there an easier STRLEN() or LENGTH() operation? Any ideas, or is this something that could be implemented? Thanks.
i too have been thinking that regex is an overkill for tests like this:
if (uri=~"^sip:+") ...
a php like substr function might be faster. so instead of the above or
i.e. strip_tail(strlen($ru) - 2); ... or something like such.
how about
if (substr(uri, 0, 5) == "sip:+") ...
or
substr($ru, -2, 2)
by the way, i didn't notice == operator in the summary. should i write the above if as
switch(substr(uri, 0, 5)) { case "sip:+": ... default: ... }
instead or is == supported?
-- juha
Hello,
On 01/30/07 08:00, Juha Heinanen wrote:
Brandon Armstead writes:
I'm wondering what the easiest method would be to grab how long the RURI
is and strip based on that information... or would I have to actually use regex, or is there an easier STRLEN() or LENGTH() operation? Any ideas, or is this something that could be implemented? Thanks.
i too have been thinking that regex is an overkill for tests like this:
if (uri=~"^sip:+") ...
a php like substr function might be faster. so instead of the above or
i.e. strip_tail(strlen($ru) - 2); ... or something like such.
how about
if (substr(uri, 0, 5) == "sip:+") ...
or
substr($ru, -2, 2)
by the way, i didn't notice == operator in the summary. should i write the above if as
switch(substr(uri, 0, 5)) { case "sip:+": ... default: ... }
instead or is == supported?
== is supported in the new 1.2.0. All old operators that could be used in IF conditions can be used now with any pseudo-variable:
== - equal match != - not equal match =~ - regexp match !~ - not regexp match (this is NEW)
if($rU=="1234") is true if r-uri username is '1234'.
Cheers, Daniel
-- juha
Users mailing list Users@openser.org http://openser.org/cgi-bin/mailman/listinfo/users
Brandon Armstead writes:
i.e. strip_tail(strlen($ru) - 2); ... or something like such.
sorry, but my suggestion
substr($ru, -2, 2)
does not work, since it returns the last two chars of $ru not the remaining chars. strlen is indeed needed for the above. using php substr and strlen
strip_tail(strlen($ru) - 2)
becomes
substr($ru, 0, strlen($ru) - 2)
-- juha
Stripping is now possible with the new introduced 'transformations': http://openser.org/dokuwiki/doku.php/transformations:devel
So if you want to strip last two characters of username in R-URI
$var(x) = $(rU{s.len})-2; $rU = $(ru{s.substr,0,$var(x)});
Cheers, Daniel
On 01/30/07 09:08, Juha Heinanen wrote:
Brandon Armstead writes:
i.e. strip_tail(strlen($ru) - 2); ... or something like such.
sorry, but my suggestion
substr($ru, -2, 2)
does not work, since it returns the last two chars of $ru not the remaining chars. strlen is indeed needed for the above. using php substr and strlen
strip_tail(strlen($ru) - 2)
becomes
substr($ru, 0, strlen($ru) - 2)
-- juha
Users mailing list Users@openser.org http://openser.org/cgi-bin/mailman/listinfo/users
Hello Brandon,
On 01/30/07 07:40, Brandon Armstead wrote:
Hello everyone,
I'm wondering what the easiest method would be to grab how long
the RURI is and strip based on that information... or would I have to actually use regex, or is there an easier STRLEN() or LENGTH() operation? Any ideas, or is this something that could be implemented? Thanks.
i.e. strip_tail(strlen($ru) - 2); ... or something like such.
now it is not possible, but should be in the next days (maybe not exactly in the way you proposed). By now you can use the new perl module and implement a small script to do that for you. Should be pretty straightforward.
http://www.openser.org/docs/modules/1.2.x/perl.html
Cheers, Daniel
-- Brandon Armstead
Users mailing list Users@openser.org http://openser.org/cgi-bin/mailman/listinfo/users