There are two AD tables that are used to determine which application should be dispatched when a call arrives on a particular channel:
This table contains at most two applications per channel: the standard application and the startup application. The standard application is typically the only application used and is displayed for a channel if the user uses the display channel or display card commands. The startup application is used only when special processing is required when a new call arrives on a channel before the standard application starts up. In this case, an IRAPI application that performs the special processing is assigned to the channel as the startup application and the regular application is assigned as the standard application. When a new call arrives, the AD process uses the AD-API function iraQueryADTables to determine which application should be started. Since a startup application is assigned, AD irExecs the channel to the startup application. The startup application performs the special processing and then either irExecs the channel back to AD or uses the iraQueryADTables function itself (with the IRD_AD_STANDARD argument) to determine which application to irExec.
For example, a startup application could be used with the converse vector step for a DEFINITY ECS or compatible switch. Either or both of the standard and startup applications can be null or the special application ``*DNIS_SVC.'' The ``*DNIS_SVC'' application indicates that the AD DNIS/ANI table (described below) should be searched to find the application for this channel. If both the standard and startup applications are null, an error is reported in the error log.
This table contains an ordered list of dialed number identification service (DNIS) and automatic number identification (ANI) ranges and associated applications. This table is ordered primarily by DNIS ranges, most to least specific. If two entries have the same DNIS range but different ANI ranges, the entries are ordered by ANI ranges, most to least specific. The order of the AD DNIS/ANI table is important because AD uses the AD-API iraQueryADTables function to determine which application to start. If necessary, iraQueryADTables searches the AD DNIS/ANI table in order and returns the application for the first entry whose DNIS and ANI ranges contain the DNIS and ANI of the incoming call.
DNIS and ANI ranges
A range is considered most specific if it contains (or matches) only one number. A range is considered least specific if it contains (or matches) any possible number. The notation for DNIS and ANI ranges is a:b, where a and b are positive integers and a <= b. Ranges can completely contain other ranges, but ranges cannot overlap to prevent ambiguity across the overlap ranges. For example, the set of ranges 4000:4000,3500:6000,0000:9999 is valid. But given the previous set of ranges, the range 4500:8000 is invalid because it overlaps the range 3500:6000.
The IRA_STR_RANGE structure contains the DNIS and ANI range information.
The iraSetStrRange(3IRAPI-AD) function sets the contents of this structure. Some AD-API functions take pointers to this structure as arguments.
Initializing AD tables
The AD tables are initialized at system startup. Typically, application developers should not initialize the AD tables themselves, but several functions are supplied if they are needed. The iraInitADTables function initializes both the AD Channel and DNIS/ANI tables, while the iraInitADChannel and iraInitADDnisani functions initialize only the AD Channel table or only the AD DNIS/ANI table, respectively. After initialization, all applications in the AD Channel table are set to NULL and the AD DNIS/ANI table is empty. Any previously existing application assignments are lost.The global parameter IRP_AD_MODE must be set to IRD_AD_READWRITE to initialize the AD tables; otherwise, the functions return an IRER_PERMISSION error.
Querying AD tables
The iraQueryADTables and iraQueryADDnisani functions can determine which application should be started in response to a new call arrival. The iraQueryADTables function uses both the AD Channel table and the AD DNIS/ANI table to determine the application, while the iraQueryADDnisani function only uses the AD DNIS/ANI table.
A parameter passed into the iraQueryADTables function influences its behavior. If the parameter is IRD_AD_STARTUP, the iraQueryADTables function looks at the startup application in the AD Channel table for the particular channel. If the application is not null and not ``*DNIS_SVC,'' it then returns this application. If the application is ``*DNIS_SVC,'' then the iraQueryADTables function searches the AD DNIS/ANI table to the find first entry that matches the DNIS and ANI for this call. If it finds an entry whose DNIS and ANI ranges match those of the call, it returns the application associated with the entry; otherwise, it returns an error. If the startup application is null, the iraQueryADTables function looks at the standard application for the channel.
If the parameter is IRD_AD_STANDARD or if the startup application is null for a particular channel, the iraQueryADTables function looks at the standard application for the channel. If the application is not null and not ``*DNIS_SVC,'' it then returns this application. If the application is "*DNIS_SVC'' or null, then the iraQueryADTables function searches the AD DNIS/ANI table to find the first entry that matches the DNIS and ANI for this call. If it finds an entry whose DNIS and ANI ranges match those of the call, it returns the application associated with the entry; otherwise, it returns an error.
Reading AD tables
Applications can read the contents of the AD Channel and DNIS/ANI tables by using the iraReadADChannel and iraReadADDnisani functions, respectively. The iraReadADDnisani function reads the AD DNIS/ANI table in order and return each entry one at a time. Subsequent calls to iraReadADDnisani returns the next entry. The iraRewindADDnisani function is used to reset (or rewind) the list, so that the next call to iraReadADDnisani returns the first entry in the list.
Changing AD tables
Applications can be assigned to a particular channel or for a particular DNIS/ANI range by using the iraAddADChannel and iraAddADDnisani functions. The global parameter IRP_AD_MODE must be set to IRD_AD_READWRITE to make changes to the AD tables; otherwise, the functions return an IRER_PERMISSION error.