File: imc_admin.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 (423 lines) | stat: -rw-r--r-- 11,054 bytes parent folder | download | duplicates (4)
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
<?xml version="1.0" encoding='ISO-8859-1'?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [

<!-- Include general documentation entities -->
<!ENTITY % docentities SYSTEM "../../../docbook/entities.xml">
%docentities;

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

<chapter>
	
	<title>&adminguide;</title>
	
	<section>
	<title>Overview</title>
	<para>
		This module offers support for instant message conference. It
		follows the architecture of IRC channels, you can send commands
		embedded in MESSAGE body, because there are just a few SIP UA clients
		which have GUI for IM conferencing.
	</para>
	<para>
	You have to define an URI corresponding to im conferencing manager, where
	user can send commands to create a new conference room. Once the conference
	room is created, users can send commands directly to conferece's URI.
	</para>
	<para>
	To ease the integration in the configuration file, the interpreter of
	the IMC commands are embeded in the module. From a configuration point of
	view, there is only one function which has to be executed for both
	messages and commands.
	</para>
	</section>
		<section>
	<title>Dependencies</title>
	<section>
		<title>&kamailio; Modules</title>
		<para>
		The following modules must be loaded before this module:
			<itemizedlist>
			<listitem>
			<para>
				<emphasis>db_mysql</emphasis>.
			</para>
			</listitem>
			<listitem>
			<para>
				<emphasis>tm</emphasis>.
			</para>
			</listitem>

			</itemizedlist>
		</para>
	</section>
	<section>
		<title>External Libraries or Applications</title>
		<para>
		The following libraries or applications must be installed before running
		&kamailio; with this module loaded:
			<itemizedlist>
			<listitem>
			<para>
				<emphasis>None</emphasis>.
			</para>
			</listitem>
			</itemizedlist>
		</para>
	</section>
	</section>
	<section>
	<title>Parameters</title>
	<section>
		<title><varname>db_url</varname> (str)</title>
		<para>
		The database url.
		</para>
		<para>
		<emphasis>	
		The default value is <quote>&defaultdb;</quote>.
		</emphasis>
		</para>
		<example>
		<title>Set <varname>db_url</varname> parameter</title>
		<programlisting format="linespecific">
...
modparam("imc", "db_url", "&exampledb;")
...
</programlisting>
		</example>
	</section>
	<section>
		<title><varname>rooms_table</varname> (str)</title>
		<para>
		The name of the table storing IMC rooms.
		</para>
		<para>
		<emphasis>
		The default value is "imc_rooms".
		</emphasis>
		</para>
		<example>
		<title>Set <varname>rooms_table</varname> parameter</title>
		<programlisting format="linespecific">
...
modparam("imc", "rooms_table", "rooms")
...
</programlisting>
		</example>
	</section>
	<section>
		<title><varname>members_table</varname> (str)</title>
		<para>
		The name of the table storing IMC members.
		</para>
		<para>
		<emphasis>
		The default value is "imc_members".
		</emphasis>
		</para>
		<example>
		<title>Set <varname>members_table</varname> parameter</title>
		<programlisting format="linespecific">
...
modparam("imc", "members_table", "members")
...
</programlisting>
		</example>
	</section>
	<section>
		<title><varname>hash_size</varname> (integer)</title>
		<para>
		The power of 2 to get the size of the hash table used for storing
		members and rooms.
		</para>
		<para>
		<emphasis>
		The default value is 4 (resultimg in hash size 16).
		</emphasis>
		</para>
		<example>
		<title>Set <varname>hash_size</varname> parameter</title>
		<programlisting format="linespecific">
...
modparam("imc", "hash_size", 8)
...
</programlisting>
		</example>
	</section>
	<section>
		<title><varname>imc_cmd_start_char</varname> (str)</title>
		<para>
	The character which indicates that the body of the message is a command.
		</para>
		<para>
		<emphasis>
		The default value is "#".
		</emphasis>
		</para>
		<example>
		<title>Set <varname>imc_cmd_start_char</varname> parameter</title>
		<programlisting format="linespecific">
...
modparam("imc", "imc_cmd_start_char", "#")
...
</programlisting>
		</example>
	</section>
	<section>
		<title><varname>outbound_proxy</varname> (str)</title>
		<para>
	   The SIP address used as next hop when sending the message. Very
   useful when using &kamailio; with a domain name not in DNS, or
   when using a separate &kamailio; instance for imc processing. If
   not set, the message will be sent to the address in destination
   URI.
		</para>
		<para>
		<emphasis>
		Default value is NULL.
		</emphasis>
		</para>
		<example>
		<title>Set <varname>outbound_proxy</varname> parameter</title>
		<programlisting format="linespecific">
...
modparam("imc", "outbound_proxy", "sip:kamailio.org;transport=tcp")
...
</programlisting>
		</example>
	</section>

	<section>
		<title><varname>extra_hdrs</varname> (str)</title>
		<para>
		Extra headers (each ending with \r\n) to be added in
		messages sent out from imc server.
		</para>
		<para>
		<emphasis>
		Default value is NULL.
		</emphasis>
		</para>
		<example>
		<title>Set <varname>extra_hdrs</varname> parameter</title>
		<programlisting format="linespecific">
...
modparam("imc", "extra_hdrs", "P-Flags: 3\r\n")
...
</programlisting>
		</example>
	</section>

	</section>
	<section>
	<title>Functions</title>
	<section>
		<title>
		<function moreinfo="none">imc_manager()</function>
		</title>
		<para>
		Handles Message method.It detects if the body of the message is a
		conference command.If so it executes it, otherwise it sends the
		message to all the members in the room. 
		</para>
		<para>
		This function can be used from REQUEST_ROUTE. See command description
		for error codes returned by this function.
		</para>
		<example>
		<title>Usage of <varname>imc_manager()</varname> function</title>
		<programlisting format="linespecific">
...
# the rooms will be named chat-xyz to avoid overlapping
# with usernames
if(is_method("MESSAGE)
    &amp;&amp; (uri=~ "sip:chat-[0-9]+@" || (uri=~ "sip:chat-manager@"))
{
    if(imc_manager())
        sl_send_reply("200", "ok");
    else
        sl_send_reply("500", "command error");
    exit;
}
...
</programlisting>
		</example>
	</section>
	</section>

	<section>
	<title>MI Commands</title>
	<section>
		<title>
		<function moreinfo="none">imc_list_rooms</function>
		</title>
		<para>
		Lists of the IM Conferencing rooms.
		</para>
		<para>
		Name: <emphasis>imc_list_rooms</emphasis>
		</para>
		<para>Parameters: none</para>

        <para>
		MI FIFO Command Format:
		</para>
        <programlisting  format="linespecific">
		:imc_list_rooms:_reply_fifo_file_
		_empty_line_
		</programlisting>
	</section>

    <section>
		<title>
		<function moreinfo="none">imc_list_members</function>
		</title>
		<para>
		Listing of the members in IM Conferencing rooms.
		</para>
		<para>
		Name: <emphasis>imc_list_members</emphasis>
		</para>
		<para>Parameters:</para>
		<itemizedlist>
			<listitem><para>_room_ : the room for which you want to list the members</para></listitem>
        </itemizedlist>

        <para>
		MI FIFO Command Format:
		</para>
        <programlisting  format="linespecific">
		:imc_list_members:_reply_fifo_file_
		_room_
		_empty_line_
		</programlisting>
	</section>
	</section>


	<section>
	<title>Statistics</title>
	<section>
		<title>
		<function moreinfo="none">active_rooms</function>
		</title>
		<para>
		Number of active IM Conferencing rooms.
		</para>
	</section>
	</section>

	
	<section>
	<title>IMC Commands</title>
		<para>
		A command is identified by the starting character. A command must be
		written in one line. By default, the starting character is '#'. You
		can change it via "imc_cmd_start_char" parameter.
		</para>
		<para>
		Next picture presents the list of commands and their parameters.
		</para>

		<example>
		<title>List of commands</title>
		<programlisting format="linespecific">
...

1.create
  -creates a conference room
  -takes 2 parameters:
     1) the name of the room
     2)optional- "private" -if present the created room is private
	   and new members can be added only though invitations
  -the user is added as the first member and owner of the room
  -eg:  #create chat-000 private
  -error case: return codes: -30 -- -39

2.join
  -makes the user member of a room
  -takes one optional parameter - the address of the room -if not
    present it will be considered to be the address in the To
    header of the message
  -if the room does not exist the command is treated as create
  -eg:join sip:chat-000@kamailio.org,
      or just, #join, sent to sip:chat-000@kamailio.org
  -error case: return codes: -40 -- -49

3.invite
  -invites a user to become a member of a room
  -takes 2 parameters:
     1)the complete address of the user
     2)the address of the room -if not present it will be considered
	   to be the address in the To header of the message
  -only certain users have the right to invite other user: the owner
    and the administrators
  -eg: #invite sip:john@kamailio.org sip:chat-000@kamailio.org
    or  #invite john@kamailio.org sent to sip:chat-000@kamailio.org
  -error case: return codes: -50 -- -59

4.accept
  -accepting an invitation
  -takes one optional parameter - the address of the room - if not
    present it will be considered to be the address in the To header
    of the message
  -eg: #accept sip:john@kamailio.org
  -error case: return codes: -60 -- -69

5.deny
  -rejects an invitation
  -the parameter is the same as for accept
  -error case: return codes: -70 -- -79

6.remove
  -deletes a member from a room
  -takes 2 parameters:
    1)the complete address of the member
    2)the address of the room -if not present it will be considered
	  to be the address in the To header of the message
  -only certain members have the right to remove other members
  -eg: #remove sip:john@kamailio.org, sent to sip:chat-000@kamailio.org
  -error case: return codes: -80 -- -89

7.exit
  -leaving a room
  -takes one optional parameter - the address of the room - if not
    present it will be considered to be the address in the To header
    of the message
  -if the user is the owner of the room, the room will be destroyed
  -error case: return codes: -90 -- -99

8.destroy
  -removing a room
  -the parameter is the same as for exit
  -only the owner of a room has the right to destroy it
  -error case: return codes: -110 -- -119

9.list
  -list members in a room
  -error case: return codes: -100 -- -109

...
</programlisting>
		</example>
	</section>
	<section>
	<title>Installation</title>
		<para>
		Before running &kamailio; with IMC, you have to setup the database 
		tables where the module will store the data. For that, if the 
		tables were not created by the installation script or you choose
		to install everything by yourself you can use the imc-create.sql
		<acronym>SQL</acronym> script in the database directories in the 
		kamailio/scripts folder as template. 
		You can also find the complete database documentation on the
		project webpage, &kamailiodbdocslink;.
		</para>
	</section>

</chapter>