# dtmGetBriTrunkStatus

Retrieves complete status and statistics for a digital BRI trunk.

#### Prototype

DWORD dtmGetBriTrunkStatus ( DTMHD dtmhd, DTM_BRI_TRUNK_STATUS *status, unsigned size)

Argument | Description
dtmhd | Handle to the trunk monitor object.
status | Pointer to the DTM_BRI_TRUNK_STATUS structure: typedef struct { DWORD size; /* size of this structure */ DWORD board; /* board number */ DWORD trunk; /* trunk number */ DWORD starttime; /* when counts started (time_t)*/ WORD state; /* state DTM_BRI_STATE_XX */ WORD type; /* mode TE or NT */ DWORD slips; /* slips accumulator */ DWORD errors; /* errors accumulator */ DWORD receives; /* receives accumulator */ DWORD transmits; /* transmits accumulator */ WORD b_channel1; /* B Channel 1 */ WORD b_channel2; /* B Channel 2 */ } DTM_BRI_TRUNK_STATUS ; Refer to the Details section for more information on these fields.
size | Size, in bytes, of the DTM_BRI_TRUNK_STATUS structure.

#### Return values

Return value | Description
SUCCESS |
CTAERR_INVALID_HANDLE | dtmhd is not a valid monitor handle.
CTAERR_SVR_COMM | Communication error in server environment.

#### Details

dtmGetBriTrunkStatus retrieves the digital trunk status from the DTM service. The DTM service caches the most recent status and error counters received from the board. dtmGetBriTrunkStatus retrieves the status and counters and stores them in a DTM_BRI_TRUNK_STATUS structure.

This is a synchronous function that copies data from the service context into the caller's buffer. The first DWORD contains the size of the returned structure.

The status structure that is stored in the service context is updated each time an event is received from the board. Use dtmRefreshTrunkStatus to force an event to be generated.

The physical layer of the NMS ISDN protocol stack must be initialized (with isdnStartProtocol) before using the dtmGetBriTrunkStatus function. Otherwise the data may not reflect a valid board status (in this case, the state field is equal to DTM_BRI_STATE_NO_USED). For more information, refer to the NMS ISDN Messaging API Developer's Reference Manual.

Other information specific to BRI trunks is stored in the type field and determines how the BRI trunk is used. The parameter value (DTM_BRI_TYPE_TE or DTM_BRI_TYPE_NT) describes whether the trunk is used in terminal (TE) or network (NT) mode. The value of the state field is also affected.

The following table lists the state field values for terminal (TE) mode:

Value | Definition
--- | ---
DTM_BRI_STATE_F1 | Inactive
DTM_BRI_STATE_F2 | Sensing
DTM_BRI_STATE_F3 | Deactivated
DTM_BRI_STATE_F4 | Awaiting signal
DTM_BRI_STATE_F5 | Identifying input
DTM_BRI_STATE_F6 | Synchronized
DTM_BRI_STATE_F7 | Activated
DTM_BRI_STATE_F8 | Lost framing

The following table lists the state field values for network (NT) mode:

Value | Definition
--- | ---
DTM_BRI_STATE_G1 | Deactivated
DTM_BRI_STATE_G2 | Pending activation
DTM_BRI_STATE_G3 | Activated
DTM_BRI_STATE_G4 | Pending deactivation

Note: For more details about trunk state values, refer to the ITU-T recommendation I.430.