Kamailio-开源SIP软交换平台

中国第一个专注Kamailio SIP 软交换技术分享平台

用户工具

站点工具


kex_kamailio_core_extensions_module_released

差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

kex_kamailio_core_extensions_module_released [2017/09/11 14:56] (当前版本)
james_zhu 创建
行 1: 行 1:
 +====== KEx Module ======
  
 +==== Daniel-Constantin Mierla ====
 +
 +asipto.com\\ ​
 +
 +''<​[[miconda@gmail.com|miconda@gmail.com]]>''​
 +
 +==== Ovidiu Sas ====
 +
 +VoIP Embedded, Inc.\\ ​
 +
 +=== Edited by ===
 +
 +==== Daniel-Constantin Mierla ====
 +
 +''<​[[miconda@gmail.com|miconda@gmail.com]]>''​
 +
 +=== Edited by ===
 +
 +==== Ovidiu Sas ====
 +
 +''<​[[osas@voipembedded.com.com|osas@voipembedded.com.com]]>''​
 +
 +Copyright © 2009 Daniel-Constantin Mierla
 +
 +Copyright © 2014 [[http://​www.voipembedded.com|VoIP Embedded, Inc.]]
 +
 +----
 +
 +**Table of Contents**
 +
 +  * **1. Admin Guide** ​
 +    * **1. Overview** ​
 +    * **2. Dependencies** ​
 +      * **2.1. Kamailio Modules** ​
 +      * **2.2. External Libraries or Applications** ​
 +    * **3. Functions** ​
 +      * **3.1. setsflag(flag)** ​
 +      * **3.2. issflagset(flag)** ​
 +      * **3.3. resetsflag(flag)** ​
 +      * **3.4. setbflag(flag [, branch])** ​
 +      * **3.5. isbflagset(flag [, branch])** ​
 +      * **3.6. resetbflag(flag [, branch])** ​
 +      * **3.7. setdsturi(uri)** ​
 +      * **3.8. resetdsturi()** ​
 +      * **3.9. isdsturiset()** ​
 +      * **3.10. pv_printf(var,​ str)** ​
 +      * **3.11. is_myself(uri)** ​
 +      * **3.12. setdebug(level)** ​
 +      * **3.13. resetdebug()** ​
 +      * **3.14. km_append_branch%%([%%uri])** ​
 +    * **4. RPC Commands** ​
 +      * **4.1. core.arg** ​
 +      * **4.2. core.kill** ​
 +      * **4.3. core.pwd** ​
 +      * **4.4. core.uptime** ​
 +      * **4.5. version** ​
 +      * **4.6. system.listMethods** ​
 +      * **4.7. pkg.stats** ​
 +      * **4.8. stats.get_statistics** ​
 +      * **4.9. stats.reset_statistics** ​
 +      * **4.10. stats.clear_statistics** ​
 +      * **4.11. mod.stats module_name/​all pkg/​shm/​all** ​
 +
 +**List of Examples**
 +
 +  * **1.1. setsflag usage** ​
 +  * **1.2. issflagset usage** ​
 +  * **1.3. resetsflag usage** ​
 +  * **1.4. setbflag usage** ​
 +  * **1.5. isbflagset usage** ​
 +  * **1.6. resetbflag usage** ​
 +  * **1.7. setdsturi usage** ​
 +  * **1.8. resetdsturi usage** ​
 +  * **1.9. isdsturiset usage** ​
 +  * **1.10. pv_printf usage** ​
 +  * **1.11. is_myself usage** ​
 +  * **1.12. setdebug usage** ​
 +  * **1.13. resetdebug usage** ​
 +
 +====== Chapter 1. Admin Guide ======
 +
 +**Table of Contents**
 +
 +  * **1. Overview** ​
 +  * **2. Dependencies** ​
 +    * **2.1. Kamailio Modules** ​
 +    * **2.2. External Libraries or Applications** ​
 +  * **3. Functions** ​
 +    * **3.1. setsflag(flag)** ​
 +    * **3.2. issflagset(flag)** ​
 +    * **3.3. resetsflag(flag)** ​
 +    * **3.4. setbflag(flag [, branch])** ​
 +    * **3.5. isbflagset(flag [, branch])** ​
 +    * **3.6. resetbflag(flag [, branch])** ​
 +    * **3.7. setdsturi(uri)** ​
 +    * **3.8. resetdsturi()** ​
 +    * **3.9. isdsturiset()** ​
 +    * **3.10. pv_printf(var,​ str)** ​
 +    * **3.11. is_myself(uri)** ​
 +    * **3.12. setdebug(level)** ​
 +    * **3.13. resetdebug()** ​
 +    * **3.14. km_append_branch%%([%%uri])** ​
 +  * **4. RPC Commands** ​
 +    * **4.1. core.arg** ​
 +    * **4.2. core.kill** ​
 +    * **4.3. core.pwd** ​
 +    * **4.4. core.uptime** ​
 +    * **4.5. version** ​
 +    * **4.6. system.listMethods** ​
 +    * **4.7. pkg.stats** ​
 +    * **4.8. stats.get_statistics** ​
 +    * **4.9. stats.reset_statistics** ​
 +    * **4.10. stats.clear_statistics** ​
 +    * **4.11. mod.stats module_name/​all pkg/​shm/​all** ​
 +
 +===== 1. Overview =====
 +
 +This module collects extensions from Kamailio core.
 +
 +Kamailio Core CookBook is available at: [[http://​kamailio.org/​dokuwiki/​|http://​kamailio.org/​dokuwiki/​]]
 +
 +===== 2. Dependencies =====
 +
 +==== 2.1. Kamailio Modules ====
 +
 +The following modules must be loaded before this module:
 +
 +  * No dependencies on other Kamailio modules. ​
 +
 +==== 2.2. External Libraries or Applications ====
 +
 +The following libraries or applications must be installed before running Kamailio with this module loaded:
 +
 +  * None. 
 +
 +===== 3. Functions =====
 +
 +==== 3.1. setsflag(flag) ====
 +
 +Set the script flag.
 +
 +Meaning of the parameters is as follows:
 +
 +  * flag - the index of the script flag to be set. Can be integer or pseudo-variable with integer value. ​
 +
 +This function can be used from ANY_ROUTE.
 +
 +**Example 1.1. ''​setsflag''​ usage**
 +
 +<​code>​
 +...
 +setsflag("​1"​);​
 +...
 +$var(flag) = 11;
 +setsflag("​$var(flag)"​);​
 +...
 +</​code>​
 +
 +\\ ==== 3.2. issflagset(flag) ====
 +
 +Return true of the script flag is set.
 +
 +Meaning of the parameters is as follows:
 +
 +  * flag - the index of the script flag to be tested. Can be integer or pseudo-variable with integer value. ​
 +
 +This function can be used from ANY_ROUTE.
 +
 +**Example 1.2. ''​issflagset''​ usage**
 +
 +<​code>​
 +...
 +if(issflagset("​1"​))
 +{
 +    ...
 +}
 +...
 +</​code>​
 +
 +\\ ==== 3.3. resetsflag(flag) ====
 +
 +Reset the script flag.
 +
 +Meaning of the parameters is as follows:
 +
 +  * flag - the index of the script flag to be reset. Can be integer or pseudo-variable with integer value. ​
 +
 +This function can be used from ANY_ROUTE.
 +
 +**Example 1.3. ''​resetsflag''​ usage**
 +
 +<​code>​
 +...
 +resetsflag("​1"​);​
 +...
 +</​code>​
 +
 +\\ ==== 3.4. setbflag(flag [, branch]) ====
 +
 +Set the branch flag.
 +
 +Meaning of the parameters is as follows:
 +
 +  * flag - the index of the branch flag to be set. Can be integer or pseudo-variable with integer value. ​
 +  * branch - the index of the branch whose flag to be set. Can be integer or pseudo-variable with integer value. If omitted, then branch 0 is used (R-URI). ​
 +
 +This function can be used from ANY_ROUTE.
 +
 +**Example 1.4. ''​setbflag''​ usage**
 +
 +<​code>​
 +...
 +setbflag("​1"​);​
 +...
 +$var(flag) = 11;
 +setbflag("​$var(flag)",​ "​1"​);​
 +...
 +</​code>​
 +
 +\\ ==== 3.5. isbflagset(flag [, branch]) ====
 +
 +Return true of the branch flag is set.
 +
 +Meaning of the parameters is as follows:
 +
 +  * flag - the index of the branch flag to be tested. Can be integer or pseudo-variable with integer value. ​
 +  * branch - the index of the branch whose flag to be set. Can be integer or pseudo-variable with integer value. If omitted, then branch 0 is used (R-URI). ​
 +
 +This function can be used from ANY_ROUTE.
 +
 +**Example 1.5. ''​isbflagset''​ usage**
 +
 +<​code>​
 +...
 +if(isbflagset("​1"​))
 +{
 +    ...
 +}
 +...
 +</​code>​
 +
 +\\ ==== 3.6. resetbflag(flag [, branch]) ====
 +
 +Reset the branch flag.
 +
 +Meaning of the parameters is as follows:
 +
 +  * flag - the index of the branch flag to be reset. Can be integer or pseudo-variable with integer value. ​
 +  * branch - the index of the branch whose flag to be set. Can be integer or pseudo-variable with integer value. If omitted, then branch 0 is used (R-URI). ​
 +
 +This function can be used from ANY_ROUTE.
 +
 +**Example 1.6. ''​resetbflag''​ usage**
 +
 +<​code>​
 +...
 +resetbflag("​1"​);​
 +...
 +</​code>​
 +
 +\\ ==== 3.7. setdsturi(uri) ====
 +
 +Set the destination address URI (outbound proxy address).
 +
 +Meaning of the parameters is as follows:
 +
 +  * uri - Valid SIP URI representing the address where to send the request. It must be a static string, no variables are evaluated at runtime. If you need to set outbound proxy address via a variable, use assginment to $du. 
 +
 +This function can be used from ANY_ROUTE.
 +
 +**Example 1.7. ''​setdsturi''​ usage**
 +
 +<​code>​
 +...
 +setdsturi("​sip:​10.0.0.10"​);​
 +...
 +</​code>​
 +
 +\\ ==== 3.8. resetdsturi() ====
 +
 +Reset the destination address URI (outbound proxy address).
 +
 +This function can be used from ANY_ROUTE.
 +
 +**Example 1.8. ''​resetdsturi''​ usage**
 +
 +<​code>​
 +...
 +resetdsturi();​
 +...
 +</​code>​
 +
 +\\ ==== 3.9. isdsturiset() ====
 +
 +Check if the destination address URI (outbound proxy address) is set.
 +
 +This function can be used from ANY_ROUTE.
 +
 +**Example 1.9. ''​isdsturiset''​ usage**
 +
 +<​code>​
 +...
 +if(isdsturiset())
 +{
 +   ...
 +}
 +...
 +</​code>​
 +
 +\\ ==== 3.10. pv_printf(var,​ str) ====
 +
 +Evalues the str and sets the resulting value to variable var. For backward compatibility reasons, the same function can be executed via '​avp_printf(var,​ str)'.
 +
 +Meaning of the parameters is as follows:
 +
 +  * var - name of a writable variable ​
 +  * str - string that may contain variables which will be evaluated at runtime. ​
 +
 +This function can be used from ANY_ROUTE.
 +
 +**Example 1.10. ''​pv_printf''​ usage**
 +
 +<​code>​
 +...
 +pv_printf("​$ru",​ "​sip:​$rU@$fd"​);​
 +pv_printf("​$avp(x)",​ "From: $fU - To: $tU");
 +...
 +</​code>​
 +
 +\\ ==== 3.11. is_myself(uri) ====
 +
 +Check if the parameter matches the '​myself'​ condition (i.e., is a local IP or domain).
 +
 +Meaning of the parameters is as follows:
 +
 +  * uri - Valid SIP URI or IP address to check against the list of local IP addresses or domains. The parameter value can contain pseudo-variables. ​
 +
 +This function can be used from ANY_ROUTE.
 +
 +**Example 1.11. ''​is_myself''​ usage**
 +
 +<​code>​
 +...
 +if(is_myself("​$fu"​)) {
 +    ...
 +}
 +...
 +</​code>​
 +
 +\\ ==== 3.12. setdebug(level) ====
 +
 +Set the debug log level per process.
 +
 +Meaning of the parameters is as follows:
 +
 +  * level - the debug log level to be set. Can be integer or pseudo-variable with integer value. ​
 +
 +This function can be used from ANY_ROUTE.
 +
 +**Example 1.12. ''​setdebug''​ usage**
 +
 +<​code>​
 +...
 +setdebug("​1"​);​
 +...
 +$var(level) = 2;
 +setdebug("​$var(level)"​);​
 +...
 +</​code>​
 +
 +\\ ==== 3.13. resetdebug() ====
 +
 +Reset the local debug log level back to the value of core parameter '​debug'​.
 +
 +This function can be used from ANY_ROUTE.
 +
 +**Example 1.13. ''​resetdebug''​ usage**
 +
 +<​code>​
 +...
 +resetdebug();​
 +...
 +</​code>​
 +
 +\\ ==== 3.14. km_append_branch%%([%%uri]) ====
 +
 +This function was replaced by append_branch() from corex module, starting with version 4.0.0.
 +
 +===== 4. RPC Commands =====
 +
 +==== 4.1. core.arg ====
 +
 +Print command line arguments.
 +
 +Name: core.arg
 +
 +Parameters: none.
 +
 +RPC Command Format:
 +
 +<​code>​
 +...
 +kamcmd core.arg
 +...
 +</​code>​
 +
 +==== 4.2. core.kill ====
 +
 +Kill the application.
 +
 +Name: core.kill
 +
 +Parameters: none.
 +
 +RPC Command Format:
 +
 +<​code>​
 +...
 +kamcmd core.kill
 +...
 +</​code>​
 +
 +==== 4.3. core.pwd ====
 +
 +Print working directory.
 +
 +Name: core.pwd
 +
 +Parameters: none.
 +
 +RPC Command Format:
 +
 +<​code>​
 +...
 +kamcmd core.pwd
 +...
 +</​code>​
 +
 +==== 4.4. core.uptime ====
 +
 +Print uptime.
 +
 +Name: core.uptime
 +
 +Parameters: none.
 +
 +RPC Command Format:
 +
 +<​code>​
 +...
 +kamcmd core.uptime
 +...
 +</​code>​
 +
 +==== 4.5. version ====
 +
 +Print version information.
 +
 +Name: core.version
 +
 +Parameters: none.
 +
 +RPC Command Format:
 +
 +<​code>​
 +...
 +kamcmd core.version
 +...
 +</​code>​
 +
 +==== 4.6. system.listMethods ====
 +
 +Print list of available RPC commands.
 +
 +Name: system.listMethods
 +
 +Parameters: none.
 +
 +RPC Command Format:
 +
 +<​code>​
 +...
 +kamcmd system.listMethods
 +...
 +</​code>​
 +
 +==== 4.7. pkg.stats ====
 +
 +Print private memory (pkg) usage statistics per process. It can take optinally a filter to print statistics only for a specific process or set of processes. If no filter is given, it prints statistics for all processes.
 +
 +The filter can be:
 +
 +  * pid value - print statistics for specific process pid. 
 +  * rank value - print statistics for specific process rank. 
 +  * index value - print statistics for specific index in process table. ​
 +
 +Examples:
 +
 +<​code>​
 +                kamcmd pkg.stats
 +                kamcmd pkg.stats pid 1234
 +                kamcmd pkg.stats rank 1
 +                kamcmd pkg.stats index 10
 +</​code>​
 +
 +==== 4.8. stats.get_statistics ====
 +
 +Print the list of available internal statistics.
 +
 +Parameters: statsid - which statistics to be printed. If set to '​all'​ then all statistics are printed; if set to '​statsgroup:'​ then all statistics in the group are printed; if set to '​statsname'​ then the statistics identified by the name is printed.
 +
 +Examples:
 +
 +<​code>​
 +                kamcmd stats.get_statistics all
 +                kamcmd stats.get_statistics core:
 +                kamcmd stats.get_statistics unsupported_methods
 +                kamcmd stats.get_statistics shmem: fwd_requests fwd_replies
 +</​code>​
 +
 +==== 4.9. stats.reset_statistics ====
 +
 +Reset internal statistics.
 +
 +Parameters: statsid - same as for get_statistics.
 +
 +Examples:
 +
 +<​code>​
 +                kamcmd stats.reset_statistics all
 +                kamcmd stats.reset_statistics core:
 +                kamcmd stats.reset_statistics unsupported_methods
 +                kamcmd stats.reset_statistics shmem: fwd_requests fwd_replies
 +</​code>​
 +
 +==== 4.10. stats.clear_statistics ====
 +
 +Return statistics and reset their value in one command.
 +
 +Parameters: statsid - same as for get_statistics.
 +
 +Examples:
 +
 +<​code>​
 +                kamcmd stats.reset_statistics all
 +                kamcmd stats.reset_statistics core:
 +                kamcmd stats.reset_statistics unsupported_methods
 +                kamcmd stats.reset_statistics shmem: fwd_requests fwd_replies
 +</​code>​
 +
 +==== 4.11. mod.stats module_name/​all pkg/shm/all ====
 +
 +Print private(pkg) or shared(shm) memory currently allocated a given module or by all modules.
 +
 +NOTE: Processing is done only when the command is issued and involves iterating throug the list of memory fragments and printing details about them.
 +
 +NOTE: Only the module functions that directly calls shm_alloc or pkg_alloc are taken into consideration.
 +
 +The first parameter can be one of the following:
 +
 +  * module_name - print statistics for specific module. Either a module name (like "​usrloc"​) or "​core"​ for the Kamailio core. 
 +  * all - print statistics for all modules that uses memory. ​
 +
 +The second parameter can be:
 +
 +  * pkg - print private (process) memory statistics. ​
 +  * shm - print shared memory statistics. ​
 +  * all - print both private and shared memory statistics. ​
 +
 +Examples:
 +
 +<​code>​
 +                kamcmd mod.stats core all
 +                kamcmd mod.stats userblacklist shm
 +                kamcmd mod.stats kex pkg
 +                kamcmd mod.stats all all
 +</​code>​
 +
 +Output:
 +
 +<​code>​
 +Module: kex
 +{
 +    // this is the pkg zone of the module
 +    // function_name(line_where_pkg_malloc_was_called):​ size_alloc'​ed_by_pkg_malloc
 +    init_rpc_uptime(74):​ 56
 +    Total: 56
 +}
 +{
 +    // this is the shm zone of the module
 +    // function_name(line_where_shm_malloc_was_called):​ size_alloc'​ed_by_shm_malloc
 +    pkg_proc_stats_init(79):​ 864
 +    Total: 864
 +}
 +</​code>​
kex_kamailio_core_extensions_module_released.txt · 最后更改: 2017/09/11 14:56 由 james_zhu