static const char modname[] = "mod_wanpipe";
#define STRLEN 15
-static switch_memory_pool *module_pool = NULL;
+static switch_memory_pool_t *module_pool = NULL;
typedef enum {
PFLAG_ANSWER = (1 << 0),
struct private_object {
unsigned int flags; /* FLAGS */
- switch_frame read_frame; /* Frame for Writing */
- switch_core_session *session;
- switch_codec read_codec;
- switch_codec write_codec;
+ switch_frame_t read_frame; /* Frame for Writing */
+ switch_core_session_t *session;
+ switch_codec_t read_codec;
+ switch_codec_t write_codec;
unsigned char databuf[SWITCH_RECCOMMENDED_BUFFER_SIZE];
struct sangoma_pri *spri;
sangoma_api_hdr_t hdrframe;
- switch_caller_profile *caller_profile;
+ switch_caller_profile_t *caller_profile;
int socket;
int callno;
int span;
q931_call *call;
teletone_dtmf_detect_state_t dtmf_detect;
teletone_generation_session_t tone_session;
- switch_buffer *dtmf_buffer;
+ switch_buffer_t *dtmf_buffer;
unsigned int skip_read_frames;
unsigned int skip_write_frames;
#ifdef DOTRACE
};
struct channel_map {
- switch_core_session *map[36];
+ switch_core_session_t *map[36];
};
static void set_global_dialplan(char *dialplan);
static int str2node(char *node);
static int str2switch(char *swtype);
-static switch_status wanpipe_on_init(switch_core_session *session);
-static switch_status wanpipe_on_hangup(switch_core_session *session);
-static switch_status wanpipe_on_loopback(switch_core_session *session);
-static switch_status wanpipe_on_transmit(switch_core_session *session);
-static switch_status wanpipe_outgoing_channel(switch_core_session *session, switch_caller_profile *outbound_profile,
- switch_core_session **new_session, switch_memory_pool *pool);
-static switch_status wanpipe_read_frame(switch_core_session *session, switch_frame **frame, int timeout,
+static switch_status wanpipe_on_init(switch_core_session_t *session);
+static switch_status wanpipe_on_hangup(switch_core_session_t *session);
+static switch_status wanpipe_on_loopback(switch_core_session_t *session);
+static switch_status wanpipe_on_transmit(switch_core_session_t *session);
+static switch_status wanpipe_outgoing_channel(switch_core_session_t *session, switch_caller_profile_t *outbound_profile,
+ switch_core_session_t **new_session, switch_memory_pool_t *pool);
+static switch_status wanpipe_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout,
switch_io_flag flags, int stream_id);
-static switch_status wanpipe_write_frame(switch_core_session *session, switch_frame *frame, int timeout,
+static switch_status wanpipe_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout,
switch_io_flag flags, int stream_id);
static int on_info(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *event);
static int on_hangup(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *event);
static int check_flags(struct sangoma_pri *spri);
static int on_restart(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *event);
static int on_anything(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *event);
-static void *pri_thread_run(switch_thread *thread, void *obj);
+static void *pri_thread_run(switch_thread_t *thread, void *obj);
static switch_status config_wanpipe(int reload);
returning SWITCH_STATUS_SUCCESS tells the core to execute the standard state method next
so if you fully implement the state you can return SWITCH_STATUS_FALSE to skip it.
*/
-static switch_status wanpipe_on_init(switch_core_session *session)
+static switch_status wanpipe_on_init(switch_core_session_t *session)
{
struct private_object *tech_pvt;
- switch_channel *channel = NULL;
+ switch_channel_t *channel = NULL;
wanpipe_tdm_api_t tdm_api = {};
int err = 0;
int mtu_mru;
return SWITCH_STATUS_SUCCESS;
}
-static switch_status wanpipe_on_ring(switch_core_session *session)
+static switch_status wanpipe_on_ring(switch_core_session_t *session)
{
- switch_channel *channel = NULL;
+ switch_channel_t *channel = NULL;
struct private_object *tech_pvt = NULL;
channel = switch_core_session_get_channel(session);
return SWITCH_STATUS_SUCCESS;
}
-static switch_status wanpipe_on_hangup(switch_core_session *session)
+static switch_status wanpipe_on_hangup(switch_core_session_t *session)
{
struct private_object *tech_pvt;
- switch_channel *channel = NULL;
+ switch_channel_t *channel = NULL;
struct channel_map *chanmap = NULL;
return SWITCH_STATUS_SUCCESS;
}
-static switch_status wanpipe_on_loopback(switch_core_session *session)
+static switch_status wanpipe_on_loopback(switch_core_session_t *session)
{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "WANPIPE LOOPBACK\n");
return SWITCH_STATUS_SUCCESS;
}
-static switch_status wanpipe_on_transmit(switch_core_session *session)
+static switch_status wanpipe_on_transmit(switch_core_session_t *session)
{
struct private_object *tech_pvt;
- switch_channel *channel;
+ switch_channel_t *channel;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
}
-static switch_status wanpipe_answer_channel(switch_core_session *session)
+static switch_status wanpipe_answer_channel(switch_core_session_t *session)
{
struct private_object *tech_pvt;
- switch_channel *channel = NULL;
+ switch_channel_t *channel = NULL;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
-static switch_status wanpipe_read_frame(switch_core_session *session, switch_frame **frame, int timeout,
+static switch_status wanpipe_read_frame(switch_core_session_t *session, switch_frame_t **frame, int timeout,
switch_io_flag flags, int stream_id)
{
struct private_object *tech_pvt;
- switch_channel *channel = NULL;
+ switch_channel_t *channel = NULL;
uint8_t *bp;
int bytes = 0, res = 0;
char digit_str[80];
return SWITCH_STATUS_SUCCESS;
}
-static switch_status wanpipe_write_frame(switch_core_session *session, switch_frame *frame, int timeout,
+static switch_status wanpipe_write_frame(switch_core_session_t *session, switch_frame_t *frame, int timeout,
switch_io_flag flags, int stream_id)
{
struct private_object *tech_pvt;
- switch_channel *channel = NULL;
+ switch_channel_t *channel = NULL;
int result = 0;
int bytes = frame->datalen;
uint8_t *bp = frame->data;
return status;
}
-static switch_status wanpipe_send_dtmf(switch_core_session *session, char *digits)
+static switch_status wanpipe_send_dtmf(switch_core_session_t *session, char *digits)
{
struct private_object *tech_pvt;
- switch_channel *channel = NULL;
+ switch_channel_t *channel = NULL;
switch_status status = SWITCH_STATUS_SUCCESS;
int wrote = 0;
char *cur = NULL;
return status;
}
-static switch_status wanpipe_receive_message(switch_core_session *session, switch_core_session_message *msg)
+static switch_status wanpipe_receive_message(switch_core_session_t *session, switch_core_session_message_t *msg)
{
return SWITCH_STATUS_FALSE;
}
-static switch_status wanpipe_kill_channel(switch_core_session *session, int sig)
+static switch_status wanpipe_kill_channel(switch_core_session_t *session, int sig)
{
struct private_object *tech_pvt;
- switch_channel *channel = NULL;
+ switch_channel_t *channel = NULL;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
/*.receive_message*/ wanpipe_receive_message
};
-static const switch_state_handler_table wanpipe_state_handlers = {
+static const switch_state_handler_table_t wanpipe_state_handlers = {
/*.on_init */ wanpipe_on_init,
/*.on_ring */ wanpipe_on_ring,
/*.on_execute */ NULL,
};
-static switch_status wanpipe_outgoing_channel(switch_core_session *session, switch_caller_profile *outbound_profile,
- switch_core_session **new_session, switch_memory_pool *pool)
+static switch_status wanpipe_outgoing_channel(switch_core_session_t *session, switch_caller_profile_t *outbound_profile,
+ switch_core_session_t **new_session, switch_memory_pool_t *pool)
{
char *bchan = NULL;
char name[128] = "";
if ((*new_session = switch_core_session_request(&wanpipe_endpoint_interface, pool))) {
struct private_object *tech_pvt;
- switch_channel *channel;
+ switch_channel_t *channel;
switch_core_session_add_stream(*new_session, NULL);
if ((tech_pvt = (struct private_object *) switch_core_session_alloc(*new_session, sizeof(struct private_object)))) {
if (outbound_profile) {
- switch_caller_profile *caller_profile;
+ switch_caller_profile_t *caller_profile;
struct sangoma_pri *spri;
int span = 0, autospan = 0, autochan = 0;
char *num, *p;
static int on_hangup(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *event)
{
struct channel_map *chanmap;
- switch_core_session *session;
+ switch_core_session_t *session;
struct private_object *tech_pvt;
chanmap = spri->private_info;
if ((session = chanmap->map[event->hangup.channel])) {
- switch_channel *channel = NULL;
+ switch_channel_t *channel = NULL;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
static int on_answer(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *event)
{
- switch_core_session *session;
- switch_channel *channel;
+ switch_core_session_t *session;
+ switch_channel_t *channel;
struct channel_map *chanmap;
static int on_proceed(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *event)
{
- switch_core_session *session;
- switch_channel *channel;
+ switch_core_session_t *session;
+ switch_channel_t *channel;
struct channel_map *chanmap;
chanmap = spri->private_info;
if ((session = chanmap->map[event->proceeding.channel])) {
- switch_caller_profile *originator;
+ switch_caller_profile_t *originator;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "-- Proceeding on channel s%dc%d\n", spri->span, event->proceeding.channel);
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
if ((originator = switch_channel_get_originator_caller_profile(channel))) {
- switch_core_session_message msg;
+ switch_core_session_message_t msg;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "-- Passing progress to Originator %s\n", originator->chan_name);
#if 0
static int on_ringing(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *event)
{
- switch_core_session *session;
- switch_channel *channel;
+ switch_core_session_t *session;
+ switch_channel_t *channel;
struct channel_map *chanmap;
struct private_object *tech_pvt;
static int on_ring(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *event)
{
char name[128];
- switch_core_session *session;
- switch_channel *channel;
+ switch_core_session_t *session;
+ switch_channel_t *channel;
struct channel_map *chanmap;
static int on_restart(struct sangoma_pri *spri, sangoma_pri_event_t event_type, pri_event *event)
{
int fd;
- switch_core_session *session;
+ switch_core_session_t *session;
struct channel_map *chanmap;
chanmap = spri->private_info;
if ((session = chanmap->map[event->restart.channel])) {
- switch_channel *channel;
+ switch_channel_t *channel;
channel = switch_core_session_get_channel(session);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Hanging Up channel %s\n", switch_channel_get_name(channel));
switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
}
-static void *pri_thread_run(switch_thread *thread, void *obj)
+static void *pri_thread_run(switch_thread_t *thread, void *obj)
{
struct sangoma_pri *spri = obj;
struct channel_map chanmap;
- switch_event *s_event;
+ switch_event_t *s_event;
SANGOMA_MAP_PRI_EVENT((*spri), SANGOMA_PRI_EVENT_ANY, on_anything);
SANGOMA_MAP_PRI_EVENT((*spri), SANGOMA_PRI_EVENT_RING, on_ring);
//SANGOMA_MAP_PRI_EVENT((*spri), SANGOMA_PRI_EVENT_RINGING, on_ringing);
static void pri_thread_launch(struct sangoma_pri *spri)
{
- switch_thread *thread;
+ switch_thread_t *thread;
switch_threadattr_t *thd_attr = NULL;
switch_threadattr_create(&thd_attr, module_pool);
static switch_status config_wanpipe(int reload)
{
- switch_config cfg;
+ switch_config_t cfg;
char *var, *val;
char *cf = "wanpipe.conf";
int current_span = 0;