SWITCH_DECLARE(void) switch_dial_handle_list_add_global_var_printf(switch_dial_handle_list_t *hl, const char *var, const char *fmt, ...);
SWITCH_DECLARE(switch_status_t) switch_ivr_enterprise_orig_and_bridge(switch_core_session_t *session, const char *data, switch_dial_handle_list_t *hl, switch_call_cause_t *cause);
SWITCH_DECLARE(switch_status_t) switch_ivr_orig_and_bridge(switch_core_session_t *session, const char *data, switch_dial_handle_t *dh, switch_call_cause_t *cause);
-
+SWITCH_DECLARE(switch_status_t) switch_ivr_send_prompt(switch_core_session_t *session, const char *type, const char *text, const char *regex);
+
SWITCH_DECLARE(switch_status_t) switch_ivr_play_and_collect_input(switch_core_session_t *session,
const char *prompt,
const char *recognizer_mod_name,
SWITCH_MESSAGE_RESAMPLE_EVENT,
SWITCH_MESSAGE_HEARTBEAT_EVENT,
SWITCH_MESSAGE_INDICATE_SESSION_ID,
+ SWITCH_MESSAGE_INDICATE_PROMPT,
SWITCH_MESSAGE_INVALID
} switch_core_session_message_types_t;
}
break;
+ case SWITCH_MESSAGE_INDICATE_PROMPT:
+ {
+ const char *type = NULL, *text = NULL, *regex = NULL;
+ cJSON *jmsg = NULL, *params = NULL;
+ jsock_t *jsock = NULL;
+
+ if ((jsock = get_jsock(tech_pvt->jsock_uuid))) {
+
+ type = msg->string_array_arg[0];
+ text = msg->string_array_arg[1];
+ regex = msg->string_array_arg[2];
+
+ if (type && (!strcasecmp(type, "dtmf") || !strcasecmp(type, "message")) && text) {
+ jmsg = jrpc_new_req("verto.prompt", tech_pvt->call_id, ¶ms);
+
+ cJSON_AddItemToObject(params, "type", cJSON_CreateString(type));
+ cJSON_AddItemToObject(params, "text", cJSON_CreateString(text));
+
+ if (regex) {
+ cJSON_AddItemToObject(params, "regex", cJSON_CreateString(regex));
+ }
+
+ jsock_queue_event(jsock, &jmsg, SWITCH_TRUE);
+
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Error Parsing Media Params\n");
+ r = SWITCH_STATUS_FALSE;
+ }
+
+
+ switch_thread_rwlock_unlock(jsock->rwlock);
+ }
+ }
+ break;
case SWITCH_MESSAGE_INDICATE_MEDIA_RENEG:
{
jsock_t *jsock = NULL;
"RING_EVENT",
"RESAMPLE_EVENT",
"HEARTBEAT_EVENT",
+ "SESSION_ID",
+ "PROMPT",
"INVALID"
};
return status;
}
+
+SWITCH_DECLARE(switch_status_t) switch_ivr_send_prompt(switch_core_session_t *session, const char *type, const char *text, const char *regex)
+{
+ switch_core_session_message_t msg = { 0 };
+
+ msg.message_id = SWITCH_MESSAGE_INDICATE_PROMPT;
+ msg.string_array_arg[0] = type;
+ msg.string_array_arg[1] = text;
+ msg.string_array_arg[2] = regex;
+ msg.from = __FILE__;
+
+ switch_core_session_receive_message(session, &msg);
+
+ return SWITCH_STATUS_SUCCESS;
+}
+
SWITCH_DECLARE(switch_status_t) switch_ivr_hold(switch_core_session_t *session, const char *message, switch_bool_t moh)
{
switch_core_session_message_t msg = { 0 };