static switch_memory_pool_t *module_pool = NULL;
-
typedef enum {
TFLAG_LINKED = (1 << 0),
TFLAG_OUTBOUND = (1 << 1),
switch_caller_profile_t *caller_profile;
int32_t bowout_frame_count;
};
+
typedef struct private_object private_t;
static struct {
int debug;
} globals;
-
static switch_status_t channel_on_init(switch_core_session_t *session);
static switch_status_t channel_on_hangup(switch_core_session_t *session);
static switch_status_t channel_on_routing(switch_core_session_t *session);
tech_pvt->read_frame.buflen = sizeof(tech_pvt->databuf);
tech_pvt->read_frame.codec = &tech_pvt->read_codec;
-
tech_pvt->write_frame.data = tech_pvt->write_databuf;
tech_pvt->write_frame.buflen = sizeof(tech_pvt->write_databuf);
return status;
}
-
-
-
/*
State methods they get called when the state changes to the specific state
returning SWITCH_STATUS_SUCCESS tells the core to execute the standard state method next
switch_core_session_destroy(&b_session);
goto end;
}
-
caller_profile = switch_caller_profile_clone(b_session, tech_pvt->caller_profile);
caller_profile->source = switch_core_strdup(caller_profile->pool, modname);
goto end;
}
-
switch_channel_set_variable(channel, "loopback_leg", switch_test_flag(tech_pvt, TFLAG_OUTBOUND) ? "B" : "A");
switch_channel_set_state(channel, CS_ROUTING);
end:
return SWITCH_STATUS_SUCCESS;
-
}
static void do_reset(private_t *tech_pvt)
static switch_status_t channel_on_execute(switch_core_session_t *session)
{
-
switch_channel_t *channel = NULL;
private_t *tech_pvt = NULL;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL EXECUTE\n", switch_channel_get_name(channel));
-
return SWITCH_STATUS_SUCCESS;
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s CHANNEL KILL\n", switch_channel_get_name(channel));
-
return SWITCH_STATUS_SUCCESS;
}
return SWITCH_STATUS_SUCCESS;
}
-
static switch_status_t channel_on_reset(switch_core_session_t *session)
{
private_t *tech_pvt = (private_t *) switch_core_session_get_private(session);
return SWITCH_STATUS_SUCCESS;
}
-
static switch_status_t channel_on_hibernate(switch_core_session_t *session)
{
private_t *tech_pvt = switch_core_session_get_private(session);
return SWITCH_STATUS_SUCCESS;
}
-
-
static switch_status_t channel_on_consume_media(switch_core_session_t *session)
{
switch_channel_t *channel = NULL;
return SWITCH_STATUS_FALSE;
}
-
static switch_status_t channel_send_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf)
{
private_t *tech_pvt = NULL;
if (switch_test_flag(frame, SFF_CNG) || switch_test_flag(tech_pvt, TFLAG_CNG) || switch_test_flag(tech_pvt, TFLAG_BOWOUT)) {
return SWITCH_STATUS_SUCCESS;
}
-
if (!switch_test_flag(tech_pvt, TFLAG_BOWOUT) &&
tech_pvt->other_tech_pvt &&
tech_pvt = switch_core_session_get_private(session);
assert(tech_pvt != NULL);
-
switch (msg->message_id) {
case SWITCH_MESSAGE_INDICATE_ANSWER:
return SWITCH_STATUS_SUCCESS;
}
-
static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *session, switch_event_t *var_event,
switch_caller_profile_t *outbound_profile,
switch_core_session_t **new_session, switch_memory_pool_t **pool, switch_originate_flag_t flags)
{
char name[128];
-
if (session) {
switch_channel_t *channel = switch_core_session_get_channel(session);
switch_channel_clear_flag(channel, CF_PROXY_MEDIA);
}
return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
-
}
static switch_state_handler_table_t channel_event_handlers = {
/*.receive_message */ channel_receive_message
};
-
-
SWITCH_MODULE_LOAD_FUNCTION(mod_loopback_load)
{
-
- //switch_status_t status;
-
if (switch_core_new_memory_pool(&module_pool) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "OH OH no pool\n");
return SWITCH_STATUS_TERM;
loopback_endpoint_interface->io_routines = &channel_io_routines;
loopback_endpoint_interface->state_handler = &channel_event_handlers;
-
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS;
}
-
SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_loopback_shutdown)
{
return SWITCH_STATUS_SUCCESS;
}
-
-
/* For Emacs:
* Local Variables:
* mode:c