|
@@ -11,19 +11,15 @@ Andrei Pelinescu-Onciul
|
|
|
|
|
|
<[email protected]>
|
|
|
|
|
|
-Edited by
|
|
|
-
|
|
|
Daniel-Constantin Mierla
|
|
|
|
|
|
<[email protected]>
|
|
|
|
|
|
-Edited by
|
|
|
-
|
|
|
Juha Heinanen
|
|
|
|
|
|
<[email protected]>
|
|
|
|
|
|
- Copyright © 2003 FhG FOKUS
|
|
|
+ Copyright © 2003 FhG FOKUS
|
|
|
__________________________________________________________________
|
|
|
|
|
|
Table of Contents
|
|
@@ -31,61 +27,57 @@ Juha Heinanen
|
|
|
1. Admin Guide
|
|
|
|
|
|
1. Overview
|
|
|
-
|
|
|
- 1.1. Known Limitations
|
|
|
-
|
|
|
- 2. Dependencies
|
|
|
-
|
|
|
- 2.1. Kamailio Modules
|
|
|
- 2.2. External Libraries or Applications
|
|
|
-
|
|
|
- 3. Functions
|
|
|
-
|
|
|
- 3.1. search(re)
|
|
|
- 3.2. search_body(re)
|
|
|
- 3.3. search_hf(hf, re, flags)
|
|
|
- 3.4. search_append(re, txt)
|
|
|
- 3.5. search_append_body(re, txt)
|
|
|
- 3.6. replace(re, txt)
|
|
|
- 3.7. replace_body(re, txt)
|
|
|
- 3.8. replace_all(re, txt)
|
|
|
- 3.9. replace_body_all(re, txt)
|
|
|
- 3.10. replace_body_atonce(re, txt)
|
|
|
- 3.11. subst('/re/repl/flags')
|
|
|
- 3.12. subst_uri('/re/repl/flags')
|
|
|
- 3.13. subst_user('/re/repl/flags')
|
|
|
- 3.14. subst_body('/re/repl/flags')
|
|
|
- 3.15. subst_hf(hf, subexp, flags)
|
|
|
- 3.16. set_body(txt,content_type)
|
|
|
- 3.17. set_reply_body(txt,content_type)
|
|
|
- 3.18. filter_body(content_type)
|
|
|
- 3.19. append_to_reply(txt)
|
|
|
- 3.20. append_hf(txt[, hdr])
|
|
|
- 3.21. insert_hf(txt[, hdr])
|
|
|
- 3.22. append_urihf(prefix, suffix)
|
|
|
- 3.23. is_present_hf(hf_name)
|
|
|
- 3.24. is_present_hf_re(hf_name_re)
|
|
|
- 3.25. append_time()
|
|
|
- 3.26. append_time_to_request()
|
|
|
- 3.27. is_method(name)
|
|
|
- 3.28. remove_hf(hname)
|
|
|
- 3.29. remove_hf_re(re)
|
|
|
- 3.30. has_body(), has_body(mime)
|
|
|
- 3.31. is_audio_on_hold()
|
|
|
- 3.32. is_privacy(privacy_type)
|
|
|
- 3.33. in_list(subject, list, separator)
|
|
|
- 3.34. cmp_str(str1, str2)
|
|
|
- 3.35. cmp_istr(str1, str2)
|
|
|
- 3.36. starts_with(str1, str2)
|
|
|
- 3.37. set_body_multipart([txt,content_type][,boundary])
|
|
|
- 3.38. append_body_part(txt,content_type[,
|
|
|
+ 2. Known Limitations
|
|
|
+ 3. Dependencies
|
|
|
+
|
|
|
+ 3.1. Kamailio Modules
|
|
|
+ 3.2. External Libraries or Applications
|
|
|
+
|
|
|
+ 4. Functions
|
|
|
+
|
|
|
+ 4.1. search(re)
|
|
|
+ 4.2. search_body(re)
|
|
|
+ 4.3. search_hf(hf, re, flags)
|
|
|
+ 4.4. search_append(re, txt)
|
|
|
+ 4.5. search_append_body(re, txt)
|
|
|
+ 4.6. replace(re, txt)
|
|
|
+ 4.7. replace_body(re, txt)
|
|
|
+ 4.8. replace_all(re, txt)
|
|
|
+ 4.9. replace_body_all(re, txt)
|
|
|
+ 4.10. replace_body_atonce(re, txt)
|
|
|
+ 4.11. subst('/re/repl/flags')
|
|
|
+ 4.12. subst_uri('/re/repl/flags')
|
|
|
+ 4.13. subst_user('/re/repl/flags')
|
|
|
+ 4.14. subst_body('/re/repl/flags')
|
|
|
+ 4.15. subst_hf(hf, subexp, flags)
|
|
|
+ 4.16. set_body(txt,content_type)
|
|
|
+ 4.17. set_reply_body(txt,content_type)
|
|
|
+ 4.18. filter_body(content_type)
|
|
|
+ 4.19. append_to_reply(txt)
|
|
|
+ 4.20. append_hf(txt[, hdr])
|
|
|
+ 4.21. insert_hf(txt[, hdr])
|
|
|
+ 4.22. append_urihf(prefix, suffix)
|
|
|
+ 4.23. is_present_hf(hf_name)
|
|
|
+ 4.24. is_present_hf_re(hf_name_re)
|
|
|
+ 4.25. append_time()
|
|
|
+ 4.26. append_time_to_request()
|
|
|
+ 4.27. is_method(name)
|
|
|
+ 4.28. remove_hf(hname)
|
|
|
+ 4.29. remove_hf_re(re)
|
|
|
+ 4.30. has_body(), has_body(mime)
|
|
|
+ 4.31. is_audio_on_hold()
|
|
|
+ 4.32. is_privacy(privacy_type)
|
|
|
+ 4.33. in_list(subject, list, separator)
|
|
|
+ 4.34. cmp_str(str1, str2)
|
|
|
+ 4.35. cmp_istr(str1, str2)
|
|
|
+ 4.36. starts_with(str1, str2)
|
|
|
+ 4.37. set_body_multipart([txt,content_type][,boundary])
|
|
|
+ 4.38. append_body_part(txt,content_type[,
|
|
|
content_disposition])
|
|
|
|
|
|
- 3.39. get_body_part(content_type, opv)
|
|
|
- 3.40. get_body_part_raw(content_type, opv)
|
|
|
- 3.41. remove_body_part(content_type)
|
|
|
-
|
|
|
- 4. Known Limitations
|
|
|
+ 4.39. get_body_part(content_type, opv)
|
|
|
+ 4.40. get_body_part_raw(content_type, opv)
|
|
|
+ 4.41. remove_body_part(content_type)
|
|
|
|
|
|
2. Developer Guide
|
|
|
|
|
@@ -142,64 +134,58 @@ Chapter 1. Admin Guide
|
|
|
Table of Contents
|
|
|
|
|
|
1. Overview
|
|
|
-
|
|
|
- 1.1. Known Limitations
|
|
|
-
|
|
|
- 2. Dependencies
|
|
|
-
|
|
|
- 2.1. Kamailio Modules
|
|
|
- 2.2. External Libraries or Applications
|
|
|
-
|
|
|
- 3. Functions
|
|
|
-
|
|
|
- 3.1. search(re)
|
|
|
- 3.2. search_body(re)
|
|
|
- 3.3. search_hf(hf, re, flags)
|
|
|
- 3.4. search_append(re, txt)
|
|
|
- 3.5. search_append_body(re, txt)
|
|
|
- 3.6. replace(re, txt)
|
|
|
- 3.7. replace_body(re, txt)
|
|
|
- 3.8. replace_all(re, txt)
|
|
|
- 3.9. replace_body_all(re, txt)
|
|
|
- 3.10. replace_body_atonce(re, txt)
|
|
|
- 3.11. subst('/re/repl/flags')
|
|
|
- 3.12. subst_uri('/re/repl/flags')
|
|
|
- 3.13. subst_user('/re/repl/flags')
|
|
|
- 3.14. subst_body('/re/repl/flags')
|
|
|
- 3.15. subst_hf(hf, subexp, flags)
|
|
|
- 3.16. set_body(txt,content_type)
|
|
|
- 3.17. set_reply_body(txt,content_type)
|
|
|
- 3.18. filter_body(content_type)
|
|
|
- 3.19. append_to_reply(txt)
|
|
|
- 3.20. append_hf(txt[, hdr])
|
|
|
- 3.21. insert_hf(txt[, hdr])
|
|
|
- 3.22. append_urihf(prefix, suffix)
|
|
|
- 3.23. is_present_hf(hf_name)
|
|
|
- 3.24. is_present_hf_re(hf_name_re)
|
|
|
- 3.25. append_time()
|
|
|
- 3.26. append_time_to_request()
|
|
|
- 3.27. is_method(name)
|
|
|
- 3.28. remove_hf(hname)
|
|
|
- 3.29. remove_hf_re(re)
|
|
|
- 3.30. has_body(), has_body(mime)
|
|
|
- 3.31. is_audio_on_hold()
|
|
|
- 3.32. is_privacy(privacy_type)
|
|
|
- 3.33. in_list(subject, list, separator)
|
|
|
- 3.34. cmp_str(str1, str2)
|
|
|
- 3.35. cmp_istr(str1, str2)
|
|
|
- 3.36. starts_with(str1, str2)
|
|
|
- 3.37. set_body_multipart([txt,content_type][,boundary])
|
|
|
- 3.38. append_body_part(txt,content_type[, content_disposition])
|
|
|
- 3.39. get_body_part(content_type, opv)
|
|
|
- 3.40. get_body_part_raw(content_type, opv)
|
|
|
- 3.41. remove_body_part(content_type)
|
|
|
-
|
|
|
- 4. Known Limitations
|
|
|
+ 2. Known Limitations
|
|
|
+ 3. Dependencies
|
|
|
+
|
|
|
+ 3.1. Kamailio Modules
|
|
|
+ 3.2. External Libraries or Applications
|
|
|
+
|
|
|
+ 4. Functions
|
|
|
+
|
|
|
+ 4.1. search(re)
|
|
|
+ 4.2. search_body(re)
|
|
|
+ 4.3. search_hf(hf, re, flags)
|
|
|
+ 4.4. search_append(re, txt)
|
|
|
+ 4.5. search_append_body(re, txt)
|
|
|
+ 4.6. replace(re, txt)
|
|
|
+ 4.7. replace_body(re, txt)
|
|
|
+ 4.8. replace_all(re, txt)
|
|
|
+ 4.9. replace_body_all(re, txt)
|
|
|
+ 4.10. replace_body_atonce(re, txt)
|
|
|
+ 4.11. subst('/re/repl/flags')
|
|
|
+ 4.12. subst_uri('/re/repl/flags')
|
|
|
+ 4.13. subst_user('/re/repl/flags')
|
|
|
+ 4.14. subst_body('/re/repl/flags')
|
|
|
+ 4.15. subst_hf(hf, subexp, flags)
|
|
|
+ 4.16. set_body(txt,content_type)
|
|
|
+ 4.17. set_reply_body(txt,content_type)
|
|
|
+ 4.18. filter_body(content_type)
|
|
|
+ 4.19. append_to_reply(txt)
|
|
|
+ 4.20. append_hf(txt[, hdr])
|
|
|
+ 4.21. insert_hf(txt[, hdr])
|
|
|
+ 4.22. append_urihf(prefix, suffix)
|
|
|
+ 4.23. is_present_hf(hf_name)
|
|
|
+ 4.24. is_present_hf_re(hf_name_re)
|
|
|
+ 4.25. append_time()
|
|
|
+ 4.26. append_time_to_request()
|
|
|
+ 4.27. is_method(name)
|
|
|
+ 4.28. remove_hf(hname)
|
|
|
+ 4.29. remove_hf_re(re)
|
|
|
+ 4.30. has_body(), has_body(mime)
|
|
|
+ 4.31. is_audio_on_hold()
|
|
|
+ 4.32. is_privacy(privacy_type)
|
|
|
+ 4.33. in_list(subject, list, separator)
|
|
|
+ 4.34. cmp_str(str1, str2)
|
|
|
+ 4.35. cmp_istr(str1, str2)
|
|
|
+ 4.36. starts_with(str1, str2)
|
|
|
+ 4.37. set_body_multipart([txt,content_type][,boundary])
|
|
|
+ 4.38. append_body_part(txt,content_type[, content_disposition])
|
|
|
+ 4.39. get_body_part(content_type, opv)
|
|
|
+ 4.40. get_body_part_raw(content_type, opv)
|
|
|
+ 4.41. remove_body_part(content_type)
|
|
|
|
|
|
1. Overview
|
|
|
|
|
|
- 1.1. Known Limitations
|
|
|
-
|
|
|
The module implements text based operations over the SIP message
|
|
|
processed by Kamailio. SIP is a text based protocol and the module
|
|
|
provides a large set of very useful functions to manipulate the message
|
|
@@ -207,74 +193,77 @@ Chapter 1. Admin Guide
|
|
|
substitutions, checks for method type, header presence, insert of new
|
|
|
header and date, etc.
|
|
|
|
|
|
-1.1. Known Limitations
|
|
|
+2. Known Limitations
|
|
|
|
|
|
- search ignores folded lines. For example, search("(From|f):.*@foo.bar")
|
|
|
+ Search functions are applied to the original request, i.e., they ignore
|
|
|
+ all changes resulting from message processing in Kamailio script.
|
|
|
+
|
|
|
+ Search ignores folded lines. For example, search(“(From|f):.*@foo.bar�)
|
|
|
doesn't match the following From header field:
|
|
|
From: medabeda
|
|
|
<sip:[email protected]>;tag=1234
|
|
|
|
|
|
-2. Dependencies
|
|
|
+3. Dependencies
|
|
|
|
|
|
- 2.1. Kamailio Modules
|
|
|
- 2.2. External Libraries or Applications
|
|
|
+ 3.1. Kamailio Modules
|
|
|
+ 3.2. External Libraries or Applications
|
|
|
|
|
|
-2.1. Kamailio Modules
|
|
|
+3.1. Kamailio Modules
|
|
|
|
|
|
The following modules must be loaded before this module:
|
|
|
* No dependencies on other Kamailio modules.
|
|
|
|
|
|
-2.2. External Libraries or Applications
|
|
|
+3.2. External Libraries or Applications
|
|
|
|
|
|
The following libraries or applications must be installed before
|
|
|
running Kamailio with this module loaded:
|
|
|
* None.
|
|
|
|
|
|
-3. Functions
|
|
|
-
|
|
|
- 3.1. search(re)
|
|
|
- 3.2. search_body(re)
|
|
|
- 3.3. search_hf(hf, re, flags)
|
|
|
- 3.4. search_append(re, txt)
|
|
|
- 3.5. search_append_body(re, txt)
|
|
|
- 3.6. replace(re, txt)
|
|
|
- 3.7. replace_body(re, txt)
|
|
|
- 3.8. replace_all(re, txt)
|
|
|
- 3.9. replace_body_all(re, txt)
|
|
|
- 3.10. replace_body_atonce(re, txt)
|
|
|
- 3.11. subst('/re/repl/flags')
|
|
|
- 3.12. subst_uri('/re/repl/flags')
|
|
|
- 3.13. subst_user('/re/repl/flags')
|
|
|
- 3.14. subst_body('/re/repl/flags')
|
|
|
- 3.15. subst_hf(hf, subexp, flags)
|
|
|
- 3.16. set_body(txt,content_type)
|
|
|
- 3.17. set_reply_body(txt,content_type)
|
|
|
- 3.18. filter_body(content_type)
|
|
|
- 3.19. append_to_reply(txt)
|
|
|
- 3.20. append_hf(txt[, hdr])
|
|
|
- 3.21. insert_hf(txt[, hdr])
|
|
|
- 3.22. append_urihf(prefix, suffix)
|
|
|
- 3.23. is_present_hf(hf_name)
|
|
|
- 3.24. is_present_hf_re(hf_name_re)
|
|
|
- 3.25. append_time()
|
|
|
- 3.26. append_time_to_request()
|
|
|
- 3.27. is_method(name)
|
|
|
- 3.28. remove_hf(hname)
|
|
|
- 3.29. remove_hf_re(re)
|
|
|
- 3.30. has_body(), has_body(mime)
|
|
|
- 3.31. is_audio_on_hold()
|
|
|
- 3.32. is_privacy(privacy_type)
|
|
|
- 3.33. in_list(subject, list, separator)
|
|
|
- 3.34. cmp_str(str1, str2)
|
|
|
- 3.35. cmp_istr(str1, str2)
|
|
|
- 3.36. starts_with(str1, str2)
|
|
|
- 3.37. set_body_multipart([txt,content_type][,boundary])
|
|
|
- 3.38. append_body_part(txt,content_type[, content_disposition])
|
|
|
- 3.39. get_body_part(content_type, opv)
|
|
|
- 3.40. get_body_part_raw(content_type, opv)
|
|
|
- 3.41. remove_body_part(content_type)
|
|
|
-
|
|
|
-3.1. search(re)
|
|
|
+4. Functions
|
|
|
+
|
|
|
+ 4.1. search(re)
|
|
|
+ 4.2. search_body(re)
|
|
|
+ 4.3. search_hf(hf, re, flags)
|
|
|
+ 4.4. search_append(re, txt)
|
|
|
+ 4.5. search_append_body(re, txt)
|
|
|
+ 4.6. replace(re, txt)
|
|
|
+ 4.7. replace_body(re, txt)
|
|
|
+ 4.8. replace_all(re, txt)
|
|
|
+ 4.9. replace_body_all(re, txt)
|
|
|
+ 4.10. replace_body_atonce(re, txt)
|
|
|
+ 4.11. subst('/re/repl/flags')
|
|
|
+ 4.12. subst_uri('/re/repl/flags')
|
|
|
+ 4.13. subst_user('/re/repl/flags')
|
|
|
+ 4.14. subst_body('/re/repl/flags')
|
|
|
+ 4.15. subst_hf(hf, subexp, flags)
|
|
|
+ 4.16. set_body(txt,content_type)
|
|
|
+ 4.17. set_reply_body(txt,content_type)
|
|
|
+ 4.18. filter_body(content_type)
|
|
|
+ 4.19. append_to_reply(txt)
|
|
|
+ 4.20. append_hf(txt[, hdr])
|
|
|
+ 4.21. insert_hf(txt[, hdr])
|
|
|
+ 4.22. append_urihf(prefix, suffix)
|
|
|
+ 4.23. is_present_hf(hf_name)
|
|
|
+ 4.24. is_present_hf_re(hf_name_re)
|
|
|
+ 4.25. append_time()
|
|
|
+ 4.26. append_time_to_request()
|
|
|
+ 4.27. is_method(name)
|
|
|
+ 4.28. remove_hf(hname)
|
|
|
+ 4.29. remove_hf_re(re)
|
|
|
+ 4.30. has_body(), has_body(mime)
|
|
|
+ 4.31. is_audio_on_hold()
|
|
|
+ 4.32. is_privacy(privacy_type)
|
|
|
+ 4.33. in_list(subject, list, separator)
|
|
|
+ 4.34. cmp_str(str1, str2)
|
|
|
+ 4.35. cmp_istr(str1, str2)
|
|
|
+ 4.36. starts_with(str1, str2)
|
|
|
+ 4.37. set_body_multipart([txt,content_type][,boundary])
|
|
|
+ 4.38. append_body_part(txt,content_type[, content_disposition])
|
|
|
+ 4.39. get_body_part(content_type, opv)
|
|
|
+ 4.40. get_body_part_raw(content_type, opv)
|
|
|
+ 4.41. remove_body_part(content_type)
|
|
|
+
|
|
|
+4.1. search(re)
|
|
|
|
|
|
Searches for the re in the message.
|
|
|
|
|
@@ -289,7 +278,7 @@ From: medabeda
|
|
|
if ( search("[Ss][Ii][Pp]") ) { /*....*/ };
|
|
|
...
|
|
|
|
|
|
-3.2. search_body(re)
|
|
|
+4.2. search_body(re)
|
|
|
|
|
|
Searches for the re in the body of the message.
|
|
|
|
|
@@ -304,7 +293,7 @@ if ( search("[Ss][Ii][Pp]") ) { /*....*/ };
|
|
|
if ( search_body("[Ss][Ii][Pp]") ) { /*....*/ };
|
|
|
...
|
|
|
|
|
|
-3.3. search_hf(hf, re, flags)
|
|
|
+4.3. search_hf(hf, re, flags)
|
|
|
|
|
|
Searches for the re in the body of a header field.
|
|
|
|
|
@@ -323,7 +312,7 @@ if ( search_body("[Ss][Ii][Pp]") ) { /*....*/ };
|
|
|
if ( search_hf("From", ":test@", "a") ) { /*....*/ };
|
|
|
...
|
|
|
|
|
|
-3.4. search_append(re, txt)
|
|
|
+4.4. search_append(re, txt)
|
|
|
|
|
|
Searches for the first match of re and appends txt after it.
|
|
|
|
|
@@ -339,7 +328,7 @@ if ( search_hf("From", ":test@", "a") ) { /*....*/ };
|
|
|
search_append("[Oo]pen[Ss]er", " SIP Proxy");
|
|
|
...
|
|
|
|
|
|
-3.5. search_append_body(re, txt)
|
|
|
+4.5. search_append_body(re, txt)
|
|
|
|
|
|
Searches for the first match of re in the body of the message and
|
|
|
appends txt after it.
|
|
@@ -356,7 +345,7 @@ search_append("[Oo]pen[Ss]er", " SIP Proxy");
|
|
|
search_append_body("[Oo]pen[Ss]er", " SIP Proxy");
|
|
|
...
|
|
|
|
|
|
-3.6. replace(re, txt)
|
|
|
+4.6. replace(re, txt)
|
|
|
|
|
|
Replaces the first occurrence of re with txt.
|
|
|
|
|
@@ -372,7 +361,7 @@ search_append_body("[Oo]pen[Ss]er", " SIP Proxy");
|
|
|
replace("openser", "Kamailio SIP Proxy");
|
|
|
...
|
|
|
|
|
|
-3.7. replace_body(re, txt)
|
|
|
+4.7. replace_body(re, txt)
|
|
|
|
|
|
Replaces the first occurrence of re in the body of the message with
|
|
|
txt.
|
|
@@ -389,7 +378,7 @@ replace("openser", "Kamailio SIP Proxy");
|
|
|
replace_body("openser", "Kamailio SIP Proxy");
|
|
|
...
|
|
|
|
|
|
-3.8. replace_all(re, txt)
|
|
|
+4.8. replace_all(re, txt)
|
|
|
|
|
|
Replaces all occurrence of re with txt.
|
|
|
|
|
@@ -405,7 +394,7 @@ replace_body("openser", "Kamailio SIP Proxy");
|
|
|
replace_all("openser", "Kamailio SIP Proxy");
|
|
|
...
|
|
|
|
|
|
-3.9. replace_body_all(re, txt)
|
|
|
+4.9. replace_body_all(re, txt)
|
|
|
|
|
|
Replaces all occurrence of re in the body of the message with txt.
|
|
|
Matching is done on a per-line basis.
|
|
@@ -422,7 +411,7 @@ replace_all("openser", "Kamailio SIP Proxy");
|
|
|
replace_body_all("openser", "Kamailio SIP Proxy");
|
|
|
...
|
|
|
|
|
|
-3.10. replace_body_atonce(re, txt)
|
|
|
+4.10. replace_body_atonce(re, txt)
|
|
|
|
|
|
Replaces all occurrence of re in the body of the message with txt.
|
|
|
Matching is done over the whole body.
|
|
@@ -441,7 +430,7 @@ if(has_body() && replace_body_atonce("^.+$", ""))
|
|
|
remove_hf("Content-Type");
|
|
|
...
|
|
|
|
|
|
-3.11. subst('/re/repl/flags')
|
|
|
+4.11. subst('/re/repl/flags')
|
|
|
|
|
|
Replaces re with repl (sed or perl like).
|
|
|
|
|
@@ -467,7 +456,7 @@ if ( subst('/^To:(.*)sip:[^@]*@[a-zA-Z0-9.]+(.*)$/t:\1$avp(sip_address)\2/ig') )
|
|
|
|
|
|
...
|
|
|
|
|
|
-3.12. subst_uri('/re/repl/flags')
|
|
|
+4.12. subst_uri('/re/repl/flags')
|
|
|
|
|
|
Runs the re substitution on the message uri (like subst but works only
|
|
|
on the uri)
|
|
@@ -495,7 +484,7 @@ if (subst_uri('/^sip:([0-9]+)@(.*)$/sip:$avp(uri_prefix)\1@\2;orig_uri=\0/i')){$
|
|
|
|
|
|
...
|
|
|
|
|
|
-3.13. subst_user('/re/repl/flags')
|
|
|
+4.13. subst_user('/re/repl/flags')
|
|
|
|
|
|
Runs the re substitution on the message uri (like subst_uri but works
|
|
|
only on the user portion of the uri)
|
|
@@ -522,7 +511,7 @@ if (subst_user('/(.*)3642$/$avp(user_prefix)\13642/')){$
|
|
|
|
|
|
...
|
|
|
|
|
|
-3.14. subst_body('/re/repl/flags')
|
|
|
+4.14. subst_body('/re/repl/flags')
|
|
|
|
|
|
Replaces re with repl (sed or perl like) in the body of the message.
|
|
|
|
|
@@ -543,7 +532,7 @@ if ( subst_body('/^o=(.*) /o=$fU /') ) {};
|
|
|
|
|
|
...
|
|
|
|
|
|
-3.15. subst_hf(hf, subexp, flags)
|
|
|
+4.15. subst_hf(hf, subexp, flags)
|
|
|
|
|
|
Perl-like substitutions in the body of a header field.
|
|
|
|
|
@@ -563,7 +552,7 @@ if ( subst_body('/^o=(.*) /o=$fU /') ) {};
|
|
|
if ( subst_hf("From", "/:test@/:best@/", "a") ) { /*....*/ };
|
|
|
...
|
|
|
|
|
|
-3.16. set_body(txt,content_type)
|
|
|
+4.16. set_body(txt,content_type)
|
|
|
|
|
|
Set body to a SIP message.
|
|
|
|
|
@@ -580,7 +569,7 @@ if ( subst_hf("From", "/:test@/:best@/", "a") ) { /*....*/ };
|
|
|
set_body("test", "text/plain");
|
|
|
...
|
|
|
|
|
|
-3.17. set_reply_body(txt,content_type)
|
|
|
+4.17. set_reply_body(txt,content_type)
|
|
|
|
|
|
Set body to a SIP reply to be generated by Kamailio.
|
|
|
|
|
@@ -597,7 +586,7 @@ set_body("test", "text/plain");
|
|
|
set_reply_body("test", "text/plain");
|
|
|
...
|
|
|
|
|
|
-3.18. filter_body(content_type)
|
|
|
+4.18. filter_body(content_type)
|
|
|
|
|
|
Filters multipart/mixed body by leaving out all other body parts except
|
|
|
the first body part of given type.
|
|
@@ -620,7 +609,7 @@ if (has_body("multipart/mixed")) {
|
|
|
}
|
|
|
...
|
|
|
|
|
|
-3.19. append_to_reply(txt)
|
|
|
+4.19. append_to_reply(txt)
|
|
|
|
|
|
Append txt as header to the reply.
|
|
|
|
|
@@ -636,7 +625,7 @@ append_to_reply("Foo: bar\r\n");
|
|
|
append_to_reply("Foo: $rm at $Ts\r\n");
|
|
|
...
|
|
|
|
|
|
-3.20. append_hf(txt[, hdr])
|
|
|
+4.20. append_hf(txt[, hdr])
|
|
|
|
|
|
Appends 'txt' as header after first header field or after last 'hdr'
|
|
|
header field.
|
|
@@ -655,7 +644,7 @@ append_hf("P-hint: VOICEMAIL\r\n");
|
|
|
append_hf("From-username: $fU\r\n", "Call-ID");
|
|
|
...
|
|
|
|
|
|
-3.21. insert_hf(txt[, hdr])
|
|
|
+4.21. insert_hf(txt[, hdr])
|
|
|
|
|
|
Inserts 'txt' as header before the first header field or before first
|
|
|
'hdr' header field if 'hdr' is given.
|
|
@@ -676,7 +665,7 @@ insert_hf("P-hint: VOICEMAIL\r\n", "Call-ID");
|
|
|
insert_hf("To-username: $tU\r\n", "Call-ID");
|
|
|
...
|
|
|
|
|
|
-3.22. append_urihf(prefix, suffix)
|
|
|
+4.22. append_urihf(prefix, suffix)
|
|
|
|
|
|
Append header field name with original Request-URI in middle.
|
|
|
|
|
@@ -692,14 +681,14 @@ insert_hf("To-username: $tU\r\n", "Call-ID");
|
|
|
append_urihf("CC-Diversion: ", "\r\n");
|
|
|
...
|
|
|
|
|
|
-3.23. is_present_hf(hf_name)
|
|
|
+4.23. is_present_hf(hf_name)
|
|
|
|
|
|
Return true if a header field is present in message.
|
|
|
|
|
|
Note
|
|
|
|
|
|
The function is also able to distinguish the compact names. For exmaple
|
|
|
- "From" will match with "f"
|
|
|
+ “From� will match with “f�
|
|
|
|
|
|
Meaning of the parameters is as follows:
|
|
|
* hf_name - Header field name.(long or compact form)
|
|
@@ -712,7 +701,7 @@ Note
|
|
|
if (is_present_hf("From")) log(1, "From HF Present");
|
|
|
...
|
|
|
|
|
|
-3.24. is_present_hf_re(hf_name_re)
|
|
|
+4.24. is_present_hf_re(hf_name_re)
|
|
|
|
|
|
Return true if a header field whose name matches regular expression
|
|
|
'hf_name_re' is present in message.
|
|
@@ -728,12 +717,12 @@ if (is_present_hf("From")) log(1, "From HF Present");
|
|
|
if (is_present_hf_re("^P-")) log(1, "There are headers starting with P-\n");
|
|
|
...
|
|
|
|
|
|
-3.25. append_time()
|
|
|
+4.25. append_time()
|
|
|
|
|
|
Adds a time header to the reply of the request. You must use it before
|
|
|
functions that are likely to send a reply, e.g., save() from
|
|
|
- 'registrar' module. Header format is: "Date: %a, %d %b %Y %H:%M:%S
|
|
|
- GMT", with the legend:
|
|
|
+ 'registrar' module. Header format is: “Date: %a, %d %b %Y %H:%M:%S
|
|
|
+ GMT�, with the legend:
|
|
|
* %a abbreviated week of day name (locale)
|
|
|
* %d day of month as decimal number
|
|
|
* %b abbreviated month name (locale)
|
|
@@ -752,10 +741,10 @@ if (is_present_hf_re("^P-")) log(1, "There are headers starting with P-\n");
|
|
|
append_time();
|
|
|
...
|
|
|
|
|
|
-3.26. append_time_to_request()
|
|
|
+4.26. append_time_to_request()
|
|
|
|
|
|
- Adds a time header to the request. Header format is: "Date: %a, %d %b
|
|
|
- %Y %H:%M:%S GMT", with the legend:
|
|
|
+ Adds a time header to the request. Header format is: “Date: %a, %d %b
|
|
|
+ %Y %H:%M:%S GMT�, with the legend:
|
|
|
* %a abbreviated week of day name (locale)
|
|
|
* %d day of month as decimal number
|
|
|
* %b abbreviated month name (locale)
|
|
@@ -775,7 +764,7 @@ if(!is_present_hf("Date"))
|
|
|
append_time_to_request();
|
|
|
...
|
|
|
|
|
|
-3.27. is_method(name)
|
|
|
+4.27. is_method(name)
|
|
|
|
|
|
Check if the method of the message matches the name. If name is a known
|
|
|
method (invite, cancel, ack, bye, options, info, update, register,
|
|
@@ -812,9 +801,9 @@ if(is_method("OPTION|UPDATE"))
|
|
|
}
|
|
|
...
|
|
|
|
|
|
-3.28. remove_hf(hname)
|
|
|
+4.28. remove_hf(hname)
|
|
|
|
|
|
- Remove from message all headers with name "hname". Header matching is
|
|
|
+ Remove from message all headers with name “hname�. Header matching is
|
|
|
case-insensitive. Matches and removes also the compact header forms.
|
|
|
|
|
|
Returns true if at least one header is found and removed.
|
|
@@ -837,10 +826,10 @@ remove_hf("Contact")
|
|
|
remove_hf("m")
|
|
|
...
|
|
|
|
|
|
-3.29. remove_hf_re(re)
|
|
|
+4.29. remove_hf_re(re)
|
|
|
|
|
|
Remove from message all headers with name matching regular expression
|
|
|
- "re"
|
|
|
+ “re�
|
|
|
|
|
|
Returns true if at least one header is found and removed.
|
|
|
|
|
@@ -858,16 +847,16 @@ if(remove_hf_re("^P-"))
|
|
|
}
|
|
|
...
|
|
|
|
|
|
-3.30. has_body(), has_body(mime)
|
|
|
+4.30. has_body(), has_body(mime)
|
|
|
|
|
|
The function returns true if the SIP message has a body attached. The
|
|
|
- checked includes also the "Content-Length" header presence and value.
|
|
|
+ checked includes also the “Content-Length� header presence and value.
|
|
|
|
|
|
If a parameter is given, the mime described will be also checked
|
|
|
- against the "Content-Type" header.
|
|
|
+ against the “Content-Type� header.
|
|
|
|
|
|
Meaning of the parameters is as follows:
|
|
|
- * mime - mime to be checked against the "Content-Type" header. If not
|
|
|
+ * mime - mime to be checked against the “Content-Type� header. If not
|
|
|
present or 0, this check will be disabled.
|
|
|
|
|
|
This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE,
|
|
@@ -881,7 +870,7 @@ if(has_body("application/sdp"))
|
|
|
}
|
|
|
...
|
|
|
|
|
|
-3.31. is_audio_on_hold()
|
|
|
+4.31. is_audio_on_hold()
|
|
|
|
|
|
The function returns true if the SIP message has a body attached and at
|
|
|
least one audio stream in on hold.
|
|
@@ -897,7 +886,7 @@ if(is_audio_on_hold())
|
|
|
}
|
|
|
...
|
|
|
|
|
|
-3.32. is_privacy(privacy_type)
|
|
|
+4.32. is_privacy(privacy_type)
|
|
|
|
|
|
The function returns true if the SIP message has a Privacy header field
|
|
|
that includes the given privacy_type among its privacy values. See
|
|
@@ -915,7 +904,7 @@ if(is_privacy("id"))
|
|
|
}
|
|
|
...
|
|
|
|
|
|
-3.33. in_list(subject, list, separator)
|
|
|
+4.33. in_list(subject, list, separator)
|
|
|
|
|
|
Function checks if subject string is found in list string where list
|
|
|
items are separated by separator string. Subject and list strings may
|
|
@@ -933,7 +922,7 @@ if (in_list("$var(subject)", "$var(list)", ",") {
|
|
|
}
|
|
|
...
|
|
|
|
|
|
-3.34. cmp_str(str1, str2)
|
|
|
+4.34. cmp_str(str1, str2)
|
|
|
|
|
|
The function returns true if the two parameters matches as string case
|
|
|
sensitive comparison.
|
|
@@ -949,7 +938,7 @@ if(cmp_str("$rU", "kamailio"))
|
|
|
}
|
|
|
...
|
|
|
|
|
|
-3.35. cmp_istr(str1, str2)
|
|
|
+4.35. cmp_istr(str1, str2)
|
|
|
|
|
|
The function returns true if the two parameters matches as string case
|
|
|
insensitive comparison.
|
|
@@ -965,7 +954,7 @@ if(cmp_istr("$rU@you", "kamailio@YOU"))
|
|
|
}
|
|
|
...
|
|
|
|
|
|
-3.36. starts_with(str1, str2)
|
|
|
+4.36. starts_with(str1, str2)
|
|
|
|
|
|
The function returns true if the first string starts with the second
|
|
|
string.
|
|
@@ -981,7 +970,7 @@ if (starts_with("$rU", "+358"))
|
|
|
}
|
|
|
...
|
|
|
|
|
|
-3.37. set_body_multipart([txt,content_type][,boundary])
|
|
|
+4.37. 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.
|
|
@@ -1016,7 +1005,7 @@ text
|
|
|
--delimiter
|
|
|
...
|
|
|
|
|
|
-3.38. append_body_part(txt,content_type[, content_disposition])
|
|
|
+4.38. append_body_part(txt,content_type[, content_disposition])
|
|
|
|
|
|
Append a part on multipart body SIP message. Will use
|
|
|
"unique-boundary-1" as boundary.
|
|
@@ -1050,7 +1039,7 @@ Content-Disposition: signal;handling=required
|
|
|
--unique-boundary-1
|
|
|
...
|
|
|
|
|
|
-3.39. get_body_part(content_type, opv)
|
|
|
+4.39. get_body_part(content_type, opv)
|
|
|
|
|
|
Return the content of a multipart body SIP message, storing it in opv.
|
|
|
|
|
@@ -1068,7 +1057,7 @@ Content-Disposition: signal;handling=required
|
|
|
get_body_part("application/vnd.cirpack.isdn-ext", "$var(pbody)");
|
|
|
...
|
|
|
|
|
|
-3.40. get_body_part_raw(content_type, opv)
|
|
|
+4.40. 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.
|
|
@@ -1087,7 +1076,7 @@ get_body_part("application/vnd.cirpack.isdn-ext", "$var(pbody)");
|
|
|
get_body_part("application/vnd.cirpack.isdn-ext", "$var(hbody)");
|
|
|
...
|
|
|
|
|
|
-3.41. remove_body_part(content_type)
|
|
|
+4.41. remove_body_part(content_type)
|
|
|
|
|
|
Remove a part on a multipart body SIP message.
|
|
|
|
|
@@ -1107,11 +1096,6 @@ get_body_part("application/vnd.cirpack.isdn-ext", "$var(hbody)");
|
|
|
remove_body_part("application/vnd.cirpack.isdn-ext");
|
|
|
...
|
|
|
|
|
|
-4. Known Limitations
|
|
|
-
|
|
|
- Search functions are applied to the original request, i.e., they ignore
|
|
|
- all changes resulting from message processing in Kamailio script.
|
|
|
-
|
|
|
Chapter 2. Developer Guide
|
|
|
|
|
|
Table of Contents
|
|
@@ -1124,10 +1108,10 @@ Chapter 2. Developer Guide
|
|
|
|
|
|
1.1. load_textops(*import_structure)
|
|
|
|
|
|
-1.1. load_textops(*import_structure)
|
|
|
+1.1. load_textops(*import_structure)
|
|
|
|
|
|
For programmatic use only--import the Textops API.
|
|
|
|
|
|
Meaning of the parameters is as follows:
|
|
|
- * import_structure - Pointer to the import structure - see "struct
|
|
|
- textops_binds" in modules/textops/api.h
|
|
|
+ * import_structure - Pointer to the import structure - see “struct
|
|
|
+ textops_binds� in modules/textops/api.h
|