User Tools

Site Tools


cookbooks:devel:core

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
cookbooks:devel:core [2019/03/07 13:02]
mslehto [log_prefix] Expand text based on sr-users thread
cookbooks:devel:core [2019/05/14 19:23]
miconda [define]
Line 245: Line 245:
  
 Available directives: Available directives:
-  * #!define NAME - define a keyword +  * **#!define NAME** - define a keyword 
-  * #!define NAME VALUE - define a keyword with value +  * **#!define NAME VALUE** - define a keyword with value 
-  * #!ifdef NAME - check if a keyword is defined +  * **#!ifdef NAME** - check if a keyword is defined 
-  * #!ifndef - check if a keyword is not defined +  * **#!ifndef** - check if a keyword is not defined 
-  * #!else - switch to false branch of ifdef/ifndef region +  * **#!else** - switch to false branch of ifdef/ifndef region 
-  * #!endif - end ifdef/ifndef region +  * **#!endif** - end ifdef/ifndef region 
-  * #!trydef - add a define if not already defined +  * **#!trydef** - add a define if not already defined 
-  * #!redefine - force redefinition even if already defined+  * **#!redefine** - force redefinition even if already defined
  
 Among benefits: Among benefits:
Line 381: Line 381:
 Similar to **subst**, but in addition it adds a **#!define ID subst**. Similar to **subst**, but in addition it adds a **#!define ID subst**.
  
 +==== substdefs ====
 +
 +<code c>
 +#!substdefs "/ID/subst/"
 +</code>
 +
 +Similar to **subst**, but in addition it adds a **#!define ID "subst"** (note the difference from #!substdef that the value for define is enclosed in double quotes, useful when the define is used in a place for a string value).
 ===== Core Keywords ===== ===== Core Keywords =====
  
-Keywords specific to SIP messages which can be used mainly in '''if''' expressions.+Keywords specific to SIP messages which can be used mainly in ''if'' expressions.
  
 ==== af ==== ==== af ====
Line 866: Line 873:
 ==== flags ==== ==== flags ====
  
-**Alias name: bool**+SIP message (transaction) flags can have string names.  
 +The //name// for flags cannot be used for **branch** or **script flags**(*) 
 + 
 + 
 +<code c> 
 +... 
 +flags 
 +  FLAG_ONE   : 1, 
 +  FLAG_TWO   : 2; 
 +... 
 +</code> 
 + 
 +(*) The named flags feature was propagated from the source code merge back in 2008 and is not extensively tested. The recommended way of defining flags is using [[cookbooks:5.2.x:core#define|#!define]] (which is also valid for branch/script flags): 
 +<code c> 
 +#!define FLAG_NAME FLAG_BIT 
 +</code> 
 + 
  
 ==== force_rport ==== ==== force_rport ====
Line 1144: Line 1168:
 ==== log_prefix_mode ==== ==== log_prefix_mode ====
  
-If set to 0 (default), then log_prefix is evaluated when the sip message is received and then reused (recommended if the log_prefix has only variables that have same value for same message). This is the current behaviour of log_prefix evaluation.+Control if [[#log_prefix|log prefix]] is re-evaluated. 
 + 
 +If set to 0 (default), then log prefix is evaluated when the sip message is received and then reused (recommended if the **log_prefix** has only variables that have same value for same message). This is the current behaviour of **log_prefix** evaluation.
  
-If set to 1, then the log prefix is evaluated before/after each config action (needs to be set when the log_prefix has variables that are different based on the context of config execution, e.g., $cfg(line)).+If set to 1, then the log prefix is evaluated before/after each config action (needs to be set when the **log_prefix** has variables that are different based on the context of config execution, e.g., $cfg(line)).
  
 Example: Example:
Line 3104: Line 3130:
 <code c> <code c>
 reply_route { reply_route {
-  if(status=="128"") {+  if(status=="128") {
     drop;     drop;
   }   }
cookbooks/devel/core.txt · Last modified: 2022/04/11 17:10 by bkaufman