Ver código fonte

core/parser: Fix extract_sendrecv_mode to always return mode if valid

- All four sendrecv directions return 0
- is_on_hold flag set for inactive and sendonly

(cherry picked from commit 0a019df8f2922a940a41742ce0e4560bb6523d6c)
(cherry picked from commit 49c39a3b2409636d1360d943e6785a34002c9009)
(cherry picked from commit 18d1b4ce5328480e52f7f9d7b394dd00011c1f17)
Hugh Waite 11 anos atrás
pai
commit
20eeee825e
1 arquivos alterados com 4 adições e 5 exclusões
  1. 4 5
      parser/sdp/sdp_helpr_funcs.c

+ 4 - 5
parser/sdp/sdp_helpr_funcs.c

@@ -446,13 +446,12 @@ int extract_sendrecv_mode(str *body, str *sendrecv_mode, int *is_on_hold)
 	cp1 = body->s;
 	if ( !( (strncasecmp(cp1, "a=sendrecv", 10) == 0) ||
 		(strncasecmp(cp1, "a=recvonly", 10) == 0))) {
-		if ( !( (strncasecmp(cp1, "a=inactive", 10) == 0) ||
-			(strncasecmp(cp1, "a=sendonly", 10) == 0) )) {
-			return -1;
-		} else {
+		if ((strncasecmp(cp1, "a=inactive", 10) == 0) ||
+		    (strncasecmp(cp1, "a=sendonly", 10) == 0) ) {
 			*is_on_hold = 1;
+		} else {
+			return -1;
 		}
-		return -1;
 	}
 
 	sendrecv_mode->s = body->s + 2; /* skip `a=' */