Table of Contents
List of Examples
active_lifetime
parameterinit_lifetime
parameterfinish_lifetime
parametertimer_interval
parameterdlgs_init
usagedlgs_update
usagedlgs_count
usagedlgs_tags_add
usagedlgs_tags_rm
usagedlgs_tags_count
usagedlgs.list
usagedlgs.briefing
usagedlgs.get
usagedlgs.get
usagedlgs.stats
usageTable of Contents
This module tracks dialogs (active calls) in stateless mode and offers statistics about them.
The dialogs can be tagged and the number of dialogs with the same tag can be retrieved in configuration file.
The module aims to be a lightweight alternative to dialog module, to enable SIP server instances (such as an edge proxy or SBC) to know how many active calls they route, without being a call stateful proxy. The tracking of active calls is done without any dependency on other modules, in other words, it does not need the tm (transaction management) module.
The lifetime in seconds of an active dialog in memory. A dialog is considered active after the ACK of 200OK for INVITE.
Default value is 10800 (3 hours).
The lifetime in seconds of an initial dialog in memory. A dialog is in initial state from the moment of creation until it gets to active state. If the dialog stays longer in the initial state, then it is destroyed by the next timer cleanup.
Default value is 180 (3 minutes).
The lifetime in seconds of a finished dialog in memory. A dialog is finished if the initial INVITE was not answered or the BYE was received. Once this lifetime passes, the dialog record is removed from memory by the next timer cleanup.
Default value is 10 (seconds).
Start track the dialog corresponding to the current SIP message. It has to be used for INVITE messages.
This function can be used from REQUEST_ROUTE, BRANCH_ROUTE, ONREPLY_ROUTE, ONSEND_ROUTE.
Example 1.5. dlgs_init
usage
... onsend_route { ... if(is_method("INVITE")) { dlgs_init("$fu", "$tu", "my data"); } ... } ...
Update dialog state. It has to be used for SIP requests only, the SIP responses are handled automatically.
This function can be used from REQUEST_ROUTE, BRANCH_ROUTE, ONSEND_ROUTE.
Example 1.6. dlgs_update
usage
... request_route { ... if(is_method("ACK|BYE|CANCEL")) { dlgs_update(); } ... } ...
Return the number of dialogs matching the filter specified by the parameters. It does not count the dialogs that are finished (not answered or terminated with BYE).
The field parameter can be: 'src', 'dst', 'data' to specify what dialog attribute has to be used for matching. It can be also 'any' to get the count of all ongoing dialogs.
The op parameter can be: 'eq' - equal; 'ne' - not equal; 're' - regex; 'sw' - start with; 'fm' - fnmatch.
In case of error or no dialog matched, it returns -1 or other negative (false) value.
This function can be used from ANY_ROUTE.
Example 1.7. dlgs_count
usage
... request_route { ... $var(count) = dlgs_count("src", "eq", "$fu"); if($var(count) > 0) { # caller has ongoing dialogs } ... $var(allcalls) = dlgs_count("any", "eq", "*"); if($var(allcalls) > 0) { # there are ongoing dialogs } ... } ...
Add a tag to current dialog.
This function can be used from ANY_ROUTE.
Remove a tag from current dialog.
This function can be used from ANY_ROUTE.
List dialog records with fewer attributes per record.
Prototype: dlgs.get field op data
List first dialog record matching the filter. The parameters have the same meaning like those for dlgs_count(...).
Prototype: dlgs.getall field op data
List all dialog records matching the filter. The parameters have the same meaning like those for dlgs_count(...).