Browse code

modules: readme files regenerated - nathelper ... [skip ci]

Kamailio Dev authored on 03/09/2019 22:31:30
Showing 1 changed files
... ...
@@ -1,2 +1,793 @@
1
+nathelper Module
1 2
 
3
+Maxim Sobolev
2 4
 
5
+   Sippy Software, Inc.
6
+
7
+Juha Heinanen
8
+
9
+   TuTPro, Inc.
10
+
11
+Edited by
12
+
13
+Maxim Sobolev
14
+
15
+Bogdan-Andrei Iancu
16
+
17
+Juha Heinanen
18
+
19
+Ovidiu Sas
20
+
21
+   Copyright © 2003-2008 Sippy Software, Inc.
22
+
23
+   Copyright © 2005 Voice Sistem SRL
24
+
25
+   Copyright © 2009 TuTPro Inc.
26
+
27
+   Copyright © 2010 VoIPEmbedded Inc.
28
+     __________________________________________________________________
29
+
30
+   Table of Contents
31
+
32
+   1. Admin Guide
33
+
34
+        1. Overview
35
+        2. NAT pinging types
36
+        3. Dependencies
37
+
38
+              3.1. Kamailio Modules
39
+              3.2. External Libraries or Applications
40
+
41
+        4. Parameters
42
+
43
+              4.1. force_socket (string)
44
+              4.2. natping_interval (integer)
45
+              4.3. ping_nated_only (integer)
46
+              4.4. natping_processes (integer)
47
+              4.5. natping_socket (string)
48
+              4.6. received_avp (str)
49
+              4.7. sipping_bflag (integer)
50
+              4.8. sipping_from (string)
51
+              4.9. sipping_method (string)
52
+              4.10. natping_disable_bflag (integer)
53
+              4.11. nortpproxy_str (string)
54
+              4.12. keepalive_timeout (int)
55
+              4.13. udpping_from_path (int)
56
+              4.14. append_sdp_oldmediaip (int)
57
+              4.15. filter_server_id (int)
58
+
59
+        5. Functions
60
+
61
+              5.1. fix_nated_contact()
62
+              5.2. fix_nated_sdp(flags [, ip_address])
63
+              5.3. add_rcv_param([flag]),
64
+              5.4. fix_nated_register()
65
+              5.5. nat_uac_test(flags)
66
+              5.6. is_rfc1918(ip_address)
67
+              5.7. add_contact_alias([ip_addr, port, proto])
68
+              5.8. handle_ruri_alias()
69
+              5.9. set_contact_alias()
70
+
71
+        6. Exported Pseudo Variables
72
+
73
+              6.1. $rr_count
74
+              6.2. $rr_top_count
75
+
76
+        7. RPC Commands
77
+
78
+              7.1. nathelper.enable_ping
79
+
80
+        8. Selects
81
+
82
+              8.1. @nathelper.rewrite_contact[n]
83
+
84
+   2. Frequently Asked Questions
85
+
86
+   List of Examples
87
+
88
+   1.1. Set force_socket parameter
89
+   1.2. Set natping_interval parameter
90
+   1.3. Set ping_nated_only parameter
91
+   1.4. Set natping_processes parameter
92
+   1.5. Set natping_socket parameter
93
+   1.6. Set received_avp parameter
94
+   1.7. Set sipping_bflag parameter
95
+   1.8. Set sipping_from parameter
96
+   1.9. Set sipping_method parameter
97
+   1.10. Set natping_disable_bflag parameter
98
+   1.11. Set nortpproxy_str parameter
99
+   1.12. Set keepalive_timeout parameter
100
+   1.13. Set udpping_from_path parameter
101
+   1.14. Set append_sdp_oldmediaip parameter
102
+   1.15. Set filter_server_id parameter
103
+   1.16. fix_nated_contact usage
104
+   1.17. fix_nated_sdp usage
105
+   1.18. add_rcv_paramer usage
106
+   1.19. fix_nated_register usage
107
+   1.20. nat_uac_test usage
108
+   1.21. is_rfc1918 usage
109
+   1.22. add_contact_alias usage
110
+   1.23. handle_ruri_alias usage
111
+   1.24. set_contact_alias usage
112
+   1.25. $rr_count usage
113
+   1.26. $rr_top_count usage
114
+   1.27. nathelper.enable_ping usage
115
+   1.28. @nathelper.rewrite_contact usage
116
+
117
+Chapter 1. Admin Guide
118
+
119
+   Table of Contents
120
+
121
+   1. Overview
122
+   2. NAT pinging types
123
+   3. Dependencies
124
+
125
+        3.1. Kamailio Modules
126
+        3.2. External Libraries or Applications
127
+
128
+   4. Parameters
129
+
130
+        4.1. force_socket (string)
131
+        4.2. natping_interval (integer)
132
+        4.3. ping_nated_only (integer)
133
+        4.4. natping_processes (integer)
134
+        4.5. natping_socket (string)
135
+        4.6. received_avp (str)
136
+        4.7. sipping_bflag (integer)
137
+        4.8. sipping_from (string)
138
+        4.9. sipping_method (string)
139
+        4.10. natping_disable_bflag (integer)
140
+        4.11. nortpproxy_str (string)
141
+        4.12. keepalive_timeout (int)
142
+        4.13. udpping_from_path (int)
143
+        4.14. append_sdp_oldmediaip (int)
144
+        4.15. filter_server_id (int)
145
+
146
+   5. Functions
147
+
148
+        5.1. fix_nated_contact()
149
+        5.2. fix_nated_sdp(flags [, ip_address])
150
+        5.3. add_rcv_param([flag]),
151
+        5.4. fix_nated_register()
152
+        5.5. nat_uac_test(flags)
153
+        5.6. is_rfc1918(ip_address)
154
+        5.7. add_contact_alias([ip_addr, port, proto])
155
+        5.8. handle_ruri_alias()
156
+        5.9. set_contact_alias()
157
+
158
+   6. Exported Pseudo Variables
159
+
160
+        6.1. $rr_count
161
+        6.2. $rr_top_count
162
+
163
+   7. RPC Commands
164
+
165
+        7.1. nathelper.enable_ping
166
+
167
+   8. Selects
168
+
169
+        8.1. @nathelper.rewrite_contact[n]
170
+
171
+1. Overview
172
+
173
+   This is a module to help with NAT traversal and reuse of TCP
174
+   connections. In particular, it helps symmetric UAs that don't advertise
175
+   they are symmetric and are not able to determine their public address.
176
+
177
+   The function fix_nated_contact() rewrites the “Contact” header field
178
+   with request's source address:port pair. The function fix_nated_sdp()
179
+   adds the active direction indication to SDP (flag 0x01) and updates the
180
+   source IP address too (flag 0x02). The function fix_nated_register()
181
+   exports exports the request's source address:port into an AVP to be
182
+   used during save() and should be used for “REGISTER” requests.
183
+
184
+   Note: fix_nated_contact changes the “Contact” header, thus it breaks
185
+   the RFC. Although usually this is not an issue, it may cause problems
186
+   with strict SIP clients. An alternative is to use add_contact_alias()
187
+   that together with the handle_ruri_alias() is standards conforming and
188
+   also supports reuse of TCP/TLS connections.
189
+
190
+2. NAT pinging types
191
+
192
+   Currently, the nathelper module supports two types of NAT pings:
193
+     * UDP packet - 4 bytes (zero filled) UDP packets are sent to the
194
+       contact address.
195
+          + Advantages: low bandwidth traffic, easy to generate by
196
+            Kamailio;
197
+          + Disadvantages: unidirectional traffic through NAT (inbound -
198
+            from outside to inside); As many NATs do update the bind
199
+            timeout only on outbound traffic, the bind may expire and
200
+            closed.
201
+     * SIP request - a stateless SIP request is sent to the UDP contact
202
+       address.
203
+          + Advantages: bidirectional traffic through NAT, since each PING
204
+            request from Kamailio (inbound traffic) will force the SIP
205
+            client to generate a SIP reply (outbound traffic) - the NAT
206
+            bind will be surely kept open.
207
+          + Disadvantages: higher bandwidth traffic, more expensive (as
208
+            time) to generate by Kamailio;
209
+
210
+3. Dependencies
211
+
212
+   3.1. Kamailio Modules
213
+   3.2. External Libraries or Applications
214
+
215
+3.1. Kamailio Modules
216
+
217
+   The following modules must be loaded before this module:
218
+     * usrloc module - only if the NATed contacts are to be pinged.
219
+
220
+3.2. External Libraries or Applications
221
+
222
+   The following libraries or applications must be installed before
223
+   running Kamailio with this module loaded:
224
+     * None.
225
+
226
+4. Parameters
227
+
228
+   4.1. force_socket (string)
229
+   4.2. natping_interval (integer)
230
+   4.3. ping_nated_only (integer)
231
+   4.4. natping_processes (integer)
232
+   4.5. natping_socket (string)
233
+   4.6. received_avp (str)
234
+   4.7. sipping_bflag (integer)
235
+   4.8. sipping_from (string)
236
+   4.9. sipping_method (string)
237
+   4.10. natping_disable_bflag (integer)
238
+   4.11. nortpproxy_str (string)
239
+   4.12. keepalive_timeout (int)
240
+   4.13. udpping_from_path (int)
241
+   4.14. append_sdp_oldmediaip (int)
242
+   4.15. filter_server_id (int)
243
+
244
+4.1. force_socket (string)
245
+
246
+   Socket to be used when sending NAT pings for UDP communication. If no
247
+   one specified, the OS will choose a socket.
248
+
249
+   Default value is “NULL”.
250
+
251
+   Example 1.1. Set force_socket parameter
252
+...
253
+modparam("nathelper", "force_socket", "127.0.0.1:5060")
254
+...
255
+
256
+4.2. natping_interval (integer)
257
+
258
+   Period of time in seconds between sending the NAT pings to all
259
+   currently registered UAs to keep their NAT bindings alive. Value of 0
260
+   disables this functionality.
261
+
262
+Note
263
+
264
+   Enabling the NAT pinging functionality will force the module to bind
265
+   itself to USRLOC module.
266
+
267
+   Default value is 0.
268
+
269
+   Example 1.2. Set natping_interval parameter
270
+...
271
+modparam("nathelper", "natping_interval", 10)
272
+...
273
+
274
+4.3. ping_nated_only (integer)
275
+
276
+   If this parameter is set to 1 then only contacts that have “behind_NAT”
277
+   flag in user location database set will get ping.
278
+
279
+   If it is 0 and sipping_flag is not set, then the 4-bytes UDP ping is
280
+   sent to all contacts. If it is 0 and sipping_flag parameter is set,
281
+   then SIP-request-based pinging is sent to all contacts.
282
+
283
+   Default value is 0.
284
+
285
+   Example 1.3. Set ping_nated_only parameter
286
+...
287
+modparam("nathelper", "ping_nated_only", 1)
288
+...
289
+
290
+4.4. natping_processes (integer)
291
+
292
+   How many timer processes should be created by the module for the
293
+   exclusive task of sending the NAT pings.
294
+
295
+   Default value is 1.
296
+
297
+   Example 1.4. Set natping_processes parameter
298
+...
299
+modparam("nathelper", "natping_processes", 3)
300
+...
301
+
302
+4.5. natping_socket (string)
303
+
304
+   Spoof the natping's source-ip to this address. Works only for IPv4.
305
+
306
+   Default value is NULL.
307
+
308
+   Example 1.5. Set natping_socket parameter
309
+...
310
+modparam("nathelper", "natping_socket", "192.168.1.1:5006")
311
+...
312
+
313
+4.6. received_avp (str)
314
+
315
+   The name of the Attribute-Value-Pair (AVP) used to store the URI
316
+   containing the received IP, port, and protocol. The URI is created by
317
+   fix_nated_register function of nathelper module and the attribute is
318
+   then used by the registrar to store the received parameters. Do not
319
+   forget to change the value of corresponding parameter in registrar
320
+   module if you change the value of this parameter.
321
+
322
+Note
323
+
324
+   You must set this parameter if you use fix_nated_register. In such case
325
+   you must set the parameter with same name in the “registrar” module to
326
+   same value.
327
+
328
+   Default value is "NULL" (disabled).
329
+
330
+   Example 1.6. Set received_avp parameter
331
+...
332
+modparam("nathelper", "received_avp", "$avp(i:42)")
333
+...
334
+
335
+4.7. sipping_bflag (integer)
336
+
337
+   Which branch flag should be used by the module to identify NATed
338
+   contacts for which it should perform NAT ping via a SIP request instead
339
+   of dummy UDP packet.
340
+
341
+   Default value is -1 (disabled).
342
+
343
+   Example 1.7. Set sipping_bflag parameter
344
+...
345
+modparam("nathelper", "sipping_bflag", 7)
346
+...
347
+
348
+4.8. sipping_from (string)
349
+
350
+   The parameter sets the SIP URI to be used in generating the SIP
351
+   requests for NAT ping purposes. To enable the SIP request pinging
352
+   feature, you have to set this parameter. The SIP request pinging will
353
+   be used only for requests marked so.
354
+
355
+   Default value is “NULL”.
356
+
357
+   Example 1.8. Set sipping_from parameter
358
+...
359
+modparam("nathelper", "sipping_from", "sip:pinger@siphub.net")
360
+...
361
+
362
+4.9. sipping_method (string)
363
+
364
+   The parameter sets the SIP method to be used in generating the SIP
365
+   requests for NAT ping purposes.
366
+
367
+   Default value is “OPTIONS”.
368
+
369
+   Example 1.9. Set sipping_method parameter
370
+...
371
+modparam("nathelper", "sipping_method", "INFO")
372
+...
373
+
374
+4.10. natping_disable_bflag (integer)
375
+
376
+   What branch flag should be used by the module to disable NAT pings on a
377
+   per-registration basis. If the given flag is set for a particular
378
+   registration, then no NAT pings will be sent at all, regardless of any
379
+   other conditions.
380
+
381
+   Default value is -1 (disabled).
382
+
383
+   Example 1.10. Set natping_disable_bflag parameter
384
+...
385
+modparam("nathelper", "natping_disable_bflag", 8)
386
+...
387
+
388
+4.11. nortpproxy_str (string)
389
+
390
+   The parameter sets the SDP attribute used by nathelper to mark the
391
+   packet SDP that information have already been mangled.
392
+
393
+   If empty string, no marker will be added or checked.
394
+
395
+Note
396
+
397
+   The string must be a complete SDP line, including the EOH (\r\n).
398
+
399
+   Default value is “a=nortpproxy:yes\r\n”.
400
+
401
+   Example 1.11. Set nortpproxy_str parameter
402
+...
403
+modparam("nathelper", "nortpproxy_str", "a=sdpmangled:yes\r\n")
404
+...
405
+
406
+4.12. keepalive_timeout (int)
407
+
408
+   The parameter sets the interval in seconds after which a natted contact
409
+   is removed from location table if it does not reply to SIP keepalives
410
+   (usually OPTIONS ping requests).
411
+
412
+   The features is available only for UDP contacts that are stored in
413
+   memory (not working for db only mode for usrloc module).
414
+
415
+   Keepalives are sent stateless, not using TM module. The value of this
416
+   parameter has to be few times higher than natping_interval.
417
+
418
+   Default value is “0” (feature disabled).
419
+
420
+   Example 1.12. Set keepalive_timeout parameter
421
+...
422
+modparam("nathelper", "keepalive_timeout", 120)
423
+...
424
+
425
+4.13. udpping_from_path (int)
426
+
427
+   Enable sending UDP pings (keepalives) using raw socket from Path
428
+   address.
429
+
430
+   Default value is “0” (feature disabled).
431
+
432
+   Example 1.13. Set udpping_from_path parameter
433
+...
434
+modparam("nathelper", "udpping_from_path", 1)
435
+...
436
+
437
+4.14. append_sdp_oldmediaip (int)
438
+
439
+   The parameter controls if oldmediaip field should be appended to the
440
+   SDP.
441
+
442
+   Default value is “1” (feature enabled).
443
+
444
+   Example 1.14. Set append_sdp_oldmediaip parameter
445
+...
446
+modparam("nathelper", "append_sdp_oldmediaip", 1)
447
+...
448
+
449
+4.15. filter_server_id (int)
450
+
451
+   Filter contacts by “server_id” core parameter. Use this parameter to
452
+   limit pinging. When set to “1”, only proxy instances which send packets
453
+   are those where core server_id matches server_id saved in usrloc.
454
+   Default value is “0” (disabled).
455
+
456
+   Example 1.15. Set filter_server_id parameter
457
+...
458
+modparam("nathelper", "filter_server_id", 1)
459
+...
460
+
461
+5. Functions
462
+
463
+   5.1. fix_nated_contact()
464
+   5.2. fix_nated_sdp(flags [, ip_address])
465
+   5.3. add_rcv_param([flag]),
466
+   5.4. fix_nated_register()
467
+   5.5. nat_uac_test(flags)
468
+   5.6. is_rfc1918(ip_address)
469
+   5.7. add_contact_alias([ip_addr, port, proto])
470
+   5.8. handle_ruri_alias()
471
+   5.9. set_contact_alias()
472
+
473
+5.1.  fix_nated_contact()
474
+
475
+   Rewrites the “Contact” header to contain the request's source
476
+   address:port.
477
+
478
+   This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE,
479
+   BRANCH_ROUTE.
480
+
481
+   Example 1.16. fix_nated_contact usage
482
+...
483
+if (search("User-Agent: Cisco ATA.*") {fix_nated_contact();};
484
+...
485
+
486
+5.2.  fix_nated_sdp(flags [, ip_address])
487
+
488
+   Alters the SDP information in order to facilitate NAT traversal. What
489
+   changes to be performed may be controlled via the “flags” parameter.
490
+   Return value is -1 if error occurred, 1 if ip's were replaced, 2 if no
491
+   ip's were replaced.
492
+
493
+   Meaning of the parameters is as follows:
494
+     * flags - the value may be a bitwise OR of the following flags:
495
+          + 0x01 - adds “a=direction:active” SDP line;
496
+          + 0x02 - rewrite media IP address (c=) with source address of
497
+            the message or the provided IP address (the provide IP address
498
+            take precedence over the source address).
499
+          + 0x04 - adds “a=nortpproxy:yes” SDP line;
500
+          + 0x08 - rewrite IP from origin description (o=) with source
501
+            address of the message or the provided IP address (the provide
502
+            IP address take precedence over the source address).
503
+     * ip_address - IP to be used for rewriting SDP. If not specified, the
504
+       received signalling IP will be used. The parameter allows
505
+       pseudo-variables usage. NOTE: For the IP to be used, you need to
506
+       use 0x02 or 0x08 flags, otherwise it will have no effect.
507
+
508
+   This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE,
509
+   FAILURE_ROUTE, BRANCH_ROUTE.
510
+
511
+   Example 1.17. fix_nated_sdp usage
512
+...
513
+if (search("User-Agent: Cisco ATA.*") {fix_nated_sdp("3");};
514
+...
515
+
516
+5.3.  add_rcv_param([flag]),
517
+
518
+   Add a received parameter to the “Contact” header fields (available for
519
+   all transports) or to the Contact URI (available only for UDP traffic).
520
+
521
+   The parameter will contain the URI created from the source IP, port,
522
+   and protocol (if different than UDP) of the packet containing the SIP
523
+   message. The parameter can be then processed by another registrar. This
524
+   is useful, for example, when replicating register messages using
525
+   t_replicate function to another registrar.
526
+
527
+   Meaning of the parameters is as follows:
528
+     * flag - flags to indicate if the parameter should be added to
529
+       Contact URI or Contact header. If the flag is non-zero, the
530
+       parameter will be added to the Contact URI. If not used or equal to
531
+       zero, the parameter will go to the Contact header.
532
+
533
+   This function can be used from REQUEST_ROUTE.
534
+
535
+   Example 1.18. add_rcv_paramer usage
536
+...
537
+add_rcv_param(); # add the parameter to the Contact header
538
+....
539
+add_rcv_param("1"); # add the parameter to the Contact URI
540
+...
541
+
542
+5.4.  fix_nated_register()
543
+
544
+   The function creates a URI consisting of the source IP, port, and
545
+   protocol and stores the URI in an Attribute-Value-Pair. The URI will be
546
+   appended as "received" parameter to Contact in 200 OK and registrar
547
+   will store it in the received column in the location table.
548
+
549
+   Note: You have to set the “received_avp” parameter of the nathelper
550
+   module and the registrar module (both module parameters must have the
551
+   same value) to use this function.
552
+
553
+   This function can be used from REQUEST_ROUTE.
554
+
555
+   Example 1.19. fix_nated_register usage
556
+...
557
+fix_nated_register();
558
+...
559
+
560
+5.5.  nat_uac_test(flags)
561
+
562
+   Tries to guess if client's request originated behind a nat. The
563
+   parameter determines what heuristics is used.
564
+
565
+   Meaning of the flags is as follows:
566
+     * 1 - The “Contact” header field is searched for occurrence of
567
+       RFC1918 or RFC6598 addresses.
568
+     * 2 - the "received" test is used: address in the “Via” header is
569
+       compared against source IP address of signaling. If the “Via”
570
+       header contains no port, it uses the default SIP port 5060
571
+     * 4 - The Top Most “Via” is searched for occurrence of RFC1918 or
572
+       RFC6598 addresses
573
+     * 8 - The SDP is searched for occurrence of RFC1918 or RFC6598
574
+       addresses
575
+     * 16 - Test if the source port is different from the port in the
576
+       “Via” header. If the “Via” header contains no port, it uses the
577
+       default SIP port 5060
578
+     * 32 - Test if the source IP address of signaling is a RFC1918 or
579
+       RFC6598 address
580
+     * 64 - Test if the source connection of signaling is a WebSocket
581
+     * 128 - Test if the “Contact” header URI port differs from the source
582
+       port of the request (Warning: this is might be legal or even
583
+       intended combination in non NATted scenarios)
584
+     * 256 - Test if the SDP connection address is different from source
585
+       IP address. It will work also with multiple connection address
586
+       lines.
587
+
588
+   All flags can be bitwise combined, the test returns true if any of the
589
+   tests identified a NAT.
590
+
591
+   This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE,
592
+   FAILURE_ROUTE, BRANCH_ROUTE.
593
+
594
+   Example 1.20. nat_uac_test usage
595
+...
596
+if(nat_uac_test("19")) {
597
+    rtpproxy_manage("co");
598
+}
599
+...
600
+
601
+5.6.  is_rfc1918(ip_address)
602
+
603
+   Determines if the address in the parameter is an rfc1918 or rfc6598
604
+   address. The parameter allows pseudo-variables usage.
605
+
606
+   This function can be used from ANY_ROUTE.
607
+
608
+   Example 1.21. is_rfc1918 usage
609
+...
610
+if(is_rfc1918("$rd")) {
611
+    # domain in r-uri is private address
612
+}
613
+...
614
+
615
+5.7.  add_contact_alias([ip_addr, port, proto])
616
+
617
+   Adds an “;alias=ip~port~transport” parameter to the contact URI
618
+   containing either received ip, port, and transport protocol or those
619
+   given as parameters. If called without parameters, “;alias” parameter
620
+   is only added if received ip, port, or transport protocol differs from
621
+   that in contact URI.
622
+
623
+   This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE,
624
+   BRANCH_ROUTE, and LOCAL_ROUTE.
625
+
626
+   Example 1.22. add_contact_alias usage
627
+...
628
+    if (!is_present_hf("Record-Route")) {
629
+        if (!add_contact_alias("$var(src_ip)", "$Rp", "tcp")) {
630
+            xlog("L_ERR", "Error in aliasing contact $ct\n");
631
+            send_reply("400", "Bad request");
632
+            exit;
633
+        };
634
+    };
635
+...
636
+
637
+5.8.  handle_ruri_alias()
638
+
639
+   Checks if the Request URI has an “alias” parameter and if so, removes
640
+   it and sets the “$du” based on its value. Note that this means that
641
+   routing of request is based on “;alias” parameter value of the Request
642
+   URI rather than the Request URI itself. If you call handle_ruri_alias()
643
+   on a request, make sure that you screen the alias parameter value of
644
+   Request URI the same way as you would screen the Request URI itself.
645
+
646
+   Returns 1 if “;alias” parameter was found and “$du” was set and the
647
+   “$ru” rewritten, 2 if the alias parameter was not found and nothing was
648
+   done, or -1 in case of error.
649
+
650
+   This function can be used from REQUEST_ROUTE, BRANCH_ROUTE, and
651
+   LOCAL_ROUTE.
652
+
653
+   Example 1.23. handle_ruri_alias usage
654
+...
655
+    if ($du == "") {
656
+        handle_ruri_alias();
657
+        switch ($rc) {
658
+        case -1:
659
+            xlog("L_ERR", "Failed to handle alias of R-URI $ru\n");
660
+            send_reply("400", "Bad request");
661
+            exit;
662
+        case 1:
663
+            xlog("L_INFO", "Routing in-dialog $rm from $fu to $du\n");
664
+            break;
665
+        case 2:
666
+            xlog("L_INFO", "Routing in-dialog $rm from $fu to $ru\n");
667
+            break;
668
+         };
669
+    };
670
+...
671
+
672
+5.9.  set_contact_alias()
673
+
674
+   Adds an “;alias=ip~port~transport” parameter to the contact URI
675
+   containing the received ip, port, and transport protocol. The new
676
+   contact URI is immediately visible to other modules in the way the
677
+   fix_nated_contact() does it.
678
+
679
+   This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE,
680
+   BRANCH_ROUTE, and FAILURE_ROUTE.
681
+
682
+   Example 1.24. set_contact_alias usage
683
+...
684
+    if (!is_present_hf("Record-Route")) {
685
+        if (!set_contact_alias()) {
686
+            xlog("L_ERR", "Error in aliasing contact $ct\n");
687
+            send_reply("400", "Bad request");
688
+            exit;
689
+        };
690
+    };
691
+...
692
+
693
+6. Exported Pseudo Variables
694
+
695
+   6.1. $rr_count
696
+   6.2. $rr_top_count
697
+
698
+6.1. $rr_count
699
+
700
+   Number of Record Routes in received SIP request or reply.
701
+
702
+   Example 1.25. $rr_count usage
703
+...
704
+    $avp(rr_count) = $rr_count;
705
+...
706
+
707
+6.2. $rr_top_count
708
+
709
+   If topmost Record Route in received SIP request or reply is a double
710
+   Record Route, value of $rr_top_count is 2. If it a single Record Route,
711
+   value of $rr_top_count is 1. If there is no Record Route(s), value of
712
+   $rr_top_count is 0.
713
+
714
+   Example 1.26. $rr_top_count usage
715
+...
716
+    if ($rr_count == $avp(rr_count) + $rr_top_count) {
717
+        route(ADD_CONTACT_ALIAS);
718
+    };
719
+...
720
+
721
+7. RPC Commands
722
+
723
+   7.1. nathelper.enable_ping
724
+
725
+7.1. nathelper.enable_ping
726
+
727
+   Enables natping if parameter value different than 0. Disables natping
728
+   if parameter value is 0.
729
+
730
+   The function takes only one parameter - a number in decimal format.
731
+
732
+   Example 1.27. nathelper.enable_ping usage
733
+...
734
+$ kamcmd nathelper.enable_ping 1
735
+...
736
+
737
+8. Selects
738
+
739
+   8.1. @nathelper.rewrite_contact[n]
740
+
741
+8.1. @nathelper.rewrite_contact[n]
742
+
743
+   Get n-th Contact value with IP:Port rewritten to source ip:port. N is
744
+   counted from 1. Only IP:port is rewritten, remaining part are left
745
+   unchanged. Full nameaddr is supported.
746
+
747
+   Example 1.28. @nathelper.rewrite_contact usage
748
+...
749
+$c = @nathelper.rewrite_contact[1];
750
+...
751
+$c2 = @nathelper.rewrite_contact[1].nameaddr.uri;
752
+
753
+Chapter 2. Frequently Asked Questions
754
+
755
+   2.1. What happened with “rtpproxy_disable” parameter?
756
+   2.2. Where can I find more about Kamailio?
757
+   2.3. Where can I post a question about this module?
758
+   2.4. How can I report a bug?
759
+
760
+   2.1.
761
+
762
+   What happened with “rtpproxy_disable” parameter?
763
+
764
+   It was removed as it became obsolete - now “rtpproxy_sock” can take
765
+   empty value to disable the rtpproxy functionality.
766
+
767
+   2.2.
768
+
769
+   Where can I find more about Kamailio?
770
+
771
+   Take a look at https://www.kamailio.org/.
772
+
773
+   2.3.
774
+
775
+   Where can I post a question about this module?
776
+
777
+   First at all check if your question was already answered on one of our
778
+   mailing lists:
779
+     * User Mailing List -
780
+       https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
781
+     * Developer Mailing List -
782
+       https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev
783
+
784
+   E-mails regarding any stable Kamailio release should be sent to
785
+   <sr-users@lists.kamailio.org> and e-mails regarding development
786
+   versions should be sent to <sr-dev@lists.kamailio.org>.
787
+
788
+   2.4.
789
+
790
+   How can I report a bug?
791
+
792
+   Please follow the guidelines provided at:
793
+   https://github.com/kamailio/kamailio/issues.