mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-05-10 01:23:51 +00:00
FS-5608 improvement in behavior, on EXECUTE it will now send the stop ring tone message to device
This commit is contained in:
parent
9fa2079d63
commit
cc069d7307
@ -757,10 +757,73 @@ switch_status_t channel_on_routing(switch_core_session_t *session)
|
|||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct channel_on_execute_helper {
|
||||||
|
private_t *tech_pvt;
|
||||||
|
listener_t *listener;
|
||||||
|
uint32_t line_instance;
|
||||||
|
};
|
||||||
|
|
||||||
|
int channel_on_execute_callback(void *pArg, int argc, char **argv, char **columnNames)
|
||||||
|
{
|
||||||
|
struct channel_on_routing_helper *helper = pArg;
|
||||||
|
listener_t *listener = NULL;
|
||||||
|
|
||||||
|
char *device_name = argv[0];
|
||||||
|
uint32_t device_instance = atoi(argv[1]);
|
||||||
|
/* uint32_t position = atoi(argv[2]); */
|
||||||
|
uint32_t line_instance = atoi(argv[3]);
|
||||||
|
/* char *label = argv[4]; */
|
||||||
|
/* char *value = argv[5]; */
|
||||||
|
/* char *caller_name = argv[6]; */
|
||||||
|
/* uint32_t ring_on_idle = atoi(argv[7]); */
|
||||||
|
/* uint32_t ring_on_active = atoi(argv[8]); */
|
||||||
|
/* uint32_t busy_trigger = atoi(argv[9]); */
|
||||||
|
/* char *forward_all = argv[10]; */
|
||||||
|
/* char *forward_busy = argv[11]; */
|
||||||
|
/* char *forward_noanswer = argv[12]; */
|
||||||
|
/* uint32_t noanswer_duration = atoi(argv[13]); */
|
||||||
|
/* char *channel_uuid = argv[14]; */
|
||||||
|
/* uint32_t call_id = atoi(argv[15]); */
|
||||||
|
/* uint32_t call_state = atoi(argv[16]); */
|
||||||
|
|
||||||
|
skinny_profile_find_listener_by_device_name_and_instance(helper->tech_pvt->profile, device_name, device_instance, &listener);
|
||||||
|
if(listener) {
|
||||||
|
if(!strcmp(device_name, helper->listener->device_name)
|
||||||
|
&& (device_instance == helper->listener->device_instance)
|
||||||
|
&& (line_instance == helper->line_instance)) {/* the calling line */
|
||||||
|
helper->tech_pvt->caller_profile->dialplan = switch_core_strdup(helper->tech_pvt->caller_profile->pool, listener->profile->dialplan);
|
||||||
|
helper->tech_pvt->caller_profile->context = switch_core_strdup(helper->tech_pvt->caller_profile->pool, listener->profile->context);
|
||||||
|
|
||||||
|
send_stop_tone(listener, line_instance, helper->tech_pvt->call_id);
|
||||||
|
} else {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
switch_status_t channel_on_execute(switch_core_session_t *session)
|
switch_status_t channel_on_execute(switch_core_session_t *session)
|
||||||
{
|
{
|
||||||
switch_channel_t *channel = switch_core_session_get_channel(session);
|
switch_channel_t *channel = switch_core_session_get_channel(session);
|
||||||
|
|
||||||
|
if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_INBOUND) {
|
||||||
|
private_t *tech_pvt = switch_core_session_get_private(session);
|
||||||
|
listener_t *listener = NULL;
|
||||||
|
struct channel_on_execute_helper helper = {0};
|
||||||
|
|
||||||
|
skinny_profile_find_listener_by_device_name_and_instance(tech_pvt->profile,
|
||||||
|
switch_channel_get_variable(channel, "skinny_device_name"),
|
||||||
|
atoi(switch_channel_get_variable(channel, "skinny_device_instance")), &listener);
|
||||||
|
if (listener) {
|
||||||
|
helper.tech_pvt = tech_pvt;
|
||||||
|
helper.listener = listener;
|
||||||
|
helper.line_instance = atoi(switch_channel_get_variable(channel, "skinny_line_instance"));
|
||||||
|
skinny_session_walk_lines(tech_pvt->profile, switch_core_session_get_uuid(session), channel_on_execute_callback, &helper);
|
||||||
|
} else {
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Could not find listener %s:%s for Channel %s\n",
|
||||||
|
switch_channel_get_variable(channel, "skinny_device_name"), switch_channel_get_variable(channel, "skinny_device_instance"),
|
||||||
|
switch_channel_get_name(channel));
|
||||||
|
}
|
||||||
|
}
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s CHANNEL EXECUTE\n", switch_channel_get_name(channel));
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s CHANNEL EXECUTE\n", switch_channel_get_name(channel));
|
||||||
|
|
||||||
return SWITCH_STATUS_SUCCESS;
|
return SWITCH_STATUS_SUCCESS;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user