[OpenSIPS-Users] CANCEL with a To tag.

Chris Maciejewski chris at wima.co.uk
Mon May 11 12:06:34 CEST 2009


Hi,

I would like to ask what would be the best way to handle CANCEL
request with a To tag. I know such a CANCEL request is not RFC
compatible, but unfortunately I came across some buggy UAs doing this.
What I did is:

if (has_totag())
{
  /**
   * sequential request withing a dialog should
   * take the path determined by record-routing
   */
  if (loose_route())
  {
    route(T_RELAY);
  }
  else
  {
    if (is_method("SUBSCRIBE") && is_uri_host_local())
    {
      /* in-dialog subscribe requests */
      route(PRESENCE);
    }

    if (is_method("ACK"))
    {
      if (t_check_trans())
      {
        /**
         * non loose-route, but stateful ACK;
         * must be an ACK after a 487 or e.g. 404 from upstream server
         */
        t_relay();
        exit;
      }
      else
      {
        /* ACK without matching transaction ... ignore and discard. */
        exit;
      }
    }

    if (is_method("CANCEL"))
    {
      t_relay();
      exit;
    }

    sl_send_reply("404","Not here");
    exit;
  }
}

Would the above be OK? Or is it any better way of handling CANCEL with a To tag?

Any suggestions very much appreciated.

Regards,
Chris



More information about the Users mailing list