mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-14 08:05:37 +00:00
make channel hangup with media_timeout cause when rtp timeout occurs
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6095 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
a9d79d7ad0
commit
10d7d619f6
@ -1006,7 +1006,8 @@ typedef enum {
|
|||||||
SWITCH_CAUSE_BLIND_TRANSFER = 600,
|
SWITCH_CAUSE_BLIND_TRANSFER = 600,
|
||||||
SWITCH_CAUSE_ATTENDED_TRANSFER = 601,
|
SWITCH_CAUSE_ATTENDED_TRANSFER = 601,
|
||||||
SWITCH_CAUSE_ALLOTTED_TIMEOUT = 602,
|
SWITCH_CAUSE_ALLOTTED_TIMEOUT = 602,
|
||||||
SWITCH_CAUSE_USER_CHALLENGE = 603
|
SWITCH_CAUSE_USER_CHALLENGE = 603,
|
||||||
|
SWITCH_CAUSE_MEDIA_TIMEOUT = 604
|
||||||
} switch_call_cause_t;
|
} switch_call_cause_t;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@ -387,7 +387,10 @@ static switch_status_t sofia_read_video_frame(switch_core_session_t *session, sw
|
|||||||
|
|
||||||
status = switch_rtp_zerocopy_read_frame(tech_pvt->video_rtp_session, &tech_pvt->video_read_frame);
|
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) {
|
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;
|
payload = tech_pvt->video_read_frame.payload;
|
||||||
@ -492,11 +495,12 @@ static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_f
|
|||||||
|
|
||||||
status = switch_rtp_zerocopy_read_frame(tech_pvt->rtp_session, &tech_pvt->read_frame);
|
status = switch_rtp_zerocopy_read_frame(tech_pvt->rtp_session, &tech_pvt->read_frame);
|
||||||
if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
|
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;
|
payload = tech_pvt->read_frame.payload;
|
||||||
|
|
||||||
if (switch_rtp_has_dtmf(tech_pvt->rtp_session)) {
|
if (switch_rtp_has_dtmf(tech_pvt->rtp_session)) {
|
||||||
|
@ -97,6 +97,7 @@ static struct switch_cause_table CAUSE_CHART[] = {
|
|||||||
{"ATTENDED_TRANSFER", SWITCH_CAUSE_ATTENDED_TRANSFER},
|
{"ATTENDED_TRANSFER", SWITCH_CAUSE_ATTENDED_TRANSFER},
|
||||||
{"ALLOTTED_TIMEOUT", SWITCH_CAUSE_ALLOTTED_TIMEOUT},
|
{"ALLOTTED_TIMEOUT", SWITCH_CAUSE_ALLOTTED_TIMEOUT},
|
||||||
{"USER_CHALLENGE", SWITCH_CAUSE_USER_CHALLENGE},
|
{"USER_CHALLENGE", SWITCH_CAUSE_USER_CHALLENGE},
|
||||||
|
{"MEDIA_TIMEOUT", SWITCH_CAUSE_MEDIA_TIMEOUT},
|
||||||
{NULL, 0}
|
{NULL, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -906,7 +906,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
|
|||||||
do_2833(rtp_session);
|
do_2833(rtp_session);
|
||||||
if (!bytes && rtp_session->max_missed_packets) {
|
if (!bytes && rtp_session->max_missed_packets) {
|
||||||
if (++rtp_session->missed_count >= rtp_session->max_missed_packets) {
|
if (++rtp_session->missed_count >= rtp_session->max_missed_packets) {
|
||||||
return -1;
|
return -2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1204,7 +1204,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_read(switch_rtp_t *rtp_session, void
|
|||||||
|
|
||||||
if (bytes < 0) {
|
if (bytes < 0) {
|
||||||
*datalen = 0;
|
*datalen = 0;
|
||||||
return SWITCH_STATUS_GENERR;
|
return bytes == -2 ? SWITCH_STATUS_TIMEOUT : SWITCH_STATUS_GENERR;
|
||||||
} else if (bytes == 0) {
|
} else if (bytes == 0) {
|
||||||
*datalen = 0;
|
*datalen = 0;
|
||||||
return SWITCH_STATUS_BREAK;
|
return SWITCH_STATUS_BREAK;
|
||||||
@ -1244,7 +1244,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_zerocopy_read_frame(switch_rtp_t *rtp
|
|||||||
|
|
||||||
if (bytes < 0) {
|
if (bytes < 0) {
|
||||||
frame->datalen = 0;
|
frame->datalen = 0;
|
||||||
return SWITCH_STATUS_GENERR;
|
return bytes == -2 ? SWITCH_STATUS_TIMEOUT : SWITCH_STATUS_GENERR;
|
||||||
} else if (bytes == 0) {
|
} else if (bytes == 0) {
|
||||||
frame->datalen = 0;
|
frame->datalen = 0;
|
||||||
return SWITCH_STATUS_BREAK;
|
return SWITCH_STATUS_BREAK;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user