Merge remote branch 'smgorig/master'

This commit is contained in:
Moises Silva
2010-09-24 14:15:32 -04:00
19 changed files with 708 additions and 512 deletions

View File

@@ -1277,7 +1277,13 @@ FT_DECLARE(const char *) ftdm_channel_get_state_str(const ftdm_channel_t *channe
/*! \brief For display debugging purposes you can display this string which describes the last channel internal state */
FT_DECLARE(const char *) ftdm_channel_get_last_state_str(const ftdm_channel_t *channel);
/*! \brief For display debugging purposes you can display this string which describes the last channel internal state */
/*! \brief For display debugging purposes you can display this string which describes the history of the channel
* \param The channel
* \return History string for the channel. You must free the string with ftdm_free
*/
FT_DECLARE(char *) ftdm_channel_get_history_str(const ftdm_channel_t *channel);
/*! \brief Initialize channel state for an outgoing call */
FT_DECLARE(ftdm_status_t) ftdm_channel_init(ftdm_channel_t *ftdmchan);
/*! \brief Initialize the library */
@@ -1301,6 +1307,12 @@ FT_DECLARE(void) ftdm_global_set_logger(ftdm_logger_t logger);
/*! \brief Set the default logger level */
FT_DECLARE(void) ftdm_global_set_default_logger(int level);
/*! \brief Set the directory to look for modules */
FT_DECLARE(void) ftdm_global_set_mod_directory(const char *path);
/*! \brief Set the directory to look for configs */
FT_DECLARE(void) ftdm_global_set_config_directory(const char *path);
/*! \brief Check if the FTDM library is initialized and running */
FT_DECLARE(ftdm_bool_t) ftdm_running(void);

View File

@@ -356,6 +356,15 @@ typedef struct {
} ftdm_dtmf_debug_t;
#endif
typedef struct {
const char *file;
const char *func;
int line;
ftdm_channel_state_t state;
ftdm_channel_state_t last_state;
ftdm_time_t time;
} ftdm_channel_history_entry_t;
/* 2^8 table size, one for each byte (sample) value */
#define FTDM_GAINS_TABLE_SIZE 256
struct ftdm_channel {
@@ -381,6 +390,8 @@ struct ftdm_channel {
ftdm_channel_state_t state;
ftdm_channel_state_t last_state;
ftdm_channel_state_t init_state;
ftdm_channel_history_entry_t history[10];
uint8_t hindex;
ftdm_mutex_t *mutex;
teletone_dtmf_detect_state_t dtmf_detect;
uint32_t buffer_delay;
@@ -425,6 +436,7 @@ struct ftdm_channel {
float txgain;
int availability_rate;
void *user_private;
ftdm_timer_id_t hangup_timer;
#ifdef FTDM_DEBUG_DTMF
ftdm_dtmf_debug_t dtmfdbg;
#endif

View File

@@ -44,8 +44,8 @@ extern "C" {
#define FTDM_MICROSECONDS_PER_SECOND 1000000
typedef struct ftdm_sched ftdm_sched_t;
typedef struct ftdm_timer ftdm_timer_t;
typedef void (*ftdm_sched_callback_t)(void *data);
typedef uint64_t ftdm_timer_id_t;
/*! \brief Create a new scheduling context */
FT_DECLARE(ftdm_status_t) ftdm_sched_create(ftdm_sched_t **sched, const char *name);
@@ -62,18 +62,22 @@ FT_DECLARE(ftdm_status_t) ftdm_sched_free_run(ftdm_sched_t *sched);
* \param name Timer name, typically unique but is not required to be unique, any null terminated string is fine (required)
* \param callback The callback to call upon timer expiration (required)
* \param data Optional data to pass to the callback
* \param timer The timer that was created, it can be NULL if you dont care,
* but you need this if you want to be able to cancel the timer with ftdm_sched_cancel_timer
* \param timer Timer id pointer to store the id of the newly created timer. It can be null
* if you do not need to know the id, but you need this if you want to be able
* to cancel the timer with ftdm_sched_cancel_timer
*/
FT_DECLARE(ftdm_status_t) ftdm_sched_timer(ftdm_sched_t *sched, const char *name,
int ms, ftdm_sched_callback_t callback, void *data, ftdm_timer_t **timer);
int ms, ftdm_sched_callback_t callback, void *data, ftdm_timer_id_t *timer);
/*!
* \brief Cancel the timer
* Note that there is a race between cancelling and triggering a timer.
* By the time you call this function the timer may be about to be triggered.
* This is specially true with timers in free run schedule.
* \param sched The scheduling context (required)
* \param timer The timer to cancel (required)
*/
FT_DECLARE(ftdm_status_t) ftdm_sched_cancel_timer(ftdm_sched_t *sched, ftdm_timer_t **timer);
FT_DECLARE(ftdm_status_t) ftdm_sched_cancel_timer(ftdm_sched_t *sched, ftdm_timer_id_t timer);
/*! \brief Destroy the context and all of the scheduled timers in it */
FT_DECLARE(ftdm_status_t) ftdm_sched_destroy(ftdm_sched_t **sched);

View File

@@ -322,9 +322,15 @@ struct ftdm_conf_node {
/* first node child */
struct ftdm_conf_node *child;
/* last node child */
struct ftdm_conf_node *last;
/* next node sibling */
struct ftdm_conf_node *next;
/* prev node sibling */
struct ftdm_conf_node *prev;
/* my parent if any */
struct ftdm_conf_node *parent;
};