[Asterisk-cvs] asterisk/channels/h323 ast_h323.cpp,1.25,1.26

jeremy at lists.digium.com jeremy at lists.digium.com
Wed Nov 19 16:20:03 CST 2003


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

Modified Files:
	ast_h323.cpp 
Log Message:
apply G.729 patches (with changes) from bug #421


Index: ast_h323.cpp
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/h323/ast_h323.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -d -r1.25 -r1.26
--- ast_h323.cpp	22 Sep 2003 06:21:03 -0000	1.25
+++ ast_h323.cpp	19 Nov 2003 22:46:21 -0000	1.26
@@ -1,4 +1,4 @@
-/*
+/*
  * ast_h323.cpp
  *
  * OpenH323 Channel Driver for ASTERISK PBX.
@@ -22,7 +22,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
- *
+ *
  * Version Info: $Id$
  */
 #include "ast_h323.h"
@@ -100,8 +100,12 @@
 
 
 #define H323_NAME OPAL_G7231_6k3"{sw}"
+#define H323_G729  OPAL_G729 "{sw}"
+#define H323_G729A OPAL_G729A"{sw}"
 
 H323_REGISTER_CAPABILITY(H323_G7231Capability, H323_NAME);
+H323_REGISTER_CAPABILITY(AST_G729Capability,  H323_G729);
+H323_REGISTER_CAPABILITY(AST_G729ACapability, H323_G729A);
 
 H323_G7231Capability::H323_G7231Capability(BOOL annexA_)
   : H323AudioCapability(7, 4)
@@ -173,6 +177,68 @@
   return NULL;
 }
 
+
+/////////////////////////////////////////////////////////////////////////////
+
+AST_G729Capability::AST_G729Capability()
+  : H323AudioCapability(24, 6)
+{
+}
+
+
+PObject * AST_G729Capability::Clone() const
+{
+  return new AST_G729Capability(*this);
+}
+
+
+unsigned AST_G729Capability::GetSubType() const
+{
+  return H245_AudioCapability::e_g729;
+}
+
+
+PString AST_G729Capability::GetFormatName() const
+{
+  return H323_G729;
+}
+
+
+H323Codec * AST_G729Capability::CreateCodec(H323Codec::Direction direction) const
+{
+  return NULL;
+}
+/////////////////////////////////////////////////////////////////////////////
+
+AST_G729ACapability::AST_G729ACapability()
+  : H323AudioCapability(24, 6)
+{
+}
+
+
+PObject * AST_G729ACapability::Clone() const
+{
+  return new AST_G729ACapability(*this);
+}
+
+
+unsigned AST_G729ACapability::GetSubType() const
+{
+  return H245_AudioCapability::e_g729AnnexA;
+}
+
+
+PString AST_G729ACapability::GetFormatName() const
+{
+  return H323_G729A;
+}
+
+
+H323Codec * AST_G729ACapability::CreateCodec(H323Codec::Direction direction) const
+{
+  return NULL;
+}
+
 /** MyH323EndPoint 
   * The fullAddress parameter is used directly in the MakeCall method so
   * the General form for the fullAddress argument is :
@@ -268,24 +334,24 @@
 		cout << "		channelsOpen = " << channelsOpen << endl;
 	H323EndPoint::OnClosedLogicalChannel(connection, channel);
 }
-
-BOOL MyH323EndPoint::OnConnectionForwarded(H323Connection & connection,
- 		const PString & forwardParty,
- 		const H323SignalPDU & pdu)
- {
- 	if (h323debug)
- 	cout << "       -- Call Forwarded to " << forwardParty << endl;
- 	return FALSE;
- }
- 
-BOOL MyH323EndPoint::ForwardConnection(H323Connection & connection,
- 		const PString & forwardParty,
- 		const H323SignalPDU & pdu)
-{
- 	if (h323debug)
- 		cout << "       -- Forwarding call to " << forwardParty << endl;
- 	return H323EndPoint::ForwardConnection(connection, forwardParty, pdu);
-}
+
+BOOL MyH323EndPoint::OnConnectionForwarded(H323Connection & connection,
+ 		const PString & forwardParty,
+ 		const H323SignalPDU & pdu)
+ {
+ 	if (h323debug)
+ 	cout << "       -- Call Forwarded to " << forwardParty << endl;
+ 	return FALSE;
+ }
+ 
+BOOL MyH323EndPoint::ForwardConnection(H323Connection & connection,
+ 		const PString & forwardParty,
+ 		const H323SignalPDU & pdu)
+{
+ 	if (h323debug)
+ 		cout << "       -- Forwarding call to " << forwardParty << endl;
+ 	return H323EndPoint::ForwardConnection(connection, forwardParty, pdu);
+}
 
 void MyH323EndPoint::OnConnectionEstablished(H323Connection & connection, const PString & estCallToken)
 {
@@ -406,7 +472,7 @@
 
 	return new MyH323Connection(*this, callReference, options);
 }
-
+
 /* MyH323Connection */    
 MyH323Connection::MyH323Connection(MyH323EndPoint & ep,
 										   unsigned callReference,
@@ -619,27 +685,27 @@
 														     unsigned sessionID,
 														     const H245_H2250LogicalChannelParameters * /*param*/)
 {
-	struct rtp_info *info;
-	WORD port;
+	struct rtp_info *info;
+	WORD port;
 
 	/* Determine the Local (A side) IP Address and port */
 	info = on_create_connection(GetCallReference()); 
-	
-//	if (bridging) {
-//		externalIpAddress = PIPSocket::Address(info->addr);
-//	} else {
-        GetControlChannel().GetLocalAddress().GetIpAndPort(externalIpAddress, port);
-//	}
-
-//	externalIpAddress = PIPSocket::Address("192.168.1.50");
-
-	externalPort = info->port;
+	
+//	if (bridging) {
+//		externalIpAddress = PIPSocket::Address(info->addr);
+//	} else {
+        GetControlChannel().GetLocalAddress().GetIpAndPort(externalIpAddress, port);
+//	}
+
+//	externalIpAddress = PIPSocket::Address("192.168.1.50");
+
+	externalPort = info->port;
 	
 	if (h323debug) {
 		cout << "	=*= In CreateRealTimeLogicalChannel for call " << GetCallReference() << endl;
 		cout << "		-- externalIpAddress: " << externalIpAddress << endl;
 		cout << "		-- externalPort: " << externalPort << endl;
-		cout << "		-- SessionID: " << sessionID << endl;
+		cout << "		-- SessionID: " << sessionID << endl;
 		cout << "		-- Direction: " << dir << endl;
 	}
 	return new H323_ExternalRTPChannel(*this, capability, dir, sessionID, externalIpAddress, externalPort);
@@ -751,23 +817,23 @@
 }
 	
 /** Installs the callback functions on behalf of the PBX application  */
-void h323_callback_register(setup_incoming_cb  ifunc,
-							setup_outbound_cb  sfunc,
-							on_connection_cb   confunc,
-							start_logchan_cb   lfunc,
- 							clear_con_cb	   clfunc,
- 							con_established_cb efunc,
- 							send_digit_cb	   dfunc)
+void h323_callback_register(setup_incoming_cb  ifunc,
+							setup_outbound_cb  sfunc,
+							on_connection_cb   confunc,
+							start_logchan_cb   lfunc,
+ 							clear_con_cb	   clfunc,
+ 							con_established_cb efunc,
+ 							send_digit_cb	   dfunc)
 {
 	on_incoming_call = ifunc;
-	on_outgoing_call = sfunc;
+	on_outgoing_call = sfunc;
 	on_create_connection = confunc;
 	on_start_logical_channel = lfunc;
 	on_connection_cleared = clfunc;
 	on_connection_established = efunc;
 	on_send_digit = dfunc;
 }
-
+
 /**
  * Add capability to the capability table of the end point. 
  */
@@ -806,12 +872,12 @@
 		endPoint->SetCapability(0, 0, new SpeexNarrow6AudioCapability());
 	}
 
-#if WANT_G729
 	if (cap & AST_FORMAT_G729A) {
-		H323_G729ACapability *g729aCap;
-		endPoint->SetCapability(0, 0, g729aCap = new H323_G729ACapability);
+		AST_G729ACapability *g729aCap;
+		AST_G729Capability *g729Cap;
+		endPoint->SetCapability(0, 0, g729aCap = new AST_G729ACapability);
+		endPoint->SetCapability(0, 0, g729Cap = new AST_G729Capability);
 	}
-#endif
 	
 	if (cap & AST_FORMAT_G723_1) {
 		H323_G7231Capability *g7231Cap;
@@ -1058,24 +1124,24 @@
 {
 	H323Channel *channel;
 	MyH323Connection *connection = (MyH323Connection *)endPoint->FindConnectionWithLock(token);
-	PString mode(capability);
-	
-	if (!mode) {
-		return;
-	}
-
-	if (!connection){
-		cout << "ERROR: No connection found, this is bad\n";
-		return;
-	}
-
-	cout << "Native Bridge:  them [" << them << "]" << endl; 
+	PString mode(capability);
+	
+	if (!mode) {
+		return;
+	}
 
-	channel = connection->FindChannel(connection->sessionId, TRUE);
-	connection->bridging = TRUE;
-	connection->CloseLogicalChannelNumber(channel->GetNumber());
-	connection->RequestModeChange(mode);	
-	connection->Unlock();
+	if (!connection){
+		cout << "ERROR: No connection found, this is bad\n";
+		return;
+	}
+
+	cout << "Native Bridge:  them [" << them << "]" << endl; 
+
+	channel = connection->FindChannel(connection->sessionId, TRUE);
+	connection->bridging = TRUE;
+	connection->CloseLogicalChannelNumber(channel->GetNumber());
+	connection->RequestModeChange(mode);	
+	connection->Unlock();
 	return;
 
 }




More information about the svn-commits mailing list