mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-16 16:58:35 +00:00
Skinny: Correct state handling
- wait for media before marking channel as answered - set effective_caller_{id,name} before sending call info
This commit is contained in:
parent
8ec0b7f4c7
commit
23b09b4593
@ -934,6 +934,10 @@ switch_status_t channel_answer_channel(switch_core_session_t *session)
|
|||||||
atoi(switch_channel_get_variable(channel, "skinny_device_instance")), &listener);
|
atoi(switch_channel_get_variable(channel, "skinny_device_instance")), &listener);
|
||||||
if (listener) {
|
if (listener) {
|
||||||
skinny_session_start_media(session, listener, atoi(switch_channel_get_variable(channel, "skinny_line_instance")));
|
skinny_session_start_media(session, listener, atoi(switch_channel_get_variable(channel, "skinny_line_instance")));
|
||||||
|
/* Wait for media */
|
||||||
|
while(!switch_test_flag(tech_pvt, TFLAG_IO)) {
|
||||||
|
switch_cond_next();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Unable to find listener to answer %s:%s\n",
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "Unable to find listener to answer %s:%s\n",
|
||||||
switch_channel_get_variable(channel, "skinny_device_name"), switch_channel_get_variable(channel, "skinny_device_instance"));
|
switch_channel_get_variable(channel, "skinny_device_name"), switch_channel_get_variable(channel, "skinny_device_instance"));
|
||||||
|
@ -374,8 +374,6 @@ switch_status_t skinny_session_send_call_info(switch_core_session_t *session, li
|
|||||||
struct skinny_ring_lines_helper {
|
struct skinny_ring_lines_helper {
|
||||||
private_t *tech_pvt;
|
private_t *tech_pvt;
|
||||||
uint32_t lines_count;
|
uint32_t lines_count;
|
||||||
char *effective_callee_id_number;
|
|
||||||
char *effective_callee_id_name;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
int skinny_ring_lines_callback(void *pArg, int argc, char **argv, char **columnNames)
|
int skinny_ring_lines_callback(void *pArg, int argc, char **argv, char **columnNames)
|
||||||
@ -407,12 +405,8 @@ int skinny_ring_lines_callback(void *pArg, int argc, char **argv, char **columnN
|
|||||||
device_name, device_instance, &listener);
|
device_name, device_instance, &listener);
|
||||||
if(listener) {
|
if(listener) {
|
||||||
helper->lines_count++;
|
helper->lines_count++;
|
||||||
if (!helper->effective_callee_id_number) {
|
switch_channel_set_variable(switch_core_session_get_channel(helper->tech_pvt->session), "effective_callee_id_number", value);
|
||||||
helper->effective_callee_id_number = switch_core_session_strdup(helper->tech_pvt->session, value);
|
switch_channel_set_variable(switch_core_session_get_channel(helper->tech_pvt->session), "effective_callee_id_name", caller_name);
|
||||||
}
|
|
||||||
if (!helper->effective_callee_id_name) {
|
|
||||||
helper->effective_callee_id_name = switch_core_session_strdup(helper->tech_pvt->session, caller_name);
|
|
||||||
}
|
|
||||||
skinny_line_set_state(listener, line_instance, helper->tech_pvt->call_id, SKINNY_RING_IN);
|
skinny_line_set_state(listener, line_instance, helper->tech_pvt->call_id, SKINNY_RING_IN);
|
||||||
send_select_soft_keys(listener, line_instance, helper->tech_pvt->call_id, SKINNY_KEY_SET_RING_IN, 0xffff);
|
send_select_soft_keys(listener, line_instance, helper->tech_pvt->call_id, SKINNY_KEY_SET_RING_IN, 0xffff);
|
||||||
if ((tmp = switch_mprintf("%s%s", SKINNY_DISP_FROM, helper->tech_pvt->caller_profile->destination_number))) {
|
if ((tmp = switch_mprintf("%s%s", SKINNY_DISP_FROM, helper->tech_pvt->caller_profile->destination_number))) {
|
||||||
@ -441,17 +435,9 @@ switch_call_cause_t skinny_ring_lines(private_t *tech_pvt)
|
|||||||
|
|
||||||
helper.tech_pvt = tech_pvt;
|
helper.tech_pvt = tech_pvt;
|
||||||
helper.lines_count = 0;
|
helper.lines_count = 0;
|
||||||
helper.effective_callee_id_number = NULL;
|
|
||||||
helper.effective_callee_id_name = NULL;
|
|
||||||
|
|
||||||
status = skinny_session_walk_lines(tech_pvt->profile,
|
status = skinny_session_walk_lines(tech_pvt->profile,
|
||||||
switch_core_session_get_uuid(tech_pvt->session), skinny_ring_lines_callback, &helper);
|
switch_core_session_get_uuid(tech_pvt->session), skinny_ring_lines_callback, &helper);
|
||||||
if (helper.effective_callee_id_number) {
|
|
||||||
switch_channel_set_variable(switch_core_session_get_channel(tech_pvt->session), "effective_callee_id_number", helper.effective_callee_id_number);
|
|
||||||
}
|
|
||||||
if (helper.effective_callee_id_name) {
|
|
||||||
switch_channel_set_variable(switch_core_session_get_channel(tech_pvt->session), "effective_callee_id_name", helper.effective_callee_id_name);
|
|
||||||
}
|
|
||||||
if (status != SWITCH_STATUS_SUCCESS) {
|
if (status != SWITCH_STATUS_SUCCESS) {
|
||||||
return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
|
return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
|
||||||
} else if (helper.lines_count == 0) {
|
} else if (helper.lines_count == 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user