]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
update
authorAnthony Minessale <anthony.minessale@gmail.com>
Tue, 21 Mar 2006 00:20:24 +0000 (00:20 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Tue, 21 Mar 2006 00:20:24 +0000 (00:20 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@881 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_exosip/mod_exosip.c
src/mod/endpoints/mod_iax/mod_iax.c
src/mod/endpoints/mod_wanpipe/mod_wanpipe.c
src/switch_channel.c

index 24a4c7d5f8d4b2d01ea68e3c04c7948054fec83c..47fc5df86037c67f271f82016a609a89ce990f7c 100644 (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;
                        }
index d8f7cd83b0d5b935d7f7266c3466e3727b99912a..0925369766906be4c5ba01582e5c31da9a235181 100644 (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);
        }
 
index 242d53ec9a28ead5d641e6ca06b67bb70b3867e4..14c2d9bcf8bb2d6e808241332a4b1dc047555384 100644 (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])) {
index cdeb37be4b83e551d30faeccd0d2c498e1a23a83..b379365857e3eaaf19ef78992e38fd6e75a9efea 100644 (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;