const char *say_gender = NULL;
const char *sp_engine = NULL;
const char *sp_grammar = NULL;
+ char *free_string = NULL;
if (!strcasecmp(tag_name, "say")) {
say_lang = switch_xml_attr(tag, "language");
} else {
play = 1;
}
+ } else if (!strcasecmp(tag_name, "vmname")) {
+ const char *id = switch_xml_attr(tag, "id");
+ char *cmd, *resp;
+ switch_stream_handle_t stream = { 0 };
+ char *p;
+
+ SWITCH_STANDARD_STREAM(stream);
+
+ cmd = switch_mprintf("%s|name_path", id);
+
+ switch_api_execute("vm_prefs", cmd, NULL, &stream);
+
+ resp = (char *) stream.data;
+
+ if (!zstr(resp)) {
+ if (switch_stristr("://", resp) || switch_file_exists(resp, NULL) == SWITCH_STATUS_SUCCESS) {
+ play = 1;
+ file = free_string = resp;
+ resp = NULL;
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid file! [%s]\n", resp);
+ switch_safe_free(resp);
+ return SWITCH_STATUS_FALSE;
+ }
+ } else {
+ switch_safe_free(resp);
+ say_lang = switch_xml_attr(tag, "language");
+ say_gender = switch_xml_attr(tag, "gender");
+ say_type = "name_spelled";
+ say_method = "pronounced";
+ free_string = strdup(id);
+ if ((p = strchr(free_string, '@'))) {
+ *p = '\0';
+ }
+ say = 1;
+
+ body = free_string;
+ switch_ivr_play_file(client->session, NULL, "voicemail/vm-person.wav", &nullargs);
+
+ }
+
+ switch_safe_free(resp);
}
}
}
}
-
+
if (dmachine) {
switch_ivr_dmachine_destroy(&dmachine);
}
- printf("WTF %d\n", status);
+
+ switch_safe_free(free_string);
+
return status;
}
bind_parser("record", parse_record);
bind_parser("recordCall", parse_record_call);
bind_parser("playback", parse_playback);
+ bind_parser("vmName", parse_playback);
bind_parser("speak", parse_playback);
bind_parser("say", parse_playback);
bind_parser("conference", parse_conference);
asr-grammar : ASR grammar to use
+<vmname file name action digit-timeout input-timeout loops><bind action strip>*EXPR*</bind></playback>
+ : Plays a vm name and optionally collects input.
+
+ATTRS:
+file : The file
+name : Param name to save result.
+error-file : Error file to play on invalid input.
+action : Change the new target url.
+temp-action : Change url to submit to. just for the next loop.
+digit-timeout : Timeout waiting for digits after file plays (when input bindings are present)
+input-timeout : Timeout waiting for more digits in a multi-digit input.
+loops : max times to play the file when input bindings are present.
+
+
+
<record file name error-file action digit-timeout input-timeout><bind action strip>*EXPR*</bind></record>