[asterisk-commits] file: branch 1.4 r59081 - /branches/1.4/channels/chan_sip.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Mar 20 20:25:48 MST 2007


Author: file
Date: Tue Mar 20 22:25:48 2007
New Revision: 59081

URL: http://svn.digium.com/view/asterisk?view=rev&rev=59081
Log:
Until we can do media level parsing for sendrecv/etc just use the first value found. This crept up when a phone was offered audio+video and returned an inactive video stream. chan_sip thought the phone said to put the person on hold but that was totally wrong. (issue #9319 reported by benbrown)

Modified:
    branches/1.4/channels/chan_sip.c

Modified: branches/1.4/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/channels/chan_sip.c?view=diff&rev=59081&r1=59080&r2=59081
==============================================================================
--- branches/1.4/channels/chan_sip.c (original)
+++ branches/1.4/channels/chan_sip.c Tue Mar 20 22:25:48 2007
@@ -4731,7 +4731,7 @@
 	int codec;
 	int destiterator = 0;
 	int iterator;
-	int sendonly = 0;
+	int sendonly = -1;
 	int numberofports;
 	struct ast_rtp *newaudiortp, *newvideortp;	/* Buffers for codec handling */
 	int newjointcapability;				/* Negotiated capability */
@@ -4965,13 +4965,16 @@
 				continue;
 		}
 		if (!strcasecmp(a, "sendonly")) {
-			sendonly = 1;
+			if (sendonly == -1)
+				sendonly = 1;
 			continue;
 		} else if (!strcasecmp(a, "inactive")) {
-			sendonly = 2;
+			if (sendonly == -1)
+				sendonly = 2;
 			continue;
 		}  else if (!strcasecmp(a, "sendrecv")) {
-			sendonly = 0;
+			if (sendonly == -1)
+				sendonly = 0;
 			continue;
 		} else if (strlen(a) > 5 && !strncasecmp(a, "ptime", 5)) {
 			char *tmp = strrchr(a, ':');
@@ -5227,7 +5230,7 @@
 		ast_set_write_format(p->owner, p->owner->writeformat);
 	}
 	
-	if (sin.sin_addr.s_addr && !sendonly) {
+	if (sin.sin_addr.s_addr && (!sendonly || sendonly == -1)) {
 		ast_queue_control(p->owner, AST_CONTROL_UNHOLD);
 		/* Activate a re-invite */
 		ast_queue_frame(p->owner, &ast_null_frame);
@@ -5243,7 +5246,7 @@
 	}
 
 	/* Manager Hold and Unhold events must be generated, if necessary */
-	if (sin.sin_addr.s_addr && !sendonly) {
+	if (sin.sin_addr.s_addr && (!sendonly || sendonly == -1)) {
 		if (ast_test_flag(&p->flags[1], SIP_PAGE2_CALL_ONHOLD)) {
 			append_history(p, "Unhold", "%s", req->data);
 			if (global_callevents)



More information about the asterisk-commits mailing list