[Serusers] Some questions on "loose_route"

Jiri Kuthan jiri at iptel.org
Tue Jan 6 17:20:04 CET 2004


At 05:04 PM 1/3/2004, Juha Heinanen wrote:
>Greg Fausak writes:
>
> > route
> > {
> >      if(loose_route()) { t_relay(); break; };
> > 
> >      if(method=="INVITE") { do that deed, set record_route();
> >              t_relay(); };
> >      if(method=="REGISTER") { do that deed; t_relay(); };
> > 
> >      # anything that reaches here is an error???
> > }
> >
> > I don't use PRACK, COMET, SUBSCRIBE, NOTIFY.
>
>how about ACK and BYE?  don't you use them either?  

only INVITEs and SUBSCRIBEs needs to be record-routed. It is not harmful
to record-route other requests (perhaps a new method, FOOBAR, will be used
along with record-routing too and we won't have rewrite script for it then).

All message types with Route already in place are processed in the first line,
and that's good so.

>also, i would
>suggest doing some checking before calling t_relay() after loose_route
>if you care how people are using your proxy or your pstn gw.

indeed.

we do something like bellow....

    if (loose_route()) {
        # check if someone has not introduced a pre-loaded INVITE -- if so,
        # verify caller's privileges before accepting rr-ing
        if ((method=="INVITE" || method=="ACK" || method=="CANCEL")
                && uri =~ "sip:[+0-9]+ at 10\.1\.0\.1") {
            route(3); # Forward to PSTN gateway (that;s where all the ACLs are placed)
        } else {
            append_hf("P-hint: rr-enforced\r\n");
            # account all BYEs
            if (method=="BYE") setflag(1);
            route(1);  # Generic forward
        };
        break;
    };

-jiri  




More information about the sr-users mailing list