[Users] How to test for domain in sip request in openser.cfg.

Bas Driessen bas.driessen at xobas.com
Wed Apr 5 08:03:57 CEST 2006


Thanks for that Daniel,

Just implemented and tested OK. Just out of interest, how can I check
the contents of core keywords? Is there a way I can see the value in a
log file using xlog for instance?

I failed to mention that I am using version 1.0.1 on Debian Sarge.

Thanks,
Bas.

On Tue, 2006-04-04 at 16:41 +0300, Daniel-Constantin Mierla wrote:

> Hello,
> 
> to test the domain in R-URI you can use:
> 
> if(uri=~".*@foo.com")
> 
> With development version you can have:
> 
> if(avp_check("$rd", "eq/foo.com/i"))
> 
> Using pseudo-variables direct from script is in roadmap and will be 
> added in the future.
> 
> Cheers,
> Daniel
> 
> 
> On 04/04/06 14:36, Bas Driessen wrote:
> > Hello,
> >
> > I would like to test for the domain name in a sip request to decide if 
> > an invite is accepted or not. I have the following lines in my 
> > openser.cfg file to cater for DNS SRV forwarding:
> >
> >         # accept calls from foo.com
> >         if ( is_method("INVITE")  )
> >         {
> >                 rewritehost ("sipproxy.foo2.com");
> >                 rewriteport ("");
> >         }
> >
> > This works well, but I would like to tighten security by only allowing 
> > invites forwarded by foo.com. When debugging using xlog calls, the 
> > pseudo-variable I am after is : $rd.
> >
> > However $rd can not be used in openser.cfg as follows:
> >
> > if ( is_method("INVITE") && $rd="foo.com" )
> >
> > Documentation suggests to use core keywords like:
> >
> >             if(is_method("INVITE") && from_uri=~".*@foo.com")
> >
> > This does not work for my situation and I don't know how I can see the 
> > value of 'from_uri', as it can't be expanded into xlog calls.
> >
> > So my kind of overlapping questions are:
> >
> > How can I use pseudo-variables in openser.cfg to test for a certain value?
> > How can I see (debug) the contents of a core keyword?
> > Which keyword should I be using to solve this issue?
> > Has anyone solved a similar issue in the past and if so can you please 
> > give some details?
> >
> > Thanks,
> > Bas.
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Users mailing list
> > Users at openser.org
> > http://openser.org/cgi-bin/mailman/listinfo/users
> >   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kamailio.org/pipermail/users/attachments/20060405/55fec1a0/attachment.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: This is a digitally signed message part
Url : http://lists.kamailio.org/pipermail/users/attachments/20060405/55fec1a0/attachment.pgp 


More information about the Users mailing list