[Freeswitch-svn] [commit] r6095 - in freeswitch/trunk/src: . include mod/endpoints/mod_sofia
Freeswitch SVN
anthm at freeswitch.org
Wed Oct 31 09:08:46 EDT 2007
Author: anthm
Date: Wed Oct 31 09:08:45 2007
New Revision: 6095
Modified:
freeswitch/trunk/src/include/switch_types.h
freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
freeswitch/trunk/src/switch_channel.c
freeswitch/trunk/src/switch_rtp.c
Log:
make channel hangup with media_timeout cause when rtp timeout occurs
Modified: freeswitch/trunk/src/include/switch_types.h
==============================================================================
--- freeswitch/trunk/src/include/switch_types.h (original)
+++ freeswitch/trunk/src/include/switch_types.h Wed Oct 31 09:08:45 2007
@@ -1006,7 +1006,8 @@
SWITCH_CAUSE_BLIND_TRANSFER = 600,
SWITCH_CAUSE_ATTENDED_TRANSFER = 601,
SWITCH_CAUSE_ALLOTTED_TIMEOUT = 602,
- SWITCH_CAUSE_USER_CHALLENGE = 603
+ SWITCH_CAUSE_USER_CHALLENGE = 603,
+ SWITCH_CAUSE_MEDIA_TIMEOUT = 604
} switch_call_cause_t;
typedef enum {
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c Wed Oct 31 09:08:45 2007
@@ -387,7 +387,10 @@
status = switch_rtp_zerocopy_read_frame(tech_pvt->video_rtp_session, &tech_pvt->video_read_frame);
if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
- return SWITCH_STATUS_FALSE;
+ if (status == SWITCH_STATUS_TIMEOUT) {
+ switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_MEDIA_TIMEOUT);
+ }
+ return status;
}
payload = tech_pvt->video_read_frame.payload;
@@ -492,11 +495,12 @@
status = switch_rtp_zerocopy_read_frame(tech_pvt->rtp_session, &tech_pvt->read_frame);
if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
- return SWITCH_STATUS_FALSE;
+ if (status == SWITCH_STATUS_TIMEOUT) {
+ switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_MEDIA_TIMEOUT);
+ }
+ return status;
}
-
-
-
+
payload = tech_pvt->read_frame.payload;
if (switch_rtp_has_dtmf(tech_pvt->rtp_session)) {
Modified: freeswitch/trunk/src/switch_channel.c
==============================================================================
--- freeswitch/trunk/src/switch_channel.c (original)
+++ freeswitch/trunk/src/switch_channel.c Wed Oct 31 09:08:45 2007
@@ -97,6 +97,7 @@
{"ATTENDED_TRANSFER", SWITCH_CAUSE_ATTENDED_TRANSFER},
{"ALLOTTED_TIMEOUT", SWITCH_CAUSE_ALLOTTED_TIMEOUT},
{"USER_CHALLENGE", SWITCH_CAUSE_USER_CHALLENGE},
+ {"MEDIA_TIMEOUT", SWITCH_CAUSE_MEDIA_TIMEOUT},
{NULL, 0}
};
Modified: freeswitch/trunk/src/switch_rtp.c
==============================================================================
--- freeswitch/trunk/src/switch_rtp.c (original)
+++ freeswitch/trunk/src/switch_rtp.c Wed Oct 31 09:08:45 2007
@@ -906,7 +906,7 @@
do_2833(rtp_session);
if (!bytes && rtp_session->max_missed_packets) {
if (++rtp_session->missed_count >= rtp_session->max_missed_packets) {
- return -1;
+ return -2;
}
}
@@ -1204,7 +1204,7 @@
if (bytes < 0) {
*datalen = 0;
- return SWITCH_STATUS_GENERR;
+ return bytes == -2 ? SWITCH_STATUS_TIMEOUT : SWITCH_STATUS_GENERR;
} else if (bytes == 0) {
*datalen = 0;
return SWITCH_STATUS_BREAK;
@@ -1244,7 +1244,7 @@
if (bytes < 0) {
frame->datalen = 0;
- return SWITCH_STATUS_GENERR;
+ return bytes == -2 ? SWITCH_STATUS_TIMEOUT : SWITCH_STATUS_GENERR;
} else if (bytes == 0) {
frame->datalen = 0;
return SWITCH_STATUS_BREAK;
More information about the Freeswitch-svn
mailing list