[Serusers] Routing Logic Question

Greger V. Teigre greger at teigre.com
Sat Mar 12 09:55:34 CET 2005


See inline.

Java Rockx wrote:
> Hi All.
>
> I'm a confused when handling CANCEL messages when the call is between
> my SER proxy and a PSTN gateway.
>
> I've had a few discussions with Jan regarding when lookup("location")
> needs to be called and as I understand it CANCEL is sort of an odd
> message that is not really mid-dialog, and therefore not
> record-routed. So lookup("location") needs to be called before
> t_relay()ing a CANCEL.

A CANCEL only has a meaning before the final response (OK) is sent from the 
other UA.  The CANCEL is matched using CSeq.  However, AFAIK CANCEL can also 
be record-routed. It is only REGISTER messages that exclicitly (RFC3261) 
should not be record routed as it does not establish a dialog. However, 
record routing does not really help you with regards to lookup("location") 
as record-routing will give you the answer (ex. Call leg does not exists 
etc).
One thing though, even though CANCEL should be handled as an INVITE, CANCEL 
cannot have authentication information and if your routing logic for CANCEL 
triggers an authentication, the CANCEL will not reach its destination.

> This is fine for calls between two UAs on the same SER proxy since
> both UAs have a contact record and lookup("location") will return
> TRUE.
>
> But when calling SIP->PSTN, and you hang up from the SIP side, the
> CANCEL is sent from the SIP UA to SER. Then SER tries to find the
> contact record in the location table, but since this is a PSTN
> destination, lookup(location) returns false, thus a 404 and the CANCEL
> is not relayed to the PSTN gateway.
>
> So what is the best way to process CANCEL messages? Just ignore
> lookup("location") when it returns false for CANCEL messages?

How do you handle INVITEs when lookup("location") fails? The request-URI 
should be the same as the initial INVITE and you should thus be able to do 
exactly the same with CANCELs.  Even if you do lcr.

g-)

> My basic ser.cfg is like this:
>
> route {
>    # sanity checks
>    if (method!="REGISTER") record_route();
>    if (loose_route()) {
>        t_relay();
>        break;
>    };
>
>    if (uri!=myself) {
>        t_relay();
>        break;
>    };
>
>    if (uri==myself) {
>         if (method=="REGISTER") {
>             save("location");
>             break;
>         };
>         if (!lookup("location")) {
>             sl_send_reply("404", "Not Found");
>             break;
>         };
>     };
>     t_relay();
> }
>
> Regards,
> Paul
>
> _______________________________________________
> Serusers mailing list
> serusers at lists.iptel.org
> http://lists.iptel.org/mailman/listinfo/serusers 




More information about the sr-users mailing list