[asterisk-commits] may: branch may/chan_ooh323_rework r226685 - /team/may/chan_ooh323_rework/add...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Nov 1 17:15:15 CST 2009


Author: may
Date: Sun Nov  1 17:15:11 2009
New Revision: 226685

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=226685
Log:
reference counter used now (per call and per thread)
rtp timeout is now used for rtp_instance
small changes in rtp calls (engine name and others

Modified:
    team/may/chan_ooh323_rework/addons/chan_ooh323.c
    team/may/chan_ooh323_rework/addons/ooh323cDriver.c

Modified: team/may/chan_ooh323_rework/addons/chan_ooh323.c
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_rework/addons/chan_ooh323.c?view=diff&rev=226685&r1=226684&r2=226685
==============================================================================
--- team/may/chan_ooh323_rework/addons/chan_ooh323.c (original)
+++ team/may/chan_ooh323_rework/addons/chan_ooh323.c Sun Nov  1 17:15:11 2009
@@ -45,6 +45,8 @@
 static const char type[] = "OOH323";
 static const char tdesc[] = "Objective Systems H323 Channel Driver";
 static const char config[] = "ooh323.conf";
+
+struct ast_module *myself;
 
 static struct ast_jb_conf default_jbconf =
 {
@@ -99,7 +101,7 @@
 	.fixup = ooh323_fixup,
 	.send_html = 0,
 	.queryoption = ooh323_queryoption,
-	.bridge = ast_rtp_instance_bridge,                      /* XXX chan unlocked ? */
+	.bridge = ast_rtp_instance_bridge,		/* XXX chan unlocked ? */
 	.early_bridge = ast_rtp_instance_early_bridge,
 
 };
@@ -128,6 +130,7 @@
 	struct ast_rtp_instance *vrtp; /* Placeholder for now */
 
 	int t38support;			/* T.38 mode - disable, transparent, faxgw */
+	int rtptimeout;
 	struct ast_udptl *udptl;
 	int faxmode;
 	int t38_tx_enable;
@@ -362,6 +365,7 @@
 		ast_set_read_format(ch, fmt);
 		ch->tech_pvt = i;
 		i->owner = ch;
+		ast_module_ref(myself);
 
 		/* Allocate dsp for in-band DTMF support */
 		if (i->dtmfmode & H323_DTMF_INBAND) {
@@ -465,7 +469,7 @@
 	}
 
 	ouraddr.sin_addr = ipAddr;
-	if (!(pvt->rtp = ast_rtp_instance_new(NULL, sched, &ouraddr, NULL))) {
+	if (!(pvt->rtp = ast_rtp_instance_new("asterisk", sched, &ouraddr, NULL))) {
 		ast_log(LOG_WARNING, "Unable to create RTP session: %s\n", 
 				  strerror(errno));
 		ast_mutex_unlock(&pvt->lock);
@@ -488,6 +492,7 @@
 	ast_udptl_set_error_correction_scheme(pvt->udptl, UDPTL_ERROR_CORRECTION_NONE);
 	pvt->faxmode = 0;
 	pvt->t38support = gT38Support;
+	pvt->rtptimeout = gRTPTimeout;
 
 	pvt->call_reference = callref;
 	if (callToken)
@@ -609,6 +614,7 @@
 		p->dtmfmode |= peer->dtmfmode;
 		p->dtmfcodec  = peer->dtmfcodec;
 		p->t38support = peer->t38support;
+		p->rtptimeout = peer->rtptimeout;
 		if (peer->rtpmask && peer->rtpmaskstr[0]) {
 			p->rtpmask = peer->rtpmask;
 			ast_copy_string(p->rtpmaskstr, peer->rtpmaskstr, sizeof(p->rtpmaskstr));
@@ -619,6 +625,7 @@
 		p->dtmfmode = gDTMFMode;
 		p->dtmfcodec = gDTMFCodec;
 		p->t38support = gT38Support;
+		p->rtptimeout = gRTPTimeout;
 		p->capability = gCapability;
 
 		memcpy(&p->prefs, &gPrefs, sizeof(struct ast_codec_pref));
@@ -995,6 +1002,7 @@
 		if (p->owner) {
 			p->owner->tech_pvt = NULL;
 			p->owner = NULL;
+			ast_module_unref(myself);
 		}
 
 		ast_mutex_unlock(&p->lock);
@@ -1688,6 +1696,7 @@
 			p->dtmfmode |= user->dtmfmode;
 			p->dtmfcodec = user->dtmfcodec;
 			p->t38support = user->t38support;
+			p->rtptimeout = user->rtptimeout;
 			if (user->rtpmask && user->rtpmaskstr[0]) {
 				p->rtpmask = user->rtpmask;
 				ast_copy_string(p->rtpmaskstr, user->rtpmaskstr, 
@@ -1700,7 +1709,7 @@
 			ast_mutex_unlock(&user->lock);
       } else {
 	 if (!OO_TESTFLAG(p->flags,H323_DISABLEGK)) {
-	  p->username = strdup(call->remoteIP);
+		p->username = strdup(call->remoteIP);
 	 } else {
 	  ast_mutex_unlock(&p->lock);
 	  ast_log(LOG_ERROR, "Unacceptable ip %s\n", call->remoteIP);
@@ -1975,6 +1984,7 @@
     		p->owner->tech_pvt = NULL;
 		ast_channel_unlock(p->owner);
     		p->owner = NULL;
+		ast_module_unref(myself);
 	}
 
 	ast_set_flag(p, H323_NEEDDESTROY);
@@ -3097,6 +3107,8 @@
 		"---\n"
 		"---------------------------------------------------------------------------------\n");
 
+	myself = ast_module_info->self;
+
 	h225Callbacks.onReceivedSetup = &ooh323_onReceivedSetup;
 
 	userl.users = NULL;
@@ -3406,6 +3418,7 @@
 			cur->owner->tech_pvt = NULL;
 			ast_channel_unlock(cur->owner);
 			cur->owner = NULL;
+			ast_module_unref(myself);
 		}
   
 		if (cur->vad) {
@@ -3762,17 +3775,25 @@
 	if (p->rtp) {
 		ast_rtp_codecs_packetization_set(ast_rtp_instance_get_codecs(p->rtp), p->rtp, &p->prefs);
 		if (p->dtmfmode & H323_DTMF_RFC2833 && p->dtmfcodec) {
+			ast_rtp_instance_set_prop(p->rtp, AST_RTP_PROPERTY_DTMF, 1);
 			ast_rtp_codecs_payloads_set_rtpmap_type(ast_rtp_instance_get_codecs(p->rtp),
 				 p->rtp, p->dtmfcodec, "audio", "telephone-event", 0);
 		}
 		if (p->dtmfmode & H323_DTMF_CISCO && p->dtmfcodec) {
+			ast_rtp_instance_set_prop(p->rtp, AST_RTP_PROPERTY_DTMF, 1);
 			ast_rtp_codecs_payloads_set_rtpmap_type(ast_rtp_instance_get_codecs(p->rtp),
 				 p->rtp, p->dtmfcodec, "audio", "cisco-telephone-event", 0);
 		}
-	}
-
-	/* figure out our local RTP port and tell the H.323 stack about it*/
-	ast_rtp_instance_get_local_address(p->rtp, &us);
+		/* figure out our local RTP port and tell the H.323 stack about it*/
+		ast_rtp_instance_get_local_address(p->rtp, &us);
+
+		if (p->rtptimeout) {
+			ast_rtp_instance_set_timeout(p->rtp, p->rtptimeout);
+		}
+		ast_rtp_instance_set_prop(p->rtp, AST_RTP_PROPERTY_RTCP, 1);
+		
+	}
+
 
 	ast_copy_string(mediaInfo.lMediaIP, ast_inet_ntoa(us.sin_addr), sizeof(mediaInfo.lMediaIP));
 	mediaInfo.lMediaPort = ntohs(us.sin_port);
@@ -3798,7 +3819,9 @@
 		}
 	}
 
-	ast_udptl_get_us(p->udptl, &us);
+	if (p->udptl) {
+		ast_udptl_get_us(p->udptl, &us);
+	}
 	ast_copy_string(mediaInfo.lMediaIP, ast_inet_ntoa(us.sin_addr), sizeof(mediaInfo.lMediaIP));
 	mediaInfo.lMediaPort = ntohs(us.sin_port);
 	mediaInfo.lMediaCntrlPort = mediaInfo.lMediaPort +1;

Modified: team/may/chan_ooh323_rework/addons/ooh323cDriver.c
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_rework/addons/ooh323cDriver.c?view=diff&rev=226685&r1=226684&r2=226685
==============================================================================
--- team/may/chan_ooh323_rework/addons/ooh323cDriver.c (original)
+++ team/may/chan_ooh323_rework/addons/ooh323cDriver.c Sun Nov  1 17:15:11 2009
@@ -27,6 +27,7 @@
 
 #define SEC_TO_HOLD_THREAD 24
 
+extern struct ast_module *myself;
 extern OOBOOL gH323Debug;
 extern OOH323EndPoint gH323ep;
 /* ooh323c stack thread. */
@@ -119,6 +120,8 @@
  ast_mutex_destroy(&mycthread->lock);
 
  free(mycthread);
+ ast_module_unref(myself);
+ ast_update_use_count();
  return dummy;
 }
 
@@ -147,6 +150,7 @@
 		return -1;
 	}
 
+	ast_module_ref(myself);
 	memset(cur, 0, sizeof(cur));
 	if ((socketpair(PF_LOCAL, SOCK_STREAM, 0, cur->thePipe)) == -1) {
 		ast_log(LOG_ERROR, "Can't create thread pipe for call %s\n", call->callToken);




More information about the asterisk-commits mailing list