Freetdm: exposed channel availability rate to user

This commit is contained in:
David Yat Sin 2010-12-15 16:42:47 -05:00
parent a24b9c9f68
commit 53346e4948
2 changed files with 20 additions and 0 deletions

View File

@ -1702,6 +1702,18 @@ static ftdm_status_t __inline__ get_best_rated(ftdm_channel_t **fchan, ftdm_chan
return FTDM_SUCCESS;
}
FT_DECLARE(int) ftdm_channel_get_availability(ftdm_channel_t *ftdmchan)
{
int availability = -1;
ftdm_channel_lock(ftdmchan);
if (ftdm_test_flag(ftdmchan->span, FTDM_SPAN_USE_AV_RATE)) {
availability = ftdmchan->availability_rate;
}
ftdm_channel_unlock(ftdmchan);
return availability;
}
FT_DECLARE(ftdm_status_t) ftdm_channel_open_by_group(uint32_t group_id, ftdm_direction_t direction, ftdm_caller_data_t *caller_data, ftdm_channel_t **ftdmchan)
{
ftdm_status_t status = FTDM_FAIL;

View File

@ -696,6 +696,14 @@ typedef enum {
/*! \brief Override the default queue handler */
FT_DECLARE(ftdm_status_t) ftdm_global_set_queue_handler(ftdm_queue_handler_t *handler);
/*! \brief Return the availability rate for a channel
* \param ftdmchan Channel to get the availability from
*
* \retval > 0 if availability is supported
* \retval -1 if availability is not supported
*/
FT_DECLARE(int) ftdm_channel_get_availability(ftdm_channel_t *ftdmchan);
/*! \brief Answer call */
#define ftdm_channel_call_answer(ftdmchan) _ftdm_channel_call_answer(__FILE__, __FUNCTION__, __LINE__, (ftdmchan))