[Users] Checking Request-URI
Klaus Darilion
klaus.mailinglists at pernau.at
Fri Jun 15 14:39:46 CEST 2007
Andreas Sikkema wrote:
> Hi,
>
> Yesterday I noticed something strange happenign one on of our
> servers. Calls were being sent to servers within our VoIP
> platform by OpenSER without (as far as I can see) really being
> handled according to our OpenSER configuration.
>
> When I looked into it, I found that the Request-URI contained
> the IP address of the internal server, instead of the IP address
> of our OpenSER machine or our SIP domain.
Maybe someone sent a SIP message with the local IP address in the R-URI
to your proxy. According to your config this should not matter as you
rewrite the domain for every incoming SIP request - except for loose-route.
For loose-route I would suggest to check for a to-tag too. Then, the
called SIP UA should reject the call. You could also use dialog module
to see if a dialog exists before forwarding in loose_route.
regards
klaus
>
> How can I check that the Request-URI contains only the SIP
> domain or the IP address of the OpenSER server?
>
> Might this have something to do with the loose_route() block?
>
> Here's (heavily edited) basically our INVITE handling code from
> openser.cfg:
>
> if (loose_route())
> {
> use_media_proxy();
>
> t_relay();
> exit;
> };
>
> if (method=="INVITE")
> {
> t_on_reply("1");
>
> rewritehost("SIP_DOMAIN");
>
> # Check if it is international number format
> if (uri=~"^sip:00")
> {
> strip(2);
> };
>
> if ( (method == "INVITE") )
> {
> if (!proxy_authorize("SIP_DOMAIN", "subscriber"))
> {
> proxy_challenge("SIP_DOMAIN", "0");
> exit;
> };
>
> # let's check from=id ... avoids accounting confusion
> if (!check_from())
> {
> sl_send_reply("403", "That is ugly -- use
> From=id next time (gw)");
> exit;
> };
> };
>
> if (is_uri_host_local())
> {
> log("ATS: incoming message is for a local host ($tu)");
>
> route(3);
> };
>
More information about the Users
mailing list