When configured for receiving inbound phone or fax calls, CopiaFacts processing varies considerably depending on the type of board or port in use.  This topic describes the basic processing steps which are performed.

1. Selection of a CopiaFacts line to handle the call

Each incoming call requires a free CopiaFacts line thread to handle it.  How that line is selected is the step that varies most widely between different boards.  It is important to note that there may be fewer free CopiaFacts lines than there are channels on which incoming calls may arrive.  It is particularly important to minimize the time needed for post-processing of calls after the connected switch has dropped the call: otherwise the next call may be delivered before the CopiaFacts line is free to receive it.  When possible, the call that cannot be handled will be rejected with a 'busy' reason code, and presumably will be retried later by the caller.

The following list outlines the selection process for each hardware type, following detection of an incoming call:

Analog Lines and Fax ModemsThe CopiaFacts line is permanently associated with a specific hardware channel and physical phone circuit, so the CopiaFacts line is automatically selected by the channel on which the call is received.
Brooktrout Digital BoardsThe Brooktrout API permanently associates each line with a device and channel, so the CopiaFacts line is automatically selected by the channel on which the call is received.
Diva Digital BoardsCopiaFacts scans all lines configured for inbound sequentially to find a free line.  If the variable DIVA_OFFERED_SCANCOUNT is between 1 and 10, the scan is performed this number of times (default 1), at intervals of about 250ms.  Unless a call control DLL is in use (see below) which has requested it be deferred, an Alert is immediately sent to the connected switch, acknowledging the call.
Dialogic Digital BoardsAll CopiaFacts telephony channels are scanned find a free channel.   Unless a call control DLL is in use (see below) which has requested it be deferred, an Alert is immediately sent to the connected switch, acknowledging the call.
BladeWareThe CopiaFacts line is selected by reference to the line reference returned by the API.  This reference indicates which CopiaFacts line initiated the wait-for-call that has been resolved by this incoming call.  For Sangoma channels, the wait-for-call will indicate the physical channel which must be used.
Fax ModemCopiaFacts is notified of the incoming call after the fax has been received.  The intervening steps are skipped and processing proceeds to select a user profile (2).

2. Obtaining Call Data

For digital calls, and for analog calls with supported CLI capability, the DNIS (dialed number) and ANI (caller number) are obtained from the call notification event as soon as possible after the call has been notified.  For Dialogic T1 Robbed-Bit calls, the call data cannot be obtained until after the call has been answered.

3. Call Control DLL

Where a customer-supplied Call Control DLL has been implemented, it is called at this time for all incoming calls other than T1 Robbed-Bit.  The Call Control DLL is passed the DNIS and ANI (and redirect information, if available) and can optionally modify these values before CopiaFacts continues call processing.  The DLL can also determine whether the call is to be answered, and if not, can specify a rejection cause value to be returned to the switch.

It is important that the DLL is written to return without delay.  If there is no possibility of delay, the DLL initialization can specify that the digital call is not to be acknowledged until after the DLL returns.

4.  Do-Not-Answer Check

If a global Do-Not-Answer file has been specified, the incoming ANI is looked up in it to determine if the call is to be rejected.

5.  Check for "Always Answer"

Some call types are answered before a user profile is selected:

BladeWareIf the flag is set in HDID Type (in CFHWL line properties) to use in-band DTMF for DNIS purposes, the call needs to be answered so that an audio path is established.  If the flag is not set, then the in-band DTMF is used instead for 'Software DID'.
Digital Lines with 'Use Default'If the line's HDID Type (set in CFHWL line properties) is an odd value (least-significant bit is set) then we proceed to answer the call before attempting to find a user profile to handle the call.  This bit-flag indicates that the default user profile can be selected if no specific user profile can be found for the call.

6.  Select User Profile (1)

At this stage we use the $dnis_scan parameters to parse the DNIS value and extract a numeric value which can be used (left-zero-filled) as the filename of the .USR file which is to control the processing of the call.  If no matching USR file is found, the call is rejected.  For more details, see Using Caller Number and Called Number.

7. Answer Call

Finally, we are ready to answer the call.  This establishes an audio path (or media path, for SIP calls) which can be used in further processing of the call.  At this time, T1 Robbed Bit DNIS and ANI is available, as is Dialogic analog CLI and BladeWare in-band DTMF.

8. Select User Profile (2)

If the User Profile has not already been selected, we use the $dnis_scan parameters to parse the DNIS value and extract a numeric value which can be used (left-zero-filled) as the filename of the .USR file which is to control the processing of the call.  If no matching USR file is found, we select the default user profile specified for the line.  For more details, see Using Caller Number and Called Number.  Before the user profile is loaded, if a Call Control DLL is in use which specified during initialization that it is to be called at this stage, its second entry-point is called as soon as the DNIS and ANI values have been parsed out of the available data: the DLL can modify these values if necessary.

9.  Resource Allocation and Call Setup

Once the USR profile has been selected, we know whether to process the call as a fax call or a voice call, or whether the decision should be deferred until a fax tone has been detected.

For Dialogic calls, an appropriate fax or voice resource is allocated and connected to the telephony channel over the SC-Bus.

For inbound fax calls, mailbox selection proceeds as described in the Inbound Fax topic.