diff --git a/src/modules/siputils/README b/src/modules/siputils/README index bd32c3e674a..adc29cbd24f 100644 --- a/src/modules/siputils/README +++ b/src/modules/siputils/README @@ -52,58 +52,56 @@ Gabriel Vasile 3. Parameters - 3.1. ring_timeout (int) - 3.2. options_accept (string) - 3.3. options_accept_encoding (string) - 3.4. contact_flds_separator (string) - 3.5. options_accept_language (string) - 3.6. options_support (string) - 3.7. rpid_prefix (string) - 3.8. rpid_suffix (string) - 3.9. rpid_avp (string) + 3.1. options_accept (string) + 3.2. options_accept_encoding (string) + 3.3. contact_flds_separator (string) + 3.4. options_accept_language (string) + 3.5. options_support (string) + 3.6. rpid_prefix (string) + 3.7. rpid_suffix (string) + 3.8. rpid_avp (string) 4. Functions - 4.1. ring_insert_callid() - 4.2. options_reply() - 4.3. is_user(username) - 4.4. has_totag() - 4.5. uri_param(param) - 4.6. uri_param(param,value) - 4.7. uri_param_any(param) - 4.8. add_uri_param(param) - 4.9. get_uri_param(name, var) - 4.10. uri_param_rm(param) - 4.11. tel2sip(uri, hostpart, result) - 4.12. is_e164(pseudo-variable) - 4.13. is_uri_user_e164(pseudo-variable) - 4.14. is_uri(pseudo-variable) - 4.15. is_tel_number(tval) - 4.16. is_numeric(tval) - 4.17. is_alphanum(tval) - 4.18. is_alphanumex(tval, eset) - 4.19. encode_contact(encoding_prefix,hostpart) - 4.20. decode_contact() - 4.21. decode_contact_header() - 4.22. cmp_uri(str1, str2) - 4.23. cmp_aor(str1, str2) - 4.24. cmp_hdr_name(str1, str2) - 4.25. append_rpid_hf() - 4.26. append_rpid_hf(prefix, suffix) - 4.27. is_rpid_user_e164() - 4.28. set_uri_user(uri, user) - 4.29. set_uri_host(uri, host) - 4.30. is_request() - 4.31. is_reply() - 4.32. is_gruu([uri]) - 4.33. is_supported(option) - 4.34. is_first_hop([mode]) - 4.35. sip_p_charging_vector(flags) - 4.36. contact_param_encode(pname, saddr) - 4.37. contact_param_decode(pname) - 4.38. contact_param_decode_uri(pname) - 4.39. contact_param_rm(pname) - 4.40. hdr_date_check(tdiff) + 4.1. options_reply() + 4.2. is_user(username) + 4.3. has_totag() + 4.4. uri_param(param) + 4.5. uri_param(param,value) + 4.6. uri_param_any(param) + 4.7. add_uri_param(param) + 4.8. get_uri_param(name, var) + 4.9. uri_param_rm(param) + 4.10. tel2sip(uri, hostpart, result) + 4.11. is_e164(pseudo-variable) + 4.12. is_uri_user_e164(pseudo-variable) + 4.13. is_uri(pseudo-variable) + 4.14. is_tel_number(tval) + 4.15. is_numeric(tval) + 4.16. is_alphanum(tval) + 4.17. is_alphanumex(tval, eset) + 4.18. encode_contact(encoding_prefix,hostpart) + 4.19. decode_contact() + 4.20. decode_contact_header() + 4.21. cmp_uri(str1, str2) + 4.22. cmp_aor(str1, str2) + 4.23. cmp_hdr_name(str1, str2) + 4.24. append_rpid_hf() + 4.25. append_rpid_hf(prefix, suffix) + 4.26. is_rpid_user_e164() + 4.27. set_uri_user(uri, user) + 4.28. set_uri_host(uri, host) + 4.29. is_request() + 4.30. is_reply() + 4.31. is_gruu([uri]) + 4.32. is_supported(option) + 4.33. is_first_hop([mode]) + 4.34. sip_p_charging_vector(flags) + 4.35. contact_param_encode(pname, saddr) + 4.36. contact_param_decode(pname) + 4.37. contact_param_decode_uri(pname) + 4.38. contact_param_rm(pname) + 4.39. hdr_date_check(tdiff) 5. Exported pseudo-variables @@ -115,55 +113,53 @@ Gabriel Vasile List of Examples - 1.1. Set ring_timeout parameter - 1.2. Set options_accept parameter - 1.3. Set options_accept_encoding parameter - 1.4. Set contact_flds_separator parameter - 1.5. Set options_accept_language parameter - 1.6. Set options_support parameter - 1.7. rpid_prefix parameter example - 1.8. rpid_suffix parameter example - 1.9. rpid_avp parameter example - 1.10. ring_insert_callid() usage - 1.11. options_reply usage - 1.12. is_user usage - 1.13. has_totag usage - 1.14. uri_param usage - 1.15. uri_param usage - 1.16. uri_param_any usage - 1.17. add_uri_param usage - 1.18. add_uri_param usage - 1.19. uri_param_rm usage - 1.20. tel2sip usage - 1.21. is_e164 usage - 1.22. is_uri_user_e164 usage - 1.23. is_uri usage - 1.24. is_tel_number usage - 1.25. is_numeric usage - 1.26. is_alphanum usage - 1.27. is_alphanumex usage - 1.28. encode_contact usage - 1.29. decode_contact usage - 1.30. decode_contact_header usage - 1.31. cmp_uri usage - 1.32. cmp_aor usage - 1.33. cmp_hdr_name usage - 1.34. append_rpid_hf usage - 1.35. append_rpid_hf(prefix, suffix) usage - 1.36. is_rpid_user_e164 usage - 1.37. set_uri_user usage - 1.38. set_uri_host usage - 1.39. is_request usage - 1.40. is_reply usage - 1.41. is_gruu() usage - 1.42. is_supported() usage - 1.43. is_first_hop() usage - 1.44. sip_p_charging_vector() usage - 1.45. contact_param_encode usage - 1.46. contact_param_decode usage - 1.47. contact_param_decode_ruri usage - 1.48. contact_param_rm usage - 1.49. hdr_date_check usage + 1.1. Set options_accept parameter + 1.2. Set options_accept_encoding parameter + 1.3. Set contact_flds_separator parameter + 1.4. Set options_accept_language parameter + 1.5. Set options_support parameter + 1.6. rpid_prefix parameter example + 1.7. rpid_suffix parameter example + 1.8. rpid_avp parameter example + 1.9. options_reply usage + 1.10. is_user usage + 1.11. has_totag usage + 1.12. uri_param usage + 1.13. uri_param usage + 1.14. uri_param_any usage + 1.15. add_uri_param usage + 1.16. add_uri_param usage + 1.17. uri_param_rm usage + 1.18. tel2sip usage + 1.19. is_e164 usage + 1.20. is_uri_user_e164 usage + 1.21. is_uri usage + 1.22. is_tel_number usage + 1.23. is_numeric usage + 1.24. is_alphanum usage + 1.25. is_alphanumex usage + 1.26. encode_contact usage + 1.27. decode_contact usage + 1.28. decode_contact_header usage + 1.29. cmp_uri usage + 1.30. cmp_aor usage + 1.31. cmp_hdr_name usage + 1.32. append_rpid_hf usage + 1.33. append_rpid_hf(prefix, suffix) usage + 1.34. is_rpid_user_e164 usage + 1.35. set_uri_user usage + 1.36. set_uri_host usage + 1.37. is_request usage + 1.38. is_reply usage + 1.39. is_gruu() usage + 1.40. is_supported() usage + 1.41. is_first_hop() usage + 1.42. sip_p_charging_vector() usage + 1.43. contact_param_encode usage + 1.44. contact_param_decode usage + 1.45. contact_param_decode_ruri usage + 1.46. contact_param_rm usage + 1.47. hdr_date_check usage Chapter 1. Admin Guide @@ -177,58 +173,56 @@ Chapter 1. Admin Guide 3. Parameters - 3.1. ring_timeout (int) - 3.2. options_accept (string) - 3.3. options_accept_encoding (string) - 3.4. contact_flds_separator (string) - 3.5. options_accept_language (string) - 3.6. options_support (string) - 3.7. rpid_prefix (string) - 3.8. rpid_suffix (string) - 3.9. rpid_avp (string) + 3.1. options_accept (string) + 3.2. options_accept_encoding (string) + 3.3. contact_flds_separator (string) + 3.4. options_accept_language (string) + 3.5. options_support (string) + 3.6. rpid_prefix (string) + 3.7. rpid_suffix (string) + 3.8. rpid_avp (string) 4. Functions - 4.1. ring_insert_callid() - 4.2. options_reply() - 4.3. is_user(username) - 4.4. has_totag() - 4.5. uri_param(param) - 4.6. uri_param(param,value) - 4.7. uri_param_any(param) - 4.8. add_uri_param(param) - 4.9. get_uri_param(name, var) - 4.10. uri_param_rm(param) - 4.11. tel2sip(uri, hostpart, result) - 4.12. is_e164(pseudo-variable) - 4.13. is_uri_user_e164(pseudo-variable) - 4.14. is_uri(pseudo-variable) - 4.15. is_tel_number(tval) - 4.16. is_numeric(tval) - 4.17. is_alphanum(tval) - 4.18. is_alphanumex(tval, eset) - 4.19. encode_contact(encoding_prefix,hostpart) - 4.20. decode_contact() - 4.21. decode_contact_header() - 4.22. cmp_uri(str1, str2) - 4.23. cmp_aor(str1, str2) - 4.24. cmp_hdr_name(str1, str2) - 4.25. append_rpid_hf() - 4.26. append_rpid_hf(prefix, suffix) - 4.27. is_rpid_user_e164() - 4.28. set_uri_user(uri, user) - 4.29. set_uri_host(uri, host) - 4.30. is_request() - 4.31. is_reply() - 4.32. is_gruu([uri]) - 4.33. is_supported(option) - 4.34. is_first_hop([mode]) - 4.35. sip_p_charging_vector(flags) - 4.36. contact_param_encode(pname, saddr) - 4.37. contact_param_decode(pname) - 4.38. contact_param_decode_uri(pname) - 4.39. contact_param_rm(pname) - 4.40. hdr_date_check(tdiff) + 4.1. options_reply() + 4.2. is_user(username) + 4.3. has_totag() + 4.4. uri_param(param) + 4.5. uri_param(param,value) + 4.6. uri_param_any(param) + 4.7. add_uri_param(param) + 4.8. get_uri_param(name, var) + 4.9. uri_param_rm(param) + 4.10. tel2sip(uri, hostpart, result) + 4.11. is_e164(pseudo-variable) + 4.12. is_uri_user_e164(pseudo-variable) + 4.13. is_uri(pseudo-variable) + 4.14. is_tel_number(tval) + 4.15. is_numeric(tval) + 4.16. is_alphanum(tval) + 4.17. is_alphanumex(tval, eset) + 4.18. encode_contact(encoding_prefix,hostpart) + 4.19. decode_contact() + 4.20. decode_contact_header() + 4.21. cmp_uri(str1, str2) + 4.22. cmp_aor(str1, str2) + 4.23. cmp_hdr_name(str1, str2) + 4.24. append_rpid_hf() + 4.25. append_rpid_hf(prefix, suffix) + 4.26. is_rpid_user_e164() + 4.27. set_uri_user(uri, user) + 4.28. set_uri_host(uri, host) + 4.29. is_request() + 4.30. is_reply() + 4.31. is_gruu([uri]) + 4.32. is_supported(option) + 4.33. is_first_hop([mode]) + 4.34. sip_p_charging_vector(flags) + 4.35. contact_param_encode(pname, saddr) + 4.36. contact_param_decode(pname) + 4.37. contact_param_decode_uri(pname) + 4.38. contact_param_rm(pname) + 4.39. hdr_date_check(tdiff) 5. Exported pseudo-variables @@ -243,12 +237,6 @@ Chapter 1. Admin Guide This module implement various functions and checks related to SIP message handling and URI handling. - It offers some functions related to handle ringing. In a parallel - forking scenario you get several 183s with SDP. You don't want that - your customers hear more than one ringtone or answer machine in - parallel on the phone. So its necessary to drop the 183 in this cases - and send a 180 instead. - This module also provides a function to answer OPTIONS requests which are directed to the server itself. This means an OPTIONS request which has the address of the server in the request URI, and no username in @@ -277,30 +265,16 @@ Chapter 1. Admin Guide 3. Parameters - 3.1. ring_timeout (int) - 3.2. options_accept (string) - 3.3. options_accept_encoding (string) - 3.4. contact_flds_separator (string) - 3.5. options_accept_language (string) - 3.6. options_support (string) - 3.7. rpid_prefix (string) - 3.8. rpid_suffix (string) - 3.9. rpid_avp (string) - -3.1. ring_timeout (int) - - Timeout value in seconds, define how long the call-id is stored in the - internal list kept for replacing 183 messages with 180. A reasonable - value is “30”. - - Default value is “0”. This means functionality is disabled. - - Example 1.1. Set ring_timeout parameter -... -modparam("siputils", "ring_timeout", 30) -... + 3.1. options_accept (string) + 3.2. options_accept_encoding (string) + 3.3. contact_flds_separator (string) + 3.4. options_accept_language (string) + 3.5. options_support (string) + 3.6. rpid_prefix (string) + 3.7. rpid_suffix (string) + 3.8. rpid_avp (string) -3.2. options_accept (string) +3.1. options_accept (string) This parameter is the content of the Accept header field. Note: it is not clearly written in RFC3261 if a proxy should accept any content @@ -309,12 +283,12 @@ modparam("siputils", "ring_timeout", 30) Default value is “*/*”. - Example 1.2. Set options_accept parameter + Example 1.1. Set options_accept parameter ... modparam("siputils", "options_accept", "application/*") ... -3.3. options_accept_encoding (string) +3.2. options_accept_encoding (string) This parameter is the content of the Accept-Encoding header field. Please do not change the default value because Kamailio does not @@ -322,12 +296,12 @@ modparam("siputils", "options_accept", "application/*") Default value is “”. - Example 1.3. Set options_accept_encoding parameter + Example 1.2. Set options_accept_encoding parameter ... modparam("siputils", "options_accept_encoding", "gzip") ... -3.4. contact_flds_separator (string) +3.3. contact_flds_separator (string) First char of this parameter is used as separator for encoding/decoding Contact header. @@ -340,7 +314,7 @@ Warning Default value is “*”. - Example 1.4. Set contact_flds_separator parameter + Example 1.3. Set contact_flds_separator parameter ... modparam("siputils", "contact_flds_separator", "-") ... @@ -348,7 +322,7 @@ modparam("siputils", "contact_flds_separator", "-") then an encoded uri might look sip:user-password-ip-port-protocol@PublicIP -3.5. options_accept_language (string) +3.4. options_accept_language (string) This parameter is the content of the Accept-Language header field. You can set any language code which you prefer for error descriptions from @@ -357,12 +331,12 @@ modparam("siputils", "contact_flds_separator", "-") Default value is “en”. - Example 1.5. Set options_accept_language parameter + Example 1.4. Set options_accept_language parameter ... modparam("siputils", "options_accept_language", "de") ... -3.6. options_support (string) +3.5. options_support (string) This parameter is the content of the Support header field, indicating SIP extensions. Please do not change the default value, because @@ -371,32 +345,32 @@ modparam("siputils", "options_accept_language", "de") Default value is “”. - Example 1.6. Set options_support parameter + Example 1.5. Set options_support parameter ... modparam("siputils", "options_support", "100rel") ... -3.7. rpid_prefix (string) +3.6. rpid_prefix (string) Prefix to be added to Remote-Party-ID header field just before the URI returned from either radius or database. Default value is “”. - Example 1.7. rpid_prefix parameter example + Example 1.6. rpid_prefix parameter example modparam("auth", "rpid_prefix", "Whatever <") -3.8. rpid_suffix (string) +3.7. rpid_suffix (string) Suffix to be added to Remote-Party-ID header field after the URI returned from either radius or database. Default value is “;party=calling;id-type=subscriber;screen=yes”. - Example 1.8. rpid_suffix parameter example + Example 1.7. rpid_suffix parameter example modparam("auth", "rpid_suffix", "@1.2.3.4>") -3.9. rpid_avp (string) +3.8. rpid_avp (string) Full AVP specification for the AVP which stores the RPID value. It used to transport the RPID value from authentication backend modules @@ -407,76 +381,52 @@ modparam("auth", "rpid_suffix", "@1.2.3.4>") Default value is “$avp(s:rpid)”. - Example 1.9. rpid_avp parameter example + Example 1.8. rpid_avp parameter example modparam("auth", "rpid_avp", "$avp(myrpid)") 4. Functions - 4.1. ring_insert_callid() - 4.2. options_reply() - 4.3. is_user(username) - 4.4. has_totag() - 4.5. uri_param(param) - 4.6. uri_param(param,value) - 4.7. uri_param_any(param) - 4.8. add_uri_param(param) - 4.9. get_uri_param(name, var) - 4.10. uri_param_rm(param) - 4.11. tel2sip(uri, hostpart, result) - 4.12. is_e164(pseudo-variable) - 4.13. is_uri_user_e164(pseudo-variable) - 4.14. is_uri(pseudo-variable) - 4.15. is_tel_number(tval) - 4.16. is_numeric(tval) - 4.17. is_alphanum(tval) - 4.18. is_alphanumex(tval, eset) - 4.19. encode_contact(encoding_prefix,hostpart) - 4.20. decode_contact() - 4.21. decode_contact_header() - 4.22. cmp_uri(str1, str2) - 4.23. cmp_aor(str1, str2) - 4.24. cmp_hdr_name(str1, str2) - 4.25. append_rpid_hf() - 4.26. append_rpid_hf(prefix, suffix) - 4.27. is_rpid_user_e164() - 4.28. set_uri_user(uri, user) - 4.29. set_uri_host(uri, host) - 4.30. is_request() - 4.31. is_reply() - 4.32. is_gruu([uri]) - 4.33. is_supported(option) - 4.34. is_first_hop([mode]) - 4.35. sip_p_charging_vector(flags) - 4.36. contact_param_encode(pname, saddr) - 4.37. contact_param_decode(pname) - 4.38. contact_param_decode_uri(pname) - 4.39. contact_param_rm(pname) - 4.40. hdr_date_check(tdiff) - -4.1. ring_insert_callid() - - Inserting the call-id in the internal list, which is checked when - further replies arrive. Any 183 reply that is received during the - timeout value will be converted to a 180 message with removed SDP body. - Please note that you need to set a positive ring_timeout value in order - to use this function. - - Note: the change of sip reply can be done only in cases when it is not - parsed too much before config execution, otherwise it fails. For - example, setting global parameter "log_prefix" can cause this function - to fail changing the replies. - - The function returns TRUE on success, and FALSE during processing - failures. - - This function can be used from REQUEST_ROUTE and FAILURE_ROUTE. - - Example 1.10. ring_insert_callid() usage -... -ring_insert_callid(); -... - -4.2. options_reply() + 4.1. options_reply() + 4.2. is_user(username) + 4.3. has_totag() + 4.4. uri_param(param) + 4.5. uri_param(param,value) + 4.6. uri_param_any(param) + 4.7. add_uri_param(param) + 4.8. get_uri_param(name, var) + 4.9. uri_param_rm(param) + 4.10. tel2sip(uri, hostpart, result) + 4.11. is_e164(pseudo-variable) + 4.12. is_uri_user_e164(pseudo-variable) + 4.13. is_uri(pseudo-variable) + 4.14. is_tel_number(tval) + 4.15. is_numeric(tval) + 4.16. is_alphanum(tval) + 4.17. is_alphanumex(tval, eset) + 4.18. encode_contact(encoding_prefix,hostpart) + 4.19. decode_contact() + 4.20. decode_contact_header() + 4.21. cmp_uri(str1, str2) + 4.22. cmp_aor(str1, str2) + 4.23. cmp_hdr_name(str1, str2) + 4.24. append_rpid_hf() + 4.25. append_rpid_hf(prefix, suffix) + 4.26. is_rpid_user_e164() + 4.27. set_uri_user(uri, user) + 4.28. set_uri_host(uri, host) + 4.29. is_request() + 4.30. is_reply() + 4.31. is_gruu([uri]) + 4.32. is_supported(option) + 4.33. is_first_hop([mode]) + 4.34. sip_p_charging_vector(flags) + 4.35. contact_param_encode(pname, saddr) + 4.36. contact_param_decode(pname) + 4.37. contact_param_decode_uri(pname) + 4.38. contact_param_rm(pname) + 4.39. hdr_date_check(tdiff) + +4.1. options_reply() This function checks if the request method is OPTIONS and if the request URI does not contain an username. If both is true the request @@ -495,7 +445,7 @@ ring_insert_callid(); This function can be used from REQUEST_ROUTE. - Example 1.11. options_reply usage + Example 1.9. options_reply usage ... if (uri==myself) { if ((method==OPTIONS) && (! uri=~"sip:.*[@]+.*")) { @@ -504,7 +454,7 @@ if (uri==myself) { } ... -4.3. is_user(username) +4.2. is_user(username) Check if the username in credentials matches the given username. @@ -513,27 +463,27 @@ if (uri==myself) { This function can be used from REQUEST_ROUTE. - Example 1.12. is_user usage + Example 1.10. is_user usage ... if (is_user("john")) { ... }; ... -4.4. has_totag() +4.3. has_totag() Check if To header field uri contains tag parameter. This function can be used from ANY_ROUTE. - Example 1.13. has_totag usage + Example 1.11. has_totag usage ... if (has_totag()) { ... }; ... -4.5. uri_param(param) +4.4. uri_param(param) Find if Request URI has a given parameter with no value @@ -542,14 +492,14 @@ if (has_totag()) { This function can be used from REQUEST_ROUTE. - Example 1.14. uri_param usage + Example 1.12. uri_param usage ... if (uri_param("param1")) { ... }; ... -4.6. uri_param(param,value) +4.5. uri_param(param,value) Find if Request URI has a given parameter with matching value @@ -559,14 +509,14 @@ if (uri_param("param1")) { This function can be used from REQUEST_ROUTE. - Example 1.15. uri_param usage + Example 1.13. uri_param usage ... if (uri_param("param1","value1")) { ... }; ... -4.7. uri_param_any(param) +4.6. uri_param_any(param) Find if Request URI has a given parameter with or without value. @@ -575,14 +525,14 @@ if (uri_param("param1","value1")) { This function can be used from REQUEST_ROUTE. - Example 1.16. uri_param_any usage + Example 1.14. uri_param_any usage ... if (uri_param_any("param1")) { ... } ... -4.8. add_uri_param(param) +4.7. add_uri_param(param) Add to RURI a parameter (name=value); @@ -591,12 +541,12 @@ if (uri_param_any("param1")) { This function can be used from REQUEST_ROUTE. - Example 1.17. add_uri_param usage + Example 1.15. add_uri_param usage ... add_uri_param("nat=yes"); ... -4.9. get_uri_param(name, var) +4.8. get_uri_param(name, var) Get the value of RURI parameter. @@ -606,12 +556,12 @@ add_uri_param("nat=yes"); This function can be used from REQUEST_ROUTE. - Example 1.18. add_uri_param usage + Example 1.16. add_uri_param usage ... get_uri_param("nat", "$var(nat)"); ... -4.10. uri_param_rm(param) +4.9. uri_param_rm(param) Remove parameter from Request URI. @@ -620,14 +570,14 @@ get_uri_param("nat", "$var(nat)"); This function can be used from REQUEST_ROUTE. - Example 1.19. uri_param_rm usage + Example 1.17. uri_param_rm usage ... if (uri_param_rm("param1")) { ... } ... -4.11. tel2sip(uri, hostpart, result) +4.10. tel2sip(uri, hostpart, result) Converts URI in first param (pseudo variable or string) to SIP URI, if it is a tel URI. If conversion was done, writes resulting SIP URI to @@ -646,7 +596,7 @@ if (uri_param_rm("param1")) { This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, BRANCH_ROUTE, or ONREPLY_ROUTE. - Example 1.20. tel2sip usage + Example 1.18. tel2sip usage ... # $ru: tel:+(34)-999-888-777 # $fu: sip:test@foo.com @@ -659,14 +609,14 @@ tel2sip("$ru", $fd", "$ru"); # $ru: sip:+12345678;ext=200;isub=+123-456@foo.com;user=phone ... -4.12. is_e164(pseudo-variable) +4.11. is_e164(pseudo-variable) Checks if string value of pseudo variable argument is an E164 number. This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, and LOCAL_ROUTE. - Example 1.21. is_e164 usage + Example 1.19. is_e164 usage ... if (is_e164("$fU")) { # Check From header URI user part ... @@ -677,13 +627,13 @@ if (is_e164("$avp(i:705)") { }; ... -4.13. is_uri_user_e164(pseudo-variable) +4.12. is_uri_user_e164(pseudo-variable) Checks if userpart of URI stored in pseudo variable is E164 number. This function can be used from ANY_ROUTE. - Example 1.22. is_uri_user_e164 usage + Example 1.20. is_uri_user_e164 usage ... if (is_uri_user_e164("$fu")) { # Check From header URI user part ... @@ -694,13 +644,13 @@ if (is_uri_user_e164("$avp(i:705)") { }; ... -4.14. is_uri(pseudo-variable) +4.13. is_uri(pseudo-variable) Checks if string value of pseudo variable argument is a valid uri. This function can be used from ANY_ROUTE. - Example 1.23. is_uri usage + Example 1.21. is_uri usage ... if (is_uri("$var(x)")) { # Check if variable contains a uri ... @@ -711,14 +661,14 @@ if (is_uri("$avp(i:705)") { }; ... -4.15. is_tel_number(tval) +4.14. is_tel_number(tval) Checks if the parameter value is a telephone number: starting with one optional +, followed by digits. The parameter can include variables. This function can be used from ANY_ROUTE. - Example 1.24. is_tel_number usage + Example 1.22. is_tel_number usage ... if (is_tel_number("$rU")) { # Test if R-URI user is telephone number ... @@ -728,35 +678,35 @@ if (is_tel_number("+24242424")) { } ... -4.16. is_numeric(tval) +4.15. is_numeric(tval) Checks if the parameter value consists solely of decimal digits. The parameter can include variables. This function can be used from ANY_ROUTE. - Example 1.25. is_numeric usage + Example 1.23. is_numeric usage ... if (is_numeric("$rU")) { # Test if R-URI user consists of decimal digits ... } ... -4.17. is_alphanum(tval) +4.16. is_alphanum(tval) Checks if the parameter value consists solely of decimal digits or alphabetic ASCII characters. The parameter can include variables. This function can be used from ANY_ROUTE. - Example 1.26. is_alphanum usage + Example 1.24. is_alphanum usage ... if (is_alphanum("$rU")) { ... } ... -4.18. is_alphanumex(tval, eset) +4.17. is_alphanumex(tval, eset) Checks if the value of parameter 'tval' consists solely of decimal digits, alphabetic ASCII characters and the characters in the second @@ -764,14 +714,14 @@ if (is_alphanum("$rU")) { This function can be used from ANY_ROUTE. - Example 1.27. is_alphanumex usage + Example 1.25. is_alphanumex usage ... if (is_alphanumex("$rU", "+.-_")) { ... } ... -4.19. encode_contact(encoding_prefix,hostpart) +4.18. encode_contact(encoding_prefix,hostpart) This function will encode uri-s inside Contact header in the following manner sip:username:password@ip:port;transport=protocol goes @@ -793,12 +743,12 @@ if (is_alphanumex("$rU", "+.-_")) { This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE. - Example 1.28. encode_contact usage + Example 1.26. encode_contact usage ... if (src_ip == 10.0.0.0/8) encode_contact("natted_client","1.2.3.4"); ... -4.20. decode_contact() +4.19. decode_contact() This function will decode the request URI. If the RURI is in the format sip:encoding_prefix*username*password*ip*port*protocol@hostpart it will @@ -811,12 +761,12 @@ if (src_ip == 10.0.0.0/8) encode_contact("natted_client","1.2.3.4"); This function can be used from REQUEST_ROUTE. - Example 1.29. decode_contact usage + Example 1.27. decode_contact usage ... if (uri =~ "^sip:natted_client") { decode_contact(); } ... -4.21. decode_contact_header() +4.20. decode_contact_header() This function will decode URIs inside Contact header. If the URI in the format sip:encoding_prefix*username*ip*port*protocol@hostpart it will @@ -829,7 +779,7 @@ if (uri =~ "^sip:natted_client") { decode_contact(); } This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE. - Example 1.30. decode_contact_header usage + Example 1.28. decode_contact_header usage ... reply_route[2] { ... @@ -838,13 +788,13 @@ reply_route[2] { } ... -4.22. cmp_uri(str1, str2) +4.21. cmp_uri(str1, str2) The function returns true if the two parameters matches as SIP URI. This function can be used from ANY_ROUTE. - Example 1.31. cmp_uri usage + Example 1.29. cmp_uri usage ... if(cmp_uri("$ru", "sip:kamailio@kamailio.org")) { @@ -852,14 +802,14 @@ if(cmp_uri("$ru", "sip:kamailio@kamailio.org")) } ... -4.23. cmp_aor(str1, str2) +4.22. cmp_aor(str1, str2) The function returns true if the two parameters matches as AoR. The parameters have to be SIP URIs. This function can be used from ANY_ROUTE. - Example 1.32. cmp_aor usage + Example 1.30. cmp_aor usage ... if(cmp_aor("$rU@KaMaIlIo.org", "sip:kamailio@$fd")) { @@ -867,14 +817,14 @@ if(cmp_aor("$rU@KaMaIlIo.org", "sip:kamailio@$fd")) } ... -4.24. cmp_hdr_name(str1, str2) +4.23. cmp_hdr_name(str1, str2) The function returns true (return code 1) if the two parameters matches as header names. This function can be used from ANY_ROUTE. - Example 1.33. cmp_hdr_name usage + Example 1.31. cmp_hdr_name usage ... if(cmp_hdr_name("$var(hname)", "From")) { @@ -882,7 +832,7 @@ if(cmp_hdr_name("$var(hname)", "From")) } ... -4.25. append_rpid_hf() +4.24. append_rpid_hf() Appends to the message a Remote-Party-ID header that contains header 'Remote-Party-ID: ' followed by the saved value of the SIP URI received @@ -893,14 +843,14 @@ if(cmp_hdr_name("$var(hname)", "From")) This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, BRANCH_ROUTE. - Example 1.34. append_rpid_hf usage + Example 1.32. append_rpid_hf usage ... append_rpid_hf(); # Append Remote-Party-ID header field ... -4.26. append_rpid_hf(prefix, suffix) +4.25. append_rpid_hf(prefix, suffix) - This function is the same as Section 4.25, “ append_rpid_hf()”. The + This function is the same as Section 4.24, “ append_rpid_hf()”. The only difference is that it accepts two parameters--prefix and suffix to be added to Remote-Party-ID header field. This function ignores rpid_prefix and rpid_suffix parameters, instead of that allows to set @@ -917,13 +867,13 @@ append_rpid_hf(); # Append Remote-Party-ID header field This function can be used from REQUEST_ROUTE, FAILURE_ROUTE, BRANCH_ROUTE. - Example 1.35. append_rpid_hf(prefix, suffix) usage + Example 1.33. append_rpid_hf(prefix, suffix) usage ... # Append Remote-Party-ID header field append_rpid_hf("", ";party=calling;id-type=subscriber;screen=yes"); ... -4.27. is_rpid_user_e164() +4.26. is_rpid_user_e164() The function checks if the SIP URI received from the database or radius server and will potentially be used in Remote-Party-ID header field @@ -933,68 +883,68 @@ append_rpid_hf("", ";party=calling;id-type=subscriber;screen=yes"); This function can be used from REQUEST_ROUTE. - Example 1.36. is_rpid_user_e164 usage + Example 1.34. is_rpid_user_e164 usage ... if (is_rpid_user_e164()) { # do something here }; ... -4.28. set_uri_user(uri, user) +4.27. set_uri_user(uri, user) Sets userpart of SIP URI stored in writable pseudo variable 'uri' to value of pseudo variable 'user'. This function can be used from ANY_ROUTE. - Example 1.37. set_uri_user usage + Example 1.35. set_uri_user usage ... $var(uri) = "sip:user@host"; $var(user) = "new_user"; set_uri_user("$var(uri)", "$var(user)"); ... -4.29. set_uri_host(uri, host) +4.28. set_uri_host(uri, host) Sets hostpart of SIP URI stored in writable pseudo variable 'uri' to value of pseudo variable 'host'. This function can be used from ANY_ROUTE. - Example 1.38. set_uri_host usage + Example 1.36. set_uri_host usage ... $var(uri) = "sip:user@host"; $var(host) = "new_host"; set_uri_host("$var(uri)", "$var(host)"); ... -4.30. is_request() +4.29. is_request() Return true if the SIP message is a request. This function can be used from ANY_ROUTE. - Example 1.39. is_request usage + Example 1.37. is_request usage ... if (is_request()) { ... } ... -4.31. is_reply() +4.30. is_reply() Return true if the SIP message is a reply. This function can be used from ANY_ROUTE. - Example 1.40. is_reply usage + Example 1.38. is_reply usage ... if (is_reply()) { ... } ... -4.32. is_gruu([uri]) +4.31. is_gruu([uri]) The function returns true if the uri is GRUU ('gr' parameter is present): 1 - pub-gruu; 2 - temp-gruu. @@ -1005,12 +955,12 @@ if (is_reply()) { This function can be used from ANY_ROUTE. - Example 1.41. is_gruu() usage + Example 1.39. is_gruu() usage ... if(is_gruu()) { ... } ... -4.33. is_supported(option) +4.32. is_supported(option) Function returns true if given option is listed in Supported header(s) (if any) of the request. Currently the following options are known: @@ -1018,12 +968,12 @@ if(is_gruu()) { ... } This function can be used from ANY_ROUTE. - Example 1.42. is_supported() usage + Example 1.40. is_supported() usage ... if (is_supported("outbound")) { ... } ... -4.34. is_first_hop([mode]) +4.33. is_first_hop([mode]) The function returns true if the proxy is first hop after the original sender based on a best effort estimation by checking Via and @@ -1048,26 +998,26 @@ if (is_supported("outbound")) { ... } This function can be used from ANY_ROUTE. - Example 1.43. is_first_hop() usage + Example 1.41. is_first_hop() usage ... if(is_first_hop()) { ... } ... if(is_first_hop_mode("1")) { ... } ... -4.35. sip_p_charging_vector(flags) +4.34. sip_p_charging_vector(flags) Manage the P-Charging-Vector header (RFC7315). The flags can be: 'r' - remove; 'g' - generate; 'f' - force (remove + generate). This function can be used from ANY_ROUTE. - Example 1.44. sip_p_charging_vector() usage + Example 1.42. sip_p_charging_vector() usage ... sip_p_charging_vector("g"); ... -4.36. contact_param_encode(pname, saddr) +4.35. contact_param_encode(pname, saddr) This function encodes URI inside Contact headers by building a new URI from 'saddr' parameter and adding a parameter with the name 'pname' @@ -1080,14 +1030,14 @@ sip_p_charging_vector("g"); This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE. - Example 1.45. contact_param_encode usage + Example 1.43. contact_param_encode usage ... if (is_method("REGISTER") and src_ip == 10.0.0.0/8) { contact_param_encode("ksu", "sip:1.2.3.4:5060;transport=tcp"); } ... -4.37. contact_param_decode(pname) +4.36. contact_param_decode(pname) This function decodes URI inside Contact headers by building a new URI from 'pname' parameter, decoding its value from Base64URL. @@ -1098,14 +1048,14 @@ if (is_method("REGISTER") and src_ip == 10.0.0.0/8) { This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE. - Example 1.46. contact_param_decode usage + Example 1.44. contact_param_decode usage ... if (is_method("REGISTER") and src_ip == 1.2.3.4) { contact_param_decode("ksu"); } ... -4.38. contact_param_decode_uri(pname) +4.37. contact_param_decode_uri(pname) This function decodes R-URI (request URI) by building a new R-URI from 'pname' parameter, decoding its value from Base64URL. @@ -1116,14 +1066,14 @@ if (is_method("REGISTER") and src_ip == 1.2.3.4) { This function can be used from REQUEST_ROUTE. - Example 1.47. contact_param_decode_ruri usage + Example 1.45. contact_param_decode_ruri usage ... if (is_method("INVITE") and src_ip == 1.2.3.4) { contact_param_decode_ruri("ksu"); } ... -4.39. contact_param_rm(pname) +4.38. contact_param_rm(pname) This function removes the parameter from the URIs inside the Contact headers. @@ -1133,14 +1083,14 @@ if (is_method("INVITE") and src_ip == 1.2.3.4) { This function can be used from REQUEST_ROUTE, ONREPLY_ROUTE. - Example 1.48. contact_param_rm usage + Example 1.46. contact_param_rm usage ... if (is_method("REGISTER") and src_ip == 1.2.3.4) { contact_param_rm("myparam"); } ... -4.40. hdr_date_check(tdiff) +4.39. hdr_date_check(tdiff) Returns true if sip message has Date header and its value is lower than 'NOW() - tdiff'. @@ -1151,7 +1101,7 @@ if (is_method("REGISTER") and src_ip == 1.2.3.4) { This function can be used from ANY_ROUTE. - Example 1.49. hdr_date_check usage + Example 1.47. hdr_date_check usage ... if (!hdr_date_check("10")) { sl_send_reply("403", "Outdated date");