Browse code

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

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