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
Next revision Both sides next revision
tutorials:faq:main [2017/08/14 10:27]
miconda
tutorials:faq:main [2018/05/08 08:31]
miconda [SIP Message Processing]
Line 47: Line 47:
 ??? Is it possible to reload Kamailio configuration file? ??? Is it possible to reload Kamailio configuration file?
  
-!!! No, you must restart after you update the configuration file.+!!! If you use native scripting language, you must restart after you update the configuration file.
  
 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).
  
 ??? What is the license of Kamailio? ??? What is the license of Kamailio?
Line 165: Line 167:
   * without applying changes   * without applying changes
  
-<code>+<code c>
 append_hf("X-Hdr: xyz\r\n"); append_hf("X-Hdr: xyz\r\n");
  
Line 177: Line 179:
   * with applying changes   * with applying changes
  
-<code>+<code c>
 append_hf("X-Hdr: xyz\r\n"); append_hf("X-Hdr: xyz\r\n");
  
Line 201: Line 203:
   * add X-Peer-ID header when sending somewhere else   * add X-Peer-ID header when sending somewhere else
  
-<code>+<code c>
 request_route { request_route {
   ...   ...
Line 232: Line 234:
 } }
 </code> </code>
 +
 +Very important is also to be aware that doing same operation many times in request_route is not overwriting the previous value, but combines them. For example, if you do two times uac_replace_from(), the From header can become corrupt. Like:
 +
 +<code c>
 +request_route {
 +  ...
 +  uac_replace_from("sip:test1@kamailio.org");
 +  uac_replace_from("sip:test2@kamailio.org");
 +  ...
 +}
 +</code>
 +
 +Results in From header having the URI: **sip:test1@kamailio.orgsip:test2@kamailio.org**. Again, use branch_route to do the operations if you need different From header for outgoing branches.
 +
  
 ??? How to remove a single header field when a header appears multiple times? ??? How to remove a single header field when a header appears multiple times?
Line 553: Line 569:
  
 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.
 +
 +??? How is the SIP request retransmission handled?
 +
 +!!! The next snippet is detecting retransmissions:
 +
 +<code c>
 +    # handle retransmissions
 +      if (!is_method("ACK")) {
 +          if(t_precheck_trans()) {
 +              t_check_trans();
 +              exit;
 +          }
 +          t_check_trans();
 +      }
 +</code>
 +
 +The **ACK** request is skipped because it doesn't have a SIP response, therefore it doesn't create a transaction, being forwarded in stateless mode.
 +
 +The function **t_precheck_trans()** returns true if the same SIP request is processed at that time by another Kamailio process, so in this case it is a retransmission. The inner **t_check_trans()** has the role of detecting if the SIP transaction was created by the other process, and if yes, send again the last SIP response of the transaction, when one was already sent out (a requirement from SIP specs). The **exit** is then used to finish the execution of the config file for that request.
 +
 +If the function **t_precheck_trans()** returns false, the SIP request is not under processing by another Kamailio process, but it can be the case that the request processing was finished, request being sent out in stateful mode, therefore **t_check_trans()** is used to see if a transaction is found in shared memory corresponding to the same request. If such transaction is found in shared memory, then **t_check_trans()** triggers internally the **exit** for configuration file execution.
 =?==== Troubleshooting ===== =?==== Troubleshooting =====
  
tutorials/faq/main.txt ยท Last modified: 2021/08/27 08:11 by miconda