|
@@ -86,17 +86,18 @@ Ovidiu Sas
|
|
|
4.45. cmp_str(str1, str2)
|
|
|
4.46. cmp_istr(str1, str2)
|
|
|
4.47. starts_with(str1, str2)
|
|
|
- 4.48. set_body_multipart([txt,content_type][,boundary])
|
|
|
- 4.49. append_body_part(txt,content_type[,
|
|
|
+ 4.48. ends_with(str1, str2)
|
|
|
+ 4.49. set_body_multipart([txt,content_type][,boundary])
|
|
|
+ 4.50. append_body_part(txt,content_type[,
|
|
|
content_disposition])
|
|
|
|
|
|
- 4.50. append_body_part_hex(txt,content_type[,
|
|
|
+ 4.51. append_body_part_hex(txt,content_type[,
|
|
|
content_disposition])
|
|
|
|
|
|
- 4.51. get_body_part(content_type, opv)
|
|
|
- 4.52. get_body_part_raw(content_type, opv)
|
|
|
- 4.53. remove_body_part(content_type)
|
|
|
- 4.54. regex_substring(itext, regexp, mindex, mcount, dpv)
|
|
|
+ 4.52. get_body_part(content_type, opv)
|
|
|
+ 4.53. get_body_part_raw(content_type, opv)
|
|
|
+ 4.54. remove_body_part(content_type)
|
|
|
+ 4.55. regex_substring(itext, regexp, mindex, mcount, dpv)
|
|
|
|
|
|
2. Developer Guide
|
|
|
|
|
@@ -153,14 +154,15 @@ Ovidiu Sas
|
|
|
1.45. cmp_str usage
|
|
|
1.46. cmp_str usage
|
|
|
1.47. starts_with usage
|
|
|
- 1.48. set_body_multipart usage
|
|
|
- 1.49. append_body_part usage
|
|
|
- 1.50. append_body_part with headers
|
|
|
- 1.51. append_body_part_hex usage
|
|
|
- 1.52. get_body_part usage
|
|
|
- 1.53. get_body_part_raw usage
|
|
|
- 1.54. remove_body_part usage
|
|
|
- 1.55. _regex_substring usage
|
|
|
+ 1.48. ends_with usage
|
|
|
+ 1.49. set_body_multipart usage
|
|
|
+ 1.50. append_body_part usage
|
|
|
+ 1.51. append_body_part with headers
|
|
|
+ 1.52. append_body_part_hex usage
|
|
|
+ 1.53. get_body_part usage
|
|
|
+ 1.54. get_body_part_raw usage
|
|
|
+ 1.55. remove_body_part usage
|
|
|
+ 1.56. _regex_substring usage
|
|
|
|
|
|
Chapter 1. Admin Guide
|
|
|
|
|
@@ -222,15 +224,16 @@ Chapter 1. Admin Guide
|
|
|
4.45. cmp_str(str1, str2)
|
|
|
4.46. cmp_istr(str1, str2)
|
|
|
4.47. starts_with(str1, str2)
|
|
|
- 4.48. set_body_multipart([txt,content_type][,boundary])
|
|
|
- 4.49. append_body_part(txt,content_type[, content_disposition])
|
|
|
- 4.50. append_body_part_hex(txt,content_type[,
|
|
|
+ 4.48. ends_with(str1, str2)
|
|
|
+ 4.49. set_body_multipart([txt,content_type][,boundary])
|
|
|
+ 4.50. append_body_part(txt,content_type[, content_disposition])
|
|
|
+ 4.51. append_body_part_hex(txt,content_type[,
|
|
|
content_disposition])
|
|
|
|
|
|
- 4.51. get_body_part(content_type, opv)
|
|
|
- 4.52. get_body_part_raw(content_type, opv)
|
|
|
- 4.53. remove_body_part(content_type)
|
|
|
- 4.54. regex_substring(itext, regexp, mindex, mcount, dpv)
|
|
|
+ 4.52. get_body_part(content_type, opv)
|
|
|
+ 4.53. get_body_part_raw(content_type, opv)
|
|
|
+ 4.54. remove_body_part(content_type)
|
|
|
+ 4.55. regex_substring(itext, regexp, mindex, mcount, dpv)
|
|
|
|
|
|
1. Overview
|
|
|
|
|
@@ -316,13 +319,14 @@ From: medabeda
|
|
|
4.45. cmp_str(str1, str2)
|
|
|
4.46. cmp_istr(str1, str2)
|
|
|
4.47. starts_with(str1, str2)
|
|
|
- 4.48. set_body_multipart([txt,content_type][,boundary])
|
|
|
- 4.49. append_body_part(txt,content_type[, content_disposition])
|
|
|
- 4.50. append_body_part_hex(txt,content_type[, content_disposition])
|
|
|
- 4.51. get_body_part(content_type, opv)
|
|
|
- 4.52. get_body_part_raw(content_type, opv)
|
|
|
- 4.53. remove_body_part(content_type)
|
|
|
- 4.54. regex_substring(itext, regexp, mindex, mcount, dpv)
|
|
|
+ 4.48. ends_with(str1, str2)
|
|
|
+ 4.49. set_body_multipart([txt,content_type][,boundary])
|
|
|
+ 4.50. append_body_part(txt,content_type[, content_disposition])
|
|
|
+ 4.51. append_body_part_hex(txt,content_type[, content_disposition])
|
|
|
+ 4.52. get_body_part(content_type, opv)
|
|
|
+ 4.53. get_body_part_raw(content_type, opv)
|
|
|
+ 4.54. remove_body_part(content_type)
|
|
|
+ 4.55. regex_substring(itext, regexp, mindex, mcount, dpv)
|
|
|
|
|
|
4.1. search(re)
|
|
|
|
|
@@ -1221,7 +1225,23 @@ if (starts_with("$rU", "+358"))
|
|
|
}
|
|
|
...
|
|
|
|
|
|
-4.48. set_body_multipart([txt,content_type][,boundary])
|
|
|
+4.48. ends_with(str1, str2)
|
|
|
+
|
|
|
+ The function returns true if the first string ends with the second
|
|
|
+ string. The parameters can contain variables.
|
|
|
+
|
|
|
+ This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE,
|
|
|
+ FAILURE_ROUTE and BRANCH_ROUTE.
|
|
|
+
|
|
|
+ Example 1.48. ends_with usage
|
|
|
+...
|
|
|
+if (ends_with("$rU", "8800"))
|
|
|
+{
|
|
|
+ # do interesting stuff here
|
|
|
+}
|
|
|
+...
|
|
|
+
|
|
|
+4.49. set_body_multipart([txt,content_type][,boundary])
|
|
|
|
|
|
Set multipart body to a SIP message. If called with no parameters, will
|
|
|
convert present body to multipart.
|
|
@@ -1242,7 +1262,7 @@ if (starts_with("$rU", "+358"))
|
|
|
Note: it may be required that msg_apply_changes() from textopsx module
|
|
|
has to be executed if there are other operations over the new body.
|
|
|
|
|
|
- Example 1.48. set_body_multipart usage
|
|
|
+ Example 1.49. set_body_multipart usage
|
|
|
...
|
|
|
set_body_multipart("test", "text/plain", "delimiter");
|
|
|
msg_apply_changes();
|
|
@@ -1265,7 +1285,7 @@ text
|
|
|
--delimiter
|
|
|
...
|
|
|
|
|
|
-4.49. append_body_part(txt,content_type[, content_disposition])
|
|
|
+4.50. append_body_part(txt,content_type[, content_disposition])
|
|
|
|
|
|
Append a part on multipart body SIP message. Will use
|
|
|
"unique-boundary-1" as boundary.
|
|
@@ -1286,7 +1306,7 @@ text
|
|
|
Note: it may be required that msg_apply_changes() from textopsx module
|
|
|
has to be executed if there are other operations over the new body.
|
|
|
|
|
|
- Example 1.49. append_body_part usage
|
|
|
+ Example 1.50. append_body_part usage
|
|
|
...
|
|
|
$var(b) = "7e Od 04 55 75 69 20 4d 61 6b 65 43 61 6c 6c";
|
|
|
append_body_part("$var(b)", "application/vnd.cirpack.isdn-ext", "signal;handling
|
|
@@ -1309,7 +1329,7 @@ Content-Disposition: signal;handling=required
|
|
|
appended after the value of the content-type parameter, separated by
|
|
|
`\r\n` (at the very end do not add the '\r\n').
|
|
|
|
|
|
- Example 1.50. append_body_part with headers
|
|
|
+ Example 1.51. append_body_part with headers
|
|
|
...
|
|
|
$var(b) = "7e Od 04 55 75 69 20 4d 61 6b 65 43 61 6c 6c";
|
|
|
append_body_part("$var(b)", "application/vnd.cirpack.isdn-ext\r\nX-Header: xyz",
|
|
@@ -1329,7 +1349,7 @@ Content-Disposition: signal;handling=required
|
|
|
--unique-boundary-1
|
|
|
...
|
|
|
|
|
|
-4.50. append_body_part_hex(txt,content_type[, content_disposition])
|
|
|
+4.51. append_body_part_hex(txt,content_type[, content_disposition])
|
|
|
|
|
|
Append a part on multipart body SIP message, with the content provided
|
|
|
in hexa format. Will use "unique-boundary-1" as boundary.
|
|
@@ -1353,7 +1373,7 @@ Content-Disposition: signal;handling=required
|
|
|
Note: it may be required that msg_apply_changes() from textopsx module
|
|
|
has to be executed if there are other operations over the new body.
|
|
|
|
|
|
- Example 1.51. append_body_part_hex usage
|
|
|
+ Example 1.52. append_body_part_hex usage
|
|
|
...
|
|
|
$var(b) = "6b 61 6d 61 69 6c 69 6f";
|
|
|
append_body_part_hex("$var(b)", "application/my-custom-ext");
|
|
@@ -1373,7 +1393,7 @@ kamailio
|
|
|
If other headers are wanted to be added for a body part, see the docs
|
|
|
for append_body_part(...) function.
|
|
|
|
|
|
-4.51. get_body_part(content_type, opv)
|
|
|
+4.52. get_body_part(content_type, opv)
|
|
|
|
|
|
Return the content of a multipart body SIP message, storing it in opv.
|
|
|
|
|
@@ -1386,12 +1406,12 @@ kamailio
|
|
|
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE,
|
|
|
BRANCH_ROUTE, ONREPLY_ROUTE.
|
|
|
|
|
|
- Example 1.52. get_body_part usage
|
|
|
+ Example 1.53. get_body_part usage
|
|
|
...
|
|
|
get_body_part("application/vnd.cirpack.isdn-ext", "$var(pbody)");
|
|
|
...
|
|
|
|
|
|
-4.52. get_body_part_raw(content_type, opv)
|
|
|
+4.53. get_body_part_raw(content_type, opv)
|
|
|
|
|
|
Return the content of a multipart body SIP message, including headers
|
|
|
and boundary string, storing it in opv.
|
|
@@ -1405,12 +1425,12 @@ get_body_part("application/vnd.cirpack.isdn-ext", "$var(pbody)");
|
|
|
This function can be used from REQUEST_ROUTE, FAILURE_ROUTE,
|
|
|
BRANCH_ROUTE, ONREPLY_ROUTE.
|
|
|
|
|
|
- Example 1.53. get_body_part_raw usage
|
|
|
+ Example 1.54. get_body_part_raw usage
|
|
|
...
|
|
|
get_body_part("application/vnd.cirpack.isdn-ext", "$var(hbody)");
|
|
|
...
|
|
|
|
|
|
-4.53. remove_body_part(content_type)
|
|
|
+4.54. remove_body_part(content_type)
|
|
|
|
|
|
Remove a part on a multipart body SIP message.
|
|
|
|
|
@@ -1428,13 +1448,13 @@ get_body_part("application/vnd.cirpack.isdn-ext", "$var(hbody)");
|
|
|
Note: it may be required that msg_apply_changes() from textopsx module
|
|
|
has to be executed if there are other operations over the new body.
|
|
|
|
|
|
- Example 1.54. remove_body_part usage
|
|
|
+ Example 1.55. remove_body_part usage
|
|
|
...
|
|
|
remove_body_part("application/vnd.cirpack.isdn-ext");
|
|
|
msg_apply_changes();
|
|
|
...
|
|
|
|
|
|
-4.54. regex_substring(itext, regexp, mindex, mcount, dpv)
|
|
|
+4.55. regex_substring(itext, regexp, mindex, mcount, dpv)
|
|
|
|
|
|
Search in text with given regular expression then sets dpv
|
|
|
pseudo-variable with the matched token at provided index.
|
|
@@ -1454,7 +1474,7 @@ msg_apply_changes();
|
|
|
Note that the regular expression extended is used. More info at:
|
|
|
https://www.regular-expressions.info/posix.html.
|
|
|
|
|
|
- Example 1.55. _regex_substring usage
|
|
|
+ Example 1.56. _regex_substring usage
|
|
|
...
|
|
|
regex_substring("___ abc123def ___ ghi456 ___", "([a-z]*)([0-9]+)([a-z]*
|
|
|
)",
|