mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-13 17:38:59 +00:00
sync
git-svn-id: http://svn.openzap.org/svn/openzap/trunk@481 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
@@ -175,6 +175,7 @@
|
||||
*/
|
||||
#define zap_test_flag(obj, flag) ((obj)->flags & flag)
|
||||
#define zap_test_pflag(obj, flag) ((obj)->pflags & flag)
|
||||
#define zap_test_sflag(obj, flag) ((obj)->sflags & flag)
|
||||
|
||||
|
||||
#define zap_set_alarm_flag(obj, flag) (obj)->alarm_flags |= (flag)
|
||||
@@ -198,6 +199,12 @@
|
||||
(obj)->pflags |= (flag); \
|
||||
zap_mutex_unlock(obj->mutex);
|
||||
|
||||
#define zap_set_sflag(obj, flag) (obj)->sflags |= (flag)
|
||||
#define zap_set_sflag_locked(obj, flag) assert(obj->mutex != NULL); \
|
||||
zap_mutex_lock(obj->mutex); \
|
||||
(obj)->sflags |= (flag); \
|
||||
zap_mutex_unlock(obj->mutex);
|
||||
|
||||
/*!
|
||||
\brief Clear a flag on an arbitrary object while locked
|
||||
\command obj the object to test
|
||||
@@ -211,16 +218,35 @@
|
||||
|
||||
#define zap_clear_pflag_locked(obj, flag) assert(obj->mutex != NULL); zap_mutex_lock(obj->mutex); (obj)->pflags &= ~(flag); zap_mutex_unlock(obj->mutex);
|
||||
|
||||
#define zap_clear_sflag(obj, flag) (obj)->sflags &= ~(flag)
|
||||
|
||||
#define zap_clear_sflag_locked(obj, flag) assert(obj->mutex != NULL); zap_mutex_lock(obj->mutex); (obj)->sflags &= ~(flag); zap_mutex_unlock(obj->mutex);
|
||||
|
||||
|
||||
#define zap_set_state_locked(obj, s) if ( obj->state == s ) { \
|
||||
zap_log(ZAP_LOG_WARNING, "Why bother changing state on %d:%d from %s to %s\n", obj->span_id, obj->chan_id, zap_channel_state2str(obj->state), zap_channel_state2str(s)); \
|
||||
} else if (zap_test_flag(obj, ZAP_CHANNEL_READY)) { \
|
||||
int st = obj->state; \
|
||||
zap_channel_set_state(obj, s); \
|
||||
zap_channel_set_state(obj, s, 1); \
|
||||
if (obj->state == s) zap_log(ZAP_LOG_DEBUG, "Changing state on %d:%d from %s to %s\n", obj->span_id, obj->chan_id, zap_channel_state2str(st), zap_channel_state2str(s)); \
|
||||
else zap_log(ZAP_LOG_WARNING, "VETO Changing state on %d:%d from %s to %s\n", obj->span_id, obj->chan_id, zap_channel_state2str(st), zap_channel_state2str(s)); \
|
||||
}
|
||||
|
||||
typedef enum {
|
||||
ZAP_STATE_CHANGE_FAIL,
|
||||
ZAP_STATE_CHANGE_SUCCESS,
|
||||
ZAP_STATE_CHANGE_SAME,
|
||||
} zap_state_change_result_t;
|
||||
|
||||
#define zap_set_state_r(obj, s, l, r) if ( obj->state == s ) { \
|
||||
zap_log(ZAP_LOG_WARNING, "Why bother changing state on %d:%d from %s to %s\n", obj->span_id, obj->chan_id, zap_channel_state2str(obj->state), zap_channel_state2str(s)); r = ZAP_STATE_CHANGE_SAME; \
|
||||
} else if (zap_test_flag(obj, ZAP_CHANNEL_READY)) { \
|
||||
int st = obj->state; \
|
||||
r = (zap_channel_set_state(obj, s, l) == ZAP_SUCCESS) ? ZAP_STATE_CHANGE_SUCCESS : ZAP_STATE_CHANGE_FAIL; \
|
||||
if (obj->state == s) {zap_log(ZAP_LOG_DEBUG, "Changing state on %d:%d from %s to %s\n", obj->span_id, obj->chan_id, zap_channel_state2str(st), zap_channel_state2str(s));} \
|
||||
else {zap_log(ZAP_LOG_WARNING, "VETO Changing state on %d:%d from %s to %s\n", obj->span_id, obj->chan_id, zap_channel_state2str(st), zap_channel_state2str(s)); } \
|
||||
}
|
||||
|
||||
|
||||
#define zap_is_dtmf(key) ((key > 47 && key < 58) || (key > 64 && key < 69) || (key > 96 && key < 101) || key == 35 || key == 42 || key == 87 || key == 119)
|
||||
|
||||
@@ -358,6 +384,7 @@ struct zap_channel {
|
||||
zap_socket_t sockfd;
|
||||
zap_channel_flag_t flags;
|
||||
uint32_t pflags;
|
||||
uint32_t sflags;
|
||||
zap_alarm_flag_t alarm_flags;
|
||||
zap_channel_feature_t features;
|
||||
zap_codec_t effective_codec;
|
||||
@@ -455,6 +482,7 @@ struct zap_span {
|
||||
void *mod_data;
|
||||
char *type;
|
||||
int suggest_chan_id;
|
||||
zap_state_map_t *state_map;
|
||||
};
|
||||
|
||||
|
||||
@@ -515,7 +543,7 @@ zap_status_t zap_channel_get_alarms(zap_channel_t *zchan);
|
||||
zap_status_t zap_channel_send_fsk_data(zap_channel_t *zchan, zap_fsk_data_state_t *fsk_data, float db_level);
|
||||
zap_status_t zap_channel_clear_token(zap_channel_t *zchan, const char *token);
|
||||
zap_status_t zap_channel_add_token(zap_channel_t *zchan, char *token, int end);
|
||||
zap_status_t zap_channel_set_state(zap_channel_t *zchan, zap_channel_state_t state);
|
||||
zap_status_t zap_channel_set_state(zap_channel_t *zchan, zap_channel_state_t state, int lock);
|
||||
zap_status_t zap_span_load_tones(zap_span_t *span, char *mapname);
|
||||
zap_size_t zap_channel_dequeue_dtmf(zap_channel_t *zchan, char *dtmf, zap_size_t len);
|
||||
zap_status_t zap_channel_queue_dtmf(zap_channel_t *zchan, const char *dtmf);
|
||||
|
@@ -119,7 +119,8 @@ int ss7bc_connection_close(ss7bc_connection_t *mcon);
|
||||
int ss7bc_connection_open(ss7bc_connection_t *mcon, char *local_ip, int local_port, char *ip, int port);
|
||||
ss7bc_event_t *ss7bc_connection_read(ss7bc_connection_t *mcon, int iteration);
|
||||
ss7bc_event_t *ss7bc_connection_readp(ss7bc_connection_t *mcon, int iteration);
|
||||
int ss7bc_connection_write(ss7bc_connection_t *mcon, ss7bc_event_t *event);
|
||||
int __ss7bc_connection_write(ss7bc_connection_t *mcon, ss7bc_event_t *event, const char *file, const char *func, int line);
|
||||
#define ss7bc_connection_write(_m,_e) __ss7bc_connection_write(_m, _e, __FILE__, __func__, __LINE__)
|
||||
void ss7bc_event_init(ss7bc_event_t *event, ss7bc_event_id_t event_id, int chan, int span);
|
||||
void ss7bc_call_init(ss7bc_event_t *event, const char *calling, const char *called, int setup_id);
|
||||
const char *ss7bc_event_id_name(uint32_t event_id);
|
||||
|
@@ -66,6 +66,9 @@ struct zap_io_interface;
|
||||
#define ZAP_DEFAULT_DTMF_ON 250
|
||||
#define ZAP_DEFAULT_DTMF_OFF 50
|
||||
|
||||
#define ZAP_END -1
|
||||
#define ZAP_ANY_STATE -1
|
||||
|
||||
typedef uint64_t zap_time_t;
|
||||
|
||||
typedef enum {
|
||||
@@ -343,6 +346,33 @@ typedef enum {
|
||||
ZAP_CHANNEL_ANSWERED = (1 << 23)
|
||||
} zap_channel_flag_t;
|
||||
|
||||
typedef enum {
|
||||
ZSM_NONE,
|
||||
ZSM_UNACCEPTABLE,
|
||||
ZSM_ACCEPTABLE
|
||||
} zap_state_map_type_t;
|
||||
|
||||
typedef enum {
|
||||
ZSD_INBOUND,
|
||||
ZSD_OUTBOUND,
|
||||
} zap_state_direction_t;
|
||||
|
||||
#define ZAP_MAP_NODE_SIZE 512
|
||||
#define ZAP_MAP_MAX ZAP_CHANNEL_STATE_INVALID+2
|
||||
|
||||
struct zap_state_map_node {
|
||||
zap_state_direction_t direction;
|
||||
zap_state_map_type_t type;
|
||||
zap_channel_state_t check_states[ZAP_MAP_MAX];
|
||||
zap_channel_state_t states[ZAP_MAP_MAX];
|
||||
};
|
||||
typedef struct zap_state_map_node zap_state_map_node_t;
|
||||
|
||||
struct zap_state_map {
|
||||
zap_state_map_node_t nodes[ZAP_MAP_NODE_SIZE];
|
||||
};
|
||||
typedef struct zap_state_map zap_state_map_t;
|
||||
|
||||
typedef struct zap_channel zap_channel_t;
|
||||
typedef struct zap_event zap_event_t;
|
||||
typedef struct zap_sigmsg zap_sigmsg_t;
|
||||
|
Reference in New Issue
Block a user