...
|
...
|
@@ -86,17 +86,18 @@ Ovidiu Sas
|
86
|
86
|
4.45. cmp_str(str1, str2)
|
87
|
87
|
4.46. cmp_istr(str1, str2)
|
88
|
88
|
4.47. starts_with(str1, str2)
|
89
|
|
- 4.48. set_body_multipart([txt,content_type][,boundary])
|
90
|
|
- 4.49. append_body_part(txt,content_type[,
|
|
89
|
+ 4.48. ends_with(str1, str2)
|
|
90
|
+ 4.49. set_body_multipart([txt,content_type][,boundary])
|
|
91
|
+ 4.50. append_body_part(txt,content_type[,
|
91
|
92
|
content_disposition])
|
92
|
93
|
|
93
|
|
- 4.50. append_body_part_hex(txt,content_type[,
|
|
94
|
+ 4.51. append_body_part_hex(txt,content_type[,
|
94
|
95
|
content_disposition])
|
95
|
96
|
|
96
|
|
- 4.51. get_body_part(content_type, opv)
|
97
|
|
- 4.52. get_body_part_raw(content_type, opv)
|
98
|
|
- 4.53. remove_body_part(content_type)
|
99
|
|
- 4.54. regex_substring(itext, regexp, mindex, mcount, dpv)
|
|
97
|
+ 4.52. get_body_part(content_type, opv)
|
|
98
|
+ 4.53. get_body_part_raw(content_type, opv)
|
|
99
|
+ 4.54. remove_body_part(content_type)
|
|
100
|
+ 4.55. regex_substring(itext, regexp, mindex, mcount, dpv)
|
100
|
101
|
|
101
|
102
|
2. Developer Guide
|
102
|
103
|
|
...
|
...
|
@@ -153,14 +154,15 @@ Ovidiu Sas
|
153
|
154
|
1.45. cmp_str usage
|
154
|
155
|
1.46. cmp_str usage
|
155
|
156
|
1.47. starts_with usage
|
156
|
|
- 1.48. set_body_multipart usage
|
157
|
|
- 1.49. append_body_part usage
|
158
|
|
- 1.50. append_body_part with headers
|
159
|
|
- 1.51. append_body_part_hex usage
|
160
|
|
- 1.52. get_body_part usage
|
161
|
|
- 1.53. get_body_part_raw usage
|
162
|
|
- 1.54. remove_body_part usage
|
163
|
|
- 1.55. _regex_substring usage
|
|
157
|
+ 1.48. ends_with usage
|
|
158
|
+ 1.49. set_body_multipart usage
|
|
159
|
+ 1.50. append_body_part usage
|
|
160
|
+ 1.51. append_body_part with headers
|
|
161
|
+ 1.52. append_body_part_hex usage
|
|
162
|
+ 1.53. get_body_part usage
|
|
163
|
+ 1.54. get_body_part_raw usage
|
|
164
|
+ 1.55. remove_body_part usage
|
|
165
|
+ 1.56. _regex_substring usage
|
164
|
166
|
|
165
|
167
|
Chapter 1. Admin Guide
|
166
|
168
|
|
...
|
...
|
@@ -222,15 +224,16 @@ Chapter 1. Admin Guide
|
222
|
224
|
4.45. cmp_str(str1, str2)
|
223
|
225
|
4.46. cmp_istr(str1, str2)
|
224
|
226
|
4.47. starts_with(str1, str2)
|
225
|
|
- 4.48. set_body_multipart([txt,content_type][,boundary])
|
226
|
|
- 4.49. append_body_part(txt,content_type[, content_disposition])
|
227
|
|
- 4.50. append_body_part_hex(txt,content_type[,
|
|
227
|
+ 4.48. ends_with(str1, str2)
|
|
228
|
+ 4.49. set_body_multipart([txt,content_type][,boundary])
|
|
229
|
+ 4.50. append_body_part(txt,content_type[, content_disposition])
|
|
230
|
+ 4.51. append_body_part_hex(txt,content_type[,
|
228
|
231
|
content_disposition])
|
229
|
232
|
|
230
|
|
- 4.51. get_body_part(content_type, opv)
|
231
|
|
- 4.52. get_body_part_raw(content_type, opv)
|
232
|
|
- 4.53. remove_body_part(content_type)
|
233
|
|
- 4.54. regex_substring(itext, regexp, mindex, mcount, dpv)
|
|
233
|
+ 4.52. get_body_part(content_type, opv)
|
|
234
|
+ 4.53. get_body_part_raw(content_type, opv)
|
|
235
|
+ 4.54. remove_body_part(content_type)
|
|
236
|
+ 4.55. regex_substring(itext, regexp, mindex, mcount, dpv)
|
234
|
237
|
|
235
|
238
|
1. Overview
|
236
|
239
|
|
...
|
...
|
@@ -316,13 +319,14 @@ From: medabeda
|
316
|
319
|
4.45. cmp_str(str1, str2)
|
317
|
320
|
4.46. cmp_istr(str1, str2)
|
318
|
321
|
4.47. starts_with(str1, str2)
|
319
|
|
- 4.48. set_body_multipart([txt,content_type][,boundary])
|
320
|
|
- 4.49. append_body_part(txt,content_type[, content_disposition])
|
321
|
|
- 4.50. append_body_part_hex(txt,content_type[, content_disposition])
|
322
|
|
- 4.51. get_body_part(content_type, opv)
|
323
|
|
- 4.52. get_body_part_raw(content_type, opv)
|
324
|
|
- 4.53. remove_body_part(content_type)
|
325
|
|
- 4.54. regex_substring(itext, regexp, mindex, mcount, dpv)
|
|
322
|
+ 4.48. ends_with(str1, str2)
|
|
323
|
+ 4.49. set_body_multipart([txt,content_type][,boundary])
|
|
324
|
+ 4.50. append_body_part(txt,content_type[, content_disposition])
|
|
325
|
+ 4.51. append_body_part_hex(txt,content_type[, content_disposition])
|
|
326
|
+ 4.52. get_body_part(content_type, opv)
|
|
327
|
+ 4.53. get_body_part_raw(content_type, opv)
|
|
328
|
+ 4.54. remove_body_part(content_type)
|
|
329
|
+ 4.55. regex_substring(itext, regexp, mindex, mcount, dpv)
|
326
|
330
|
|
327
|
331
|
4.1. search(re)
|
328
|
332
|
|
...
|
...
|
@@ -1221,7 +1225,23 @@ if (starts_with("$rU", "+358"))
|
1221
|
1225
|
}
|
1222
|
1226
|
...
|
1223
|
1227
|
|
1224
|
|
-4.48. set_body_multipart([txt,content_type][,boundary])
|
|
1228
|
+4.48. ends_with(str1, str2)
|
|
1229
|
+
|
|
1230
|
+ The function returns true if the first string ends with the second
|
|
1231
|
+ string. The parameters can contain variables.
|
|
1232
|
+
|
|
1233
|
+ This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE,
|
|
1234
|
+ FAILURE_ROUTE and BRANCH_ROUTE.
|
|
1235
|
+
|
|
1236
|
+ Example 1.48. ends_with usage
|
|
1237
|
+...
|
|
1238
|
+if (ends_with("$rU", "8800"))
|
|
1239
|
+{
|
|
1240
|
+ # do interesting stuff here
|
|
1241
|
+}
|
|
1242
|
+...
|
|
1243
|
+
|
|
1244
|
+4.49. set_body_multipart([txt,content_type][,boundary])
|
1225
|
1245
|
|
1226
|
1246
|
Set multipart body to a SIP message. If called with no parameters, will
|
1227
|
1247
|
convert present body to multipart.
|
...
|
...
|
@@ -1242,7 +1262,7 @@ if (starts_with("$rU", "+358"))
|
1242
|
1262
|
Note: it may be required that msg_apply_changes() from textopsx module
|
1243
|
1263
|
has to be executed if there are other operations over the new body.
|
1244
|
1264
|
|
1245
|
|
- Example 1.48. set_body_multipart usage
|
|
1265
|
+ Example 1.49. set_body_multipart usage
|
1246
|
1266
|
...
|
1247
|
1267
|
set_body_multipart("test", "text/plain", "delimiter");
|
1248
|
1268
|
msg_apply_changes();
|
...
|
...
|
@@ -1265,7 +1285,7 @@ text
|
1265
|
1285
|
--delimiter
|
1266
|
1286
|
...
|
1267
|
1287
|
|
1268
|
|
-4.49. append_body_part(txt,content_type[, content_disposition])
|
|
1288
|
+4.50. append_body_part(txt,content_type[, content_disposition])
|
1269
|
1289
|
|
1270
|
1290
|
Append a part on multipart body SIP message. Will use
|
1271
|
1291
|
"unique-boundary-1" as boundary.
|
...
|
...
|
@@ -1286,7 +1306,7 @@ text
|
1286
|
1306
|
Note: it may be required that msg_apply_changes() from textopsx module
|
1287
|
1307
|
has to be executed if there are other operations over the new body.
|
1288
|
1308
|
|
1289
|
|
- Example 1.49. append_body_part usage
|
|
1309
|
+ Example 1.50. append_body_part usage
|
1290
|
1310
|
...
|
1291
|
1311
|
$var(b) = "7e Od 04 55 75 69 20 4d 61 6b 65 43 61 6c 6c";
|
1292
|
1312
|
append_body_part("$var(b)", "application/vnd.cirpack.isdn-ext", "signal;handling
|
...
|
...
|
@@ -1309,7 +1329,7 @@ Content-Disposition: signal;handling=required
|
1309
|
1329
|
appended after the value of the content-type parameter, separated by
|
1310
|
1330
|
`\r\n` (at the very end do not add the '\r\n').
|
1311
|
1331
|
|
1312
|
|
- Example 1.50. append_body_part with headers
|
|
1332
|
+ Example 1.51. append_body_part with headers
|
1313
|
1333
|
...
|
1314
|
1334
|
$var(b) = "7e Od 04 55 75 69 20 4d 61 6b 65 43 61 6c 6c";
|
1315
|
1335
|
append_body_part("$var(b)", "application/vnd.cirpack.isdn-ext\r\nX-Header: xyz",
|
...
|
...
|
@@ -1329,7 +1349,7 @@ Content-Disposition: signal;handling=required
|
1329
|
1349
|
--unique-boundary-1
|
1330
|
1350
|
...
|
1331
|
1351
|
|
1332
|
|
-4.50. append_body_part_hex(txt,content_type[, content_disposition])
|
|
1352
|
+4.51. append_body_part_hex(txt,content_type[, content_disposition])
|
1333
|
1353
|
|
1334
|
1354
|
Append a part on multipart body SIP message, with the content provided
|
1335
|
1355
|
in hexa format. Will use "unique-boundary-1" as boundary.
|
...
|
...
|
@@ -1353,7 +1373,7 @@ Content-Disposition: signal;handling=required
|
1353
|
1373
|
Note: it may be required that msg_apply_changes() from textopsx module
|
1354
|
1374
|
has to be executed if there are other operations over the new body.
|
1355
|
1375
|
|
1356
|
|
- Example 1.51. append_body_part_hex usage
|
|
1376
|
+ Example 1.52. append_body_part_hex usage
|
1357
|
1377
|
...
|
1358
|
1378
|
$var(b) = "6b 61 6d 61 69 6c 69 6f";
|
1359
|
1379
|
append_body_part_hex("$var(b)", "application/my-custom-ext");
|
...
|
...
|
@@ -1373,7 +1393,7 @@ kamailio
|
1373
|
1393
|
If other headers are wanted to be added for a body part, see the docs
|
1374
|
1394
|
for append_body_part(...) function.
|
1375
|
1395
|
|
1376
|
|
-4.51. get_body_part(content_type, opv)
|
|
1396
|
+4.52. get_body_part(content_type, opv)
|
1377
|
1397
|
|
1378
|
1398
|
Return the content of a multipart body SIP message, storing it in opv.
|
1379
|
1399
|
|
...
|
...
|
@@ -1386,12 +1406,12 @@ kamailio
|
1386
|
1406
|
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE,
|
1387
|
1407
|
BRANCH_ROUTE, ONREPLY_ROUTE.
|
1388
|
1408
|
|
1389
|
|
- Example 1.52. get_body_part usage
|
|
1409
|
+ Example 1.53. get_body_part usage
|
1390
|
1410
|
...
|
1391
|
1411
|
get_body_part("application/vnd.cirpack.isdn-ext", "$var(pbody)");
|
1392
|
1412
|
...
|
1393
|
1413
|
|
1394
|
|
-4.52. get_body_part_raw(content_type, opv)
|
|
1414
|
+4.53. get_body_part_raw(content_type, opv)
|
1395
|
1415
|
|
1396
|
1416
|
Return the content of a multipart body SIP message, including headers
|
1397
|
1417
|
and boundary string, storing it in opv.
|
...
|
...
|
@@ -1405,12 +1425,12 @@ get_body_part("application/vnd.cirpack.isdn-ext", "$var(pbody)");
|
1405
|
1425
|
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE,
|
1406
|
1426
|
BRANCH_ROUTE, ONREPLY_ROUTE.
|
1407
|
1427
|
|
1408
|
|
- Example 1.53. get_body_part_raw usage
|
|
1428
|
+ Example 1.54. get_body_part_raw usage
|
1409
|
1429
|
...
|
1410
|
1430
|
get_body_part("application/vnd.cirpack.isdn-ext", "$var(hbody)");
|
1411
|
1431
|
...
|
1412
|
1432
|
|
1413
|
|
-4.53. remove_body_part(content_type)
|
|
1433
|
+4.54. remove_body_part(content_type)
|
1414
|
1434
|
|
1415
|
1435
|
Remove a part on a multipart body SIP message.
|
1416
|
1436
|
|
...
|
...
|
@@ -1428,13 +1448,13 @@ get_body_part("application/vnd.cirpack.isdn-ext", "$var(hbody)");
|
1428
|
1448
|
Note: it may be required that msg_apply_changes() from textopsx module
|
1429
|
1449
|
has to be executed if there are other operations over the new body.
|
1430
|
1450
|
|
1431
|
|
- Example 1.54. remove_body_part usage
|
|
1451
|
+ Example 1.55. remove_body_part usage
|
1432
|
1452
|
...
|
1433
|
1453
|
remove_body_part("application/vnd.cirpack.isdn-ext");
|
1434
|
1454
|
msg_apply_changes();
|
1435
|
1455
|
...
|
1436
|
1456
|
|
1437
|
|
-4.54. regex_substring(itext, regexp, mindex, mcount, dpv)
|
|
1457
|
+4.55. regex_substring(itext, regexp, mindex, mcount, dpv)
|
1438
|
1458
|
|
1439
|
1459
|
Search in text with given regular expression then sets dpv
|
1440
|
1460
|
pseudo-variable with the matched token at provided index.
|
...
|
...
|
@@ -1454,7 +1474,7 @@ msg_apply_changes();
|
1454
|
1474
|
Note that the regular expression extended is used. More info at:
|
1455
|
1475
|
https://www.regular-expressions.info/posix.html.
|
1456
|
1476
|
|
1457
|
|
- Example 1.55. _regex_substring usage
|
|
1477
|
+ Example 1.56. _regex_substring usage
|
1458
|
1478
|
...
|
1459
|
1479
|
regex_substring("___ abc123def ___ ghi456 ___", "([a-z]*)([0-9]+)([a-z]*
|
1460
|
1480
|
)",
|