|
@@ -17,7 +17,13 @@ Daniel-Constantin Mierla
|
|
|
|
|
|
<[email protected]>
|
|
|
|
|
|
- Copyright © 2003 FhG FOKUS
|
|
|
+Edited by
|
|
|
+
|
|
|
+Juha Heinanen
|
|
|
+
|
|
|
+ <[email protected]>
|
|
|
+
|
|
|
+ Copyright © 2003 FhG FOKUS
|
|
|
Revision History
|
|
|
Revision $Revision$ $Date$
|
|
|
__________________________________________________________________
|
|
@@ -69,7 +75,8 @@ Daniel-Constantin Mierla
|
|
|
3.30. is_privacy(privacy_type)
|
|
|
3.31. cmp_str(str1, str2)
|
|
|
3.32. cmp_istr(str1, str2)
|
|
|
- 3.33. msg_apply_changes()
|
|
|
+ 3.33. starts_with(str1, str2)
|
|
|
+ 3.34. msg_apply_changes()
|
|
|
|
|
|
4. Known Limitations
|
|
|
|
|
@@ -113,7 +120,8 @@ Daniel-Constantin Mierla
|
|
|
1.30. is_privacy usage
|
|
|
1.31. cmp_str usage
|
|
|
1.32. cmp_str usage
|
|
|
- 1.33. msg_apply_changes() usage
|
|
|
+ 1.33. starts_with usage
|
|
|
+ 1.34. msg_apply_changes() usage
|
|
|
|
|
|
Chapter 1. Admin Guide
|
|
|
|
|
@@ -162,7 +170,8 @@ Chapter 1. Admin Guide
|
|
|
3.30. is_privacy(privacy_type)
|
|
|
3.31. cmp_str(str1, str2)
|
|
|
3.32. cmp_istr(str1, str2)
|
|
|
- 3.33. msg_apply_changes()
|
|
|
+ 3.33. starts_with(str1, str2)
|
|
|
+ 3.34. msg_apply_changes()
|
|
|
|
|
|
4. Known Limitations
|
|
|
|
|
@@ -179,7 +188,7 @@ Chapter 1. Admin Guide
|
|
|
|
|
|
1.1. Known Limitations
|
|
|
|
|
|
- search ignores folded lines. For example, search("(From|f):.*@foo.bar")
|
|
|
+ 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
|
|
@@ -234,9 +243,10 @@ From: medabeda
|
|
|
3.30. is_privacy(privacy_type)
|
|
|
3.31. cmp_str(str1, str2)
|
|
|
3.32. cmp_istr(str1, str2)
|
|
|
- 3.33. msg_apply_changes()
|
|
|
+ 3.33. starts_with(str1, str2)
|
|
|
+ 3.34. msg_apply_changes()
|
|
|
|
|
|
-3.1. search(re)
|
|
|
+3.1. search(re)
|
|
|
|
|
|
Searches for the re in the message.
|
|
|
|
|
@@ -251,7 +261,7 @@ From: medabeda
|
|
|
if ( search("[Ss][Ii][Pp]") ) { /*....*/ };
|
|
|
...
|
|
|
|
|
|
-3.2. search_body(re)
|
|
|
+3.2. search_body(re)
|
|
|
|
|
|
Searches for the re in the body of the message.
|
|
|
|
|
@@ -266,7 +276,7 @@ if ( search("[Ss][Ii][Pp]") ) { /*....*/ };
|
|
|
if ( search_body("[Ss][Ii][Pp]") ) { /*....*/ };
|
|
|
...
|
|
|
|
|
|
-3.3. search_append(re, txt)
|
|
|
+3.3. search_append(re, txt)
|
|
|
|
|
|
Searches for the first match of re and appends txt after it.
|
|
|
|
|
@@ -282,7 +292,7 @@ if ( search_body("[Ss][Ii][Pp]") ) { /*....*/ };
|
|
|
search_append("[Oo]pen[Ss]er", " SIP Proxy");
|
|
|
...
|
|
|
|
|
|
-3.4. search_append_body(re, txt)
|
|
|
+3.4. search_append_body(re, txt)
|
|
|
|
|
|
Searches for the first match of re in the body of the message and
|
|
|
appends txt after it.
|
|
@@ -299,7 +309,7 @@ search_append("[Oo]pen[Ss]er", " SIP Proxy");
|
|
|
search_append_body("[Oo]pen[Ss]er", " SIP Proxy");
|
|
|
...
|
|
|
|
|
|
-3.5. replace(re, txt)
|
|
|
+3.5. replace(re, txt)
|
|
|
|
|
|
Replaces the first occurrence of re with txt.
|
|
|
|
|
@@ -315,7 +325,7 @@ search_append_body("[Oo]pen[Ss]er", " SIP Proxy");
|
|
|
replace("openser", "Kamailio SIP Proxy");
|
|
|
...
|
|
|
|
|
|
-3.6. replace_body(re, txt)
|
|
|
+3.6. replace_body(re, txt)
|
|
|
|
|
|
Replaces the first occurrence of re in the body of the message with
|
|
|
txt.
|
|
@@ -332,7 +342,7 @@ replace("openser", "Kamailio SIP Proxy");
|
|
|
replace_body("openser", "Kamailio SIP Proxy");
|
|
|
...
|
|
|
|
|
|
-3.7. replace_all(re, txt)
|
|
|
+3.7. replace_all(re, txt)
|
|
|
|
|
|
Replaces all occurrence of re with txt.
|
|
|
|
|
@@ -348,7 +358,7 @@ replace_body("openser", "Kamailio SIP Proxy");
|
|
|
replace_all("openser", "Kamailio SIP Proxy");
|
|
|
...
|
|
|
|
|
|
-3.8. replace_body_all(re, txt)
|
|
|
+3.8. 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.
|
|
@@ -365,7 +375,7 @@ replace_all("openser", "Kamailio SIP Proxy");
|
|
|
replace_body_all("openser", "Kamailio SIP Proxy");
|
|
|
...
|
|
|
|
|
|
-3.9. replace_body_atonce(re, txt)
|
|
|
+3.9. 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.
|
|
@@ -384,7 +394,7 @@ if(has_body() && replace_body_atonce("^.+$", ""))
|
|
|
remove_hf("Content-Type");
|
|
|
...
|
|
|
|
|
|
-3.10. subst('/re/repl/flags')
|
|
|
+3.10. subst('/re/repl/flags')
|
|
|
|
|
|
Replaces re with repl (sed or perl like).
|
|
|
|
|
@@ -410,7 +420,7 @@ if ( subst('/^To:(.*)sip:[^@]*@[a-zA-Z0-9.]+(.*)$/t:\1$avp(sip_address)\2/ig') )
|
|
|
|
|
|
...
|
|
|
|
|
|
-3.11. subst_uri('/re/repl/flags')
|
|
|
+3.11. subst_uri('/re/repl/flags')
|
|
|
|
|
|
Runs the re substitution on the message uri (like subst but works only
|
|
|
on the uri)
|
|
@@ -438,7 +448,7 @@ if (subst_uri('/^sip:([0-9]+)@(.*)$/sip:$avp(uri_prefix)\1@\2;orig_uri=\0/i')){$
|
|
|
|
|
|
...
|
|
|
|
|
|
-3.12. subst_user('/re/repl/flags')
|
|
|
+3.12. 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)
|
|
@@ -465,7 +475,7 @@ if (subst_user('/(.*)3642$/$avp(user_prefix)\13642/')){$
|
|
|
|
|
|
...
|
|
|
|
|
|
-3.13. subst_body('/re/repl/flags')
|
|
|
+3.13. subst_body('/re/repl/flags')
|
|
|
|
|
|
Replaces re with repl (sed or perl like) in the body of the message.
|
|
|
|
|
@@ -486,7 +496,7 @@ if ( subst_body('/^o=(.*) /o=$fU /') ) {};
|
|
|
|
|
|
...
|
|
|
|
|
|
-3.14. set_body(txt,content_type)
|
|
|
+3.14. set_body(txt,content_type)
|
|
|
|
|
|
Set body to a SIP message.
|
|
|
|
|
@@ -503,7 +513,7 @@ if ( subst_body('/^o=(.*) /o=$fU /') ) {};
|
|
|
set_body("test", "text/plain");
|
|
|
...
|
|
|
|
|
|
-3.15. set_reply_body(txt,content_type)
|
|
|
+3.15. set_reply_body(txt,content_type)
|
|
|
|
|
|
Set body to a SIP reply to be generated by Kamailio.
|
|
|
|
|
@@ -520,7 +530,7 @@ set_body("test", "text/plain");
|
|
|
set_reply_body("test", "text/plain");
|
|
|
...
|
|
|
|
|
|
-3.16. filter_body(content_type)
|
|
|
+3.16. filter_body(content_type)
|
|
|
|
|
|
Filters multipart/mixed body by leaving out all other body parts except
|
|
|
the first body part of given type.
|
|
@@ -543,7 +553,7 @@ if (has_body("multipart/mixed")) {
|
|
|
}
|
|
|
...
|
|
|
|
|
|
-3.17. append_to_reply(txt)
|
|
|
+3.17. append_to_reply(txt)
|
|
|
|
|
|
Append txt as header to the reply.
|
|
|
|
|
@@ -559,7 +569,7 @@ append_to_reply("Foo: bar\r\n");
|
|
|
append_to_reply("Foo: $rm at $Ts\r\n");
|
|
|
...
|
|
|
|
|
|
-3.18. append_hf(txt)
|
|
|
+3.18. append_hf(txt)
|
|
|
|
|
|
Appends 'txt' as header after the last header field.
|
|
|
|
|
@@ -582,7 +592,7 @@ append_hf("P-hint: VOICEMAIL\r\n");
|
|
|
append_hf("From-username: $fU\r\n");
|
|
|
...
|
|
|
|
|
|
-3.19. append_hf(txt, hdr)
|
|
|
+3.19. append_hf(txt, hdr)
|
|
|
|
|
|
Appends 'txt' as header after first 'hdr' header field.
|
|
|
|
|
@@ -600,7 +610,7 @@ append_hf("P-hint: VOICEMAIL\r\n", "Call-ID");
|
|
|
append_hf("From-username: $fU\r\n", "Call-ID");
|
|
|
...
|
|
|
|
|
|
-3.20. insert_hf(txt)
|
|
|
+3.20. insert_hf(txt)
|
|
|
|
|
|
Inserts 'txt' as header before the first header field.
|
|
|
|
|
@@ -617,7 +627,7 @@ insert_hf("P-hint: VOICEMAIL\r\n");
|
|
|
insert_hf("To-username: $tU\r\n");
|
|
|
...
|
|
|
|
|
|
-3.21. insert_hf(txt, hdr)
|
|
|
+3.21. insert_hf(txt, hdr)
|
|
|
|
|
|
Inserts 'txt' as header before first 'hdr' header field.
|
|
|
|
|
@@ -635,7 +645,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)
|
|
|
+3.22. append_urihf(prefix, suffix)
|
|
|
|
|
|
Append header field name with original Request-URI in middle.
|
|
|
|
|
@@ -651,14 +661,14 @@ insert_hf("To-username: $tU\r\n", "Call-ID");
|
|
|
append_urihf("CC-Diversion: ", "\r\n");
|
|
|
...
|
|
|
|
|
|
-3.23. is_present_hf(hf_name)
|
|
|
+3.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)
|
|
@@ -671,7 +681,7 @@ Note
|
|
|
if (is_present_hf("From")) log(1, "From HF Present");
|
|
|
...
|
|
|
|
|
|
-3.24. is_present_hf_re(hf_name_re)
|
|
|
+3.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.
|
|
@@ -687,12 +697,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()
|
|
|
+3.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)
|
|
@@ -711,7 +721,7 @@ if (is_present_hf_re("^P-")) log(1, "There are headers starting with P-\n");
|
|
|
append_time();
|
|
|
...
|
|
|
|
|
|
-3.26. is_method(name)
|
|
|
+3.26. 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,
|
|
@@ -748,9 +758,9 @@ if(is_method("OPTION|UPDATE"))
|
|
|
}
|
|
|
...
|
|
|
|
|
|
-3.27. remove_hf(hname)
|
|
|
+3.27. remove_hf(hname)
|
|
|
|
|
|
- Remove from message all headers with name "hname"
|
|
|
+ Remove from message all headers with name “hname�
|
|
|
|
|
|
Returns true if at least one header is found and removed.
|
|
|
|
|
@@ -768,10 +778,10 @@ if(remove_hf("User-Agent"))
|
|
|
}
|
|
|
...
|
|
|
|
|
|
-3.28. remove_hf_re(re)
|
|
|
+3.28. 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.
|
|
|
|
|
@@ -789,16 +799,16 @@ if(remove_hf_re("^P-"))
|
|
|
}
|
|
|
...
|
|
|
|
|
|
-3.29. has_body(), has_body(mime)
|
|
|
+3.29. has_body(), has_body(mime)
|
|
|
|
|
|
The function returns true if the SIP message has a body attached. The
|
|
|
- checked includes also the "Content-Lenght" header presence and value.
|
|
|
+ checked includes also the “Content-Lenght� 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,
|
|
@@ -812,7 +822,7 @@ if(has_body("application/sdp"))
|
|
|
}
|
|
|
...
|
|
|
|
|
|
-3.30. is_privacy(privacy_type)
|
|
|
+3.30. 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
|
|
@@ -830,7 +840,7 @@ if(is_privacy("id"))
|
|
|
}
|
|
|
...
|
|
|
|
|
|
-3.31. cmp_str(str1, str2)
|
|
|
+3.31. cmp_str(str1, str2)
|
|
|
|
|
|
The function returns true if the two parameters matches as string case
|
|
|
sensitive comparison.
|
|
@@ -846,7 +856,7 @@ if(cmp_str("$rU", "kamailio"))
|
|
|
}
|
|
|
...
|
|
|
|
|
|
-3.32. cmp_istr(str1, str2)
|
|
|
+3.32. cmp_istr(str1, str2)
|
|
|
|
|
|
The function returns true if the two parameters matches as string case
|
|
|
insensitive comparison.
|
|
@@ -862,7 +872,23 @@ if(cmp_istr("$rU@you", "kamailio@YOU"))
|
|
|
}
|
|
|
...
|
|
|
|
|
|
-3.33. msg_apply_changes()
|
|
|
+3.33. starts_with(str1, str2)
|
|
|
+
|
|
|
+ The function returns true if the first string starts with the second
|
|
|
+ string.
|
|
|
+
|
|
|
+ This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE,
|
|
|
+ FAILURE_ROUTE and BRANCH_ROUTE.
|
|
|
+
|
|
|
+ Example 1.33. starts_with usage
|
|
|
+...
|
|
|
+if(cmp_str("$rU", "+358"))
|
|
|
+{
|
|
|
+ # do interesting stuff here
|
|
|
+}
|
|
|
+...
|
|
|
+
|
|
|
+3.34. msg_apply_changes()
|
|
|
|
|
|
Use this function to apply changes done on SIP request content. Be
|
|
|
careful when using this function -- due to special handling of changes
|
|
@@ -872,7 +898,7 @@ if(cmp_istr("$rU@you", "kamailio@YOU"))
|
|
|
|
|
|
This function can be used from REQUEST_ROUTE.
|
|
|
|
|
|
- Example 1.33. msg_apply_changes() usage
|
|
|
+ Example 1.34. msg_apply_changes() usage
|
|
|
...
|
|
|
append_hf("My-Header: yes\r\n");
|
|
|
if(msg_apply_changes())
|
|
@@ -902,10 +928,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
|