mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-02-09 09:17:34 +00:00
more dmachine improvements
This commit is contained in:
parent
6772c795e0
commit
f87dd96375
@ -845,6 +845,8 @@ SWITCH_DECLARE(switch_bool_t) switch_ivr_uuid_exists(const char *uuid);
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
SWITCH_DECLARE(void) switch_ivr_dmachine_set_match_callback(switch_ivr_dmachine_t *dmachine, switch_ivr_dmachine_callback_t match_callback);
|
||||||
|
SWITCH_DECLARE(void) switch_ivr_dmachine_set_nonmatch_callback(switch_ivr_dmachine_t *dmachine, switch_ivr_dmachine_callback_t nonmatch_callback);
|
||||||
SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_create(switch_ivr_dmachine_t **dmachine_p,
|
SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_create(switch_ivr_dmachine_t **dmachine_p,
|
||||||
const char *name,
|
const char *name,
|
||||||
switch_memory_pool_t *pool,
|
switch_memory_pool_t *pool,
|
||||||
|
@ -840,6 +840,7 @@ typedef enum {
|
|||||||
SWITCH_STATUS_IGNORE,
|
SWITCH_STATUS_IGNORE,
|
||||||
SWITCH_STATUS_TOO_SMALL,
|
SWITCH_STATUS_TOO_SMALL,
|
||||||
SWITCH_STATUS_FOUND,
|
SWITCH_STATUS_FOUND,
|
||||||
|
SWITCH_STATUS_CONTINUE,
|
||||||
SWITCH_STATUS_NOT_INITALIZED
|
SWITCH_STATUS_NOT_INITALIZED
|
||||||
} switch_status_t;
|
} switch_status_t;
|
||||||
|
|
||||||
|
@ -72,6 +72,21 @@ struct switch_ivr_dmachine {
|
|||||||
void *user_data;
|
void *user_data;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
SWITCH_DECLARE(void) switch_ivr_dmachine_set_match_callback(switch_ivr_dmachine_t *dmachine, switch_ivr_dmachine_callback_t match_callback)
|
||||||
|
{
|
||||||
|
|
||||||
|
dmachine->match_callback = match_callback;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
SWITCH_DECLARE(void) switch_ivr_dmachine_set_nonmatch_callback(switch_ivr_dmachine_t *dmachine, switch_ivr_dmachine_callback_t nonmatch_callback)
|
||||||
|
{
|
||||||
|
|
||||||
|
dmachine->nonmatch_callback = nonmatch_callback;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_create(switch_ivr_dmachine_t **dmachine_p,
|
SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_create(switch_ivr_dmachine_t **dmachine_p,
|
||||||
const char *name,
|
const char *name,
|
||||||
switch_memory_pool_t *pool,
|
switch_memory_pool_t *pool,
|
||||||
@ -366,12 +381,16 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_ping(switch_ivr_dmachine_t *
|
|||||||
dmachine->match.type = DM_MATCH_POSITIVE;
|
dmachine->match.type = DM_MATCH_POSITIVE;
|
||||||
|
|
||||||
if (dmachine->last_matching_binding->callback) {
|
if (dmachine->last_matching_binding->callback) {
|
||||||
dmachine->last_matching_binding->callback(&dmachine->match);
|
if (dmachine->last_matching_binding->callback(&dmachine->match) == SWITCH_STATUS_CONTINUE) {
|
||||||
|
r = SWITCH_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dmachine->match_callback) {
|
if (dmachine->match_callback) {
|
||||||
dmachine->match.user_data = dmachine->user_data;
|
dmachine->match.user_data = dmachine->user_data;
|
||||||
dmachine->match_callback(&dmachine->match);
|
if (dmachine->match_callback(&dmachine->match) == SWITCH_STATUS_CONTINUE) {
|
||||||
|
r = SWITCH_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
clear++;
|
clear++;
|
||||||
} else if (is_timeout) {
|
} else if (is_timeout) {
|
||||||
@ -390,7 +409,9 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_dmachine_ping(switch_ivr_dmachine_t *
|
|||||||
|
|
||||||
if (dmachine->nonmatch_callback) {
|
if (dmachine->nonmatch_callback) {
|
||||||
dmachine->match.user_data = dmachine->user_data;
|
dmachine->match.user_data = dmachine->user_data;
|
||||||
dmachine->nonmatch_callback(&dmachine->match);
|
if (dmachine->nonmatch_callback(&dmachine->match) == SWITCH_STATUS_CONTINUE) {
|
||||||
|
r = SWITCH_STATUS_SUCCESS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
clear++;
|
clear++;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user