Previous PageTable Of Contents../index.htmlIndexNext Page



12.5. Implementing Applications in an R4 on DM3 Fixed Routing Configuration

The following information describes how to develop applications for an R4 for DM3 fixed routing configuration, with a focus on modifying existing R4 API applications so that they can accommodate DM3 boards.

This information addresses general areas for migrating an existing R4 application to an R4 for DM3 application and provides examples from porting the existing Dialogic PANSR (polled asynchronous) Answering Machine demonstration program to R4 for DM3.

NOTE:
Although it is not reiterated throughout the following information, it is assumed that the information applies specifically to a fixed routing configuration and not a flexible routing configuration.

General information on DM3 clustering is available in Section 12.1. Fixed and Flexible Routing Configurations. The following information applies to coupled resource clusters, which are used in the fixed routing configuration.


Figure 4. Default DM3 Fixed Routing Cluster for QuadSpan DM/V960-4T1 and DM/V1200-4E1 Boards


Figure 5 shows a default DM3 cluster for DM/VF boards such as DM/VF240-T1 and DM/VF300-E1. Note the addition of a fax resource in the same cluster.


Figure 5. Default DM3 Fixed Routing Cluster with Fax Resource for DM/VF Boards


The SCbus resource is the DM3 resource that provides access to the CT Bus. As indicated in Figure 4 and Figure 5, the only DM3 resource that has access to the SCbus resource is the Telephony Service Channel (TSC). None of the other resources have access to the SCbus resource and therefore cannot access the CT Bus directly.

NOTE:
In the following discussion, voice channel device and voice device refer to voice-capable or voice/fax-capable devices.

In R4 for DM3, the TSC resource instance is abstracted by the DTI timeslot device, or dtiBnTm, while the rest of the resource instances are all grouped and abstracted by the voice channel device, or dxxxBnCm.

The immediate consequence of this DM3 clustering scheme is that the DTI devices, dtiBnTm, have full access and provide full support to the R4 SCbus routing API. On the other hand, the voice devices, dxxxBnCm, do not have direct access to the CT Bus, hence the R4 voice resource SCbus routing API has no effect on the DM3 voice devices.

Note that even though the DM3 hardware uses the CT Bus, R4 for DM3 abstracts its functionality using the R4 SCbus routing API.

The preceding concepts present what are perhaps the most challenging aspects of porting an existing R4 application to R4 for DM3. Here are some points to note about this configuration:

R4 for DM3 applications can continue using SCbus routing functions on the DTI network interface device, dtiBnTm, because DM3 clusters do not affect their operation.

The application can therefore find the CT Bus transmit timeslot and attach (listen) or de-attach (unlisten) a DTI timeslot device as desired. This is of particular interest for those applications that wish to connect two network interface devices in conversation, so that an inbound caller can be connected in conversation with an outbound call.

R4 for DM3 applications should not attempt to perform SCbus routing on voice channel devices, since the API function call would fail with error code EDX_SH_MISSING, indicating that the operation is not possible on the device.

DM3 devices have similar characteristics to earlier-generation devices. The device must first be opened in order to obtain its handle, which can then be used to access the device functionality.

Since R4 for DM3 applications must use GlobalCall for call control, i.e., for call setup and tear-down, all Dialogic network interface devices must be opened using the gc_Open( ) or gc_OpenEx( ) function.

Once the call has been established, voice and or data streaming should be done using the Dialogic voice API. Functions such as dx_playiottdata( ), dx_reciottdata( ), and dx_dial( ) can be used. Of course, in order to do so, the voice device handle must be obtained. By the same token, in order to access the DTI routing functionality with functions such as dt_listen( ) and dt_unlisten( ), the corresponding DTI device handle must be obtained accordingly.

Application initialization differs depending on the types of hardware and the APIs used. The simplest hardware and API scenarios are those where the system contains only one type of board, so that the application uses either earlier-generation boards or DM3 boards but not both. In these cases, the initialization routine is the simplest in that it does not need to discover the board family type. See the following sections for descriptions and procedures for the stated API and hardware combinations:

Applications that want to make use of both earlier-generation and DM3 devices must have a way of differentiating what type of device is to be opened.

The dx_getctinfo( ) and dt_getctinfo( ) functions provide a programming solution to this problem. R4 for DM3 contains a new equate for the CT_DEVINFO.ct_devfamily, equal to CT_DFDM3. Only DM3 devices will have the ct_devfamily set to CT_DFDM3.

See the following sections for descriptions and procedures for the stated API and hardware combinations:

This scenario is one where a standard R4 application uses only earlier-generation boards. Standard R4 digital interface applications typically perform the following initialization routine:

NOTE:
Use the sr_getboardcnt( ) function with the class name set to DEV_CLASS_DTI and DEV_CLASS_VOICE to determine the number of network and voice boards in the system, respectively. In Linux, use SRL device mapper functions to return information about the structure of the system. These functions are described in the Voice Software Reference - Standard Run-time Library.
  1. Start/Initialize GlobalCall with gc_Start( ).
  2. Open a GlobalCall device using gc_Open( ).
  3. Open a DTI device using dt_open( ).
    NOTE:
    Step 3 might not be necessary in certain protocols where both the GlobalCall and DTI device handles are the same.
  4. Open a voice device using dx_open( ).
  5. Set up the SCbus full duplex routing between the DTI and voice devices using nr_scroute(FULL DUPLEX).
  6. Attach voice device and GlobalCall device using gc_Attach( ).
  7. Repeat steps 2 to 6 for each GlobalCall device.

This is necessary since digital interface timeslot devices and their corresponding voice channel devices are not attached nor routed to each other on the SCbus by default. This is true even for the default devices such as the first trunk timeslot and the first voice channel device for the same physical Span Card hardware.

This peculiar characteristic of earlier-generation Dialogic digital hardware, such as the Span Cards, forces the application to do the proper SCbus routing and attaching of the devices (steps 5 and 6 ).

This scenario is one where an R4 for DM3 application uses only DM3 boards.

SCbus routing and attaching of the devices is not necessary with DM3 hardware and the DM3 clustering scheme. The voice device and network interface timeslot that share the same DM3 cluster are permanently routed and attached to each other, and the voice device has no direct access to the CT Bus timeslots.

For the same reason, it is not possible to move audio from a voice device channel to a DTI network interface timeslot device when they do not share the same DM3 cluster. In other words, a dx_playiottdata( ) command over a specific device handle will result in audio being pumped to its corresponding DTI device that is within the same cluster.

In most cases, R4 for DM3 applications do not need to open the voice channel device and/or the network interface timeslot device directly using the voice and DTI APIs respectively, since it is neither necessary nor possible to attach both devices together from the host.

Furthermore, for the same reasons mentioned above, the gc_Open( ) device string should not indicate the name of the voice device channel. For example, the device name string for the gc_Open( ) function should look similar to the following:

Although it is unnecessary to specify the ISDN protocol for R4 on DM3 boards, it is specified in this example to retain compatibility with R4 on earlier-generation boards. The gc_Open( ) function will internally open the associated voice channel.

An R4 for DM3 digital interface application would typically perform the following initialization routine:

NOTE:
Use the sr_getboardcnt( ) function with the class name set to DEV_CLASS_DTI and DEV_CLASS_VOICE to determine the number of network and voice boards in the system, respectively. In Linux, use SRL device mapper functions to return information about the structure of the system. These functions are described in the Voice Software Reference - Standard Run-time Library.
  1. Start/Initialize GlobalCall with gc_Start( ).
  2. Open a GlobalCall timeslot device using gc_Open( ).
  3. Obtain an associated DTI timeslot device handle using gc_GetNetworkH( ).
  4. Obtain an associated voice channel device handle using gc_GetVoiceH( ).
  5. Repeat steps 2 to 4 for each GlobalCall timeslot device.

The following procedure shows how to initialize an application and perform device discovery when the application supports both DM3 and earlier-generation boards through the R4 GlobalCall API:

NOTE:
Use the sr_getboardcnt( ) function with the class name set to DEV_CLASS_DTI and DEV_CLASS_VOICE to determine the number of network and voice boards in the system, respectively. In Linux, use SRL device mapper functions to return information about the structure of the system. These functions are described in the Voice Software Reference - Standard Run-time Library.
  1. Start/Initialize GlobalCall with gc_Start( ).
  2. Open a GlobalCall timeslot device using gc_Open( ).
  3. Obtain an associated DTI timeslot device handle using gc_GetNetworkH( ).
  4. Call dt_getctinfo( ) and check CT_DEVINFO.ct_devfamily value:
  5. Repeat steps 2 to 4 for all GlobalCall timeslot devices.

This initialization routine will not work well for an application that uses the R4 DTI API for the earlier-generation network interface devices in addition to the R4 for DM3 GlobalCall API for DM3 devices. This is the typical case of a T-1 robbed-bit application developed prior to the availability of the GlobalCall US T-1 protocol.

The following procedure shows how to initialize an application and perform device discovery when the application supports both DM3 and earlier-generation boards through the R4 for DM3 GlobalCall API and the R4 DTI API, respectively:

NOTE:
Use the sr_getboardcnt( ) function with the class name set to DEV_CLASS_DTI and DEV_CLASS_VOICE to determine the number of network and voice boards in the system, respectively. In Linux, use SRL device mapper functions to return information about the structure of the system. These functions are described in the Voice Software Reference - Standard Run-time Library.
  1. Open first DTI timeslot (e.g., dtiB1T1) on the first trunk with dt_open( ).
  2. Call dt_getctinfo( ) and check CT_DEVINFO.ct_devfamily value.
  3. If ct_devfamily is CT_DFDM3, then flag all the DTI timeslot devices associated with the trunk as DM3 type.
  4. Close DTI device with dt_close( ).
  5. Repeat steps 1 to 4 for each trunk.
  6. Open first voice channel device on the first voice board in the system with dx_open( ).
  7. Call dx_getctinfo( ) and check CT_DEVINFO.ct_devfamily value.
  8. If ct_devfamily is CT_DFDM3, then flag all the voice channel devices associated with the board as DM3 type.
  9. Close voice channel with dx_close( ).
  10. Repeat steps 6 to 9 for each voice board.
  11. For those voice and DTI devices not identified as DM3 devices, proceed with the standard initialization process for earlier-generation boards as performed in the original application. (If using GlobalCall with these earlier-generation boards, follow the initialization in Section GlobalCall API with Earlier-Generation Boards Only.)
  12. For those voice and DTI devices identified as DM3 devices, proceed with the initialization as described in Section GlobalCall API with DM3 Boards Only (Fixed Routing).

The Dialogic Answering Machine Demonstration program (PANSR) is a sample demonstration program that uses the Dialogic R4 DTI and Voice APIs to simulate the operation of a simple household answering machine. This section describes the steps taken to port the existing PANSR demonstration program so that it can work with both earlier-generation and DM3 devices. The most important considerations when porting the code are included.

The PANSR demonstration program (hereafter referred to as "the demo") is an MFC GUI application that simulates a simple answering machine. The demo receives a call, plays an introduction prompt, and based on caller response, it either records a message or else plays a previously recorded message to the caller.

The original PANSR demo supports Analog, T-1 E&M robbed-bit, as well as a CAS E-1 protocol, and supports Span Cards and D/4x boards.

The main differences between standard R4 and R4 for DM3 are call control. The following table gives a brief explanation of how to convert an analog network interface call control to use GlobalCall.


Table 20. Porting Analog Call Control to GlobalCall (Fixed Routing)

Call State

R4 Functions

GlobalCall Functions

System initialization

dx_open( )

gc_Start( )
gc_Open( ) or gc_OpenEx( )
gc_GetNetworkH( )
gc_GetVoiceH( )

Note: After gc_Open( ) or gc_OpenEx( ), the application must wait for a GCEV_UNBLOCKED event before proceeding with a call (make call or wait call).

Wait for inbound call

Enable CST event mask DE_RINGS by calling dx_setevtmsk( )

Wait for TDX_CST event

gc_WaitCall( )

Wait for event GCEV_OFFERED

Answer inbound call

dx_sethook( ) with DX_OFFHOOK

gc_AcceptCall( )
gc_AnswerCall( )

Drop a call

dx_sethook( ) with DX_ONHOOK

gc_DropCall( )
gc_ReleaseCall( )

Make outbound call

dx_sethook( ) with DX_OFFHOOK
dx_dial( )

gc_MakeCall( )

Wait for disconnect

TDX_CST event of DE_LCOFF

GlobalCall event GCEV_DISCONNECTED

The PANSR demo provides support for both earlier-generation and DM3 devices. For earlier-generation devices, the demo works the same as the previous version, but for DM3 devices, GlobalCall is adopted for call control. In order to determine if a device is an earlier-generation device or a DM3 device, the demo retrieves the device family information for all DTI and voice devices and stores the information in a global structure array for later reference.

The following code segment shows how to retrieve the family information for each board.

Based on the family information, the application can be customized to take advantage of the features for the type of board.

When the PANSR demo is executed on a system containing DM3 devices, GlobalCall must be initialized before opening the devices. If the PANSR demo is executed on a system containing earlier-generation devices, this step is skipped.

The following code segment shows how to initialize GlobalCall:

For earlier-generation devices, the PANSR demo opens voice devices and DTI devices with dx_open( ) and dt_open( ). If SCbus routing was selected as an option at the beginning of the demo, the demo calls the SCbus routing function nr_scroute( ) to route voice resources to DTI devices.

NOTE:
If the PANSR demo finds DM3 devices, then you must initialize GlobalCall before opening those devices.

If the PANSR demo is executed on a system containing DM3 devices, the demo uses GlobalCall gc_Open( ) with the device naming convention ":N_dtiBxTx:P_protocol" instead of dx_open( ) and dt_open( ) to open GlobalCall device handles. The demo calls gc_GetVoiceH( ) to retrieve the associated voice handle and stores it in a channel-specific structure for later reference. The protocol name is retrieved from the internal protocol setting which the developer specified in application settings. Because SCbus routing of voice resources is not supported in the DM3 fixed routing configuration, the SCbus routing procedure for DM3 devices is skipped.

The following segment shows how to open GlobalCall devices and retrieve associated voice devices.

The SRL event processing routine waits for any SRL event by calling sr_waitevt( ). For systems containing DM3 devices, the PANSR demo calls gc_GetMetaEvent( ) to process GlobalCall-specific events. Otherwise, sr_getevtdev( ) and sr_getevtdatap( ) are used to retrieve the appropriate information.

The structure METAEVENT, filled by gc_GetMetaEvent( ), contains all necessary event data for event processing, including the SRL event type, event handle and additional event data.

The following code segment shows how to process SRL events:

For earlier-generation devices, the PANSR demo relies on various interface-specific events to recognize an incoming call. On boards with an analog network interface, the demo waits for a TDX_CST event with DE_RINGS cst_event data. On boards with a digital network interface, the demo waits for changes in the E-1 or T-1 digital signal.

For DM3 devices, the demo calls gc_WaitCall( ) to initialize a "wait for incoming call" state. An incoming call is indicated by a GlobalCall event GCEV_OFFERED.

The following code segment shows how to initialize call waiting in asynchronous mode:

The incoming call is reported by the GlobalCall event GCEV_OFFERED.

On boards with an analog network interface, the demo calls dx_sethook( ) to go off hook. On earlier-generation boards with a digital network interface, the demo calls dt_settssigsim( ) to set digital signals indicating that the incoming call is answered.

For DM3 devices, the demo does the following:

  1. Calls gc_GetMetaEvent( ) to fill the METAEVENT structure with data.
  2. Calls gc_GetCRN( ) to retrieve the CRN (Call Reference Number).
  3. Optionally, calls gc_AcceptCall( ) to accept the incoming call, waits for the GlobalCall event GCEV_ACCEPT to indicate the completion of call acceptance. This indicates that the line is ringing.
  4. Calls gc_AnswerCall( ) to answer the incoming call. The completion of call answering is indicated by GCEV_ANSWERED.

The following code segment shows how to answer an incoming call in asynchronous mode:

After the call is answered, the call may be disconnected at any time. For earlier-generation devices, depending upon the network interface of the device, when a call is disconnected, the PANSR demo is notified. On boards with an analog network interface, the notification is a TDX_CST event in which the cst_event is DE_LCOFF. On earlier-generation boards with a digital network interface, the notification is through digital signaling.

For DM3 devices, the call disconnection is notified by the GlobalCall event GCEV_DISCONNECTED.

For earlier-generation devices, the PANSR demo drops a call in according to the network interface of the device. On boards with an analog network interface, the demo calls dx_sethook( ) to go on hook. On boards with a digital network interface, the demo calls dt_settssigsim( ) to transmit digital signals to drop the call.

For DM3 devices, the demo calls gc_DropCall( ) to drop the call. The completion of call dropping is indicated by the GlobalCall event GCEV_DROPCALL. After the call is dropped, the demo calls gc_ReleaseCall( ) to release the call completely.

The following code segment shows how to receive a call disconnect event and drop the call in asynchronous mode.

In application clean-up, the PANSR demo closes all opened devices. If GlobalCall was started, the demo calls gc_Stop( ) to stop GlobalCall.

This is a topic not covered in the implementation of the PANSR demo, but is presented here to give information about how to make outbound calls using GlobalCall for DM3 devices.

For earlier-generation devices, analog network interface devices use dx_sethook( ) and dx_dial( ) with or without call analysis to make an outbound call, while digital network interface devices use dt_settssigsim( ) and corresponding call processing signaling to make an outbound call.

For DM3 devices, the program should use gc_MakeCall( ) to make a call. After a call is established or has failed to connect, the program will be informed by the GlobalCall events such as GCEV_CONNECTED, GCEV_ALERTING, or GCEV_DISCONNECTED.


Previous PageTable Of ContentsTop Of PageIndexNext Page

Click here to contact Dialogic Customer Engineering

Copyright 2002, Intel Corporation
All rights reserved
This page generated February, 2002