NAME
          iraQueryADTables, iraQueryADDnisani - - query Application
          Dispatch tables

     SYNOPSIS
          #include <irapi-ad.h>

          int iraQueryADTables(channel_id cid, int mode, AD_APPL
          *appl);

          int iraQueryADDnisani(int channel, int mode, const char
          *dnisstring, const char * anistring, AD_APPL *appl);

     DESCRIPTION
          The iraQueryADTables function allows an application to
          determine which application should be dispatched on the cid
          for dispatch mode mode.  appl must be the address of a
          AD_APPL structure.  The iraQueryADTables function first
          looks at the entry in the channel-based AD table for the
          channel belonging to the cid and dispatch mode mode.  If the
          entry is not NULL and the service name is not "*DNIS_SVC",
          then the entry is copied into the AD_APPL structure pointed
          to by appl.  If the entry is NULL or the service name is
          "*DNISANI_SVC", iraQueryADTables will search sequentially
          through the DNIS/ANI-based AD table for a entry matching the
          the DNIS and ANI of channel belonging to the cid.  If an
          entry that matches both the DNIS and ANI is found, the
          matching entry is copied into the AD_APPL structure pointed
          to by appl.  The DNIS and ANI of channel belonging to the
          cid is obtained by using irGetIEs(3IRAPI) (see
          irIE(3IRAPI)).

          The iraQueryADDnisani function performs the same function as
          irAQueryADTables, but instead of using irGetIEs(3IRAPI) to
          obtain the dnis and ani strings, the dnis and ani string are
          passed into the function as arguments.

     RETURN VALUE
          The functions return:

          IRR_OK if successful.

          IRR_FAIL on error.

     ERROR
          On error, irError is set as follows:

          IRER_INVALID if an invalid argument is passed in.

          IRER_NOTFOUND if no entry is found that matches the dnis-
          string and anistring.

          IRER_SYSERROR if a system error occurred, errno will be set
          accordingly.

     SEE ALSO
          IRAPI-AD(4IRAPI-AD), irIE(3IRAPI)

     VERSION
          This is version 11/25/02 of this man page.