mirror of https://github.com/sipwise/kamailio.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
146 lines
4.2 KiB
146 lines
4.2 KiB
<?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="sl.functions" xmlns:xi="http://www.w3.org/2001/XInclude">
|
|
|
|
<title>Functions</title>
|
|
|
|
<section id="sl_send_reply">
|
|
<title>
|
|
<function>sl_send_reply(code, reason)</function>
|
|
</title>
|
|
<para>
|
|
For the current request, a reply is sent back having the given code
|
|
and text reason. The reply is sent stateless, totally independent
|
|
of the Transaction module and with no retransmission for the
|
|
INVITE's replies.
|
|
</para>
|
|
<para>
|
|
If the code is in the range 300-399 (redirect reply), the current
|
|
destination set is appended to the reply as Contact headers.
|
|
The destination set contains the request URI (R-URI), if it is
|
|
modified compared to the received one, plus the branches added to the
|
|
request (e.g., after an append_branch() or lookup("location")).
|
|
If the R-URI was changed but it is not desired to be part of the
|
|
destination set, it can be reverted using the function revert_uri().
|
|
</para>
|
|
<para>
|
|
Custom headers to the reply can be added using append_to_reply()
|
|
function from textops module.
|
|
</para>
|
|
<para>Meaning of the parameters is as follows:</para>
|
|
<itemizedlist>
|
|
<listitem>
|
|
<para><emphasis>code</emphasis> - Return code.
|
|
</para>
|
|
</listitem>
|
|
<listitem>
|
|
<para><emphasis>reason</emphasis> - Reason phrase.
|
|
</para>
|
|
</listitem>
|
|
</itemizedlist>
|
|
<example>
|
|
<title><function>sl_send_reply</function> usage</title>
|
|
<programlisting>
|
|
...
|
|
sl_send_reply("404", "Not found");
|
|
...
|
|
</programlisting>
|
|
</example>
|
|
</section>
|
|
|
|
<section id="send_reply">
|
|
<title>
|
|
<function moreinfo="none">send_reply(code, reason)</function>
|
|
</title>
|
|
<para>
|
|
For the current request, a reply is sent back having the given code
|
|
and text reason. The reply is sent stateful or stateless, depending of
|
|
the <acronym>TM</acronym> module: if a transaction exists for the current
|
|
request, then the reply is sent statefully, otherwise stateless.
|
|
</para>
|
|
<para>Meaning of the parameters is as follows:</para>
|
|
<itemizedlist>
|
|
<listitem>
|
|
<para><emphasis>code</emphasis> - Return code.
|
|
</para>
|
|
</listitem>
|
|
<listitem>
|
|
<para><emphasis>reason</emphasis> - Reason phrase.
|
|
</para>
|
|
</listitem>
|
|
</itemizedlist>
|
|
<para>
|
|
This function can be used from REQUEST_ROUTE and FAILURE_ROUTE.
|
|
It can be used on ONREPLY_ROUTE executed by tm module (upon a
|
|
t_on_reply() callback).
|
|
</para>
|
|
<example>
|
|
<title><function>send_reply</function> usage</title>
|
|
<programlisting format="linespecific">
|
|
...
|
|
send_reply("404", "Not found");
|
|
...
|
|
send_reply("403", "Invalid user - $fU");
|
|
...
|
|
</programlisting>
|
|
</example>
|
|
</section>
|
|
|
|
<section id="sl_reply_error">
|
|
<title>
|
|
<function>sl_reply_error()</function>
|
|
</title>
|
|
<para>
|
|
Sends back an error reply describing the nature of the last
|
|
internal error. Usually this function should be used after a
|
|
script function that returned an error code.
|
|
</para>
|
|
<example>
|
|
<title><function>sl_reply_error</function> usage</title>
|
|
<programlisting>
|
|
...
|
|
sl_reply_error();
|
|
...
|
|
</programlisting>
|
|
</example>
|
|
</section>
|
|
|
|
<section id="sl_forward_reply">
|
|
<title>
|
|
<function moreinfo="none">sl_forward _reply([ code, [ reason ] ])</function>
|
|
</title>
|
|
<para>
|
|
Forward statelessy the current received SIP reply, with the option to
|
|
change the status code and reason text. The new code has to be in the same
|
|
class. The received reply is forwarded as well by core when the config
|
|
execution ended, unless it is dropped from config.
|
|
</para>
|
|
<para>Meaning of the parameters is as follows:</para>
|
|
<itemizedlist>
|
|
<listitem>
|
|
<para><emphasis>code</emphasis> - Status code.
|
|
</para>
|
|
</listitem>
|
|
<listitem>
|
|
<para><emphasis>reason</emphasis> - Reason phrase.
|
|
</para>
|
|
</listitem>
|
|
</itemizedlist>
|
|
<para>
|
|
This function can be used from ONREPLY_ROUTE.
|
|
</para>
|
|
<example>
|
|
<title><function>send_reply</function> usage</title>
|
|
<programlisting format="linespecific">
|
|
...
|
|
if(status=="408")
|
|
sl_forward_reply("404", "Not found");
|
|
...
|
|
</programlisting>
|
|
</example>
|
|
</section>
|
|
|
|
</section>
|