[Asterisk-cvs] asterisk/channels chan_h323.c,1.115,1.116

jeremy at lists.digium.com jeremy at lists.digium.com
Thu May 19 15:07:24 CDT 2005


Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv14433/channels

Modified Files:
	chan_h323.c 
Log Message:
Make capbilities be connection specific versus for the whole endpoint. Bug #4334

Index: chan_h323.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_h323.c,v
retrieving revision 1.115
retrieving revision 1.116
diff -u -d -r1.115 -r1.116
--- chan_h323.c	19 May 2005 16:17:08 -0000	1.115
+++ chan_h323.c	19 May 2005 19:12:22 -0000	1.116
@@ -83,6 +83,7 @@
 progress_cb on_progress;
 rfc2833_cb on_set_rfc2833_payload;
 hangup_cb on_hangup;
+setcapabilities_cb on_setcapabilities;
 
 /* global debug flag */
 int h323debug;
@@ -1014,9 +1015,7 @@
 	else
 		memcpy(&pvt->options, &global_options, sizeof(pvt->options));
 
-	/* pass on our capabilites to the H.323 stack */
 	ast_mutex_lock(&caplock);
-	h323_set_capability(pvt->capability, pvt->dtmfmode);
 	/* Generate unique channel identifier */
 	snprintf(tmp1, sizeof(tmp1)-1, "%s-%u", host, ++unique);
 	tmp1[sizeof(tmp1)-1] = '\0';
@@ -1511,6 +1510,26 @@
 		ast_log(LOG_DEBUG, "DTMF payload on %s set to %d\n", token, payload);
 }
 
+static void set_local_capabilities(unsigned call_reference, const char *token)
+{
+	struct oh323_pvt *pvt;
+	int capability, dtmfmode;
+
+	if (h323debug)
+		ast_log(LOG_DEBUG, "Setting capabilities for connection %s\n", token);
+
+	pvt = find_call_locked(call_reference, token);
+	if (!pvt)
+		return;
+	capability = pvt->capability;
+	dtmfmode = pvt->dtmfmode;
+	ast_mutex_unlock(&pvt->lock);
+	h323_set_capabilities(token, capability, dtmfmode);
+
+	if (h323debug)
+		ast_log(LOG_DEBUG, "Capabilities for connection %s is set\n", token);
+}
+
 static void *do_monitor(void *data)
 {
 	int res;
@@ -2160,14 +2179,6 @@
 		alias = alias->next;
 	}
 
-	/* Add our capabilities */
-	ast_mutex_lock(&caplock);
-	if (h323_set_capability(capability, dtmfmode)) {
-		ast_log(LOG_ERROR, "Capabilities failure, this is bad.\n");
-		ast_mutex_unlock(&caplock);
-		return -1;
-	}
-	ast_mutex_unlock(&caplock);
 	return 0;
 }
 
@@ -2383,7 +2394,8 @@
 						answer_call,
 						progress,
 						set_dtmf_payload,
-						hangup_connection);
+						hangup_connection,
+						set_local_capabilities);
 		/* start the h.323 listener */
 		if (h323_start_listener(h323_signalling_port, bindaddr)) {
 			ast_log(LOG_ERROR, "Unable to create H323 listener.\n");




More information about the svn-commits mailing list