[Asterisk-cvs] asterisk/channels/h323 ast_h323.cpp,1.74,1.75

jeremy at lists.digium.com jeremy at lists.digium.com
Wed May 11 09:33:29 CDT 2005


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

Modified Files:
	ast_h323.cpp 
Log Message:
C++ formatting fixes, Log PWLib assertions, remove uncessary locking and to shut bkw up. Bug #4185

Index: ast_h323.cpp
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/h323/ast_h323.cpp,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -d -r1.74 -r1.75
--- ast_h323.cpp	11 May 2005 13:20:32 -0000	1.74
+++ ast_h323.cpp	11 May 2005 13:39:33 -0000	1.75
@@ -128,7 +128,7 @@
 			s1++;
 		c = *s1;
 		*s1 = '\0';
-		ast_verbose(s);
+		ast_verbose("%s", s);
 		*s1 = c;
 	}
 	free(str);
@@ -144,6 +144,8 @@
 MyProcess::MyProcess(): PProcess("The NuFone Network's", "H.323 Channel Driver for Asterisk",
              MAJOR_VERSION, MINOR_VERSION, BUILD_TYPE, BUILD_NUMBER)
 {
+	/* Fix missed one in PWLib */
+	PX_firstTimeStart = FALSE;
 	Resume();
 }
 
@@ -155,6 +157,12 @@
 	PTrace::SetStream(logstream);
 }
 
+void PAssertFunc(const char *msg)
+{
+	ast_log(LOG_ERROR, "%s\n", msg);
+	/* XXX: Probably we need to crash here */
+}
+
 H323_REGISTER_CAPABILITY(H323_G7231Capability, OPAL_G7231);
 H323_REGISTER_CAPABILITY(AST_G729Capability,  OPAL_G729);
 H323_REGISTER_CAPABILITY(AST_G729ACapability, OPAL_G729A);
@@ -318,7 +326,7 @@
 
 	if (h323debug) {
 		cout << "\t-- " << GetLocalUserName() << " is calling host " << fullAddress << endl;
-		cout << "\t--" << "Call token is " << (const char *)token << endl;
+		cout << "\t-- Call token is " << (const char *)token << endl;
 		cout << "\t-- Call reference is " << *callReference << endl;
 		cout << "\t-- DTMF Payload is " << connection->dtmfCodec << endl;
 	}
@@ -736,9 +744,7 @@
 	}
 
 	cd.call_reference = GetCallReference();
-	Lock();
 	cd.call_token = strdup((const char *)GetCallToken());
-	Unlock();
 	cd.call_source_aliases = strdup((const char *)sourceAliases);
 	cd.call_dest_alias = strdup((const char *)destAliases);
 	cd.call_source_e164 = strdup((const char *)sourceE164);
@@ -1093,17 +1099,6 @@
 	endPoint->RemoveGatekeeper();
 }
 
-void h323_end_process(void)
-{
-	endPoint->ClearAllCalls();
-	endPoint->RemoveListener(NULL);
-	delete endPoint;
-	endPoint = NULL;
-	PTrace::SetLevel(0);
-	delete localProcess;
-	delete logstream;
-}
-
 void h323_debug(int flag, unsigned level)
 {
 	if (flag) {
@@ -1258,6 +1253,7 @@
 	char *num;
 	PString h323id(alias->name);
 	PString e164(alias->e164);
+	char *prefix;
 	
 	if (!h323_end_point_exist()) {
 		cout << "ERROR: [h323_set_alias] No Endpoint, this is bad!" << endl;
@@ -1273,14 +1269,14 @@
 		endPoint->AddAliasName(e164);
 	}
 	if (strlen(alias->prefix)) {
-		p = alias->prefix;
-		num = strsep(&p, ",");
-		while(num) {
+		p = prefix = strdup(alias->prefix);
+		while((num = strsep(&p, ",")) != (char *)NULL) {
 	        cout << "== Adding Prefix \"" << num << "\" to endpoint" << endl;
-		endPoint->SupportedPrefixes += PString(num);
-		endPoint->SetGateway();
-	        num = strsep(&p, ",");		
+			endPoint->SupportedPrefixes += PString(num);
+			endPoint->SetGateway();
 		}
+		if (prefix)
+			free(prefix);
 	}
 	return 0;
 }
@@ -1396,6 +1392,7 @@
 	connection = (MyH323Connection *)endPoint->FindConnectionWithLock(currentToken);
 	if (connection) {
 		connection->SetCause(cause);
+		connection->SetCallEndReason(r);
 		connection->Unlock();
 	}
 	endPoint->ClearCall(currentToken, r);
@@ -1503,5 +1500,26 @@
 
 }
 
+#undef cout
+void h323_end_process(void)
+{
+	if (endPoint) {
+		endPoint->ClearAllCalls();
+		endPoint->RemoveListener(NULL);
+		delete endPoint;
+		endPoint = NULL;
+	}
+	if (localProcess) {
+		delete localProcess;
+		localProcess = NULL;
+	}
+	PTrace::SetLevel(0);
+	PTrace::SetStream(&cout);
+	if (logstream) {
+		delete logstream;
+		logstream = NULL;
+	}
+}
+
 } /* extern "C" */
 




More information about the svn-commits mailing list