The Dialogic Diva Software Development Kit (SDK) includes two samples that demonstrate how the channel status (up, down, activating, etc) can be read: ShowDeviceStatus and ShowDeviceStatusEvents.
These samples show how to read status information specific to digital (PRI/E1/T1 and ISDN BRI) Dialogic Diva Media Boards, but they do not address analog boards such as the Dialogic Diva Analog/4P Media Board.
This article describes a way to read analog-specific status messages. You can take the code in this article and add it to ShowDeviceStatus to make a version of the sample that works for both digital and analog boards.
First, you need to detect if a particular line device belongs to a Diva analog media board or a Diva digital media board:
The input parameter 'i' is the line device number. Dialog Diva Media Board line device numbers start with 1 and go up to the maximum value returned by DivaGetNumLineDevices.
Having identified a Diva analog media board, you can create a function that retrieves status information specific to Diva analog boards using the type DivaDST_PotsLineStatus.
A Diva Analog/4P Media Board (which has 4 separate analog phone line interfaces) appears in the program as a single line device that has four channels on the same line device. This is why the code iterates 'maxchans' times, to get the status for each channel in turn. The Diva Analog/8P Media Board has 8 channels on one line device, and the Diva Analog/2P Media Board has 2 channels on one line device.
The phone line status for line device 'i' can be retrieved by this line:
The 'Value' parameter selects the channel. 'Value' is a structure that contains PotsLineState.Channel (set before the function call) and PotsLineState.Status (returned by the function call).
Finally, you can add the new functionality to the program by changing the main loop to call different status functions depending on the line device type: