File: sl_functions.xml

package info (click to toggle)
kamailio 4.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 56,100 kB
  • sloc: ansic: 552,832; xml: 166,484; sh: 8,659; makefile: 7,676; sql: 6,235; perl: 3,487; yacc: 3,428; python: 1,457; cpp: 1,219; php: 1,047; java: 449; pascal: 194; cs: 40; awk: 27
file content (132 lines) | stat: -rw-r--r-- 3,659 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<?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>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>