Beginner Needs Clarification: Destination URI always NULL?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Beginner Needs Clarification: Destination URI always NULL?

Alan Frisch
I've been using the scripts generated by the Sipwise Wizard to learn the LCR module and OpenSIPS in general.  Just sending requests from OpenSIPS to two Asterisk test servers I set up.

While I get the general concept of URI's, I am trying to discern exactly what a Destination URI is within the OpenSIPS world.  This debug line has me a little confused:

...
xlog("L_INFO", "Request leaving server, D-URI='$du' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
...

This is fired just before the !t_relay to the selected gateway.  However, in the console "D-URI" always is NULL.  If somone could be so kind, please help me understand the difference between a R-URI and D-URI and why D-URI is always NULL in my case.

Thanks!



_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Beginner Needs Clarification: Destination URIalways NULL?

Robert Borz
Alan,

please give us some more information. In which (sub-) route do you receive "D-URI='<null>'"?
Maybe you could provide your configuration?


Regards,
Robert

________________________________________
From: [hidden email] [mailto:[hidden email]] On Behalf Of Alan Frisch
Sent: Friday, March 27, 2009 9:10 PM
To: [hidden email]
Subject: [OpenSIPS-Users] Beginner Needs Clarification: Destination URIalways NULL?

I've been using the scripts generated by the Sipwise Wizard to learn the LCR module and OpenSIPS in general.  Just sending requests from OpenSIPS to two Asterisk test servers I set up.

While I get the general concept of URI's, I am trying to discern exactly what a Destination URI is within the OpenSIPS world.  This debug line has me a little confused:

...
xlog("L_INFO", "Request leaving server, D-URI='$du' - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
...

This is fired just before the !t_relay to the selected gateway.  However, in the console "D-URI" always is NULL.  If somone could be so kind, please help me understand the difference between a R-URI and D-URI and why D-URI is always NULL in my case.

Thanks!



_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Beginner Needs Clarification: Destination URIalways NULL?

Alan Frisch
I used the "SIP Proxy/Registrar with Offnet-Termination and
Accounting" configuration from the Sipwise Wizard.  Rather than
gumming up the list with what it spits out there, here is the relevant
bits when issuing a call to one of my gateways:

########################################################################
# Request route 'invite-to-external'
########################################################################
route[6]
{
        if(isflagset(20))
        {
               
                xlog("L_INFO", "Call to foreign domain - M=$rm RURI=$ru F=$fu T=$tu
IP=$si ID=$ci\n");
                route(2);
                exit;
        }
        if(!isflagset(23))
        {
                # don't allow calls relaying from PSTN to PSTN, if not explicitely forwarded
                if(uri =~ "^sip:[0-9]+@")
                {
                        # only route numeric users to PSTN
                        if(!load_gws())
                        {
                               
                                xlog("L_ERR", "Error loading PSTN gateways - M=$rm RURI=$ru F=$fu
T=$tu IP=$si ID=$ci\n");
                                sl_send_reply("503", "PSTN Termination Currently Unavailable");
                                exit;
                        }
                        if(!next_gw())
                        {
                               
                                xlog("L_ERR", "No PSTN gateways available - M=$rm RURI=$ru F=$fu
T=$tu IP=$si ID=$ci\n");
                                sl_send_reply("503", "PSTN Termination Currently Unavailable");
                                exit;
                        }
                        setflag(21);
                       
                        t_on_failure("1");
                        route(2);
                }
        }
       
        xlog("L_INFO", "Call to unknown user - M=$rm RURI=$ru F=$fu T=$tu
IP=$si ID=$ci\n");
        sl_send_reply("404", "User Not Found");
        exit;
       
}

########################################################################
# Request route 'base-outbound'
########################################################################
route[2]
{
        t_on_reply("1");
        if(!isflagset(21))
        {

                t_on_failure("2");
        }
        if(is_present_hf("Proxy-Authorization"))
        {
                xlog("L_INFO", "Attempting to consume
credentials.\n$hdr(Proxy-Authorization)\n)");
                remove_hf("Proxy-Authorization");
        }

        xlog("L_INFO", "Request leaving server, D-URI='$du' - M=$rm
RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
        # no 100 (we already sent it) and no DNS blacklisting
        if(!t_relay("0x05"))
        {
                sl_reply_error();
        }
        exit;

}

########################################################################

For the life of me, I can't find much of a definition of D-URI in
Google.  Even the OpenSER book I have does not even touch on it other
than saying $du = Destination URI.

Thanks.

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Beginner Needs Clarification: Destination URI always NULL?

Iñaki Baz Castillo
In reply to this post by Alan Frisch
El Viernes 27 Marzo 2009, Alan Frisch escribió:

> While I get the general concept of URI's, I am trying to discern exactly
> what a Destination URI is within the OpenSIPS world.  This debug line has
> me a little confused:

A request has a Request-Line URI, and can also contain a Route header.
According to RFC 3261, ifa proxy routes a request it must inspect first the
Route header:

If the Route header points to the proxy itself, it's removed and the next
Route header is inspected. If there is a Route no pointing to the proxy
itself, then the request must be sent to that Route URI.

If there is no Route (after removing Route pointintg to the proxy), the the
request must be sent to the Request-Line URI.

But, of course, a proxy could decide to send the request to any other
destination, regardless of the Route(s) and RURI content.

If you set $du in OpenSIPS, you are *forcing* the destination of the request
(Route and RURI doesn't matter now).
But there are other cases in which $du is automatically sent by OpenSIPS:

- A user is registered behind NAT so when routing a request to him, OpenSIPS
sets the RURI according to the private address in the REGISTER contact from
this user, and sets the $du with the value of the *real* source address of the
REGISTER.
- There are also other cases in which $du is automatically added.

Hope it helps.

PD: Note that setting $du doesn't change the RURI. This is, OpenSIPS could
send a request with RURI:
  sip:1234@1.2.3.4
to the address 1.2.3.5.


--
Iñaki Baz Castillo <[hidden email]>

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Beginner Needs Clarification: Destination URI always NULL?

Alan Frisch
Baz,

Many thanks... your explanation really cleared it up for me.  So I
guess in the example I cited, the fact that $du is empty is okay
(since it is a direct routing to the gateway).

AF.

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Beginner Needs Clarification: Destination URI always NULL?

Iñaki Baz Castillo
El Sábado 28 Marzo 2009, Alan Frisch escribió:
> Baz,
>
> Many thanks... your explanation really cleared it up for me.  So I
> guess in the example I cited, the fact that $du is empty is okay
> (since it is a direct routing to the gateway).

Yes, it's ok :)


--
Iñaki Baz Castillo <[hidden email]>

_______________________________________________
Users mailing list
[hidden email]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users