[Asterisk-cvs] asterisk/channels/h323 ast_h323.cpp,1.23,1.24 ast_h323.h,1.9,1.10 chan_h323.h,1.9,1.10

jeremy at lists.digium.com jeremy at lists.digium.com
Sat Sep 6 15:27:42 CDT 2003


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

Modified Files:
	ast_h323.cpp ast_h323.h chan_h323.h 
Log Message:
implement transfer and call forwarding. Bug #221


Index: ast_h323.cpp
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/h323/ast_h323.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** ast_h323.cpp	25 Aug 2003 18:34:10 -0000	1.23
--- ast_h323.cpp	6 Sep 2003 20:28:51 -0000	1.24
***************
*** 269,272 ****
--- 269,290 ----
  	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);
+ }
  
  void MyH323EndPoint::OnConnectionEstablished(H323Connection & connection, const PString & estCallToken)
***************
*** 389,393 ****
  	return new MyH323Connection(*this, callReference, options);
  }
! 
  
  /* MyH323Connection */    
--- 407,453 ----
  	return new MyH323Connection(*this, callReference, options);
  }
! 
! H323Connection * MyH323EndPoint::SetupTransfer(const PString & token,
!  											   const PString & callIdentity,
!  											   const PString & remoteParty,
!  											   PString & newToken,
! 											   void * userData)
! {
!  	PString alias;
!  	H323TransportAddress address;
!  	
!  	H323Connection * connection; 
!  
!  	if (h323debug) {
!  		cout << " -- Setup transfer of  " << callIdentity << ":" << endl;
!  		cout << "	-- Call from    " << token << endl;
!  		cout << "	-- Remote Party " << remoteParty << endl;
!  	}
!  
!  	connection = FindConnectionWithLock(token);
!  
!  	if (connection != NULL) {
!  		unsigned int old_call_reference = connection->GetCallReference();
!  
!  		if (h323debug)
!  			cout << " -- Old call reference " << old_call_reference << endl;
!  		connection->Unlock();
!  
!  		if (on_transfer_call(old_call_reference, remoteParty)) {
!  			if (h323debug)
!  				cout << "	-- Transfer succeded " << endl;
!  			if (connection->ClearCall(H323Connection::EndedByCallForwarded))
!  					return NULL;
!  			return NULL;
!  		}
!  	}
!  	if (h323debug)
!  		cout << "	-- Transfer failed " << endl;
!  
!  	if (connection != NULL) {
!  		return connection;
!  	}
!  	return NULL;
! }
  
  /* MyH323Connection */    
***************
*** 735,748 ****
  	
  /** 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)
  {
  	on_incoming_call = ifunc;
  	on_outgoing_call = sfunc;
  	on_create_connection = confunc;
  	on_start_logical_channel = lfunc;
--- 795,810 ----
  	
  /** Installs the callback functions on behalf of the PBX application  */
! void h323_callback_register(setup_incoming_cb  ifunc,
! 							setup_outbound_cb  sfunc,
! 							setup_transfer_cb  tfunc,
! 							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_transfer_call = tfunc;
  	on_create_connection = confunc;
  	on_start_logical_channel = lfunc;
***************
*** 751,755 ****
  	on_send_digit = dfunc;
  }
! 
  /**
   * Add capability to the capability table of the end point. 
--- 813,817 ----
  	on_send_digit = dfunc;
  }
! 
  /**
   * Add capability to the capability table of the end point. 

Index: ast_h323.h
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/h323/ast_h323.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** ast_h323.h	25 Aug 2003 18:34:10 -0000	1.9
--- ast_h323.h	6 Sep 2003 20:28:51 -0000	1.10
***************
*** 112,117 ****
--- 112,121 ----
  	void OnConnectionCleared(H323Connection &, const PString &);
  	H323Connection * CreateConnection(unsigned, void *);
+ 	H323Connection * SetupTransfer(const PString &, const PString &, const PString &, PString &, void *);
  	void SendUserTone(const PString &, char);
  	H323Capabilities GetCapabilities(void);
+ 	BOOL OnConnectionForwarded(H323Connection &, const PString &, const H323SignalPDU &);
+  
+ 	BOOL ForwardConnection(H323Connection &, const PString &, const H323SignalPDU &);
  
  	PStringArray SupportedPrefixes;	
***************
*** 133,145 ****
  	H323Channel * CreateRealTimeLogicalChannel(const H323Capability &, H323Channel::Directions, unsigned, 
  											   const H245_H2250LogicalChannelParameters *);
! 	H323Connection::AnswerCallResponse OnAnswerCall(const PString &, const H323SignalPDU &, H323SignalPDU &);
  	BOOL OnAlerting(const H323SignalPDU &, const PString &);
  	BOOL OnSendReleaseComplete(H323SignalPDU &);
  	BOOL OnReceivedSignalSetup(const H323SignalPDU &);
- 	void OnReceivedReleaseComplete(const H323SignalPDU &);
  	BOOL OnReceivedFacility(const H323SignalPDU &);
  	BOOL OnSendSignalSetup(H323SignalPDU &);
  	BOOL OnStartLogicalChannel(H323Channel &);
! 	BOOL OnClosingLogicalChannel(H323Channel &);
  	void SendUserInputTone(char, unsigned);
  	void OnUserInputTone(char, unsigned, unsigned, unsigned);
--- 137,149 ----
  	H323Channel * CreateRealTimeLogicalChannel(const H323Capability &, H323Channel::Directions, unsigned, 
  											   const H245_H2250LogicalChannelParameters *);
! 	H323Connection::AnswerCallResponse OnAnswerCall(const PString &, const H323SignalPDU &, H323SignalPDU &);
! 	void OnReceivedReleaseComplete(const H323SignalPDU &);
  	BOOL OnAlerting(const H323SignalPDU &, const PString &);
  	BOOL OnSendReleaseComplete(H323SignalPDU &);
  	BOOL OnReceivedSignalSetup(const H323SignalPDU &);
  	BOOL OnReceivedFacility(const H323SignalPDU &);
  	BOOL OnSendSignalSetup(H323SignalPDU &);
  	BOOL OnStartLogicalChannel(H323Channel &);
! 	BOOL OnClosingLogicalChannel(H323Channel &);	
  	void SendUserInputTone(char, unsigned);
  	void OnUserInputTone(char, unsigned, unsigned, unsigned);

Index: chan_h323.h
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/h323/chan_h323.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** chan_h323.h	25 Aug 2003 18:34:10 -0000	1.9
--- chan_h323.h	6 Sep 2003 20:28:51 -0000	1.10
***************
*** 131,134 ****
--- 131,139 ----
  typedef int (*setup_outbound_cb)(call_details_t);
  setup_outbound_cb	on_outgoing_call; 
+ 
+ /* This is a callback prototype function, called upon
+     a transfer. */
+ typedef int (*setup_transfer_cb)(unsigned int, const char *);
+ setup_transfer_cb	on_transfer_call;
  
  /* This is a callback prototype function, called when the openh323 
***************
*** 165,169 ****
  
  	/* callback function handler*/
! 	void h323_callback_register(setup_incoming_cb, setup_outbound_cb, on_connection_cb, start_logchan_cb, clear_con_cb, con_established_cb, send_digit_cb);
  
  	int h323_set_capability(int, int);
--- 170,182 ----
  
  	/* callback function handler*/
! 	void h323_callback_register(setup_incoming_cb,
!  								setup_outbound_cb,
!  								setup_transfer_cb,
!  								on_connection_cb,
!  								start_logchan_cb,
!  								clear_con_cb,
!  								con_established_cb,
!  								send_digit_cb);
! 
  
  	int h323_set_capability(int, int);




More information about the svn-commits mailing list