%docentities; ]> &adminguide;
Overview The dialog_ng module provides dialog awareness to the &kamailio; proxy. Its functionality is to keep track of the current dialogs, to offer information about them (like how many dialogs are active) or to manage them. The module exports several functions that could be used directly from scripts. The dialog_ng module extends the original dialog module by providing support for forked calling and early dialog termination. It is the intention that the dialog_ng module will eventually replace the dialog module. The module, via an internal API, also provide the foundation to build on top of it more complex dialog-based functionalities via other &kamailio; modules.
How it works To create the dialog associated to an initial request, the flag dlg_flag ( ) must be set before creating the corresponding transaction. The dialog is automatically destroyed when a BYE is received. In case of no BYE, the dialog lifetime is controlled via the default timeout (see default_timeout - ) and custom timeout (see timeout_avp - ). The dialog timeout is reset each time a sequential request passes.
Dialog profiling Dialog profiling is a mechanism that helps in classifying, sorting and keeping trace of certain types of dialogs, using whatever properties of the dialog (like caller, destination, type of calls, etc). Dialogs can be dynamically added in different (and several) profile tables - logically, each profile table can have a special meaning (like dialogs outside the domain, dialogs terminated to PSTN, etc). There are two types of profiles: with no value - a dialog simply belongs to a profile. (like outbound calls profile). There is no other additional information to describe the dialog's belonging to the profile; with value - a dialog belongs to a profile having a certain value (like in caller profile, where the value is the caller ID). The belonging of the dialog to the profile is strictly related to the value. A dialog can be added to multiple profiles in the same time. Profiles are visible (at the moment) in the request route (for initial and sequential requests) and in the branch, failure and reply routes of the original request.
Dependencies
&kamailio; Modules The following modules must be loaded before this module: TM - Transaction module RR - Record-Route module
External Libraries or Applications The following libraries or applications must be installed before running &kamailio; with this module loaded: None.
Parameters
<varname>enable_stats</varname> (integer) This function is currently not supported by the dialog_ng module. To be incorporated in the future.
<varname>hash_size</varname> (integer) The size of the hash table internally used to keep the dialogs. A larger table is much faster but consumes more memory. The hash size must be a power of two number. IMPORTANT: If dialogs' information should be stored in a database, a constant hash_size should be used, otherwise the restoring process will not take place. If you really want to modify the hash_size you must delete all table's rows before restarting the server. Default value is 4096. Set <varname>hash_size</varname> parameter ... modparam("dialog_ng", "hash_size", 1024) ...
<varname>rr_param</varname> (string) Name of the Record-Route parameter to be added with the dialog cookie. It is used for the fast dialog matching of sequential requests. Default value is did. Set <varname>rr_param</varname> parameter ... modparam("dialog_ng", "rr_param", "xyz") ...
<varname>dlg_flag</varname> (integer) Flag to be used for marking if a dialog should be constructed for the current request (this make sense only for initial requests). Default value is none. Set <varname>dlg_flag</varname> parameter ... modparam("dialog_ng", "dlg_flag", 4) ...
<varname>timeout_avp</varname> (string) The specification of an AVP that contain a custom timeout (in seconds) for the dialog. It may be used only in a request (initial or sequential) context Default value is none. Set <varname>timeout_avp</varname> parameter ... modparam("dialog_ng", "timeout_avp", "$avp(i:10)") ...
<varname>default_timeout</varname> (integer) The default dialog timeout (in seconds) if no custom one is set. Default value is 43200 (12 hours). Set <varname>default_timeout</varname> parameter ... modparam("dialog_ng", "default_timeout", 21600) ...
<varname>dlg_extra_hdrs</varname> (string) A string containing the extra headers (full format, with EOH) to be added in the requests generated by the module (like BYEs). Default value is NULL. Set <varname>dlf_extra_hdrs</varname> parameter ... modparam("dialog_ng", "dlg_extra_hdrs", "Hint: credit expired\r\n") ...
<varname>dlg_match_mode</varname> (integer) Deprecated - in the new dialog module we always match using DID ONLY
<varname>detect_spirals</varname> (integer) Whether spirals (i.e., messages routed through the proxy multiple times) should be detected or not. If set to 0, spirals will not be detected and result in the generation of a new, possibly dangling dialog structure per occurring spiral. If set to 1, spirals are detected and internally mapped to existing dialog structures. Default value is 1. Set <varname>detect_spirals</varname> parameter ... modparam("dialog_ng", "detect_spirals", 1) ...
<varname>db_url</varname> (string) Db storage not yet supported by dialog_ng - this to be done in future.
<varname>db_mode</varname> (integer) Db storage not yet supported by dialog_ng - this to be done in future.
<varname>db_update_period</varname> (integer) Db storage not yet supported by dialog_ng - this to be done in future.
<varname>db_fetch_rows</varname> (integer) Db storage not yet supported by dialog_ng - this to be done in future.
<varname>table_name</varname> (string) Db storage not yet supported by dialog_ng - this to be done in future.
<varname>profiles_with_value</varname> (string) List of names for profiles with values. Default value is empty. Set <varname>profiles_with_value</varname> parameter ... modparam("dialog", "profiles_with_value", "caller ; my_profile") ...
<varname>profiles_no_value</varname> (string) List of names for profiles without values. Default value is empty. Set <varname>profiles_no_value</varname> parameter ... modparam("dialog", "profiles_no_value", "inbound ; outbound") ...
<varname>bridge_controller</varname> (string) SIP address to be used in From header when initiating a call bridge. Default value is sip:controller@kamailio.org. Set <varname>bridge_controller</varname> parameter ... modparam("dialog", "bridge_controller", "sip:ctd@kamailio.org") ...
<varname>initial_cbs_inscript</varname> (string) This has been deprecated since dlg_manage has been removed.
Functions
<function moreinfo="none">set_dlg_profile(profile,[value])</function> Inserts the current dialog into a profile. Note that if the profile does not supports values, this will be silently discarded. Also, there is no check for inserting the same dialog in the same profile for multiple times. Meaning of the parameters is as follows: profile - name of the profile to be added to; value (optional) - string value to define the belonging of the dialog to the profile - note that the profile must support values. Pseudo-variables are supported. This function can be used from REQUEST_ROUTE, BRANCH_ROUTE, REPLY_ROUTE and FAILURE_ROUTE. <function>set_dlg_profile</function> usage ... set_dlg_profile("inbound_call"); set_dlg_profile("caller","$fu"); ...
<function moreinfo="none">unset_dlg_profile(profile,[value])</function> Removes the current dialog from a profile. Meaning of the parameters is as follows: profile - name of the profile to be removed from; value (optional) - string value to define the belonging of the dialog to the profile - note that the profile must support values. Pseudo-variables are supported. This function can be used from BRANCH_ROUTE, REPLY_ROUTE and FAILURE_ROUTE. <function>unset_dlg_profile</function> usage ... unset_dlg_profile("inbound_call"); unset_dlg_profile("caller","$fu"); ...
<function moreinfo="none">is_in_profile(profile,[value])</function> Checks if the current dialog belongs to a profile. If the profile supports values, the check can be reinforced to take into account a specific value - if the dialog was inserted into the profile for a specific value. If no value is passed, only the simply belonging of the dialog to the profile is checked. Note that if the profile does not supports values, this will be silently discarded. Meaning of the parameters is as follows: profile - name of the profile to be checked against; value (optional) - string value to further restrict the check. Pseudo-variables are supported. This function can be used from REQUEST_ROUTE, BRANCH_ROUTE, REPLY_ROUTE and FAILURE_ROUTE. <function>is_in_profile</function> usage ... if (is_in_profile("inbound_call")) { log("this request belongs to a inbound call\n"); } ... if (is_in_profile("caller","XX")) { log("this request belongs to a call of user XX\n"); } ...
<function moreinfo="none">get_profile_size(profile,[value],size)</function> Returns the number of dialogs belonging to a profile. If the profile supports values, the check can be reinforced to take into account a specific value - how many dialogs were inserted into the profile with a specific value. If no value is passed, only simply belonging of the dialog to the profile is checked. Note that if the profile does not supports values, this will be silently discarded. Meaning of the parameters is as follows: profile - name of the profile to get the size for; value (optional) - string value to further restrict the check. Pseudo-variables are supported; size - an AVP or script variable to return the profile size in. This function can be used from REQUEST_ROUTE, BRANCH_ROUTE, REPLY_ROUTE and FAILURE_ROUTE. <function>get_profile_size</function> usage ... if(get_profile_size("inbound_call","$avp(size)")) xlog("currently there are $avp(size) inbound calls\n"); ... if(get_profile_size("caller","$fu","$avp(size)")) xlog("currently, the user $fu has $avp(size) active outgoing calls\n"); ...
<function moreinfo="none">dlg_isflagset(flag)</function> Check if the dialog flag is set or not. Meaning of the parameters is as follows: flag - index of the flag - can be pseudo-variable. This function can be used from BRANCH_ROUTE, REQUEST_ROUTE, ONREPLY_ROUTE and FAILURE_ROUTE. <function>dlg_isflagset</function> usage ... if(dlg_isflagset("1")) { ... } ...
<function moreinfo="none">dlg_setflag(flag)</function> Set the dialog flag. Meaning of the parameters is as follows: flag - index of the flag - can be pseudo-variable. This function can be used from BRANCH_ROUTE, REQUEST_ROUTE, ONREPLY_ROUTE and FAILURE_ROUTE. <function>dlg_setflag</function> usage ... dlg_setflag("1"); ...
<function moreinfo="none">dlg_resetflag(flag)</function> Reset the dialog flag. Meaning of the parameters is as follows: flag - index of the flag - can be pseudo-variable. This function can be used from BRANCH_ROUTE, REQUEST_ROUTE, ONREPLY_ROUTE and FAILURE_ROUTE. <function>dlg_resetflag</function> usage ... redlg_setflag("1"); ...
<function moreinfo="none">dlg_terminate</function> Terminates a dialog. In dialog_ng module this function now includes support for early as well as confirmed dialogs. Meaning of the parameters is as follows: side - which side to terminate. It can be: caller, callee or both of them. reason - reason for termination. This function can be used from BRANCH_ROUTE, REQUEST_ROUTE, ONREPLY_ROUTE and FAILURE_ROUTE. <function>dlg_terminate</function> usage ... dlg_terminate("all", "Insufficient QoS"); ...
<function moreinfo="none">dlg_refer(side, address)</function> This function is currently not supported by the dialog_ng module. To be incorporated in the future.
<function moreinfo="none">dlg_manage()</function> This has been deprecated in dialog_ng. Instead set dialog flag for initial INVITE and Route-parameter-callback execution for within-dialog requests.
<function moreinfo="none">dlg_bridge(from, to, op)</function> This function is currently not supported by the dialog_ng module. To be incorporated in the future.
<function moreinfo="none">dlg_get(callid, ftag, ttag)</function> Search and set current dialog based on Call-ID, From-Tag and To-Tag parameters. Meaning of the parameters is as follows: callid - SIP call-id. ftag - SIP From tag. ttag - SIP To tag. This function can be used from BRANCH_ROUTE, REQUEST_ROUTE, ONREPLY_ROUTE and FAILURE_ROUTE. <function>dlg_get</function> usage ... if(dlg_get("abcdef", "123", "456")) { dlg_bye("all"); } ...
<function moreinfo="none">is_known_dlg()</function> This function is currently not supported by the dialog_ng module. To be incorporated in the future.
Exported statistics
<varname>active_dialogs</varname> This function is currently not supported by the dialog_ng module. To be incorporated in the future.
<varname>early_dialogs</varname> This function is currently not supported by the dialog_ng module. To be incorporated in the future.
<varname>processed_dialogs</varname> This function is currently not supported by the dialog_ng module. To be incorporated in the future.
<varname>expired_dialogs</varname> This function is currently not supported by the dialog_ng module. To be incorporated in the future.
<varname>failed_dialogs</varname> This function is currently not supported by the dialog_ng module. To be incorporated in the future.
MI Commands
<varname>dlg_list</varname> Lists the description of a dialog or of all dialogs (calls). If only one dialogs is to be listed, the dialog identifiers are to be passed as parameter (callid and fromtag). In dialog_ng module this also now also lists all dlg_out entries for early dialogs. Name: dlg_list Parameters: callid (optional) - callid if a single dialog to be listed. from_tag (optional, but cannot be present without the callid parameter) - from tag (as per initial request) of the dialog to be listed. Note that if the from_tag is not specified, only dialogs created by a request without a from tag are matched, which will only occur with broken clients and is thus a very rare situation. MI FIFO Command Format: :dlg_list:_reply_fifo_file_ _empty_line_ :dlg_list:_reply_fifo_file_ abcdrssfrs122444@192.168.1.1 AAdfeEFF33
<varname>dlg_list_ctx</varname> This function is currently not supported by the dialog_ng module. To be incorporated in the future.
<varname>dlg_end_dlg</varname> This function is currently not supported by the dialog_ng module. To be incorporated in the future.
<varname>dlg_terminate_dlg</varname> Terminates a singe dialog, identified by the call_id, ftag, ttag. In dialog_ng module this dialog can be terminated in the early or confirmed states. Name: dlg_terminate_dlg Parameters: callid - callid of the dialog to be terminated. ftag fromtag of dialog to be terminated. ttag totag of dialog to be terminated. Note: Works for confirmed and early dialogs. MI FIFO Command Format: :dlg_terminate_dlg:_reply_fifo_file_ abcdrssfrs122444@192.168.1.1 AAdfeEFF33 ftag-1234 t-tag1234
<varname>profile_get_size</varname> This function is currently not supported by the dialog_ng module. To be incorporated in the future.
<varname>profile_list_dlgs</varname> This function is currently not supported by the dialog_ng module. To be incorporated in the future.
<varname>dlg_bridge</varname> This function is currently not supported by the dialog_ng module. To be incorporated in the future.
Exported RPC Functions
<varname>dlg.list</varname> This function is currently not supported by the dialog_ng module. To be incorporated in the future.
<varname>dlg.list_ctx</varname> This function is currently not supported by the dialog_ng module. To be incorporated in the future.
<varname>dlg.dlg_list</varname> This function is currently not supported by the dialog_ng module. To be incorporated in the future.
<varname>dlg.dlg_list_ctx</varname> This function is currently not supported by the dialog_ng module. To be incorporated in the future.
<varname>dlg.end_dlg</varname> This function is currently not supported by the dialog_ng module. To be incorporated in the future.
<varname>dlg.profile_get_size</varname> This function is currently not supported by the dialog_ng module. To be incorporated in the future.
<varname>dlg.profile_list</varname> This function is currently not supported by the dialog_ng module. To be incorporated in the future.
<varname>dlg.bridge_dlg</varname> This function is currently not supported by the dialog_ng module. To be incorporated in the future.
Exported pseudo-variables
<varname>$DLG_count</varname> This function is currently not supported by the dialog_ng module. To be incorporated in the future.
<varname>$DLG_status</varname> This function is currently not supported by the dialog_ng module. To be incorporated in the future.
<varname>$DLG_lifetime</varname> This function is currently not supported by the dialog_ng module. To be incorporated in the future.
<varname>$dlg(...)</varname> This function is currently not supported by the dialog_ng module. To be incorporated in the future.
<varname>$dlg_ctx(...)</varname> This function is currently not supported by the dialog_ng module. To be incorporated in the future.
<varname>$dlg_var(key)</varname> This function is currently not supported by the dialog_ng module. To be incorporated in the future.