[sr-dev] git:master: core/parser: Fix extract_sendrecv_mode to always return mode if valid

Hugh Waite hugh.waite at acision.com
Wed Oct 29 18:22:55 CET 2014


Module: sip-router
Branch: master
Commit: 0a019df8f2922a940a41742ce0e4560bb6523d6c
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=0a019df8f2922a940a41742ce0e4560bb6523d6c

Author: Hugh Waite <hugh.waite at acision.com>
Committer: Hugh Waite <hugh.waite at acision.com>
Date:   Wed Oct  8 21:11:55 2014 +0100

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

---

 parser/sdp/sdp_helpr_funcs.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/parser/sdp/sdp_helpr_funcs.c b/parser/sdp/sdp_helpr_funcs.c
index 6436b85..52fe655 100644
--- a/parser/sdp/sdp_helpr_funcs.c
+++ b/parser/sdp/sdp_helpr_funcs.c
@@ -384,13 +384,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=' */




More information about the sr-dev mailing list