Browse code

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

Kamailio Dev authored on 06/12/2018 08:52:16
Showing 9 changed files
... ...
@@ -28,6 +28,12 @@ Olle E. Johansson
28 28
 
29 29
    <oej@edvina.net>
30 30
 
31
+Edited by
32
+
33
+Surendra Tiwari
34
+
35
+   <surendratiwari3@gmail.com>
36
+
31 37
    Copyright © 2006 Voice Sistem SRL
32 38
 
33 39
    Copyright © 2011 Carsten Bock, http://www.ng-voice.com
... ...
@@ -145,14 +151,17 @@ Olle E. Johansson
145 145
 
146 146
               9.1. dlg.list
147 147
               9.2. dlg.list_ctx
148
-              9.3. dlg.dlg_list
149
-              9.4. dlg.dlg_list_ctx
150
-              9.5. dlg.terminate_dlg
151
-              9.6. dlg.end_dlg
152
-              9.7. dlg.profile_get_size
153
-              9.8. dlg.profile_list
154
-              9.9. dlg.bridge_dlg
155
-              9.10. dlg.stats_active
148
+              9.3. dlg.list_match
149
+              9.4. dlg.list_match_ctx
150
+              9.5. dlg.dlg_list
151
+              9.6. dlg.dlg_list_ctx
152
+              9.7. dlg.terminate_dlg
153
+              9.8. dlg.end_dlg
154
+              9.9. dlg.profile_get_size
155
+              9.10. dlg.profile_list
156
+              9.11. dlg.bridge_dlg
157
+              9.12. dlg.stats_active
158
+              9.13. dlg.is_alive
156 159
 
157 160
         10. Exported Variables
158 161
 
... ...
@@ -375,14 +384,17 @@ Chapter 1. Admin Guide
375 375
 
376 376
         9.1. dlg.list
377 377
         9.2. dlg.list_ctx
378
-        9.3. dlg.dlg_list
379
-        9.4. dlg.dlg_list_ctx
380
-        9.5. dlg.terminate_dlg
381
-        9.6. dlg.end_dlg
382
-        9.7. dlg.profile_get_size
383
-        9.8. dlg.profile_list
384
-        9.9. dlg.bridge_dlg
385
-        9.10. dlg.stats_active
378
+        9.3. dlg.list_match
379
+        9.4. dlg.list_match_ctx
380
+        9.5. dlg.dlg_list
381
+        9.6. dlg.dlg_list_ctx
382
+        9.7. dlg.terminate_dlg
383
+        9.8. dlg.end_dlg
384
+        9.9. dlg.profile_get_size
385
+        9.10. dlg.profile_list
386
+        9.11. dlg.bridge_dlg
387
+        9.12. dlg.stats_active
388
+        9.13. dlg.is_alive
386 389
 
387 390
    10. Exported Variables
388 391
 
... ...
@@ -1866,14 +1878,17 @@ if(has_totag()) {
1866 1866
 
1867 1867
    9.1. dlg.list
1868 1868
    9.2. dlg.list_ctx
1869
-   9.3. dlg.dlg_list
1870
-   9.4. dlg.dlg_list_ctx
1871
-   9.5. dlg.terminate_dlg
1872
-   9.6. dlg.end_dlg
1873
-   9.7. dlg.profile_get_size
1874
-   9.8. dlg.profile_list
1875
-   9.9. dlg.bridge_dlg
1876
-   9.10. dlg.stats_active
1869
+   9.3. dlg.list_match
1870
+   9.4. dlg.list_match_ctx
1871
+   9.5. dlg.dlg_list
1872
+   9.6. dlg.dlg_list_ctx
1873
+   9.7. dlg.terminate_dlg
1874
+   9.8. dlg.end_dlg
1875
+   9.9. dlg.profile_get_size
1876
+   9.10. dlg.profile_list
1877
+   9.11. dlg.bridge_dlg
1878
+   9.12. dlg.stats_active
1879
+   9.13. dlg.is_alive
1877 1880
 
1878 1881
 9.1. dlg.list
1879 1882
 
... ...
@@ -1898,7 +1913,45 @@ kamcmd dlg.list
1898 1898
 kamcmd dlg.list_ctx
1899 1899
 ...
1900 1900
 
1901
-9.3. dlg.dlg_list
1901
+9.3. dlg.list_match
1902
+
1903
+   Lists the details of matching dialogs. The paramters specify the
1904
+   matching key, operator, value and optionally a limit of matched
1905
+   dialogs.
1906
+
1907
+   Name: dlg.list_match
1908
+
1909
+   Parameters:
1910
+     * mkey - matching key. It can be: 'ruri' - match against R-URI of the
1911
+       dialog; 'furi' - match against From header URI of the dialog;
1912
+       'turi' - match against the To header URI of the dialog; 'callid' -
1913
+       match against Call-Id value.
1914
+     * mop - matching operator. It can be: 'eq' - match using string
1915
+       comparison; 're' - match using regular expression; 'sw' - match
1916
+       using starts-with (prefix) comparison.
1917
+     * mval - matching value.
1918
+
1919
+   RPC Command Format:
1920
+...
1921
+kamcmd dlg.list_match furi eq sip:alice@test.com 2
1922
+...
1923
+kamcmd dlg.list_match furi sw sip:alice@
1924
+...
1925
+
1926
+9.4. dlg.list_match_ctx
1927
+
1928
+   Similar to “dlg.list_match”, but including in the attributes associated
1929
+   with the dialog context from modules sitting on top of the dialog
1930
+   module.
1931
+
1932
+   Name: dlg.list_match_ctx
1933
+
1934
+   RPC Command Format:
1935
+...
1936
+kamcmd dlg.list_match_ctx furi sw sip:alice@
1937
+...
1938
+
1939
+9.5. dlg.dlg_list
1902 1940
 
1903 1941
    Lists the description of one dialog. The dialog identifiers are to be
1904 1942
    passed as parameter (callid and optionally fromtag).
... ...
@@ -1917,9 +1970,9 @@ kamcmd dlg.list abcdrssfrs122444@192.168.1.1 AAdfeEFF33
1917 1917
 kamcmd dlg.list abcdrssfrs122444@192.168.1.1
1918 1918
 ...
1919 1919
 
1920
-9.4. dlg.dlg_list_ctx
1920
+9.6. dlg.dlg_list_ctx
1921 1921
 
1922
-   The same as the “dlg.list_ctx” but including in the dialog description
1922
+   The same as the “dlg.list_list” but including in the dialog description
1923 1923
    the associated context from modules sitting on top of the dialog
1924 1924
    module.
1925 1925
 
... ...
@@ -1934,7 +1987,7 @@ kamcmd dlg.list_ctx abcdrssfrs122444@192.168.1.1 AAdfeEFF33
1934 1934
 kamcmd dlg.list_ctx abcdrssfrs122444@192.168.1.1
1935 1935
 ...
1936 1936
 
1937
-9.5. dlg.terminate_dlg
1937
+9.7. dlg.terminate_dlg
1938 1938
 
1939 1939
    Terminates an ongoing dialog by sending BYE in both directions,
1940 1940
    matching the dialog on call-id, from tag and to tag.
... ...
@@ -1951,7 +2004,7 @@ kamcmd dlg.list_ctx abcdrssfrs122444@192.168.1.1
1951 1951
    RPC Command Format:
1952 1952
                 kamcmd dlg.terminate_dlg callid12345 fromtag123 totag123
1953 1953
 
1954
-9.6. dlg.end_dlg
1954
+9.8. dlg.end_dlg
1955 1955
 
1956 1956
    Terminates an ongoing dialog by sending BYE in both directions.
1957 1957
 
... ...
@@ -1971,7 +2024,7 @@ kamcmd dlg.list_ctx abcdrssfrs122444@192.168.1.1
1971 1971
 kamcmd dlg.end_dlg 342 56
1972 1972
 ...
1973 1973
 
1974
-9.7. dlg.profile_get_size
1974
+9.9. dlg.profile_get_size
1975 1975
 
1976 1976
    Returns the number of dialogs belonging to a profile. If the profile
1977 1977
    supports values, the check can be reinforced to take into account a
... ...
@@ -1991,7 +2044,7 @@ kamcmd dlg.end_dlg 342 56
1991 1991
 kamcmd dlg.dlg.profile_get_size inbound_calls
1992 1992
 ...
1993 1993
 
1994
-9.8. dlg.profile_list
1994
+9.10. dlg.profile_list
1995 1995
 
1996 1996
    Lists all the dialogs belonging to a profile. If the profile supports
1997 1997
    values, the check can be reinforced to take into account a specific
... ...
@@ -2011,7 +2064,7 @@ kamcmd dlg.dlg.profile_get_size inbound_calls
2011 2011
 kamcmd dlg.profile_list inbound_calls
2012 2012
 ...
2013 2013
 
2014
-9.9. dlg.bridge_dlg
2014
+9.11. dlg.bridge_dlg
2015 2015
 
2016 2016
    Bridge two SIP addresses into a call using INVITE(hold)-REFER-BYE
2017 2017
    mechanism.
... ...
@@ -2036,7 +2089,7 @@ kamcmd dlg.profile_list inbound_calls
2036 2036
 kamcmd dlg.bridge_dlg _from_ _to_ _op_
2037 2037
 ...
2038 2038
 
2039
-9.10. dlg.stats_active
2039
+9.12. dlg.stats_active
2040 2040
 
2041 2041
    Get stats about active dialogs by scanning internal list of dialogs
2042 2042
    (not relying on core stats framework).
... ...
@@ -2060,6 +2113,26 @@ kamcmd dlg.bridge_dlg _from_ _to_ _op_
2060 2060
 kamcmd dlg.stats_active
2061 2061
 ...
2062 2062
 
2063
+9.13. dlg.is_alive
2064
+
2065
+   Check whether a dialog matching the parameter is in confirmed state
2066
+   (answered and alive).
2067
+
2068
+   Name: dlg.is_alive
2069
+
2070
+   Parameters:
2071
+     * callid - callid of dialog
2072
+     * from_tag - from tag of the dialog
2073
+     * to_tag - to tag of the dialog
2074
+
2075
+   This command will return error if dialog is not found or not confirmed
2076
+   state (answered).
2077
+
2078
+   RPC Command Format:
2079
+...
2080
+kamcmd dlg.is_alive callid123 fromtag123 totag123
2081
+...
2082
+
2063 2083
 10. Exported Variables
2064 2084
 
2065 2085
    10.1. $DLG_count
... ...
@@ -1439,12 +1439,21 @@ kamcmd dispatcher.ping_active 0
1439 1439
    destination address (string value in full SIP URI format).
1440 1440
 
1441 1441
    Optionally, these fields can be followed by:
1442
-     * flags (listed by index - can be bitwise mask of values): 0 (value
1443
-       1) - inactive destination; 1 (value 2) - temporary trying
1444
-       destination (in the way to become inactive if it does not reply to
1445
-       keepalives - there is a module parameter to set the threshold of
1446
-       failures); 2 (value 4) - admin disabled destination; 3 (value 8) -
1447
-       probing destination (sending keep alives);
1442
+     * flags - control the mode of using the destination address and
1443
+       sending keepalives. It is a bitwise value that can be built using
1444
+       the folowing flags:
1445
+          + 1 (bit at index 0 - 1 <<0) - inactive destination
1446
+          + 2 (bit at index 1 - 1 <<1) - temporary trying destination (in
1447
+            the way to become inactive if it does not reply to keepalives
1448
+            - there is a module parameter to set the threshold of
1449
+            failures)
1450
+          + 4 (bit at index 2 - 1 <<2) - admin disabled destination
1451
+          + 8 (bit at index 3 - 1 <<3) - probing destination (sending keep
1452
+            alives);
1453
+          + 16 (bit at index 4 - 1 <<4) - skip DNS A/AAAA resolve at
1454
+            startup, useful when the hostname of the destination address
1455
+            is a NAPTR or SRV record only. Such addresses cannot be
1456
+            matched anymore with ds_is_from_list(...).
1448 1457
      * priority: sets the priority in destination list (based on it is
1449 1458
        done the initial ordering inside the set)
1450 1459
      * attributes: extra fields in form of name1=value1;...;nameN=valueN.
... ...
@@ -66,7 +66,7 @@ Carlos Ruiz Diaz
66 66
         5. Functions
67 67
 
68 68
               5.1. Ro_CCR(route_name, direction, reservation_units,
69
-                      domain, incoming_trunk_id, outgoing_trunk_id
69
+                      incoming_trunk_id, outgoing_trunk_id)
70 70
 
71 71
               5.2. Ro_set_session_id_avp()
72 72
 
... ...
@@ -163,8 +163,8 @@ Chapter 1. Admin Guide
163 163
 
164 164
    5. Functions
165 165
 
166
-        5.1. Ro_CCR(route_name, direction, reservation_units, domain,
167
-                incoming_trunk_id, outgoing_trunk_id
166
+        5.1. Ro_CCR(route_name, direction, reservation_units,
167
+                incoming_trunk_id, outgoing_trunk_id)
168 168
 
169 169
         5.2. Ro_set_session_id_avp()
170 170
 
... ...
@@ -689,13 +689,13 @@ modparam("ims_charging", "custom_user_avp", "$avp(from_user)")
689 689
 
690 690
 5. Functions
691 691
 
692
-   5.1. Ro_CCR(route_name, direction, reservation_units, domain,
693
-          incoming_trunk_id, outgoing_trunk_id
692
+   5.1. Ro_CCR(route_name, direction, reservation_units,
693
+          incoming_trunk_id, outgoing_trunk_id)
694 694
 
695 695
    5.2. Ro_set_session_id_avp()
696 696
 
697
-5.1. Ro_CCR(route_name, direction, reservation_units, domain,
698
-incoming_trunk_id, outgoing_trunk_id
697
+5.1. Ro_CCR(route_name, direction, reservation_units, incoming_trunk_id,
698
+outgoing_trunk_id)
699 699
 
700 700
    Perform a CCR on Diameter Ro interface for Charging
701 701
 
... ...
@@ -704,7 +704,6 @@ incoming_trunk_id, outgoing_trunk_id
704 704
      * direction "orig"inating or "term"inating
705 705
      * reservation_units how many units (at the moment seconds) should be
706 706
        reserved at the moment.
707
-     * domain Logical domain within registrar.
708 707
      * incoming_trunk_id Identifies the trunk group from which this
709 708
        originates.
710 709
      * outgoing_trunk_id Identifies the trunk group where this will be
... ...
@@ -652,11 +652,11 @@ modparam("rtpengine", "rtpengine_retr", 2)
652 652
 
653 653
 4.8. extra_id_pv (string)
654 654
 
655
-   The parameter sets the PV definition to use when the “b” parameter is
656
-   used on rtpengine_delete(), rtpengine_offer(), rtpengine_answer() or
657
-   rtpengine_manage() command.
655
+   The parameter sets the PV definition to use when the “via-branch”
656
+   parameter is used on rtpengine_delete(), rtpengine_offer(),
657
+   rtpengine_answer() or rtpengine_manage() command.
658 658
 
659
-   Default is empty, the “b” parameter may not be used then.
659
+   Default is empty, the “via-branch” parameter may not be used then.
660 660
 
661 661
    Example 1.8. Set extra_id_pv parameter
662 662
 ...
... ...
@@ -2028,6 +2028,19 @@ rtpengine_offer();
2028 2028
             used when recording calls to provide custom additional
2029 2029
             information. More details about this are found in the
2030 2030
             rtpengine README.
2031
+          + codec-transcode=... - allows codecs to be added to the list of
2032
+            offered codecs even if they were not present in the original
2033
+            list of codecs. In this case, the transcoding engine will be
2034
+            engaged. Only codecs that are supported for both decoding and
2035
+            encoding can be added in this manner. More details about this
2036
+            are found in the rtpengine README.
2037
+          + codec-strip=... - strips given codec from sdp
2038
+          + codec-offer=... - offer given codec from sdp.More details
2039
+            about this are found in the rtpengine README.
2040
+          + codec-mask=... - Similar to strip except that codecs listed
2041
+            here will still be accepted and used for transcoding on the
2042
+            offering side.Useful only in combination with codec-transcode.
2043
+            all keyword can be used to mask all offered codecs
2031 2044
        Check also the documentation of RTPEngine, these flags are
2032 2045
        documented there as well: https://github.com/sipwise/rtpengine.
2033 2046
 
... ...
@@ -2064,6 +2077,14 @@ onreply_route[2]
2064 2064
         rtpengine_offer();
2065 2065
 ...
2066 2066
 }
2067
+...
2068
+if (has_body("application/sdp")) {
2069
+                if (rtpengine_offer("codec-mask=all codec-transcode=PCMU codec-t
2070
+ranscode=PCMA"))
2071
+                                t_on_reply("1");
2072
+}
2073
+
2074
+...
2067 2075
 
2068 2076
 5.3.  rtpengine_answer([flags])
2069 2077
 
... ...
@@ -29,6 +29,7 @@ Daniel-Constantin Mierla
29 29
               3.1. sqlcon (str)
30 30
               3.2. sqlres (str)
31 31
               3.3. tr_buf_size (int)
32
+              3.4. connect_mode (int)
32 33
 
33 34
         4. Functions
34 35
 
... ...
@@ -48,13 +49,14 @@ Daniel-Constantin Mierla
48 48
    1.1. Set sqlcon parameter
49 49
    1.2. Set sqlres parameter
50 50
    1.3. Set tr_buf_size parameter
51
-   1.4. sql_query() usage
52
-   1.5. sql_xquery() usage
53
-   1.6. sql_pvquery() usage
54
-   1.7. sql_result_free() usage
55
-   1.8. sql_query_async() usage
56
-   1.9. $dbr(result=>key) usage
57
-   1.10. $sqlrows(con) usage
51
+   1.4. Set connect_mode parameter
52
+   1.5. sql_query() usage
53
+   1.6. sql_xquery() usage
54
+   1.7. sql_pvquery() usage
55
+   1.8. sql_result_free() usage
56
+   1.9. sql_query_async() usage
57
+   1.10. $dbr(result=>key) usage
58
+   1.11. $sqlrows(con) usage
58 59
 
59 60
 Chapter 1. Admin Guide
60 61
 
... ...
@@ -71,6 +73,7 @@ Chapter 1. Admin Guide
71 71
         3.1. sqlcon (str)
72 72
         3.2. sqlres (str)
73 73
         3.3. tr_buf_size (int)
74
+        3.4. connect_mode (int)
74 75
 
75 76
    4. Functions
76 77
 
... ...
@@ -132,6 +135,7 @@ Chapter 1. Admin Guide
132 132
    3.1. sqlcon (str)
133 133
    3.2. sqlres (str)
134 134
    3.3. tr_buf_size (int)
135
+   3.4. connect_mode (int)
135 136
 
136 137
 3.1. sqlcon (str)
137 138
 
... ...
@@ -181,6 +185,19 @@ modparam("sqlops", "sqlres", "ra")
181 181
 modparam("sqlops", "tr_buf_size", 4096)
182 182
 ...
183 183
 
184
+3.4. connect_mode (int)
185
+
186
+   Control if the module must stop loading when connecting to database
187
+   server fails during start up. Values: 0 - stop loading; 1 - continue
188
+   even if connecting to database server fails.
189
+
190
+   Default value is 0.
191
+
192
+   Example 1.4. Set connect_mode parameter
193
+...
194
+modparam("sqlops", "connect_mode", 1)
195
+...
196
+
184 197
 4. Functions
185 198
 
186 199
    4.1. sql_query(connection, query[, result])
... ...
@@ -209,7 +226,7 @@ modparam("sqlops", "tr_buf_size", 4096)
209 209
 
210 210
    This function can be used from ANY_ROUTE.
211 211
 
212
-   Example 1.4. sql_query() usage
212
+   Example 1.5. sql_query() usage
213 213
 ...
214 214
 modparam("sqlops","sqlcon","ca=>dbdriver://username:password@dbhost/dbname")
215 215
 ...
... ...
@@ -229,7 +246,7 @@ sql_result_free("ra");
229 229
 
230 230
    This function can be used from ANY_ROUTE.
231 231
 
232
-   Example 1.5. sql_xquery() usage
232
+   Example 1.6. sql_xquery() usage
233 233
 ...
234 234
 modparam("sqlops","sqlcon","ca=>dbdriver://username:password@dbhost/dbname")
235 235
 ...
... ...
@@ -267,7 +284,7 @@ if (sql_xquery("ca", "select * from domain", "ra") == 1) {
267 267
    successful query, 2 if query provided no result set, 3 if result is
268 268
    ignored (no result parameter given)
269 269
 
270
-   Example 1.6. sql_pvquery() usage
270
+   Example 1.7. sql_pvquery() usage
271 271
 ...
272 272
 modparam("sqlops","sqlcon","ca=>dbdriver://username:password@dbhost/dbname")
273 273
 ...
... ...
@@ -281,7 +298,7 @@ sql_pvquery("ca", "select 'col1', 2, NULL, 'sip:test@example.com'",
281 281
 
282 282
    This function can be used from ANY_ROUTE.
283 283
 
284
-   Example 1.7. sql_result_free() usage
284
+   Example 1.8. sql_result_free() usage
285 285
 ...
286 286
 modparam("sqlops","sqlcon","ca=>dbdriver://username:password@dbhost/dbname")
287 287
 ...
... ...
@@ -305,7 +322,7 @@ sql_result_free("ra");
305 305
 
306 306
    This function can be used from ANY_ROUTE.
307 307
 
308
-   Example 1.8. sql_query_async() usage
308
+   Example 1.9. sql_query_async() usage
309 309
 ...
310 310
 modparam("sqlops","sqlcon","ca=>dbdriver://username:password@dbhost/dbname")
311 311
 ...
... ...
@@ -332,7 +349,7 @@ sql_query_async("ca", "delete from domain");
332 332
        integer.
333 333
      * colname[N] - return the name of the N-th column in the result set.
334 334
 
335
-   Example 1.9. $dbr(result=>key) usage
335
+   Example 1.10. $dbr(result=>key) usage
336 336
 ...
337 337
 modparam("sqlops","sqlcon","ca=>dbdriver://username:password@dbhost/dbname")
338 338
 ...
... ...
@@ -391,7 +408,7 @@ if (sql_xquery("ca", "select * from domain", "ra") == 1)
391 391
 
392 392
    “con” must be the name identifying a DB connection.
393 393
 
394
-   Example 1.10. $sqlrows(con) usage
394
+   Example 1.11. $sqlrows(con) usage
395 395
 ...
396 396
 modparam("sqlops","sqlcon","ca=>dbdriver://username:password@dbhost/dbname")
397 397
 ...
... ...
@@ -97,6 +97,7 @@ Ovidiu Sas
97 97
               4.46. get_body_part(content_type, opv)
98 98
               4.47. get_body_part_raw(content_type, opv)
99 99
               4.48. remove_body_part(content_type)
100
+              4.49. regex_substring(itext, regexp, mindex, mcount, dpv)
100 101
 
101 102
    2. Developer Guide
102 103
 
... ...
@@ -155,6 +156,7 @@ Ovidiu Sas
155 155
    1.47. get_body_part usage
156 156
    1.48. get_body_part_raw usage
157 157
    1.49. remove_body_part usage
158
+   1.50. _regex_substring usage
158 159
 
159 160
 Chapter 1. Admin Guide
160 161
 
... ...
@@ -219,6 +221,7 @@ Chapter 1. Admin Guide
219 219
         4.46. get_body_part(content_type, opv)
220 220
         4.47. get_body_part_raw(content_type, opv)
221 221
         4.48. remove_body_part(content_type)
222
+        4.49. regex_substring(itext, regexp, mindex, mcount, dpv)
222 223
 
223 224
 1. Overview
224 225
 
... ...
@@ -305,6 +308,7 @@ From: medabeda
305 305
    4.46. get_body_part(content_type, opv)
306 306
    4.47. get_body_part_raw(content_type, opv)
307 307
    4.48. remove_body_part(content_type)
308
+   4.49. regex_substring(itext, regexp, mindex, mcount, dpv)
308 309
 
309 310
 4.1.  search(re)
310 311
 
... ...
@@ -1160,6 +1164,7 @@ if (starts_with("$rU", "+358"))
1160 1160
 set_body_multipart("test", "text/plain", "delimiter");
1161 1161
 msg_apply_changes();
1162 1162
 append_body_part(...);
1163
+msg_apply_changes();
1163 1164
 
1164 1165
 ...
1165 1166
 
... ...
@@ -1195,11 +1200,15 @@ text
1195 1195
    The core will take care of the last boundary ending "--". Detecting
1196 1196
    wich one is the last and fixing the others if needed.
1197 1197
 
1198
+   Note: it may be required that msg_apply_changes() from textopsx module
1199
+   has to be executed if there are other operations over the new body.
1200
+
1198 1201
    Example 1.44. append_body_part usage
1199 1202
 ...
1200 1203
 $var(b) = "7e Od 04 55 75 69 20 4d 61 6b 65 43 61 6c 6c";
1201 1204
 append_body_part("$var(b)", "application/vnd.cirpack.isdn-ext", "signal;handling
1202 1205
 =required");
1206
+msg_apply_changes();
1203 1207
 ...
1204 1208
 
1205 1209
 # Will append this to the body:
... ...
@@ -1221,6 +1230,7 @@ Content-Disposition: signal;handling=required
1221 1221
 ...
1222 1222
 $var(b) = "";
1223 1223
 append_body_part("$var(b)", "application/xml\r\nX-Header: xyz");
1224
+msg_apply_changes();
1224 1225
 ...
1225 1226
 
1226 1227
 # Will append this to the body:
... ...
@@ -1255,10 +1265,14 @@ Content-Disposition: signal;handling=required
1255 1255
    The core will take care of the last boundary ending "--". Detecting
1256 1256
    wich one is the last and fixing the others if needed.
1257 1257
 
1258
+   Note: it may be required that msg_apply_changes() from textopsx module
1259
+   has to be executed if there are other operations over the new body.
1260
+
1258 1261
    Example 1.46. append_body_part_hex usage
1259 1262
 ...
1260 1263
 $var(b) = "6b 61 6d 61 69 6c 69 6f";
1261 1264
 append_body_part_hex("$var(b)", "application/my-custom-ext");
1265
+msg_apply_changes();
1262 1266
 ...
1263 1267
 
1264 1268
 # Will append this to the body:
... ...
@@ -1326,11 +1340,47 @@ get_body_part("application/vnd.cirpack.isdn-ext", "$var(hbody)");
1326 1326
    The core will take care of the last boundary ending "--". Detecting
1327 1327
    wich one is the last and fixing the others if needed.
1328 1328
 
1329
+   Note: it may be required that msg_apply_changes() from textopsx module
1330
+   has to be executed if there are other operations over the new body.
1331
+
1329 1332
    Example 1.49. remove_body_part usage
1330 1333
 ...
1331 1334
 remove_body_part("application/vnd.cirpack.isdn-ext");
1335
+msg_apply_changes();
1332 1336
 ...
1333 1337
 
1338
+4.49.  regex_substring(itext, regexp, mindex, mcount, dpv)
1339
+
1340
+   Search in text with given regular expression then sets dpv
1341
+   pseudo-variable with the matched token at provided index.
1342
+
1343
+   Meaning of the parameters is as follows:
1344
+     * itext - text to be searched (dynamic string)
1345
+     * regexp - regular expression (dynamic string)
1346
+     * mindex - index of the matched token (int or variable holding int)
1347
+     * mcount - the number of maximum expected matches (int or variable
1348
+       holding int)
1349
+     * dpv - variable to be set with matched token (static string with a
1350
+       name of a variable)
1351
+
1352
+   This function can be used from REQUEST_ROUTE, FAILURE_ROUTE,
1353
+   BRANCH_ROUTE.
1354
+
1355
+   Note that the regular expression extended is used. More info at:
1356
+   https://www.regular-expressions.info/posix.html.
1357
+
1358
+   Example 1.50. _regex_substring usage
1359
+        ...
1360
+        regex_substring("___ abc123def ___ ghi456 ___", "([a-z]*)([0-9]+)([a-z]*
1361
+)",
1362
+                        1, 3, "$var(asd)");
1363
+        xlog("L_WARN","RESULT: $var(asd)\r\n");
1364
+        ------
1365
+        result:
1366
+        abc
1367
+        ----
1368
+        ...
1369
+
1334 1370
 Chapter 2. Developer Guide
1335 1371
 
1336 1372
    Table of Contents
... ...
@@ -52,8 +52,9 @@ Juha Heinanen
52 52
               4.9. t_is_request_route()
53 53
               4.10. t_suspend()
54 54
               4.11. t_continue(tindex, tlabel, rtname)
55
-              4.12. t_reuse_branch()
56
-              4.13. t_precheck_trans()
55
+              4.12. t_drop([rcode])
56
+              4.13. t_reuse_branch()
57
+              4.14. t_precheck_trans()
57 58
 
58 59
         5. Exported Variables
59 60
         6. Statistics
... ...
@@ -87,8 +88,9 @@ Juha Heinanen
87 87
    1.10. t_is_request_route usage
88 88
    1.11. t_suspend usage
89 89
    1.12. t_continue usage
90
-   1.13. t_reuse_branch usage
91
-   1.14. t_precheck_trans usage
90
+   1.13. t_drop usage
91
+   1.14. t_reuse_branch usage
92
+   1.15. t_precheck_trans usage
92 93
 
93 94
 Chapter 1. Admin Guide
94 95
 
... ...
@@ -117,8 +119,9 @@ Chapter 1. Admin Guide
117 117
         4.9. t_is_request_route()
118 118
         4.10. t_suspend()
119 119
         4.11. t_continue(tindex, tlabel, rtname)
120
-        4.12. t_reuse_branch()
121
-        4.13. t_precheck_trans()
120
+        4.12. t_drop([rcode])
121
+        4.13. t_reuse_branch()
122
+        4.14. t_precheck_trans()
122 123
 
123 124
    5. Exported Variables
124 125
    6. Statistics
... ...
@@ -191,8 +194,9 @@ modparam("tmx", "precheck_trans", 0)
191 191
    4.9. t_is_request_route()
192 192
    4.10. t_suspend()
193 193
    4.11. t_continue(tindex, tlabel, rtname)
194
-   4.12. t_reuse_branch()
195
-   4.13. t_precheck_trans()
194
+   4.12. t_drop([rcode])
195
+   4.13. t_reuse_branch()
196
+   4.14. t_precheck_trans()
196 197
 
197 198
 4.1.  t_cancel_branches(which)
198 199
 
... ...
@@ -407,7 +411,47 @@ route[MYROUTE] {
407 407
 }
408 408
 ...
409 409
 
410
-4.12.  t_reuse_branch()
410
+4.12.  t_drop([rcode])
411
+
412
+   Drops the transaction with response code (500 default).
413
+
414
+   Parameters:.
415
+     * rcode - response code to set in uas status.
416
+
417
+   This function can be used in ANY_ROUTE.
418
+
419
+   Example 1.13. t_drop usage
420
+...
421
+route[MYREQ]
422
+{
423
+...
424
+    if (!t_newtran()) {
425
+        xlog("L_ERROR", "$ci|log|failed to create transaction\n");
426
+        drop;
427
+    }
428
+
429
+    t_on_failure("TR_ERROR");
430
+    t_on_reply("TR_OK");
431
+    t_relay();
432
+}
433
+
434
+failure_route[TR_ERROR]
435
+{
436
+    xlog("L_INFO", "$ci|log|failed $T_reply_code $T_reply_reason\n");
437
+    t_drop();
438
+}
439
+
440
+onreply_route[TR_OK]
441
+{
442
+   xlog("L_INFO", "$ci|log|checking transaction result\n");
443
+   if(status=~"60[0-9]") {
444
+      t_drop();
445
+   }
446
+...
447
+}
448
+...
449
+
450
+4.13.  t_reuse_branch()
411 451
 
412 452
    Creates new "main" branch by making copy of branch-failure branch.
413 453
    Currently the following branch attributes are copied from
... ...
@@ -416,7 +460,7 @@ route[MYROUTE] {
416 416
 
417 417
    This function can be used from tm:branch-failure event_route.
418 418
 
419
-   Example 1.13. t_reuse_branch usage
419
+   Example 1.14. t_reuse_branch usage
420 420
 ...
421 421
 event_route [tm:branch-failure:contact] {
422 422
     t_reuse_branch();
... ...
@@ -426,7 +470,7 @@ event_route [tm:branch-failure:contact] {
426 426
 }
427 427
 ...
428 428
 
429
-4.13.  t_precheck_trans()
429
+4.14.  t_precheck_trans()
430 430
 
431 431
    Check if current processed message is handled by other process. This
432 432
    function is useful to catch retransmissions before transaction is
... ...
@@ -438,7 +482,7 @@ event_route [tm:branch-failure:contact] {
438 438
 
439 439
    This function can be used from REQUEST_ROUTE .
440 440
 
441
-   Example 1.14. t_precheck_trans usage
441
+   Example 1.15. t_precheck_trans usage
442 442
 ...
443 443
     # handle retransmissions
444 444
     if(t_precheck_trans()) {
... ...
@@ -203,7 +203,7 @@ event_route[xhttp:request] {
203 203
                 # Optional... perform HTTP authentication
204 204
 
205 205
                 # ws_handle_handshake() exits (no further configuration file
206
-                # processing of the request) when complete.
206
+                # processing of the request) when complete in case of failure.
207 207
                 if (ws_handle_handshake())
208 208
                 {
209 209
                         # Optional... cache some information about the
... ...
@@ -500,7 +500,8 @@ end
500 500
 Note
501 501
 
502 502
    This function returns 0, stopping all further processing of the
503
-   request, when there is a problem.
503
+   request, when there is a problem. Otherwise, it returns 1 (or positive
504
+   number) in case of success.
504 505
 
505 506
    Example 1.12. ws_handle_handshake usage
506 507
 ...
... ...
@@ -24,6 +24,7 @@ Jan Janak
24 24
               2.5. mode (integer)
25 25
               2.6. url_skip (str)
26 26
               2.7. url_match (str)
27
+              2.8. event_callback (string)
27 28
 
28 29
         3. Functions
29 30
 
... ...
@@ -44,8 +45,9 @@ Jan Janak
44 44
    1.5. Set the mode parameter
45 45
    1.6. Set url_skip parameter
46 46
    1.7. Set url_match parameter
47
-   1.8. dispatch_rpc usage
48
-   1.9. xmlrpc_reply usage
47
+   1.8. Set event_callback parameter
48
+   1.9. dispatch_rpc usage
49
+   1.10. xmlrpc_reply usage
49 50
 
50 51
 1. Design Goals
51 52
 
... ...
@@ -536,6 +538,7 @@ Chapter 1. Admin Guide
536 536
         2.5. mode (integer)
537 537
         2.6. url_skip (str)
538 538
         2.7. url_match (str)
539
+        2.8. event_callback (string)
539 540
 
540 541
    3. Functions
541 542
 
... ...
@@ -560,6 +563,7 @@ Chapter 1. Admin Guide
560 560
    2.5. mode (integer)
561 561
    2.6. url_skip (str)
562 562
    2.7. url_match (str)
563
+   2.8. event_callback (string)
563 564
 
564 565
 2.1. route (string)
565 566
 
... ...
@@ -665,6 +669,38 @@ modparam("xmlrpc", "url_skip", "^/sip")
665 665
 modparam("xmlrpc", "url_match", "^/RPC2")
666 666
 ...
667 667
 
668
+2.8. event_callback (string)
669
+
670
+   The name of the function in the kemi configuration file (embedded
671
+   scripting language such as Lua, Python, ...) to be executed instead of
672
+   route blocks defined by route parameter for xmlrpc request.
673
+
674
+   This route will be called only for HTTP messages whose method is either
675
+   GET or POST. The message visible inside the route will be a HTTP
676
+   request converted to SIP (the uri will be fixed and a fake via will be
677
+   added).
678
+
679
+   The route should perform additional security checks to ensure the
680
+   client is authorized to execute management/RPC functions and then it
681
+   should call the dispatch_rpc().
682
+
683
+   Example 1.8. Set event_callback parameter
684
+...
685
+modparam("xmlrpc", "event_callback", "ksr_xmlrpc_event")
686
+...
687
+-- event callback function implemented in Lua
688
+function ksr_xmlrpc_event(evname)
689
+        KSR.info("===== xmlrpc triggered event: " .. evname .. "\n");
690
+        local rpc_method = KSR.pv.get("$rm") or ""
691
+        if ((rpc_method == "POST" or rpc_method == "GET")) then
692
+                if (KSR.xmlrpc.dispatch_rpc() < 0) then
693
+                        KSR.err("error while executing xmlrpc event")
694
+                end
695
+        end
696
+        return 1;
697
+end
698
+...
699
+
668 700
 3. Functions
669 701
 
670 702
    3.1. dispatch_rpc()
... ...
@@ -686,7 +722,7 @@ modparam("xmlrpc", "url_match", "^/RPC2")
686 686
    function with matching name. If such a function is found then
687 687
    dispatch_rpc() will pass control to the function to handle the request.
688 688
 
689
-   Example 1.8. dispatch_rpc usage
689
+   Example 1.9. dispatch_rpc usage
690 690
 #...
691 691
 modparam("xmlrpc", "route", "XMLRPC");
692 692
 #...
... ...
@@ -702,7 +738,7 @@ route[XMLRPC]{
702 702
    This function can be called from the config script to directly generate
703 703
    an XML-RPC reply.
704 704
 
705
-   Example 1.9. xmlrpc_reply usage
705
+   Example 1.10. xmlrpc_reply usage
706 706
 #...
707 707
 modparam("xmlrpc", "route", "XMLRPC");
708 708
 #...