Index: channels/chan_h323.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_h323.c,v
retrieving revision 1.2
diff -r1.2 chan_h323.c
1092a1093,1148
>   * Call-back function that gets called on transfer
>   *
>   * Returns 1 on success
>   */
> int setup_transfer_call(unsigned call_reference, const char *extension)
> {
> 	struct oh323_pvt *p;
> 	struct ast_channel *c = NULL;
> 	char exten[AST_MAX_EXTENSION];
> 	char *context;
> 
> 	p=find_call(call_reference);
> 
> 	if (!p) {
> 		ast_log(LOG_WARNING, "No such call %d.\n", call_reference);
> 		return -1;
> 	}
> 
> 	if (!p->owner) {
> 		ast_log(LOG_WARNING, "Call %d has no owner.\n", call_reference);
> 		return -1;
> 	}
> 	
> 	memcpy(exten, extension, AST_MAX_EXTENSION);
> 
> 	c = p->owner;
> 	if (c && c->bridge) {
> 		strncpy(exten, extension, sizeof(exten) - 1);
> 		context = strchr(exten, '@');
> 		if (context) {
> 			*context = '\0';
> 			context++;
> 		} else
> 			context = c->context;
> 		if (!strlen(context))
> 			context = c->bridge->context;
> 		if (ast_exists_extension(c->bridge, context, exten, 1, c->bridge->callerid)) {
> 			
> 			ast_log(LOG_NOTICE, "Transfering call %s to %s@%s.\n", c->bridge->name, exten, context);
> 			
> 			if (!ast_async_goto(c->bridge, context, exten, 1, 1))
> 				return 1;
> 
> 			ast_log(LOG_WARNING, "Failed to transfer.\n");
> 		} else {
> 			ast_log(LOG_WARNING, "No such extension '%s' exists.\n", exten);
> 		}
> 	} else {
> 		ast_log(LOG_WARNING, "There is no call to transfer\n");
> 	}
> 	return 0;
> }
> 
> 
> 
> /**
1716a1773
> 							   setup_transfer_call,
Index: channels/h323/ast_h323.cpp
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/h323/ast_h323.cpp,v
retrieving revision 1.23
diff -r1.23 ast_h323.cpp
245a246,290
> H323Connection * MyH323EndPoint::SetupTransfer(const PString & token,
> 		const PString & callIdentity,
> 		const PString & remoteParty,
> 		PString & newToken,
> 		void * userData)
> {
> 	PString alias;
> 	H323TransportAddress address;
> 	
> 	H323Connection *H323Con; 
> 
> 	if (h323debug) {
> 		cout << " -- Setup transfer of  " << callIdentity << ":" << endl;
> 		cout << "	-- Call from    " << token << endl;
> 		cout << "	-- Remote Party " << remoteParty << endl;
> 	}
> 
> 	H323Con = FindConnectionWithLock(token);
> 
> 	if (H323Con != NULL) {
> 		unsigned int old_call_reference = H323Con->GetCallReference();
> 
> 		if (h323debug)
> 			cout << " -- Old call reference " << old_call_reference << endl;
> 		H323Con->Unlock();
> 
> 		if (on_transfer_call(old_call_reference, remoteParty /*fullAddress*/)) {
> 			if (h323debug)
> 				cout << "	-- Transfer succeded " << endl;
> 			if (H323Con->ClearCall(H323Connection::EndedByCallForwarded))
> 					return NULL;
> 			return NULL;
> 		}
> 	}
> 	if (h323debug)
> 		cout << "	-- Transfer failed " << endl;
> 
> 	if (H323Con != NULL) {
> 		return H323Con;
> 	}
> 	return NULL;
> }
> 
> 
> 
271a317,336
> // Ajouter les tests dans OnConnectionForwarded ou ForwardConnection pour transfer_local
> 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);
> }
> 
> 
429c494
< 		cout << "	-- Ringing phone for \"" << username << "\"" << endl;
---
> 		cout << "	-- Ringing phone for \"" << username << "\" call reference " << GetCallReference() << endl;
737,743c802,809
< 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,
> 		setup_transfer_cb  tfunc,
> 		on_connection_cb   confunc,
> 		start_logchan_cb   lfunc,
> 		clear_con_cb	   clfunc,
> 		con_established_cb efunc,
> 		send_digit_cb	   dfunc)
746a813
> 	on_transfer_call = tfunc;
Index: channels/h323/ast_h323.h
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/h323/ast_h323.h,v
retrieving revision 1.9
diff -r1.9 ast_h323.h
107a108
> 	H323Connection * SetupTransfer(const PString &, const PString &, const PString &, PString &, void *);
110a112,113
> 	BOOL OnConnectionForwarded(H323Connection &, const PString &, const H323SignalPDU &);
> 	BOOL ForwardConnection(H323Connection &, const PString &, const H323SignalPDU &);
Index: channels/h323/chan_h323.h
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/h323/chan_h323.h,v
retrieving revision 1.9
diff -r1.9 chan_h323.h
133a134,138
> /* This is a callback prototype function, called upon
>    an transfer. */
> typedef int (*setup_transfer_cb)(unsigned int, const char *);
> setup_transfer_cb	on_transfer_call; 
> 
167c172,179
< 	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);
---
> 	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);
