User Tools

Site Tools


tutorials:faq:main

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
tutorials:faq:main [2020/10/15 08:32]
miconda
tutorials:faq:main [2021/08/27 08:11] (current)
miconda [SIP Message Processing]
Line 51: Line 51:
 But note that many global parameters can be changed via RPC/MI commands without restart (e.g., TCP connecting timeout, debug level). Applying changes related to loaded modules or routing block require always a restart. But note that many global parameters can be changed via RPC/MI commands without restart (e.g., TCP connecting timeout, debug level). Applying changes related to loaded modules or routing block require always a restart.
  
-If you use a KEMI scripting language (Lua, Python, JavaScript, Squirrel), then you can reload the routing logic script without restarting Kamailio by issuing an RPC command (see KEMI interpreter modules documentation for more details: app_lua, app_python, app_python3, app_jsdt, app_sqlang).+If you use a KEMI scripting language (Lua, Python, JavaScript, Ruby, Squirrel), then you can reload the routing logic script without restarting Kamailio by issuing an RPC command (see KEMI interpreter modules documentation for more details: app_lua, app_python, app_python3, app_jsdt, app_ruby, app_sqlang).
  
 ??? What is the license of Kamailio? ??? What is the license of Kamailio?
Line 227: Line 227:
  
 The examples above were with assignments to $fU (can be other vars as well, such as $fu, $tU, $tu, ..), but it is the same behaviour when using functions such as uac_replace_from() or uac_replace_to(). The examples above were with assignments to $fU (can be other vars as well, such as $fu, $tU, $tu, ..), but it is the same behaviour when using functions such as uac_replace_from() or uac_replace_to().
 +
 +??? Why body or other parts of the SIP message appear multiple times?
 +
 +!!! It is practically the same reason as for multiple From/To parts.
 +
 +The configuration file does an operation that changes parts in the headers or body many times. For example, if the body has two concatenated IP addresses for media stream, then likely the rtpproxy function is used twice, or, if the SDP appears two time, then the rtpengine function is used two times.
 +
 +If the update has to be done many times, use **msg_apply_changes()** in between, otherwise refactor the config to perform the operation only once (e.g., the RTP relaying functions should be used in a branch_route block).
  
 ??? How to set different header values for each destination of a SIP request? ??? How to set different header values for each destination of a SIP request?
Line 360: Line 368:
  
 !!! No, //however// Kamailio can be configured to proxy media if needed.  !!! No, //however// Kamailio can be configured to proxy media if needed. 
-  * [[http://www.kamailio.org/docs/modules/stable/|See rtpproxy, iptrtpproxyand mediaproxy]]+  * [[http://www.kamailio.org/docs/modules/stable/|See rtpengine, rtpproxy, lrkproxyor mediaproxy]]
  
 ??? What codecs are supported by Kamailio? ??? What codecs are supported by Kamailio?
Line 606: Line 614:
  
 However, if return code is 0, the next action after function() is not executed. It can be used only of positive or negative response code. However, if return code is 0, the next action after function() is not executed. It can be used only of positive or negative response code.
 +
 +On the other hand, the pseudo-variables (including $rc) have to be compared as an integer, the rules for evaluating return code of the functions do not apply, for example:
 +
 +<code c>
 +$var(x) = 0;
 +if($var(x) == 0) {
 +  # do something
 +}
 +</code>
 +
 +To compare the return code of a function with a number is recommended to use the value stored in $rc, because the priority of the operators can convert function return code to internal-true or internal-false. Therefore the next approach should be used:
 +
 +<code c>
 +function_returns_four();
 +$var(rc4) = $rc;
 +if($var(rc4)==4) {
 +   # it goes here
 +} else {
 +   # it doesn't go here
 +}
 +...
 +function_returns_two();
 +$var(rc2) = $rc;
 +if($var(rc4)==$var(rc2)) {
 +   # it doesn't go here
 +} else {
 +   # it goes here
 +}
 +...
 +if (function_returns_four() && $rc ieq 6 ) {
 +   # it doesn't go here
 +} else if ($rc ieq 4) {
 +   # it goes here
 +} else {
 +   # it doesn't go here
 +}
 +</code>
 +
 +Note that $rc is overwritten by a new function call, therefore store its value in another variable (like $var(...)) if it is needed for longer time.
 +
 +For pseudo-variables, the non-zero value is evaluated to true and zero to false, for example:
 +
 +<code c>
 +$var(x) = 1;
 +if($var(x)) {
 +  # do something
 +}
 +</code>
  
 ??? How is the SIP request retransmission handled? ??? How is the SIP request retransmission handled?
tutorials/faq/main.1602743532.txt.gz ยท Last modified: 2020/10/15 08:32 by miconda