Ejemplo n.º 1
0
/*! \brief
 * remap the 'say' functions to use those in this file
 */
static int say_init_mode(const char *mode) {
	if (!strcmp(mode, say_new)) {
		if (say_cfg == NULL) {
			ast_log(LOG_ERROR, "There is no say.conf file to use new mode\n");
			return -1;
		}
		save_say_mode(say_new);
		ast_say_number_full = say_number_full;

		ast_say_enumeration_full = say_enumeration_full;
#if 0
		/*! \todo XXX 
		   These functions doesn't exist.
		   say.conf.sample indicates this is working... 
		*/
		ast_say_digits_full = say_digits_full;
		ast_say_digit_str_full = say_digit_str_full;
		ast_say_character_str_full = say_character_str_full;
		ast_say_phonetic_str_full = say_phonetic_str_full;
		ast_say_datetime_from_now = say_datetime_from_now;
#endif
		ast_say_datetime = say_datetime;
		ast_say_time = say_time;
		ast_say_date = say_date;
		ast_say_date_with_format = say_date_with_format;
	} else if (!strcmp(mode, say_old) && say_api_buf[0] == say_new) {
		restore_say_mode(NULL);
	} else if (strcmp(mode, say_old)) {
		ast_log(LOG_WARNING, "unrecognized mode %s\n", mode);
		return -1;
	}
	
	return 0;
}
Ejemplo n.º 2
0
/*
 * remap the 'say' functions to use those in this file
 */
static int __say_init(int fd, int argc, char *argv[])
{
	const char *old_mode = say_api_buf[0] ? say_new : say_old;
	char *mode;

	if (argc == 2) {
		ast_cli(fd, "say mode is [%s]\n", old_mode);
		return RESULT_SUCCESS;
        } else if (argc != 3)
                return RESULT_SHOWUSAGE;
        mode = argv[2];

	ast_log(LOG_WARNING, "init say.c from %s to %s\n", old_mode, mode);

	if (!strcmp(mode, old_mode)) {
		ast_log(LOG_WARNING, "say mode is %s already\n", mode);
	} else if (!strcmp(mode, say_new)) {
		if (say_cfg == NULL)
			say_cfg = ast_config_load("say.conf");
		save_say_mode(say_new);
		ast_say_number_full = say_number_full;

		ast_say_enumeration_full = say_enumeration_full;
#if 0
		ast_say_digits_full = say_digits_full;
		ast_say_digit_str_full = say_digit_str_full;
		ast_say_character_str_full = say_character_str_full;
		ast_say_phonetic_str_full = say_phonetic_str_full;
		ast_say_datetime_from_now = say_datetime_from_now;
#endif
		ast_say_datetime = say_datetime;
		ast_say_time = say_time;
		ast_say_date = say_date;
		ast_say_date_with_format = say_date_with_format;
	} else if (!strcmp(mode, say_old) && say_api_buf[0] == say_new) {
		restore_say_mode(NULL);
	} else {
		ast_log(LOG_WARNING, "unrecognized mode %s\n", mode);
	}
	return RESULT_SUCCESS;
}