提交 7406be69 authored 作者: Travis Cross's avatar Travis Cross

Relay cause of hangup on SRTP failure

We hangup the channel after receiving 10 SRTP packets in a row with a
bad auth tag or that are replayed.  Prior to this commit we were
indicating a normal clearing.  When doing interop and looking first at
packet traces, this made freeswitch's behavior look surprising.  With
this commit we'll indicate more loudly what's happening.
上级 52892b31
......@@ -1968,7 +1968,8 @@ typedef enum {
SWITCH_CAUSE_GATEWAY_DOWN = 609,
SWITCH_CAUSE_INVALID_URL = 610,
SWITCH_CAUSE_INVALID_PROFILE = 611,
SWITCH_CAUSE_NO_PICKUP = 612
SWITCH_CAUSE_NO_PICKUP = 612,
SWITCH_CAUSE_SRTP_READ_ERROR = 613
} switch_call_cause_t;
typedef enum {
......
......@@ -123,6 +123,7 @@ static struct switch_cause_table CAUSE_CHART[] = {
{"INVALID_URL", SWITCH_CAUSE_INVALID_URL},
{"INVALID_PROFILE", SWITCH_CAUSE_INVALID_PROFILE},
{"NO_PICKUP", SWITCH_CAUSE_NO_PICKUP},
{"SRTP_READ_ERROR", SWITCH_CAUSE_SRTP_READ_ERROR},
{NULL, 0}
};
......
......@@ -4802,15 +4802,14 @@ static switch_status_t read_rtp_packet(switch_rtp_t *rtp_session, switch_size_t
if (stat && rtp_session->recv_msg.header.pt != rtp_session->recv_te && rtp_session->recv_msg.header.pt != rtp_session->cng_pt) {
if (++rtp_session->srtp_errs[rtp_session->srtp_idx_rtp] >= MAX_SRTP_ERRS && stat != 10) {
switch_channel_t *channel = switch_core_session_get_channel(rtp_session->session);
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR,
"Error: SRTP %s unprotect failed with code %d%s %ld\n", rtp_type(rtp_session), stat,
stat == err_status_replay_fail ? " (replay check failed)" : stat ==
err_status_auth_fail ? " (auth check failed)" : "", (long)*bytes);
return SWITCH_STATUS_GENERR;
} else {
sbytes = 0;
switch_channel_hangup(channel, SWITCH_CAUSE_SRTP_READ_ERROR);
}
sbytes = 0;
} else {
rtp_session->srtp_errs[rtp_session->srtp_idx_rtp] = 0;
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论