From efef44985d8db83d23cd66d09e56780266066668 Mon Sep 17 00:00:00 2001 From: Salah Ahmed Date: Fri, 15 Nov 2019 11:34:26 -0600 Subject: [PATCH] res_pjsip_t38: T.38 error correction mode selection at 200 ok received if asterisk offer T38 SDP with none error correction scheme and the endpoint respond with redundancy EC scheme, asterisk switch to that mode. Since we configure the endpoint as none EC mode we should not switch to any other mode except none. following logic implemented in code. 1. If asterisk offer none, and anything except none in answer will be ignored. 2. If asterisk offer fec, answer with fec, redundancy and none will be accepted. 3. If asterisk offer redundancy, answer with redundancy and none will be accepted. ASTERISK-28621 Change-Id: I343c62253ea4c8b7ee17abbfb377a4d484a14b19 --- res/res_pjsip_t38.c | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/res/res_pjsip_t38.c b/res/res_pjsip_t38.c index cb126a4015..9c9569b4f2 100644 --- a/res/res_pjsip_t38.c +++ b/res/res_pjsip_t38.c @@ -740,12 +740,32 @@ static void t38_interpret_sdp(struct t38_state *state, struct ast_sip_session *s state->their_parms.rate_management = AST_T38_RATE_MANAGEMENT_TRANSFERRED_TCF; } } else if (!pj_stricmp2(&attr->name, "t38faxudpec")) { - if (!pj_stricmp2(&attr->value, "t38UDPRedundancy")) { - ast_udptl_set_error_correction_scheme(session_media->udptl, UDPTL_ERROR_CORRECTION_REDUNDANCY); - } else if (!pj_stricmp2(&attr->value, "t38UDPFEC")) { - ast_udptl_set_error_correction_scheme(session_media->udptl, UDPTL_ERROR_CORRECTION_FEC); + if (session->t38state == T38_LOCAL_REINVITE) { + if (session->endpoint->media.t38.error_correction == UDPTL_ERROR_CORRECTION_FEC) { + if (!pj_stricmp2(&attr->value, "t38UDPFEC")) { + ast_udptl_set_error_correction_scheme(session_media->udptl, UDPTL_ERROR_CORRECTION_FEC); + } else if (!pj_stricmp2(&attr->value, "t38UDPRedundancy")) { + ast_udptl_set_error_correction_scheme(session_media->udptl, UDPTL_ERROR_CORRECTION_REDUNDANCY); + } else { + ast_udptl_set_error_correction_scheme(session_media->udptl, UDPTL_ERROR_CORRECTION_NONE); + } + } else if (session->endpoint->media.t38.error_correction == UDPTL_ERROR_CORRECTION_REDUNDANCY) { + if (!pj_stricmp2(&attr->value, "t38UDPRedundancy")) { + ast_udptl_set_error_correction_scheme(session_media->udptl, UDPTL_ERROR_CORRECTION_REDUNDANCY); + } else { + ast_udptl_set_error_correction_scheme(session_media->udptl, UDPTL_ERROR_CORRECTION_NONE); + } + } else { + ast_udptl_set_error_correction_scheme(session_media->udptl, UDPTL_ERROR_CORRECTION_NONE); + } } else { - ast_udptl_set_error_correction_scheme(session_media->udptl, UDPTL_ERROR_CORRECTION_NONE); + if (!pj_stricmp2(&attr->value, "t38UDPRedundancy")) { + ast_udptl_set_error_correction_scheme(session_media->udptl, UDPTL_ERROR_CORRECTION_REDUNDANCY); + } else if (!pj_stricmp2(&attr->value, "t38UDPFEC")) { + ast_udptl_set_error_correction_scheme(session_media->udptl, UDPTL_ERROR_CORRECTION_FEC); + } else { + ast_udptl_set_error_correction_scheme(session_media->udptl, UDPTL_ERROR_CORRECTION_NONE); + } } }