Count registration records under the same user
The following method is available from Brekeke SIP Server v3.1. With the method in dial plan rule Matchin Patterns, you can get the number of registration records with the same user name.
Syntax:
$regdb.recordnum( SIP-URI ) $regdb.recordnum( username )
Returns:
A number of current registration records with the defined string in the method
Example
Ex1: check if the number of registration records with user name 222 is greater or equals to 1
--------------------------------- [Matching Patterns] $request = ^REGISTER $regdb.recordnum( "222" ) = (.+) $math.ge("%1", "1") = true ---------------------------------
Ex2: check if the number of registration records in REGISTER request To header’s URI is greater or equals to 1
--------------------------------- [Matching Patterns] $request = ^REGISTER $regdb.recordnum( To ) = (.+) $math.ge("%1", "1") = true ---------------------------------