<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" 
   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">

<section id="options.functions" xmlns:xi="http://www.w3.org/2001/XInclude">
    <sectioninfo>
    </sectioninfo>

    <title>Functions</title>

    <section id="options_reply">
	    <title>
		<function>options_reply()</function>
	    </title>
	<para>
	    This function checks if the request method is OPTIONS and if the
	    request URI does not contain an username. If both is true the
	    request will be answered stateless with "200 OK" and
	    the capabilities from the modules parameters.
	</para>
	<para>
	    It sends "500 Server Internal Error" for some errors
	    and returns false if it is called for a wrong request.
	</para>
	<para>
	    The check for the request method and the missing username is
	    optional because it is also done by the function itself. But you
	    should not call this function outside the myself check because in
	    this case the function could answer OPTIONS requests which are sent
	    to you as outbound proxy but with an other destination then your
	    proxy (this check is currently missing in the function).
	</para>
	<example>
	    <title><function>options_reply</function> usage</title>
	    <programlisting>
<![CDATA[
...
if (uri==myself) {
  if ((method==OPTIONS) && (! uri=~"sip:.*[@]+.*")) {
    options_reply();
  }
}
...
]]>
	    </programlisting>
	</example>
    </section>
</section>
