[Asterisk-code-review] res_pjsip_t38: T.38 error correction mode selection at 200 ok received (asterisk[13])

Salah Ahmed asteriskteam at digium.com
Fri Nov 15 11:34:46 CST 2019


Salah Ahmed has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/13180 )


Change subject: res_pjsip_t38: T.38 error correction mode selection at 200 ok received
......................................................................

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
---
M res/res_pjsip_t38.c
1 file changed, 25 insertions(+), 5 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/80/13180/1

diff --git a/res/res_pjsip_t38.c b/res/res_pjsip_t38.c
index 62bbb48..7cdd471 100644
--- a/res/res_pjsip_t38.c
+++ b/res/res_pjsip_t38.c
@@ -702,12 +702,32 @@
 				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);
+				}
 			}
 		}
 

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/13180
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Change-Id: I343c62253ea4c8b7ee17abbfb377a4d484a14b19
Gerrit-Change-Number: 13180
Gerrit-PatchSet: 1
Gerrit-Owner: Salah Ahmed <txrubel at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20191115/853ba781/attachment.html>


More information about the asterisk-code-review mailing list