<!-- Module User's Guide -->

<chapter>
	
	<title>&adminguide;</title>
	
	<section id="overview" xreflabel="Overview">
		<title>Overview</title>

		<para>The qos module provides a way to keep track of
		per dialog SDP session(s).</para>
	</section>
	
	<section>
	<title>How it works</title>
	
	<para>The qos module uses the dialog module to be notified of
	any new or updated dialogs.  It will then look for and extract
	the SDP session (if present) from SIP requests and replies and
	keep track of it for the entire life of a dialog.</para>

	<para>All of this happens with a properly configured dialog
	and qos module and setting the dialog flag and the qos flag at
	the time any INVITE sip message is seen.  There is no
	config script function call required to set the SDP session
	tracking mechanism.  See the dialog module users guide for
	more information.</para>

	<para>A dialog can have one or more SDP sessions active in one
	of the following states:
	<itemizedlist>
	<listitem>
	<para><emphasis>pending</emphasis> - only one end point of the
	SDP session is known.
	</para>
	</listitem>
	<listitem>
	<para><emphasis>negotiated</emphasis> - both end points of the
	SDP session are known.
	</para>
	</listitem>
	</itemizedlist>
	</para>

	<para>An SDP session can be established in one of the following
	scenarios:
	<itemizedlist>
	<listitem>
	<para><emphasis>INVITE/200ok</emphasis> - typical "INVITE" and
	"200 OK" SDP exchange.
	</para>
	</listitem>
	<listitem>
	<para><emphasis>200ok/ACK</emphasis> - "200 OK" and  "ACK" SDP
	exchange (for calls starting with an empty INVITE).
	</para>
	</listitem>
	<listitem>
	<para><emphasis>183/PRACK</emphasis> - early media via "183
	Session Progress" and "PRACK" (see rfc3959 for more information) -
	not implemented yet.
	</para>
	</listitem>
	</itemizedlist>
	</para>
	</section>

	<section id="dependencies" xreflabel="Dependencies">
	<title>Dependencies</title>
	<section>
		<title>&osips; Modules</title>
		
		<para>The following modules must be loaded
		before this module:
		<itemizedlist>
		<listitem>
		<para>
		<emphasis>dialog</emphasis> - dialog module and
		its decencies (tm).
		</para>
		</listitem>
		</itemizedlist>
		</para>
	</section>
	<section>
	<title>External Libraries or Applications</title>
	<para>
	The following libraries or applications must be installed before
	running &osips; with this module loaded:
		<itemizedlist>
		<listitem>
		<para>
			<emphasis>None</emphasis>.
		</para>
		</listitem>
		</itemizedlist>
	</para>
	</section>
	</section>
	<section id="exported_parameters" xreflabel="Exported Parameters">
	<title>Exported Parameters</title>
	<section id="param_qos_flag" xreflabel="qos_flag">
		<title><varname>qos_flag</varname> (string)</title>
		
		<para>Keeping with &osips;, the module will not do
		anything to any message unless instructed to do so via
		the config script. You must set the qos_flag
		value in the setflag() call of the INVITE you want the
		qos module to process. But before you can do that, you
		need to tell the qos module which flag value you are
		assigning to qos.</para>

		<para>In most cases when ever you create a new dialog
		via create_dialog() function,you will want to set the qos flag. 
		If create_dialog() is not called and the qos flag is set, 
		it will not have any effect.</para>

		<para>This parameter must be set of the module will
		not load.</para>

		<para>
		<emphasis>
			Default value is <quote>Not set!</quote>.
		</emphasis>
		</para>
		<example>
		<title>Set <varname>qos_flag</varname> parameter</title>
		<programlisting format="linespecific">
...
modparam("qos", "qos_flag", "QOS_FLAG")
...
route {
  ...
  if ($rm=="INVITE") {
    setflag(QOS_FLAG); # Set the qos flag
	create_dialog(); # create the dialog
  }
  ...
}
</programlisting>
		</example>
	</section>

	</section>
	<section id="exported_functions" xreflabel="exported_functions">
	<title>Exported Functions</title>
	<para>There are no exported functions that could be used in scripts.
	</para>
	</section>

	<section>
	<title>Exported Statistics</title>
	<para>There are no exported statistics for the qos module.</para>
	</section>

	<section id="exported_mi_functions" xreflabel="Exported MI Functions">
	<title>Exported MI Functions</title>
	<para>There are no exported MI functions for the qos module.
	Check the dialog MI functions for a way to inspect the internals
	of a dialog.
	</para>
	</section>

	<section id="exported_pseudo_variables">
	<title>Exported Pseudo-Variables</title>
	<para>There are no exported pseudo-variables for the qos module.
	</para>
	</section>

    <section>
	<title>Installation and Running</title>
	<para>Just load the module and remember to set the flag.
	</para>
	</section>
</chapter>

