/* The entry point of the application. */ static int app_synth_exec(struct ast_channel *chan, ast_app_data data) { ast_format_compat nwriteformat; ast_format_clear(&nwriteformat); get_synth_format(chan, &nwriteformat); int samplerate = 8000; /* int framesize = DEFAULT_FRAMESIZE; */ int framesize = format_to_bytes_per_sample(&nwriteformat) * (DEFAULT_FRAMESIZE / 2); struct ast_frame *f; struct ast_frame fr; struct timeval next; int ms; apr_size_t len; int rres; ast_mrcp_profile_t *profile; apr_uint32_t speech_channel_number = get_next_speech_channel_number(); const char *name; char buffer[framesize]; speech_channel_status_t status; char *parse; int i; mrcpsynth_options_t mrcpsynth_options; mrcpsynth_session_t mrcpsynth_session; AST_DECLARE_APP_ARGS(args, AST_APP_ARG(prompt); AST_APP_ARG(options); );
/* Fill the frame with data. */ static APR_INLINE void ast_frame_fill(ast_format_compat *format, struct ast_frame *fr, void *data, apr_size_t size) { memset(fr, 0, sizeof(*fr)); fr->frametype = AST_FRAME_VOICE; ast_frame_set_format(fr, format); fr->datalen = size; fr->samples = size / format_to_bytes_per_sample(format); ast_frame_set_data(fr, data); fr->mallocd = 0; fr->offset = AST_FRIENDLY_OFFSET; fr->src = __PRETTY_FUNCTION__; fr->delivery.tv_sec = 0; fr->delivery.tv_usec = 0; }