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 [2018/05/08 08:23]
miconda [General]
tutorials:faq:main [2019/11/19 15:52]
miconda
Line 55: Line 55:
 ??? What is the license of Kamailio? ??? What is the license of Kamailio?
  
-!!! Kamailio is an open source application licensed under GNU Public License version 2 (aka GPLv2). It can be used for free "as in beer".+!!! Kamailio is an open source application licensed under GNU Public License version 2 (aka GPLv2). It can be used for free "as in beer" on your infrastructure. Keep in mind that you need also distribute the source code of your changes, if you distribute it as a binary to your customer. For more information have a look to the [[https://www.gnu.org/licenses/old-licenses/gpl-2.0-faq.html.en|GPLv2 FAQ]].
  
 Starting with end of 2008, contributions to core and several modules are done under BSD license. That means parts of it can be extracted and used under BSD license terms. But over all, when used as one application, the use must follow the terms of GPLv2, because GPLv2 is viral.  Starting with end of 2008, contributions to core and several modules are done under BSD license. That means parts of it can be extracted and used under BSD license terms. But over all, when used as one application, the use must follow the terms of GPLv2, because GPLv2 is viral. 
Line 167: 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 179: 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 203: 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 234: 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 502: Line 516:
 ??? How to iterate through the items in a comma separated string? ??? How to iterate through the items in a comma separated string?
  
-!!! If you have a variable holding a string like "a,b,c,d" and want to get each character separately, you have to use a WHILE loop and {s.select,index,separator} transformationIf there is no value at the given index, then the transformation will return $nullthus you have to use a variable as index, incrementing it until you get a $null.+!!! If you have a variable holding a string like "a,b,c,d" and want to get each character separately, you have to use a WHILE loop with {s.count,separator} and {s.select,index,separator} transformations.
  
 Here is an example: Here is an example:
Line 509: Line 523:
 $var(x) = "a,b,c,d"; $var(x) = "a,b,c,d";
 $var(i) = 0; $var(i) = 0;
 +$var(n) = $(var(x){s.count,,});
  
-while( $(var(x){s.select,$var(i),,})!=$null ) {+while( $var(i<= $var(n) ) {
    xlog("token at position $var(i) is: $(var(x){s.select,$var(i),,})\n");    xlog("token at position $var(i) is: $(var(x){s.select,$var(i),,})\n");
    $var(i) = $var(i) + 1;    $var(i) = $var(i) + 1;
tutorials/faq/main.txt ยท Last modified: 2021/08/27 08:11 by miconda