git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@881 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2006-03-21 00:20:24 +00:00
parent a688382c3c
commit bc69b89cf9
4 changed files with 39 additions and 3 deletions

View File

@ -468,7 +468,7 @@ static void activate_rtp(struct private_object *tech_pvt)
switch_set_flag(tech_pvt, TFLAG_RTP);
} else {
switch_channel *channel = switch_core_session_get_channel(tech_pvt->session);
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Oh oh? [%s]\n", err);
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "RTP REPORTS ERROR: [%s]\n", err);
switch_channel_hangup(channel);
switch_set_flag(tech_pvt, TFLAG_BYE);
switch_clear_flag(tech_pvt, TFLAG_IO);
@ -518,6 +518,8 @@ static switch_status exosip_read_frame(switch_core_session *session, switch_fram
size_t bytes = 0, samples = 0, frames = 0, ms = 0;
switch_channel *channel = NULL;
int payload = 0;
switch_time_t started = switch_time_now();
unsigned int elapsed;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
@ -550,6 +552,14 @@ static switch_status exosip_read_frame(switch_core_session *session, switch_fram
&& tech_pvt->read_frame.datalen == 0) {
tech_pvt->read_frame.datalen =
jrtp4c_read(tech_pvt->rtp_session, tech_pvt->read_frame.data, sizeof(tech_pvt->read_buf), &payload);
if (timeout > -1) {
elapsed = (unsigned int)((switch_time_now() - started) / 1000);
if (elapsed >= timeout) {
return SWITCH_STATUS_SUCCESS;
}
}
/* RFC2833 ... TBD try harder to honor the duration etc.*/
if (payload == 101) {
unsigned char *packet = tech_pvt->read_frame.data;
@ -578,6 +588,7 @@ static switch_status exosip_read_frame(switch_core_session *session, switch_fram
}
if (globals.supress_telephony_events && payload != tech_pvt->payload_num) {
tech_pvt->read_frame.datalen = 0;
switch_yield(1000);
continue;
}

View File

@ -592,6 +592,8 @@ static switch_status channel_read_frame(switch_core_session *session, switch_fra
{
switch_channel *channel = NULL;
struct private_object *tech_pvt = NULL;
switch_time_t started = switch_time_now();
unsigned int elapsed;
channel = switch_core_session_get_channel(session);
assert(channel != NULL);
@ -615,6 +617,15 @@ static switch_status channel_read_frame(switch_core_session *session, switch_fra
*frame = &tech_pvt->read_frame;
return SWITCH_STATUS_SUCCESS;
}
if (timeout > -1) {
elapsed = (unsigned int)((switch_time_now() - started) / 1000);
if (elapsed >= timeout) {
return SWITCH_STATUS_SUCCESS;
}
}
switch_yield(1000);
}

View File

@ -855,7 +855,7 @@ static const switch_loadable_module_interface wanpipe_module_interface = {
static void s_pri_error(struct pri *pri, char *s)
{
switch_console_printf(SWITCH_CHANNEL_CONSOLE, s);
switch_console_printf(SWITCH_CHANNEL_CONSOLE_CLEAN, s);
}
static void s_pri_message(struct pri *pri, char *s)
@ -1125,8 +1125,14 @@ static int on_restart(struct sangoma_pri *spri, sangoma_pri_event_t event_type,
switch_core_session *session;
struct channel_map *chanmap;
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "-- Restarting channel %d\n", event->restart.channel);
if (event->restart.channel < 1) {
return 0;
}
chanmap = spri->private_info;
if ((session = chanmap->map[event->restart.channel])) {

View File

@ -571,7 +571,12 @@ SWITCH_DECLARE(switch_status) switch_channel_pre_answer(switch_channel *channel)
char *uuid = switch_core_session_get_uuid(channel->session);
switch_status status;
assert(channel != NULL);
assert(channel != NULL);
if (channel->state >= CS_HANGUP) {
return SWITCH_STATUS_FALSE;
}
msg.message_id = SWITCH_MESSAGE_INDICATE_PROGRESS;
msg.from = channel->name;
status = switch_core_session_message_send(uuid, &msg);
@ -588,6 +593,9 @@ SWITCH_DECLARE(switch_status) switch_channel_answer(switch_channel *channel)
{
assert(channel != NULL);
if (channel->state >= CS_HANGUP) {
return SWITCH_STATUS_FALSE;
}
if (switch_core_session_answer_channel(channel->session) == SWITCH_STATUS_SUCCESS) {
switch_event *event;