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

<chapter>
	
	<title>&develguide;</title>
	<section>
	<title>Available Functions</title>

	<section>
		<title>
		<function moreinfo="none">register_dlgcb (dialog, type, cb, param, free_param_cb)</function>
		</title>
		<para>
		Register a new callback to the dialog.
		</para>
		<para>Meaning of the parameters is as follows:</para>
		<itemizedlist>
		<listitem>
			<para><emphasis>struct dlg_cell* dlg</emphasis> - dialog to 
			register callback to. If maybe NULL only for DLG_CREATED callback
			type, which is not a per dialog type.
			</para>
		</listitem>
		<listitem>
			<para><emphasis>int type</emphasis> - types of callbacks; more
			types may be register for the same callback function; only 
			DLG_CREATED must be register alone. Possible types:
			<itemizedlist>
			<listitem>
				<para><emphasis>DLGCB_LOADED</emphasis> - called when a dialog
				is loaded from the database, or received by a node using the
				cluster replication.
				</para>
			</listitem>
			<listitem>
				<para><emphasis>DLGCB_SAVED</emphasis>
				</para>
			</listitem>
			<listitem>
				<para><emphasis>DLG_CREATED</emphasis> - called when a new 
				dialog is created - it's a global type (not associated to 
				any dialog)
				</para>
			</listitem>
			<listitem>
				<para><emphasis>DLG_FAILED</emphasis> - called when the dialog
				was negatively replied (non-2xx) - it's a per dialog type.
				</para>
			</listitem>
			<listitem>
				<para><emphasis>DLG_CONFIRMED</emphasis> - called when the 
				dialog is confirmed (2xx replied) - it's a per dialog type.
				</para>
			</listitem>
			<listitem>
				<para><emphasis>DLG_REQ_WITHIN</emphasis> - called when the 
				dialog matches a sequential request - it's a per dialog type.
				</para>
			</listitem>
			<listitem>
				<para><emphasis>DLG_TERMINATED</emphasis> - called when the 
				dialog is terminated via BYE, or by the mi dlg_end_dlg command
				- it's a per dialog type.
				</para>
			</listitem>
			<listitem>
				<para><emphasis>DLG_EXPIRED</emphasis> - called when the 
				dialog expires without receiving a BYE - it's a per dialog 
				type. Note that when using replication sharing tags, this
				callback is only executed by the node that has the Active tag.
				</para>
			</listitem>
			<listitem>
				<para><emphasis>DLGCB_EARLY</emphasis> - called when the
				dialog is created in an early state (18x replied) - it's
				a per dialog type.
				</para>
			</listitem>
			<listitem>
				<para><emphasis>DLGCB_RESPONSE_FWDED</emphasis> - called when
				the dialog matches a reply to the initial INVITE request - it's
				a per dialog type.
				</para>
			</listitem>
			<listitem>
				<para><emphasis>DLGCB_RESPONSE_WITHIN</emphasis> - called when
				the dialog matches a reply to a subsequent in dialog request
				- it's a per dialog type.
				</para>
			</listitem>
			<listitem>
				<para><emphasis>DLGCB_MI_CONTEXT</emphasis> - called when the
				mi dlg_list_ctx command is invoked - it's a per dialog type.
				</para>
			</listitem>
			<listitem>
				<para><emphasis>DLGCB_DESTROY</emphasis>
				</para>
			</listitem>
			</itemizedlist>
			</para>
		</listitem>
		<listitem>
			<para><emphasis>dialog_cb cb</emphasis> - callback function to be 
			called. Prototype is: <quote>void (dialog_cb) 
			(struct dlg_cell* dlg, int type, struct dlg_cb_params * params);
			</quote>
			</para>
		</listitem>
		<listitem>
			<para><emphasis>void *param</emphasis> - parameter to be passed to
			the callback function.
			</para>
		</listitem>
		<listitem>
			<para><emphasis>param_free callback_param_free</emphasis> - 
			callback function to be called to free the param.
			Prototype is: <quote>void (param_free_cb) (void *param);</quote>
			</para>
		</listitem>

		</itemizedlist>
	</section>

	</section>

</chapter>

