[core] add new prompt functionality to ask for pin over dialogbox
This commit is contained in:
parent
ffbe8500ec
commit
b18ea498df
|
@ -1069,6 +1069,7 @@ SWITCH_DECLARE(void) switch_dial_handle_list_add_global_var(switch_dial_handle_l
|
|||
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,
|
||||
|
|
|
@ -1173,6 +1173,7 @@ typedef enum {
|
|||
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;
|
||||
|
||||
|
|
|
@ -2623,6 +2623,40 @@ static switch_status_t messagehook (switch_core_session_t *session, switch_core_
|
|||
|
||||
}
|
||||
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;
|
||||
|
|
|
@ -827,6 +827,8 @@ static const char *message_names[] = {
|
|||
"RING_EVENT",
|
||||
"RESAMPLE_EVENT",
|
||||
"HEARTBEAT_EVENT",
|
||||
"SESSION_ID",
|
||||
"PROMPT",
|
||||
"INVALID"
|
||||
};
|
||||
|
||||
|
|
|
@ -1506,6 +1506,22 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_count(switch_core_sess
|
|||
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 };
|
||||
|
|
Loading…
Reference in New Issue