mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-11-04 05:15:22 +00:00 
			
		
		
		
	check to make sure the extension exists b4 actually accepting the call and lets hope this gives Open H.323 enough time to sync up (bug #1714)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3220 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
		@@ -1007,7 +1007,7 @@ int setup_incoming_call(call_details_t cd)
 | 
			
		||||
{
 | 
			
		||||
	
 | 
			
		||||
	struct oh323_pvt *p = NULL;
 | 
			
		||||
	struct ast_channel *c = NULL;
 | 
			
		||||
/*	struct ast_channel *c = NULL; */
 | 
			
		||||
	struct oh323_user *user = NULL;
 | 
			
		||||
	struct oh323_alias *alias = NULL;
 | 
			
		||||
 | 
			
		||||
@@ -1118,13 +1118,41 @@ int setup_incoming_call(call_details_t cd)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
exit:
 | 
			
		||||
#if 0
 | 
			
		||||
	/* allocate a channel and tell asterisk about it */
 | 
			
		||||
	c = oh323_new(p, AST_STATE_RINGING, cd.call_token);
 | 
			
		||||
	if (!c) {
 | 
			
		||||
		ast_log(LOG_ERROR, "Couldn't create channel. This is bad\n");
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Call-back function to start PBX when OpenH323 ready to serve incoming call
 | 
			
		||||
 *
 | 
			
		||||
 * Returns 1 on success
 | 
			
		||||
 */
 | 
			
		||||
static int answer_call(unsigned call_reference)
 | 
			
		||||
{
 | 
			
		||||
	struct oh323_pvt *p = NULL;
 | 
			
		||||
	struct ast_channel *c = NULL;
 | 
			
		||||
	
 | 
			
		||||
	/* Find the call or allocate a private structure if call not found */
 | 
			
		||||
	p = find_call(call_reference);
 | 
			
		||||
	
 | 
			
		||||
	if (!p) {
 | 
			
		||||
		ast_log(LOG_ERROR, "Something is wrong: answer_call\n");
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
	
 | 
			
		||||
	/* allocate a channel and tell asterisk about it */
 | 
			
		||||
	c = oh323_new(p, AST_STATE_RINGING, p->cd.call_token);
 | 
			
		||||
	if (!c) {
 | 
			
		||||
		ast_log(LOG_ERROR, "Couldn't create channel. This is bad\n");
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -1857,7 +1885,8 @@ int load_module()
 | 
			
		||||
				       cleanup_connection, 
 | 
			
		||||
				       chan_ringing,
 | 
			
		||||
				       connection_made, 
 | 
			
		||||
				       send_digit);	
 | 
			
		||||
				       send_digit,
 | 
			
		||||
				       answer_call);
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
		/* start the h.323 listener */
 | 
			
		||||
 
 | 
			
		||||
@@ -489,6 +489,9 @@ H323Connection::AnswerCallResponse MyH323Connection::OnAnswerCall(const PString
 | 
			
		||||
																   const H323SignalPDU & /*setupPDU*/,
 | 
			
		||||
																   H323SignalPDU & /*connectPDU*/)
 | 
			
		||||
{
 | 
			
		||||
	if (!on_answer_call(GetCallReference()))
 | 
			
		||||
		return H323Connection::AnswerCallDenied;
 | 
			
		||||
 | 
			
		||||
	/* The call will be answered later with "AnsweringCall()" function.
 | 
			
		||||
	 */ 
 | 
			
		||||
	return H323Connection::AnswerCallDeferred;
 | 
			
		||||
@@ -835,7 +838,8 @@ void h323_callback_register(setup_incoming_cb  	ifunc,
 | 
			
		||||
 			    clear_con_cb	clfunc,
 | 
			
		||||
 			    chan_ringing_cb     rfunc,
 | 
			
		||||
			    con_established_cb 	efunc,
 | 
			
		||||
 			    send_digit_cb	dfunc)
 | 
			
		||||
 			    send_digit_cb	dfunc,
 | 
			
		||||
 			    answer_call_cb	acfunc)
 | 
			
		||||
{
 | 
			
		||||
	on_incoming_call = ifunc;
 | 
			
		||||
	on_outgoing_call = sfunc;
 | 
			
		||||
@@ -845,6 +849,7 @@ void h323_callback_register(setup_incoming_cb  	ifunc,
 | 
			
		||||
	on_chan_ringing = rfunc;
 | 
			
		||||
	on_connection_established = efunc;
 | 
			
		||||
	on_send_digit = dfunc;
 | 
			
		||||
	on_answer_call = acfunc;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 
 | 
			
		||||
@@ -153,6 +153,9 @@ con_established_cb		on_connection_established;
 | 
			
		||||
typedef void (*clear_con_cb)(call_details_t);
 | 
			
		||||
clear_con_cb		on_connection_cleared;
 | 
			
		||||
 | 
			
		||||
typedef int (*answer_call_cb)(unsigned);
 | 
			
		||||
answer_call_cb		on_answer_call;
 | 
			
		||||
 | 
			
		||||
/* debug flag */
 | 
			
		||||
int h323debug;
 | 
			
		||||
 | 
			
		||||
@@ -178,7 +181,8 @@ extern "C" {
 | 
			
		||||
 				    clear_con_cb,
 | 
			
		||||
 				    chan_ringing_cb,
 | 
			
		||||
				    con_established_cb,
 | 
			
		||||
 				    send_digit_cb);
 | 
			
		||||
 				    send_digit_cb,
 | 
			
		||||
 				    answer_call_cb);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	int h323_set_capability(int, int);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user