[asterisk-commits] pcadach: branch pcadach/chan_h323-live r40779 - /team/pcadach/chan_h323-live/...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Aug 21 11:52:19 MST 2006


Author: pcadach
Date: Mon Aug 21 13:52:19 2006
New Revision: 40779

URL: http://svn.digium.com/view/asterisk?rev=40779&view=rev
Log:
Small updates:
1) Replace usage counters by ast_module_ref()/ast_module_unref()
   (as suggested by Kevin);
2) Lookup peer by address too and set RTP options when no named
   peer found;
3) Ignore (for present time, until VL-DTMF isn't ready) "DTMF tone
   end" message (uses space instead DTMF digit).

Modified:
    team/pcadach/chan_h323-live/channels/chan_h323.c

Modified: team/pcadach/chan_h323-live/channels/chan_h323.c
URL: http://svn.digium.com/view/asterisk/team/pcadach/chan_h323-live/channels/chan_h323.c?rev=40779&r1=40778&r2=40779&view=diff
==============================================================================
--- team/pcadach/chan_h323-live/channels/chan_h323.c (original)
+++ team/pcadach/chan_h323-live/channels/chan_h323.c Mon Aug 21 13:52:19 2006
@@ -149,7 +149,6 @@
 static int tos = 0;
 static char secret[50];
 static unsigned int unique = 0;
-static int usecnt = 0;
 
 static call_options_t global_options;
 
@@ -572,8 +571,7 @@
 
 	/* Update usage counter */
 	ast_mutex_unlock(&pvt->lock);
-	ast_atomic_fetchadd_int(&usecnt, -1);
-	ast_update_use_count();
+	ast_module_unref(ast_module_info->self);
 	return 0;
 }
 
@@ -776,8 +774,7 @@
 	ast_mutex_unlock(&pvt->lock);
 	ch = ast_channel_alloc(1);
 	/* Update usage counter */
-	ast_atomic_fetchadd_int(&usecnt, +1);
-	ast_update_use_count();
+	ast_module_ref(ast_module_info->self);
 	ast_mutex_lock(&pvt->lock);
 	if (ch) {
 		ch->tech = &oh323_tech;
@@ -1053,10 +1050,23 @@
 		}		
 		hp = ast_gethostbyname(hostn, &ahp);
 		if (hp) {
-			memcpy(&pvt->options, &global_options, sizeof(pvt->options));
-			pvt->jointcapability = pvt->options.capability;
 			memcpy(&pvt->sa.sin_addr, hp->h_addr, sizeof(pvt->sa.sin_addr));
 			pvt->sa.sin_port = htons(portno);
+			/* Look peer by address */
+			p = find_peer(NULL, &pvt->sa);
+			memcpy(&pvt->options, (p ? &p->options :  &global_options), sizeof(pvt->options));
+			pvt->jointcapability = pvt->options.capability;
+			if (pvt->rtp) {
+				ast_log(LOG_DEBUG, "Setting NAT on RTP to %d\n", pvt->options.nat);
+				ast_rtp_setnat(pvt->rtp, pvt->options.nat);
+			}
+			if (pvt->options.dtmfmode) {
+				if (pvt->options.dtmfmode & H323_DTMF_RFC2833) {
+					pvt->nonCodecCapability |= AST_RTP_DTMF;
+				} else {
+					pvt->nonCodecCapability &= ~AST_RTP_DTMF;
+				}
+			}
 			return 0;	
 		} else {
 			ast_log(LOG_WARNING, "No such host: %s\n", peer);
@@ -1171,6 +1181,8 @@
 	struct oh323_pvt *pvt;
 	int res;
 
+	if (digit == ' ') /* DTMF tone update -- ignore */
+		return 0;
 	ast_log(LOG_DEBUG, "Received Digit: %c\n", digit);
 	pvt = find_call_locked(call_reference, token); 
 	if (!pvt) {



More information about the asterisk-commits mailing list