@ -779,13 +779,16 @@ static const struct ast_channel_tech null_tech = {
static void ast_channel_destructor ( void * obj ) ;
static void ast_channel_destructor ( void * obj ) ;
/*! \brief Create a new channel structure */
/*! \brief Create a new channel structure */
struct ast_channel * ast_channel_alloc ( int needqueue , int state , const char * cid_num , const char * cid_name , const char * acctcode , const char * exten , const char * context , const int amaflag , const char * name_fmt , . . . )
static struct ast_channel * attribute_malloc __attribute__ ( ( format ( printf , 12 , 0 ) ) )
__ast_channel_alloc_ap ( int needqueue , int state , const char * cid_num , const char * cid_name ,
const char * acctcode , const char * exten , const char * context ,
const int amaflag , const char * file , int line , const char * function ,
const char * name_fmt , va_list ap1 , va_list ap2 )
{
{
struct ast_channel * tmp ;
struct ast_channel * tmp ;
int x ;
int x ;
int flags ;
int flags ;
struct varshead * headp ;
struct varshead * headp ;
va_list ap1 , ap2 ;
/* If shutting down, don't allocate any new channels */
/* If shutting down, don't allocate any new channels */
if ( shutting_down ) {
if ( shutting_down ) {
@ -793,9 +796,19 @@ struct ast_channel *ast_channel_alloc(int needqueue, int state, const char *cid_
return NULL ;
return NULL ;
}
}
# if defined(REF_DEBUG)
if ( ! ( tmp = __ao2_alloc_debug ( sizeof ( * tmp ) , ast_channel_destructor , " " , file , line , function , 1 ) ) ) {
return NULL ;
}
# elif defined(__AST_DEBUG_MALLOC)
if ( ! ( tmp = __ao2_alloc_debug ( sizeof ( * tmp ) , ast_channel_destructor , " " , file , line , function , 0 ) ) ) {
return NULL ;
}
# else
if ( ! ( tmp = ao2_alloc ( sizeof ( * tmp ) , ast_channel_destructor ) ) ) {
if ( ! ( tmp = ao2_alloc ( sizeof ( * tmp ) , ast_channel_destructor ) ) ) {
return NULL ;
return NULL ;
}
}
# endif
if ( ! ( tmp - > sched = sched_context_create ( ) ) ) {
if ( ! ( tmp - > sched = sched_context_create ( ) ) ) {
ast_log ( LOG_WARNING , " Channel allocation failed: Unable to create schedule context \n " ) ;
ast_log ( LOG_WARNING , " Channel allocation failed: Unable to create schedule context \n " ) ;
@ -908,11 +921,7 @@ alertpipe_failed:
* uses them to build the string , instead of forming the va_lists internally from the vararg . . . list .
* uses them to build the string , instead of forming the va_lists internally from the vararg . . . list .
* This new function was written so this can be accomplished .
* This new function was written so this can be accomplished .
*/
*/
va_start ( ap1 , name_fmt ) ;
va_start ( ap2 , name_fmt ) ;
ast_string_field_build_va ( tmp , name , name_fmt , ap1 , ap2 ) ;
ast_string_field_build_va ( tmp , name , name_fmt , ap1 , ap2 ) ;
va_end ( ap1 ) ;
va_end ( ap2 ) ;
}
}
/* Reminder for the future: under what conditions do we NOT want to track cdrs on channels? */
/* Reminder for the future: under what conditions do we NOT want to track cdrs on channels? */
@ -988,6 +997,25 @@ alertpipe_failed:
return tmp ;
return tmp ;
}
}
struct ast_channel * __ast_channel_alloc ( int needqueue , int state , const char * cid_num ,
const char * cid_name , const char * acctcode ,
const char * exten , const char * context ,
const int amaflag , const char * file , int line ,
const char * function , const char * name_fmt , . . . )
{
va_list ap1 , ap2 ;
struct ast_channel * result ;
va_start ( ap1 , name_fmt ) ;
va_start ( ap2 , name_fmt ) ;
result = __ast_channel_alloc_ap ( needqueue , state , cid_num , cid_name , acctcode , exten , context ,
amaflag , file , line , function , name_fmt , ap1 , ap2 ) ;
va_end ( ap1 ) ;
va_end ( ap2 ) ;
return result ;
}
/*! \brief Queue an outgoing media frame */
/*! \brief Queue an outgoing media frame */
static int __ast_queue_frame ( struct ast_channel * chan , struct ast_frame * fin , int head )
static int __ast_queue_frame ( struct ast_channel * chan , struct ast_frame * fin , int head )
{
{
@ -6474,3 +6502,36 @@ void ast_channel_queue_redirecting_update(struct ast_channel *chan, const struct
ast_queue_control_data ( chan , AST_CONTROL_REDIRECTING , data , datalen ) ;
ast_queue_control_data ( chan , AST_CONTROL_REDIRECTING , data , datalen ) ;
}
}
/* DO NOT PUT ADDITIONAL FUNCTIONS BELOW THIS BOUNDARY
*
* ONLY FUNCTIONS FOR PROVIDING BACKWARDS ABI COMPATIBILITY BELONG HERE
*
*/
/* Provide binary compatibility for modules that call ast_channel_alloc() directly;
* newly compiled modules will call __ast_channel_alloc ( ) via the macros in channel . h
*/
# undef ast_channel_alloc
struct ast_channel __attribute__ ( ( format ( printf , 9 , 10 ) ) )
* ast_channel_alloc ( int needqueue , int state , const char * cid_num ,
const char * cid_name , const char * acctcode ,
const char * exten , const char * context ,
const int amaflag , const char * name_fmt , . . . ) ;
struct ast_channel * ast_channel_alloc ( int needqueue , int state , const char * cid_num ,
const char * cid_name , const char * acctcode ,
const char * exten , const char * context ,
const int amaflag , const char * name_fmt , . . . )
{
va_list ap1 , ap2 ;
struct ast_channel * result ;
va_start ( ap1 , name_fmt ) ;
va_start ( ap2 , name_fmt ) ;
result = __ast_channel_alloc_ap ( needqueue , state , cid_num , cid_name , acctcode , exten , context ,
amaflag , __FILE__ , __LINE__ , __FUNCTION__ , name_fmt , ap1 , ap2 ) ;
va_end ( ap1 ) ;
va_end ( ap2 ) ;
return result ;
}