mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-07-24 13:12:03 +00:00
add some device-state mechinism to FS to allow tracking of device-specific states where they may have more than one call from the same device
This commit is contained in:
@@ -659,7 +659,16 @@ SWITCH_DECLARE(void) switch_channel_state_thread_lock(switch_channel_t *channel)
|
||||
SWITCH_DECLARE(void) switch_channel_state_thread_unlock(switch_channel_t *channel);
|
||||
SWITCH_DECLARE(switch_status_t) switch_channel_state_thread_trylock(switch_channel_t *channel);
|
||||
SWITCH_DECLARE(void) switch_channel_handle_cause(switch_channel_t *channel, switch_call_cause_t cause);
|
||||
|
||||
SWITCH_DECLARE(void) switch_channel_global_init(switch_memory_pool_t *pool);
|
||||
SWITCH_DECLARE(void) switch_channel_global_uninit(void);
|
||||
SWITCH_DECLARE(const char *) switch_channel_set_device_id(switch_channel_t *channel, const char *device_id);
|
||||
SWITCH_DECLARE(void) switch_channel_clear_device_record(switch_channel_t *channel);
|
||||
SWITCH_DECLARE(switch_device_record_t *) switch_channel_get_device_record(switch_channel_t *channel);
|
||||
SWITCH_DECLARE(void) switch_channel_release_device_record(switch_device_record_t **dcdrp);
|
||||
SWITCH_DECLARE(switch_status_t) switch_channel_bind_device_state_handler(switch_device_state_function_t function, void *user_data);
|
||||
SWITCH_DECLARE(switch_status_t) switch_channel_unbind_device_state_handler(switch_device_state_function_t function);
|
||||
SWITCH_DECLARE(const char *) switch_channel_device_state2str(switch_device_state_t device_state);
|
||||
|
||||
SWITCH_END_EXTERN_C
|
||||
#endif
|
||||
/* For Emacs:
|
||||
|
||||
@@ -61,6 +61,11 @@ struct switch_app_log {
|
||||
struct switch_app_log *next;
|
||||
};
|
||||
|
||||
typedef struct switch_thread_data_s {
|
||||
switch_thread_start_t func;
|
||||
void *obj;
|
||||
int alloc;
|
||||
} switch_thread_data_t;
|
||||
|
||||
typedef struct switch_hold_record_s {
|
||||
switch_time_t on;
|
||||
@@ -69,12 +74,42 @@ typedef struct switch_hold_record_s {
|
||||
struct switch_hold_record_s *next;
|
||||
} switch_hold_record_t;
|
||||
|
||||
typedef struct device_uuid_node_s {
|
||||
char *uuid;
|
||||
switch_xml_t xml_cdr;
|
||||
switch_event_t *event;
|
||||
switch_channel_callstate_t callstate;
|
||||
switch_hold_record_t *hold_record;
|
||||
switch_caller_profile_t *hup_profile;
|
||||
struct switch_device_record_s *parent;
|
||||
struct device_uuid_node_s *next;
|
||||
} switch_device_node_t;
|
||||
|
||||
typedef struct switch_thread_data_s {
|
||||
switch_thread_start_t func;
|
||||
void *obj;
|
||||
int alloc;
|
||||
} switch_thread_data_t;
|
||||
typedef struct switch_device_stats_s {
|
||||
uint32_t total;
|
||||
uint32_t offhook;
|
||||
uint32_t active;
|
||||
uint32_t held;
|
||||
uint32_t hup;
|
||||
} switch_device_stats_t;
|
||||
|
||||
|
||||
typedef struct switch_device_record_s {
|
||||
char *device_id;
|
||||
char *uuid;
|
||||
int refs;
|
||||
switch_device_stats_t stats;
|
||||
switch_device_state_t state;
|
||||
switch_device_state_t last_state;
|
||||
switch_time_t active_start;
|
||||
switch_time_t active_stop;
|
||||
struct device_uuid_node_s *uuid_list;
|
||||
struct device_uuid_node_s *uuid_tail;
|
||||
switch_mutex_t *mutex;
|
||||
switch_memory_pool_t *pool;
|
||||
} switch_device_record_t;
|
||||
|
||||
typedef void(*switch_device_state_function_t)(switch_core_session_t *session, switch_channel_callstate_t callstate, switch_device_record_t *drec);
|
||||
|
||||
|
||||
#define MESSAGE_STAMP_FFL(_m) _m->_file = __FILE__; _m->_func = __SWITCH_FUNC__; _m->_line = __LINE__
|
||||
|
||||
@@ -1109,9 +1109,19 @@ typedef enum {
|
||||
CCS_EARLY,
|
||||
CCS_ACTIVE,
|
||||
CCS_HELD,
|
||||
CCS_HANGUP
|
||||
CCS_HANGUP,
|
||||
CCS_UNHOLD
|
||||
} switch_channel_callstate_t;
|
||||
|
||||
typedef enum {
|
||||
SDS_DOWN,
|
||||
SDS_ACTIVE,
|
||||
SDS_ACTIVE_MULTI,
|
||||
SDS_HELD,
|
||||
SDS_HANGUP
|
||||
} switch_device_state_t;
|
||||
|
||||
|
||||
/*!
|
||||
\enum switch_channel_state_t
|
||||
\brief Channel States (these are the defaults, CS_SOFT_EXECUTE, CS_EXCHANGE_MEDIA, and CS_CONSUME_MEDIA are often overridden by specific apps)
|
||||
@@ -1277,6 +1287,8 @@ typedef enum {
|
||||
CF_ZRTP_PASSTHRU,
|
||||
CF_ZRTP_HASH,
|
||||
CF_CHANNEL_SWAP,
|
||||
CF_DEVICE_LEG,
|
||||
CF_FINAL_DEVICE_LEG,
|
||||
CF_PICKUP,
|
||||
CF_CONFIRM_BLIND_TRANSFER,
|
||||
CF_NO_PRESENCE,
|
||||
@@ -1727,6 +1739,8 @@ typedef enum {
|
||||
SWITCH_EVENT_CONFERENCE_DATA,
|
||||
SWITCH_EVENT_CALL_SETUP_REQ,
|
||||
SWITCH_EVENT_CALL_SETUP_RESULT,
|
||||
SWITCH_EVENT_CALL_DETAIL,
|
||||
SWITCH_EVENT_DEVICE_STATE,
|
||||
SWITCH_EVENT_ALL
|
||||
} switch_event_types_t;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user