@ -798,8 +798,11 @@
< / argument >
< / argument >
< / option >
< / option >
< option name = " d " >
< option name = " d " >
< para > Play < literal > dial < / literal > indications tone on channel while waiting
< para > Play indications tone on channel while waiting for digits . < / para >
for digits . < / para >
< argument name = " x " >
< para > Specify the indications tone to play .
Default is < literal > dial < / literal > tone . < / para >
< / argument >
< / option >
< / option >
< / optionlist >
< / optionlist >
< / parameter >
< / parameter >
@ -828,12 +831,21 @@ AST_APP_OPTIONS(background_opts, {
AST_APP_OPTION ( ' p ' , BACKGROUND_PLAYBACK ) ,
AST_APP_OPTION ( ' p ' , BACKGROUND_PLAYBACK ) ,
} ) ;
} ) ;
# define WAITEXTEN_MOH (1 << 0)
enum {
# define WAITEXTEN_DIALTONE (1 << 1)
WAITEXTEN_MOH = ( 1 < < 0 ) ,
WAITEXTEN_DIALTONE = ( 1 < < 1 ) ,
} ;
enum read_option_flags {
WAITEXTEN_ARG_MOH ,
WAITEXTEN_ARG_DIALTONE ,
/* note: this entry _MUST_ be the last one in the enum */
WAITEXTEN_ARRAY_SIZE ,
} ;
AST_APP_OPTIONS ( waitexten_opts , {
AST_APP_OPTIONS ( waitexten_opts , {
AST_APP_OPTION_ARG ( ' m ' , WAITEXTEN_MOH , 0 ) ,
AST_APP_OPTION_ARG ( ' m ' , WAITEXTEN_MOH , WAITEXTEN_ARG_MOH ) ,
AST_APP_OPTION_ARG ( ' d ' , WAITEXTEN_DIALTONE , 0 ) ,
AST_APP_OPTION_ARG ( ' d ' , WAITEXTEN_DIALTONE , WAITEXTEN_ARG_DIALTONE ) ,
} ) ;
} ) ;
int pbx_builtin_raise_exception ( struct ast_channel * chan , const char * reason )
int pbx_builtin_raise_exception ( struct ast_channel * chan , const char * reason )
@ -1203,7 +1215,7 @@ static int pbx_builtin_waitexten(struct ast_channel *chan, const char *data)
{
{
int ms , res ;
int ms , res ;
struct ast_flags flags = { 0 } ;
struct ast_flags flags = { 0 } ;
char * opt s[ 1 ] = { NULL } ;
char * opt _args[ WAITEXTEN_ARRAY_SIZE ] ;
char * parse ;
char * parse ;
AST_DECLARE_APP_ARGS ( args ,
AST_DECLARE_APP_ARGS ( args ,
AST_APP_ARG ( timeout ) ;
AST_APP_ARG ( timeout ) ;
@ -1217,15 +1229,17 @@ static int pbx_builtin_waitexten(struct ast_channel *chan, const char *data)
memset ( & args , 0 , sizeof ( args ) ) ;
memset ( & args , 0 , sizeof ( args ) ) ;
if ( args . options )
if ( args . options )
ast_app_parse_options ( waitexten_opts , & flags , opt s, args . options ) ;
ast_app_parse_options ( waitexten_opts , & flags , opt _arg s, args . options ) ;
if ( ast_test_flag ( & flags , WAITEXTEN_MOH ) & & ! opts [ 0 ] ) {
if ( ast_test_flag ( & flags , WAITEXTEN_MOH ) ) {
ast_log ( LOG_WARNING , " The 'm' option has been specified for WaitExten without a class. \n " ) ;
if ( ast_strlen_zero ( opt_args [ WAITEXTEN_ARG_MOH ] ) ) {
} else if ( ast_test_flag ( & flags , WAITEXTEN_MOH ) ) {
ast_log ( LOG_WARNING , " The 'm' option has been specified for WaitExten without a class. \n " ) ;
ast_indicate_data ( chan , AST_CONTROL_HOLD , S_OR ( opts [ 0 ] , NULL ) ,
}
! ast_strlen_zero ( opts [ 0 ] ) ? strlen ( opts [ 0 ] ) + 1 : 0 ) ;
ast_indicate_data ( chan , AST_CONTROL_HOLD , S_OR ( opt_args [ WAITEXTEN_ARG_MOH ] , NULL ) ,
! ast_strlen_zero ( opt_args [ WAITEXTEN_ARG_MOH ] ) ? strlen ( opt_args [ WAITEXTEN_ARG_MOH ] ) + 1 : 0 ) ;
} else if ( ast_test_flag ( & flags , WAITEXTEN_DIALTONE ) ) {
} else if ( ast_test_flag ( & flags , WAITEXTEN_DIALTONE ) ) {
struct ast_tone_zone_sound * ts = ast_get_indication_tone ( ast_channel_zone ( chan ) , " dial " ) ;
const char * tone = ! ast_strlen_zero ( opt_args [ WAITEXTEN_ARG_DIALTONE ] ) ? opt_args [ WAITEXTEN_ARG_DIALTONE ] : " dial " ;
struct ast_tone_zone_sound * ts = ast_get_indication_tone ( ast_channel_zone ( chan ) , tone ) ;
if ( ts ) {
if ( ts ) {
ast_playtones_start ( chan , 0 , ts - > data , 0 ) ;
ast_playtones_start ( chan , 0 , ts - > data , 0 ) ;
ts = ast_tone_zone_sound_unref ( ts ) ;
ts = ast_tone_zone_sound_unref ( ts ) ;