[core, mod_loopback] Add test case for group confirm over loopback endpoints
This commit is contained in:
parent
7264426386
commit
2a54e08019
|
@ -1521,6 +1521,7 @@ static switch_status_t null_channel_read_frame(switch_core_session_t *session, s
|
||||||
samples = tech_pvt->read_codec.implementation->samples_per_packet;
|
samples = tech_pvt->read_codec.implementation->samples_per_packet;
|
||||||
tech_pvt->read_frame.codec = &tech_pvt->read_codec;
|
tech_pvt->read_frame.codec = &tech_pvt->read_codec;
|
||||||
tech_pvt->read_frame.datalen = samples * sizeof(int16_t);
|
tech_pvt->read_frame.datalen = samples * sizeof(int16_t);
|
||||||
|
tech_pvt->read_frame.buflen = samples * sizeof(int16_t);
|
||||||
tech_pvt->read_frame.samples = samples;
|
tech_pvt->read_frame.samples = samples;
|
||||||
tech_pvt->read_frame.data = tech_pvt->null_buf;
|
tech_pvt->read_frame.data = tech_pvt->null_buf;
|
||||||
switch_generate_sln_silence((int16_t *)tech_pvt->read_frame.data, tech_pvt->read_frame.samples, tech_pvt->read_codec.implementation->number_of_channels, 10000);
|
switch_generate_sln_silence((int16_t *)tech_pvt->read_frame.data, tech_pvt->read_frame.samples, tech_pvt->read_codec.implementation->number_of_channels, 10000);
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
<load module="mod_tone_stream"/>
|
<load module="mod_tone_stream"/>
|
||||||
<load module="mod_dptools"/>
|
<load module="mod_dptools"/>
|
||||||
<load module="mod_sndfile"/>
|
<load module="mod_sndfile"/>
|
||||||
|
<load module="mod_dialplan_xml"/>
|
||||||
|
<load module="mod_sndfile"/>
|
||||||
</modules>
|
</modules>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|
||||||
|
@ -38,6 +40,12 @@
|
||||||
|
|
||||||
<section name="dialplan" description="Regex/XML Dialplan">
|
<section name="dialplan" description="Regex/XML Dialplan">
|
||||||
<context name="default">
|
<context name="default">
|
||||||
|
<extension name="loopback">
|
||||||
|
<condition field="destination_number" expression="^loopback$">
|
||||||
|
<action application="bridge" data="null/+1234"/>
|
||||||
|
</condition>
|
||||||
|
</extension>
|
||||||
|
|
||||||
<extension name="sample">
|
<extension name="sample">
|
||||||
<condition>
|
<condition>
|
||||||
<action application="info"/>
|
<action application="info"/>
|
||||||
|
|
|
@ -71,6 +71,16 @@ static switch_state_handler_table_t state_handlers = {
|
||||||
SSH_FLAG_STICKY
|
SSH_FLAG_STICKY
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static int application_hit = 0;
|
||||||
|
|
||||||
|
static void loopback_group_confirm_event_handler(switch_event_t *event) // general event handler
|
||||||
|
{
|
||||||
|
if (event->event_id == SWITCH_EVENT_CHANNEL_APPLICATION) {
|
||||||
|
application_hit++;
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "application_hit = %d\n", application_hit);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
FST_CORE_BEGIN("./conf")
|
FST_CORE_BEGIN("./conf")
|
||||||
{
|
{
|
||||||
FST_SUITE_BEGIN(switch_ivr_originate)
|
FST_SUITE_BEGIN(switch_ivr_originate)
|
||||||
|
@ -78,6 +88,7 @@ FST_CORE_BEGIN("./conf")
|
||||||
FST_SETUP_BEGIN()
|
FST_SETUP_BEGIN()
|
||||||
{
|
{
|
||||||
fst_requires_module("mod_loopback");
|
fst_requires_module("mod_loopback");
|
||||||
|
application_hit = 0;
|
||||||
}
|
}
|
||||||
FST_SETUP_END()
|
FST_SETUP_END()
|
||||||
|
|
||||||
|
@ -437,6 +448,44 @@ FST_CORE_BEGIN("./conf")
|
||||||
switch_core_session_rwunlock(session);
|
switch_core_session_rwunlock(session);
|
||||||
}
|
}
|
||||||
FST_TEST_END()
|
FST_TEST_END()
|
||||||
|
|
||||||
|
FST_TEST_BEGIN(originate_test_group_confirm_loopback_endpoint_originate)
|
||||||
|
{
|
||||||
|
switch_core_session_t *session = NULL;
|
||||||
|
switch_channel_t *channel = NULL;
|
||||||
|
switch_status_t status;
|
||||||
|
switch_call_cause_t cause;
|
||||||
|
const char *dialstring = "[group_confirm_key=exec,group_confirm_file='event a=1']loopback/loopback";
|
||||||
|
|
||||||
|
switch_event_bind("test", SWITCH_EVENT_ALL, SWITCH_EVENT_SUBCLASS_ANY, loopback_group_confirm_event_handler, NULL);
|
||||||
|
status = switch_ivr_originate(NULL, &session, &cause, dialstring, 0, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL);
|
||||||
|
fst_requires(status == SWITCH_STATUS_SUCCESS);
|
||||||
|
fst_requires(session);
|
||||||
|
switch_yield(1000000);
|
||||||
|
switch_channel_hangup(switch_core_session_get_channel(session), SWITCH_CAUSE_NORMAL_CLEARING);
|
||||||
|
switch_yield(1000000);
|
||||||
|
switch_core_session_rwunlock(session);
|
||||||
|
switch_event_unbind_callback(loopback_group_confirm_event_handler);
|
||||||
|
fst_check(application_hit == 1);
|
||||||
|
}
|
||||||
|
FST_TEST_END()
|
||||||
|
|
||||||
|
FST_SESSION_BEGIN(originate_test_group_confirm_loopback_endpoint_bridge)
|
||||||
|
{
|
||||||
|
switch_core_session_t *session = NULL;
|
||||||
|
switch_channel_t *channel = NULL;
|
||||||
|
switch_status_t status;
|
||||||
|
switch_call_cause_t cause;
|
||||||
|
const char *dialstring = "[group_confirm_key=exec,group_confirm_file='event a=1']loopback/loopback";
|
||||||
|
|
||||||
|
switch_event_bind("test", SWITCH_EVENT_ALL, SWITCH_EVENT_SUBCLASS_ANY, loopback_group_confirm_event_handler, NULL);
|
||||||
|
|
||||||
|
switch_core_session_execute_application(fst_session, "bridge", dialstring);
|
||||||
|
switch_yield(2000000);
|
||||||
|
switch_channel_hangup(fst_channel, SWITCH_CAUSE_NORMAL_CLEARING);
|
||||||
|
fst_check(application_hit == 1);
|
||||||
|
}
|
||||||
|
FST_SESSION_END()
|
||||||
}
|
}
|
||||||
FST_SUITE_END()
|
FST_SUITE_END()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue