[asterisk-dev] [Code Review] SIP: authenticate OPTIONS requests just like we would an INVITE

Klaus Darilion klaus.mailinglists at pernau.at
Wed Sep 1 12:53:41 CDT 2010



Am 31.08.2010 10:17, schrieb Olle E. Johansson:
> Question for you: Will Kamailio dispatcher accept a 401 message to OPTIONs as "being alive" or will it be an error?

looks like 401 will be an error, only 200, 501, 403 and 405 will be 
accepted. So we have to add 401 for Asterisk? ;-)

regards
klaus


/* ps->code contains the result-code of the request.
  *
  * We accept both a "200 OK", "501 Not supported" and "403" as an
  * successful reply.
  *   501: Cisco-Gateways reply with a "501 Not supported" to the request.
  *   403: Aastra-Gateways reply with a "403" to the request.
  *   405: Some GWs reply with a "405 Method Not Allowed" to the request. */
if ((ps->code == 200) || (ps->code == 501) || (ps->code == 403) || 
(ps->code == 405))
{
     /* Set the according entry back to "Active":
      *  remove the Probing/Inactive Flag and reset the failure counter. */
     if (ds_set_state(group, &uri,
                 DS_INACTIVE_DST|DS_PROBING_DST|DS_RESET_FAIL_DST, 0) != 0)
     {
         LM_ERR("Setting the state failed (%.*s, group %d)\n", uri.len,
                 uri.s, group);
     }
}
if(ds_probing_mode==1 && ps->code == 408)
{
     if (ds_set_state(group, &uri, DS_PROBING_DST, 1) != 0)
     {
         LM_ERR("Setting the probing state failed (%.*s, group %d)\n",
                 uri.len, uri.s, group);
     }
}



More information about the asterisk-dev mailing list