[asterisk-commits] may: branch may/ooh323_ipv6_direct_rtp r307676 - in /team/may/ooh323_ipv6_dir...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Feb 12 15:58:05 CST 2011


Author: may
Date: Sat Feb 12 15:57:56 2011
New Revision: 307676

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=307676
Log:
close transmit logical channels by receving empty tcs

Modified:
    team/may/ooh323_ipv6_direct_rtp/addons/chan_ooh323.c
    team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooh245.c
    team/may/ooh323_ipv6_direct_rtp/include/asterisk/astmm.h
    team/may/ooh323_ipv6_direct_rtp/main/astmm.c
    team/may/ooh323_ipv6_direct_rtp/main/rtp_engine.c

Modified: team/may/ooh323_ipv6_direct_rtp/addons/chan_ooh323.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6_direct_rtp/addons/chan_ooh323.c?view=diff&rev=307676&r1=307675&r2=307676
==============================================================================
--- team/may/ooh323_ipv6_direct_rtp/addons/chan_ooh323.c (original)
+++ team/may/ooh323_ipv6_direct_rtp/addons/chan_ooh323.c Sat Feb 12 15:57:56 2011
@@ -83,7 +83,7 @@
 static enum ast_rtp_glue_result ooh323_get_vrtp_peer(struct ast_channel *chan, struct ast_rtp_instance **rtp);
 static int ooh323_set_rtp_peer(struct ast_channel *chan, struct ast_rtp_instance *rtp, 
           struct ast_rtp_instance *vrtp, struct ast_rtp_instance *trtp, const struct ast_format_cap *codecs, int nat_active);
-static format_t ooh323_get_codec(struct ast_channel *chan);
+static void ooh323_get_codec(struct ast_channel *chan, struct ast_format_cap *result);
 
 static struct ast_udptl *ooh323_get_udptl_peer(struct ast_channel *chan);
 static int ooh323_set_udptl_peer(struct ast_channel *chan, struct ast_udptl *udptl);
@@ -689,7 +689,7 @@
 		ast_mutex_unlock(&iflock);
    	} else {
       		ast_mutex_lock(&p->lock);
-      		p->callToken = (char*)ast_malloc(AST_MAX_EXTENSION);
+      		p->callToken = (char*)ast_calloc(1, AST_MAX_EXTENSION);
       		if(!p->callToken) {
        			ast_mutex_unlock(&p->lock);
        			ast_mutex_lock(&iflock);
@@ -2238,7 +2238,7 @@
 				if (user->rtptimeout < 0)
 					user->rtptimeout = gRTPTimeout;
 			} else if (!strcasecmp(v->name, "rtpmask")) {
-				if ((user->rtpmask = malloc(sizeof(struct OOH323Regex))) &&
+				if ((user->rtpmask = ast_calloc(1, sizeof(struct OOH323Regex))) &&
 					(regcomp(&user->rtpmask->regex, v->value, REG_EXTENDED) 
 											== 0)) {
 					ast_mutex_init(&user->rtpmask->lock);
@@ -2392,7 +2392,7 @@
             			if(peer->rtptimeout < 0)
 					peer->rtptimeout = gRTPTimeout;
 			} else if (!strcasecmp(v->name, "rtpmask")) {
-				if ((peer->rtpmask = malloc(sizeof(struct OOH323Regex))) &&
+				if ((peer->rtpmask = ast_calloc(1, sizeof(struct OOH323Regex))) &&
 					(regcomp(&peer->rtpmask->regex, v->value, REG_EXTENDED) 
 											== 0)) {
 					ast_mutex_init(&peer->rtpmask->lock);
@@ -2633,7 +2633,7 @@
 			else 
 				ooH323EpTryBeMaster(0);
 		} else if (!strcasecmp(v->name, "h323id")) {
-         		pNewAlias = malloc(sizeof(struct ooAliases));
+         		pNewAlias = ast_calloc(1, sizeof(struct ooAliases));
 			if (!pNewAlias) {
 				ast_log(LOG_ERROR, "Failed to allocate memory for h323id alias\n");
 				return 1;
@@ -2647,7 +2647,7 @@
 			gAliasList = pNewAlias;
 			pNewAlias = NULL;
 		} else if (!strcasecmp(v->name, "e164")) {
-         		pNewAlias = malloc(sizeof(struct ooAliases));
+         		pNewAlias = ast_calloc(1, sizeof(struct ooAliases));
 			if (!pNewAlias) {
 				ast_log(LOG_ERROR, "Failed to allocate memory for e164 alias\n");
 				return 1;
@@ -2658,7 +2658,7 @@
 			gAliasList = pNewAlias;
 			pNewAlias = NULL;
 		} else if (!strcasecmp(v->name, "email")) {
-         		pNewAlias = malloc(sizeof(struct ooAliases));
+         		pNewAlias = ast_calloc(1, sizeof(struct ooAliases));
 			if (!pNewAlias) {
 				ast_log(LOG_ERROR, "Failed to allocate memory for email alias\n");
 				return 1;
@@ -3270,7 +3270,7 @@
 		.onModeChanged = onModeChanged
 	};
 	if (!(gCap = ast_format_cap_alloc())) {
-		return 1;
+		return 1; 
 	}
 	if (!(ooh323_tech.capabilities = ast_format_cap_alloc())) {
 		return 1;
@@ -3816,19 +3816,19 @@
 	return 0;
 }
 
-static format_t ooh323_get_codec(struct ast_channel *chan)
+static void ooh323_get_codec(struct ast_channel *chan, struct ast_format_cap *result)
 {
 	struct ooh323_pvt *p = chan->tech_pvt;
 	if (gH323Debug) {
-		ast_verbose("+++ ooh323  get_codec\n");	
-	}
+		ast_verbose("+++ ooh323  get_codec, %s\n", chan->name);	
+	}
+
+	ast_format_cap_append(result,  ast_format_cap_is_empty(chan->nativeformats) ? 
+				(ast_format_cap_is_empty(p->cap) ? NULL : p->cap) : chan->nativeformats);
 
 	if (gH323Debug) {
-		ast_verbose("--- ooh323  get_codec, %d\n", (int) (chan->nativeformats ? chan->nativeformats : (p ? p->capability : 0)));
-	}
-
-	return chan->nativeformats ? chan->nativeformats : 
-		(p ? p->capability : 0);
+		ast_verbose("--- ooh323  get_codec, %s\n", chan->name);
+	}
 }
 
 
@@ -3865,8 +3865,8 @@
 	}
 
 	ast_rtp_instance_get_remote_address(*rtp, &tmp);
-	ast_verbose("ooh323_get_rtp_peer  %s:%d\n", ast_sockaddr_stringify_addr(&tmp),
-						ast_sockaddr_port(&tmp));
+	ast_verbose("ooh323_get_rtp_peer  %s -> %s:%d, %d\n", chan->name, ast_sockaddr_stringify_addr(&tmp),
+						ast_sockaddr_port(&tmp), res);
 	if (gH323Debug) {
 		ast_verbose("--- ooh323  get_rtp_peer, res = %d\n", (int) res);	
 	}
@@ -3994,7 +3994,7 @@
 	ast_rtp_instance_get_local_address(rtp, &tmp); */
 	if (changed) {
 		if (!ast_sockaddr_isnull(&p->redirip)) {
-			ast_verbose("ooh323_set_rtp_peer  %s:%d\n", ast_sockaddr_stringify_addr(&p->redirip),
+			ast_verbose("ooh323_set_rtp_peer  %s -> %s:%d\n", chan->name, ast_sockaddr_stringify_addr(&p->redirip),
 							ast_sockaddr_port(&p->redirip));
 			ooUpdateLogChannels(callToken, ast_sockaddr_stringify_addr(&p->redirip),
 							ast_sockaddr_port(&p->redirip));
@@ -4005,6 +4005,7 @@
 	}
 
 	ast_mutex_unlock(&p->lock);
+	free(callToken);
 	return 0;
 }
 

Modified: team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooh245.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooh245.c?view=diff&rev=307676&r1=307675&r2=307676
==============================================================================
--- team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooh245.c (original)
+++ team/may/ooh323_ipv6_direct_rtp/addons/ooh323c/src/ooh245.c Sat Feb 12 15:57:56 2011
@@ -3236,6 +3236,7 @@
    H245TerminalCapabilitySet *tcs=NULL;
    DListNode *pNode=NULL;
    H245CapabilityTableEntry *capEntry = NULL;
+   ooLogicalChannel *temp = NULL;
 
    tcs =  pmsg->h245Msg.u.request->u.terminalCapabilitySet;
    if(call->remoteTermCapSeqNo > tcs->sequenceNumber)
@@ -3257,16 +3258,31 @@
    if(call->remoteTermCapSeqNo == tcs->sequenceNumber)
     call->localTermCapState = OO_LocalTermCapExchange_Idle;
    }
-  
+/* empty tcs - renegotiate logical channels 
+ */ 
    if(!tcs->m.capabilityTablePresent)
    {
-      // OOTRACEWARN3("Warn:Ignoring TCS as no capability table present(%s, %s)\n",
-      OOTRACEWARN3("Empty TCS found.  (%s, %s)\n",
+      OOTRACEDBGC3("Empty TCS found.  (%s, %s)\n",
                     call->callType, call->callToken);
-      // call->h245SessionState = OO_H245SESSION_PAUSED;
-      //ooSendTerminalCapabilitySetReject(call, tcs->sequenceNumber, 
-      //                   T_H245TerminalCapabilitySetReject_cause_unspecified);
-      //return OO_OK;
+
+      ooH245AcknowledgeTerminalCapabilitySet(call);   
+      call->remoteTermCapSeqNo = tcs->sequenceNumber;
+
+/* close all transmit chans */
+
+      temp = call->logicalChans;
+      while(temp) {
+       if(temp->state == OO_LOGICALCHAN_ESTABLISHED) {
+          /* Sending closelogicalchannel only for outgoing channels */
+         if(!strcmp(temp->dir, "transmit")) {
+            ooSendCloseLogicalChannel(call, temp);
+         }
+       }
+       temp = temp->next;
+      }
+
+      call->TCSPending = TRUE;
+      return OO_OK;
    }
    call->remoteTermCapSeqNo = tcs->sequenceNumber;
 

Modified: team/may/ooh323_ipv6_direct_rtp/include/asterisk/astmm.h
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6_direct_rtp/include/asterisk/astmm.h?view=diff&rev=307676&r1=307675&r2=307676
==============================================================================
--- team/may/ooh323_ipv6_direct_rtp/include/asterisk/astmm.h (original)
+++ team/may/ooh323_ipv6_direct_rtp/include/asterisk/astmm.h Sat Feb 12 15:57:56 2011
@@ -57,6 +57,7 @@
 void *__ast_calloc(size_t nmemb, size_t size, const char *file, int lineno, const char *func);
 void *__ast_calloc_cache(size_t nmemb, size_t size, const char *file, int lineno, const char *func);
 void *__ast_malloc(size_t size, const char *file, int lineno, const char *func);
+void *_ast_malloc(size_t size, const char *file, int lineno, const char *func);
 void __ast_free(void *ptr, const char *file, int lineno, const char *func);
 void *__ast_realloc(void *ptr, size_t size, const char *file, int lineno, const char *func);
 char *__ast_strdup(const char *s, const char *file, int lineno, const char *func);

Modified: team/may/ooh323_ipv6_direct_rtp/main/astmm.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6_direct_rtp/main/astmm.c?view=diff&rev=307676&r1=307675&r2=307676
==============================================================================
--- team/may/ooh323_ipv6_direct_rtp/main/astmm.c (original)
+++ team/may/ooh323_ipv6_direct_rtp/main/astmm.c Sat Feb 12 15:57:56 2011
@@ -217,6 +217,11 @@
 }
 
 void *__ast_malloc(size_t size, const char *file, int lineno, const char *func) 
+{
+	return __ast_alloc_region(size, FUNC_MALLOC, file, lineno, func, 0);
+}
+
+void *_ast_malloc(size_t size, const char *file, int lineno, const char *func) 
 {
 	return __ast_alloc_region(size, FUNC_MALLOC, file, lineno, func, 0);
 }

Modified: team/may/ooh323_ipv6_direct_rtp/main/rtp_engine.c
URL: http://svnview.digium.com/svn/asterisk/team/may/ooh323_ipv6_direct_rtp/main/rtp_engine.c?view=diff&rev=307676&r1=307675&r2=307676
==============================================================================
--- team/may/ooh323_ipv6_direct_rtp/main/rtp_engine.c (original)
+++ team/may/ooh323_ipv6_direct_rtp/main/rtp_engine.c Sat Feb 12 15:57:56 2011
@@ -1604,7 +1604,7 @@
 		glue1->get_codec(c1, cap1);
 	}
 
-	ast_debug(1,"glues %d, %d, codecs %d, %d\n", audio_glue0_res, audio_glue1_res, (int) codec0, (int) codec1);
+	/* ast_debug(1,"glues %d, %d, codecs %d, %d\n", audio_glue0_res, audio_glue1_res, (int) codec0, (int) codec1); */
 
 	/* If any sort of bridge is forbidden just completely bail out and go back to generic bridging */
 	if (audio_glue0_res != AST_RTP_GLUE_RESULT_REMOTE || audio_glue1_res != AST_RTP_GLUE_RESULT_REMOTE) {




More information about the asterisk-commits mailing list