[asterisk-commits] pcadach: trunk r43574 - in /trunk/channels: chan_h323.c h323/ast_h323.cxx

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sun Sep 24 11:53:45 MST 2006


Author: pcadach
Date: Sun Sep 24 13:53:44 2006
New Revision: 43574

URL: http://svn.digium.com/view/asterisk?rev=43574&view=rev
Log:
DTMF mode is bitmask, not valued field

Modified:
    trunk/channels/chan_h323.c
    trunk/channels/h323/ast_h323.cxx

Modified: trunk/channels/chan_h323.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_h323.c?rev=43574&r1=43573&r2=43574&view=diff
==============================================================================
--- trunk/channels/chan_h323.c (original)
+++ trunk/channels/chan_h323.c Sun Sep 24 13:53:44 2006
@@ -1254,12 +1254,12 @@
 		ast_parse_allow_disallow(&options->prefs, &options->capability, v->value, 0);
 	} else if (!strcasecmp(v->name, "dtmfmode")) {
 		if (!strcasecmp(v->value, "inband")) {
-			options->dtmfmode = H323_DTMF_INBAND;
+			options->dtmfmode |= H323_DTMF_INBAND;
 		} else if (!strcasecmp(v->value, "rfc2833")) {
-			options->dtmfmode = H323_DTMF_RFC2833;
+			options->dtmfmode |= H323_DTMF_RFC2833;
 		} else {
 			ast_log(LOG_WARNING, "Unknown dtmf mode '%s', using rfc2833\n", v->value);
-			options->dtmfmode = H323_DTMF_RFC2833;
+			options->dtmfmode |= H323_DTMF_RFC2833;
 		}
 	} else if (!strcasecmp(v->name, "dtmfcodec")) {
 		tmp = atoi(v->value);
@@ -1333,6 +1333,7 @@
 	oldha = user->ha;
 	user->ha = (struct ast_ha *)NULL;
 	memcpy(&user->options, &global_options, sizeof(user->options));
+	user->options.dtmfmode = 0;
 	/* Set default context */
 	strncpy(user->context, default_context, sizeof(user->context) - 1);
 	if (user && !found)
@@ -1377,6 +1378,8 @@
 			user->ha = ast_append_ha(v->name, v->value, user->ha);
 		}
 	}
+	if (!user->options.dtmfmode)
+		user->options.dtmfmode = global_options.dtmfmode;
 	ASTOBJ_UNMARK(user);
 	ast_free_ha(oldha);
 	return user;
@@ -1438,6 +1441,7 @@
 	oldha = peer->ha;
 	peer->ha = NULL;
 	memcpy(&peer->options, &global_options, sizeof(peer->options));
+	peer->options.dtmfmode = 0;
 	peer->addr.sin_port = htons(h323_signalling_port);
 	peer->addr.sin_family = AF_INET;
 	if (!found && name)
@@ -1475,6 +1479,8 @@
 			ast_copy_string(peer->mailbox, v->value, sizeof(peer->mailbox));
 		}
 	}
+	if (!peer->options.dtmfmode)
+		peer->options.dtmfmode = global_options.dtmfmode;
 	ASTOBJ_UNMARK(peer);
 	ast_free_ha(oldha);
 	return peer;
@@ -2729,7 +2735,7 @@
 	global_options.fastStart = 1;
 	global_options.h245Tunneling = 1;
 	global_options.dtmfcodec = H323_DTMF_RFC2833_PT;
-	global_options.dtmfmode = H323_DTMF_RFC2833;
+	global_options.dtmfmode = 0;
 	global_options.capability = GLOBAL_CAPABILITY;
 	global_options.bridge = 1;		/* Do native bridging by default */
 	strncpy(default_context, "default", sizeof(default_context) - 1);
@@ -2822,6 +2828,8 @@
 			/* dummy */
 		}
 	}
+	if (!global_options.dtmfmode)
+		global_options.dtmfmode = H323_DTMF_RFC2833;
 
 	for (cat = ast_category_browse(cfg, NULL); cat; cat = ast_category_browse(cfg, cat)) {
 		if (strcasecmp(cat, "general")) {

Modified: trunk/channels/h323/ast_h323.cxx
URL: http://svn.digium.com/view/asterisk/trunk/channels/h323/ast_h323.cxx?rev=43574&r1=43573&r2=43574&view=diff
==============================================================================
--- trunk/channels/h323/ast_h323.cxx (original)
+++ trunk/channels/h323/ast_h323.cxx Sun Sep 24 13:53:44 2006
@@ -1204,7 +1204,7 @@
 
 void MyH323Connection::OnUserInputTone(char tone, unsigned duration, unsigned logicalChannel, unsigned rtpTimestamp)
 {
-	if (dtmfMode == H323_DTMF_RFC2833) {
+	if ((dtmfMode & H323_DTMF_RFC2833)) {
 		if (h323debug) {
 			cout << "\t-- Received user input tone (" << tone << ") from remote" << endl;
 		}
@@ -1299,7 +1299,7 @@
 	if (cap != NULL) {
 		RTP_DataFrame::PayloadTypes pt = ((H323_UserInputCapability*)cap)->GetPayloadType();
 		on_set_rfc2833_payload(GetCallReference(), (const char *)GetCallToken(), (int)pt);
-		if ((dtmfMode == H323_DTMF_RFC2833) && (sendUserInputMode == SendUserInputAsTone))
+		if ((dtmfMode & H323_DTMF_RFC2833) && (sendUserInputMode == SendUserInputAsTone))
 			sendUserInputMode = SendUserInputAsInlineRFC2833;
 		if (h323debug) {
 			cout << "\t-- Inbound RFC2833 on payload " << pt << endl;
@@ -1514,7 +1514,7 @@
 
 	lastcap++;
 	dtmfMode = dtmf_mode;
-	if (dtmf_mode == H323_DTMF_INBAND) {
+	if ((dtmfMode & H323_DTMF_INBAND)) {
 		localCapabilities.SetCapability(0, lastcap, new H323_UserInputCapability(H323_UserInputCapability::BasicString));
 		sendUserInputMode = SendUserInputAsString;
 	} else {



More information about the asterisk-commits mailing list