Hi
I am trying to find a way to detect if the Invite URI starts with a *.
How do I match this as ser normally sees * as a wildcard.
Regards
Jon
On Thu, Feb 22, 2007 at 12:45:53AM +0000, Jon Farmer wrote:
Hi
I am trying to find a way to detect if the Invite URI starts with a *.
Perhaps I'm not really enlightened in the realms of URIs, but can a URI really contain a * ? I was under the impression that the only allowed characters were [A-z0-9-.] plus @ as a separator of username and domain.
How do I match this as ser normally sees * as a wildcard.
I believe SER uses regular expression type of matching and thus * is not really a wildcard, but rather "0 or more instances of the previous character". Anyway to match a request-URI starting with '*' you simply do if (uri =~ /^*/) { #blaha }
I'm from the OpenSER world so request-URI might not be called 'uri'.
Kristian
Kristian Larsson wrote:
On Thu, Feb 22, 2007 at 12:45:53AM +0000, Jon Farmer wrote:
Hi
I am trying to find a way to detect if the Invite URI starts with a *.
Perhaps I'm not really enlightened in the realms of URIs, but can a URI really contain a * ? I was under the impression that the only allowed characters were [A-z0-9-.] plus @ as a separator of username and domain.
Thankfully, this is IETF land and we can easily check:
SIP-URI = "sip:" [ userinfo ] hostport uri-parameters [ headers ] userinfo = ( user / telephone-subscriber ) [ ":" password ] "@" user = 1*( unreserved / escaped / user-unreserved ) unreserved = alphanum / mark alphanum = ALPHA / DIGIT mark = "-" / "_" / "." / "!" / "~" / "*" / "'" / "(" / ")" escaped = "%" HEXDIG HEXDIG user-unreserved = "&" / "=" / "+" / "$" / "," / ";" / "?" / "/"
They userinfo part of a URI may actually contain quite a lot non-alphanumerical characters. Well, pretty much everything, really.
How do I match this as ser normally sees * as a wildcard.
I believe SER uses regular expression type of matching and thus * is not really a wildcard, but rather "0 or more instances of the previous character". Anyway to match a request-URI starting with '*' you simply do if (uri =~ /^*/) { #blaha }
Almost, but the scheme is part of the URI, so it would be
if (uri =~ "^sip:*") { ; }
Regards, Martin
I would try: if (uri=~"^sip:*") -jiri
p.s. =~ is regular matching operator in SER config language, * is the RE expression for the "special character".
At 01:45 22/02/2007, Jon Farmer wrote:
Hi
I am trying to find a way to detect if the Invite URI starts with a *.
How do I match this as ser normally sees * as a wildcard.
Regards
Jon
-- Jon Farmer Telford, Shropshire, UK _______________________________________________ Serusers mailing list Serusers@lists.iptel.org http://lists.iptel.org/mailman/listinfo/serusers
-- Jiri Kuthan http://iptel.org/~jiri/