Browse code

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

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