|
|
|
@ -396,7 +396,7 @@ int skinny_ring_lines_callback(void *pArg, int argc, char **argv, char **columnN
|
|
|
|
|
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);
|
|
|
|
|
if ((tmp = switch_mprintf("\200\027%s", helper->tech_pvt->caller_profile->destination_number))) {
|
|
|
|
|
display_prompt_status(listener, 0, tmp, line_instance, helper->tech_pvt->call_id);
|
|
|
|
|
send_display_prompt_status(listener, 0, tmp, line_instance, helper->tech_pvt->call_id);
|
|
|
|
|
switch_safe_free(tmp);
|
|
|
|
|
}
|
|
|
|
|
if ((tmp = switch_mprintf("\005\000\000\000%s", helper->tech_pvt->caller_profile->destination_number))) {
|
|
|
|
@ -404,8 +404,8 @@ int skinny_ring_lines_callback(void *pArg, int argc, char **argv, char **columnN
|
|
|
|
|
switch_safe_free(tmp);
|
|
|
|
|
}
|
|
|
|
|
skinny_send_call_info(helper->tech_pvt->session, listener, line_instance);
|
|
|
|
|
set_lamp(listener, SKINNY_BUTTON_LINE, line_instance, SKINNY_LAMP_BLINK);
|
|
|
|
|
set_ringer(listener, SKINNY_RING_INSIDE, SKINNY_RING_FOREVER, 0, helper->tech_pvt->call_id);
|
|
|
|
|
send_set_lamp(listener, SKINNY_BUTTON_LINE, line_instance, SKINNY_LAMP_BLINK);
|
|
|
|
|
send_set_ringer(listener, SKINNY_RING_INSIDE, SKINNY_RING_FOREVER, 0, helper->tech_pvt->call_id);
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
@ -436,6 +436,7 @@ switch_call_cause_t skinny_ring_lines(private_t *tech_pvt)
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
switch_status_t skinny_create_ingoing_session(listener_t *listener, uint32_t *line_instance_p, switch_core_session_t **session)
|
|
|
|
|
{
|
|
|
|
|
uint32_t line_instance;
|
|
|
|
|
switch_core_session_t *nsession;
|
|
|
|
|
switch_channel_t *channel;
|
|
|
|
|
private_t *tech_pvt;
|
|
|
|
@ -443,6 +444,7 @@ switch_status_t skinny_create_ingoing_session(listener_t *listener, uint32_t *li
|
|
|
|
|
char *sql;
|
|
|
|
|
struct line_stat_res_message *button = NULL;
|
|
|
|
|
|
|
|
|
|
line_instance = *line_instance_p;
|
|
|
|
|
if((nsession = skinny_profile_find_session(listener->profile, listener, line_instance_p, 0))) {
|
|
|
|
|
switch_core_session_rwunlock(nsession);
|
|
|
|
|
if(skinny_line_get_state(listener, *line_instance_p, 0) == SKINNY_OFF_HOOK) {
|
|
|
|
@ -452,6 +454,7 @@ switch_status_t skinny_create_ingoing_session(listener_t *listener, uint32_t *li
|
|
|
|
|
}
|
|
|
|
|
skinny_session_hold_line(nsession, listener, *line_instance_p);
|
|
|
|
|
}
|
|
|
|
|
*line_instance_p = line_instance;
|
|
|
|
|
if(*line_instance_p == 0) {
|
|
|
|
|
*line_instance_p = 1;
|
|
|
|
|
}
|
|
|
|
@ -518,14 +521,14 @@ switch_status_t skinny_create_ingoing_session(listener_t *listener, uint32_t *li
|
|
|
|
|
switch_safe_free(sql);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
set_ringer(listener, SKINNY_RING_OFF, SKINNY_RING_FOREVER, 0, tech_pvt->call_id);
|
|
|
|
|
set_speaker_mode(listener, SKINNY_SPEAKER_ON);
|
|
|
|
|
set_lamp(listener, SKINNY_BUTTON_LINE, *line_instance_p, SKINNY_LAMP_ON);
|
|
|
|
|
send_set_ringer(listener, SKINNY_RING_OFF, SKINNY_RING_FOREVER, 0, tech_pvt->call_id);
|
|
|
|
|
send_set_speaker_mode(listener, SKINNY_SPEAKER_ON);
|
|
|
|
|
send_set_lamp(listener, SKINNY_BUTTON_LINE, *line_instance_p, SKINNY_LAMP_ON);
|
|
|
|
|
skinny_line_set_state(listener, *line_instance_p, tech_pvt->call_id, SKINNY_OFF_HOOK);
|
|
|
|
|
send_select_soft_keys(listener, *line_instance_p, tech_pvt->call_id, SKINNY_KEY_SET_OFF_HOOK, 0xffff);
|
|
|
|
|
display_prompt_status(listener, 0, "\200\000",
|
|
|
|
|
send_display_prompt_status(listener, 0, "\200\000",
|
|
|
|
|
*line_instance_p, tech_pvt->call_id);
|
|
|
|
|
activate_call_plane(listener, *line_instance_p);
|
|
|
|
|
send_activate_call_plane(listener, *line_instance_p);
|
|
|
|
|
|
|
|
|
|
goto done;
|
|
|
|
|
error:
|
|
|
|
@ -554,10 +557,10 @@ switch_status_t skinny_session_process_dest(switch_core_session_t *session, list
|
|
|
|
|
|
|
|
|
|
if(!dest) {
|
|
|
|
|
if(append_dest == '\0') {/* no digit yet */
|
|
|
|
|
start_tone(listener, SKINNY_TONE_DIALTONE, 0, line_instance, tech_pvt->call_id);
|
|
|
|
|
send_start_tone(listener, SKINNY_TONE_DIALTONE, 0, line_instance, tech_pvt->call_id);
|
|
|
|
|
} else {
|
|
|
|
|
if(strlen(tech_pvt->caller_profile->destination_number) == 0) {/* first digit */
|
|
|
|
|
stop_tone(listener, line_instance, tech_pvt->call_id);
|
|
|
|
|
send_stop_tone(listener, line_instance, tech_pvt->call_id);
|
|
|
|
|
send_select_soft_keys(listener, line_instance, tech_pvt->call_id,
|
|
|
|
|
SKINNY_KEY_SET_DIGITS_AFTER_DIALING_FIRST_DIGIT, 0xffff);
|
|
|
|
|
}
|
|
|
|
@ -596,7 +599,7 @@ switch_status_t skinny_session_ring_out(switch_core_session_t *session, listener
|
|
|
|
|
skinny_line_set_state(listener, line_instance, tech_pvt->call_id, SKINNY_RING_OUT);
|
|
|
|
|
send_select_soft_keys(listener, line_instance, tech_pvt->call_id,
|
|
|
|
|
SKINNY_KEY_SET_RING_OUT, 0xffff);
|
|
|
|
|
display_prompt_status(listener, 0, "\200\026",
|
|
|
|
|
send_display_prompt_status(listener, 0, "\200\026",
|
|
|
|
|
line_instance, tech_pvt->call_id);
|
|
|
|
|
skinny_send_call_info(session, listener, line_instance);
|
|
|
|
|
|
|
|
|
@ -642,14 +645,14 @@ int skinny_session_answer_callback(void *pArg, int argc, char **argv, char **col
|
|
|
|
|
&& (line_instance == helper->line_instance)) {/* the answering line */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
set_ringer(listener, SKINNY_RING_OFF, SKINNY_RING_FOREVER, 0, helper->tech_pvt->call_id);
|
|
|
|
|
set_speaker_mode(listener, SKINNY_SPEAKER_ON);
|
|
|
|
|
set_lamp(listener, SKINNY_BUTTON_LINE, line_instance, SKINNY_LAMP_ON);
|
|
|
|
|
send_set_ringer(listener, SKINNY_RING_OFF, SKINNY_RING_FOREVER, 0, helper->tech_pvt->call_id);
|
|
|
|
|
send_set_speaker_mode(listener, SKINNY_SPEAKER_ON);
|
|
|
|
|
send_set_lamp(listener, SKINNY_BUTTON_LINE, line_instance, SKINNY_LAMP_ON);
|
|
|
|
|
skinny_line_set_state(listener, line_instance, helper->tech_pvt->call_id, SKINNY_OFF_HOOK);
|
|
|
|
|
/* send_select_soft_keys(listener, line_instance, helper->tech_pvt->call_id, SKINNY_KEY_SET_OFF_HOOK, 0xffff); */
|
|
|
|
|
/* display_prompt_status(listener, 0, "\200\000",
|
|
|
|
|
line_instance, tech_pvt->call_id); */
|
|
|
|
|
activate_call_plane(listener, line_instance);
|
|
|
|
|
send_activate_call_plane(listener, line_instance);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
@ -693,8 +696,8 @@ switch_status_t skinny_session_start_media(switch_core_session_t *session, liste
|
|
|
|
|
channel = switch_core_session_get_channel(session);
|
|
|
|
|
tech_pvt = switch_core_session_get_private(session);
|
|
|
|
|
|
|
|
|
|
stop_tone(listener, line_instance, tech_pvt->call_id);
|
|
|
|
|
open_receive_channel(listener,
|
|
|
|
|
send_stop_tone(listener, line_instance, tech_pvt->call_id);
|
|
|
|
|
send_open_receive_channel(listener,
|
|
|
|
|
tech_pvt->call_id, /* uint32_t conference_id, */
|
|
|
|
|
tech_pvt->call_id, /* uint32_t pass_thru_party_id, */
|
|
|
|
|
20, /* uint32_t packets, */
|
|
|
|
@ -707,7 +710,7 @@ switch_status_t skinny_session_start_media(switch_core_session_t *session, liste
|
|
|
|
|
skinny_line_set_state(listener, line_instance, tech_pvt->call_id, SKINNY_CONNECTED);
|
|
|
|
|
send_select_soft_keys(listener, line_instance, tech_pvt->call_id,
|
|
|
|
|
SKINNY_KEY_SET_CONNECTED, 0xffff);
|
|
|
|
|
display_prompt_status(listener,
|
|
|
|
|
send_display_prompt_status(listener,
|
|
|
|
|
0,
|
|
|
|
|
"\200\030",
|
|
|
|
|
line_instance,
|
|
|
|
@ -932,7 +935,26 @@ void skinny_feature_get(listener_t *listener, uint32_t instance, struct feature_
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
/* SKINNY MESSAGE SENDER */
|
|
|
|
|
/*****************************************************************************/
|
|
|
|
|
switch_status_t start_tone(listener_t *listener,
|
|
|
|
|
switch_status_t send_register_ack(listener_t *listener,
|
|
|
|
|
uint32_t keep_alive,
|
|
|
|
|
char *date_format,
|
|
|
|
|
char *reserved,
|
|
|
|
|
uint32_t secondary_keep_alive,
|
|
|
|
|
char *reserved2)
|
|
|
|
|
{
|
|
|
|
|
skinny_message_t *message;
|
|
|
|
|
message = switch_core_alloc(listener->pool, 12+sizeof(message->data.reg_ack));
|
|
|
|
|
message->type = REGISTER_ACK_MESSAGE;
|
|
|
|
|
message->length = 4 + sizeof(message->data.reg_ack);
|
|
|
|
|
message->data.reg_ack.keep_alive = keep_alive;
|
|
|
|
|
strncpy(message->data.reg_ack.date_format, date_format, 6);
|
|
|
|
|
strncpy(message->data.reg_ack.reserved, reserved, 2);
|
|
|
|
|
message->data.reg_ack.secondary_keep_alive = keep_alive;
|
|
|
|
|
strncpy(message->data.reg_ack.reserved2, reserved2, 4);
|
|
|
|
|
return skinny_send_reply(listener, message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch_status_t send_start_tone(listener_t *listener,
|
|
|
|
|
uint32_t tone,
|
|
|
|
|
uint32_t reserved,
|
|
|
|
|
uint32_t line_instance,
|
|
|
|
@ -946,11 +968,10 @@ switch_status_t start_tone(listener_t *listener,
|
|
|
|
|
message->data.start_tone.reserved = reserved;
|
|
|
|
|
message->data.start_tone.line_instance = line_instance;
|
|
|
|
|
message->data.start_tone.call_id = call_id;
|
|
|
|
|
skinny_send_reply(listener, message);
|
|
|
|
|
return SWITCH_STATUS_SUCCESS;
|
|
|
|
|
return skinny_send_reply(listener, message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch_status_t stop_tone(listener_t *listener,
|
|
|
|
|
switch_status_t send_stop_tone(listener_t *listener,
|
|
|
|
|
uint32_t line_instance,
|
|
|
|
|
uint32_t call_id)
|
|
|
|
|
{
|
|
|
|
@ -960,11 +981,10 @@ switch_status_t stop_tone(listener_t *listener,
|
|
|
|
|
message->length = 4 + sizeof(message->data.stop_tone);
|
|
|
|
|
message->data.stop_tone.line_instance = line_instance;
|
|
|
|
|
message->data.stop_tone.call_id = call_id;
|
|
|
|
|
skinny_send_reply(listener, message);
|
|
|
|
|
return SWITCH_STATUS_SUCCESS;
|
|
|
|
|
return skinny_send_reply(listener, message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch_status_t set_ringer(listener_t *listener,
|
|
|
|
|
switch_status_t send_set_ringer(listener_t *listener,
|
|
|
|
|
uint32_t ring_type,
|
|
|
|
|
uint32_t ring_mode,
|
|
|
|
|
uint32_t line_instance,
|
|
|
|
@ -978,11 +998,10 @@ switch_status_t set_ringer(listener_t *listener,
|
|
|
|
|
message->data.ringer.ring_mode = ring_mode;
|
|
|
|
|
message->data.ringer.line_instance = line_instance;
|
|
|
|
|
message->data.ringer.call_id = call_id;
|
|
|
|
|
skinny_send_reply(listener, message);
|
|
|
|
|
return SWITCH_STATUS_SUCCESS;
|
|
|
|
|
return skinny_send_reply(listener, message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch_status_t set_lamp(listener_t *listener,
|
|
|
|
|
switch_status_t send_set_lamp(listener_t *listener,
|
|
|
|
|
uint32_t stimulus,
|
|
|
|
|
uint32_t stimulus_instance,
|
|
|
|
|
uint32_t mode)
|
|
|
|
@ -994,11 +1013,10 @@ switch_status_t set_lamp(listener_t *listener,
|
|
|
|
|
message->data.lamp.stimulus = stimulus;
|
|
|
|
|
message->data.lamp.stimulus_instance = stimulus_instance;
|
|
|
|
|
message->data.lamp.mode = mode;
|
|
|
|
|
skinny_send_reply(listener, message);
|
|
|
|
|
return SWITCH_STATUS_SUCCESS;
|
|
|
|
|
return skinny_send_reply(listener, message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch_status_t set_speaker_mode(listener_t *listener,
|
|
|
|
|
switch_status_t send_set_speaker_mode(listener_t *listener,
|
|
|
|
|
uint32_t mode)
|
|
|
|
|
{
|
|
|
|
|
skinny_message_t *message;
|
|
|
|
@ -1006,11 +1024,10 @@ switch_status_t set_speaker_mode(listener_t *listener,
|
|
|
|
|
message->type = SET_SPEAKER_MODE_MESSAGE;
|
|
|
|
|
message->length = 4 + sizeof(message->data.speaker_mode);
|
|
|
|
|
message->data.speaker_mode.mode = mode;
|
|
|
|
|
skinny_send_reply(listener, message);
|
|
|
|
|
return SWITCH_STATUS_SUCCESS;
|
|
|
|
|
return skinny_send_reply(listener, message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch_status_t start_media_transmission(listener_t *listener,
|
|
|
|
|
switch_status_t send_start_media_transmission(listener_t *listener,
|
|
|
|
|
uint32_t conference_id,
|
|
|
|
|
uint32_t pass_thru_party_id,
|
|
|
|
|
uint32_t remote_ip,
|
|
|
|
@ -1037,11 +1054,10 @@ switch_status_t start_media_transmission(listener_t *listener,
|
|
|
|
|
message->data.start_media.max_frames_per_packet = max_frames_per_packet;
|
|
|
|
|
message->data.start_media.g723_bitrate = g723_bitrate;
|
|
|
|
|
/* ... */
|
|
|
|
|
skinny_send_reply(listener, message);
|
|
|
|
|
return SWITCH_STATUS_SUCCESS;
|
|
|
|
|
return skinny_send_reply(listener, message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch_status_t stop_media_transmission(listener_t *listener,
|
|
|
|
|
switch_status_t send_stop_media_transmission(listener_t *listener,
|
|
|
|
|
uint32_t conference_id,
|
|
|
|
|
uint32_t pass_thru_party_id,
|
|
|
|
|
uint32_t conference_id2)
|
|
|
|
@ -1054,8 +1070,7 @@ switch_status_t stop_media_transmission(listener_t *listener,
|
|
|
|
|
message->data.stop_media.pass_thru_party_id = pass_thru_party_id;
|
|
|
|
|
message->data.stop_media.conference_id2 = conference_id2;
|
|
|
|
|
/* ... */
|
|
|
|
|
skinny_send_reply(listener, message);
|
|
|
|
|
return SWITCH_STATUS_SUCCESS;
|
|
|
|
|
return skinny_send_reply(listener, message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch_status_t send_call_info(listener_t *listener,
|
|
|
|
@ -1084,31 +1099,95 @@ switch_status_t send_call_info(listener_t *listener,
|
|
|
|
|
message = switch_core_alloc(listener->pool, 12+sizeof(message->data.call_info));
|
|
|
|
|
message->type = CALL_INFO_MESSAGE;
|
|
|
|
|
message->length = 4 + sizeof(message->data.call_info);
|
|
|
|
|
strcpy(message->data.call_info.calling_party_name, calling_party_name);
|
|
|
|
|
strcpy(message->data.call_info.calling_party, calling_party);
|
|
|
|
|
strcpy(message->data.call_info.called_party_name, called_party_name);
|
|
|
|
|
strcpy(message->data.call_info.called_party, called_party);
|
|
|
|
|
strncpy(message->data.call_info.calling_party_name, calling_party_name, 40);
|
|
|
|
|
strncpy(message->data.call_info.calling_party, calling_party, 24);
|
|
|
|
|
strncpy(message->data.call_info.called_party_name, called_party_name, 40);
|
|
|
|
|
strncpy(message->data.call_info.called_party, called_party, 24);
|
|
|
|
|
message->data.call_info.line_instance = line_instance;
|
|
|
|
|
message->data.call_info.call_id = call_id;
|
|
|
|
|
message->data.call_info.call_type = call_type;
|
|
|
|
|
strcpy(message->data.call_info.original_called_party_name, original_called_party_name);
|
|
|
|
|
strcpy(message->data.call_info.original_called_party, original_called_party);
|
|
|
|
|
strcpy(message->data.call_info.last_redirecting_party_name, last_redirecting_party_name);
|
|
|
|
|
strcpy(message->data.call_info.last_redirecting_party, last_redirecting_party);
|
|
|
|
|
strncpy(message->data.call_info.original_called_party_name, original_called_party_name, 40);
|
|
|
|
|
strncpy(message->data.call_info.original_called_party, original_called_party, 24);
|
|
|
|
|
strncpy(message->data.call_info.last_redirecting_party_name, last_redirecting_party_name, 40);
|
|
|
|
|
strncpy(message->data.call_info.last_redirecting_party, last_redirecting_party, 24);
|
|
|
|
|
message->data.call_info.original_called_party_redirect_reason = original_called_party_redirect_reason;
|
|
|
|
|
message->data.call_info.last_redirecting_reason = last_redirecting_reason;
|
|
|
|
|
strcpy(message->data.call_info.calling_party_voice_mailbox, calling_party_voice_mailbox);
|
|
|
|
|
strcpy(message->data.call_info.called_party_voice_mailbox, called_party_voice_mailbox);
|
|
|
|
|
strcpy(message->data.call_info.original_called_party_voice_mailbox, original_called_party_voice_mailbox);
|
|
|
|
|
strcpy(message->data.call_info.last_redirecting_voice_mailbox, last_redirecting_voice_mailbox);
|
|
|
|
|
strncpy(message->data.call_info.calling_party_voice_mailbox, calling_party_voice_mailbox, 24);
|
|
|
|
|
strncpy(message->data.call_info.called_party_voice_mailbox, called_party_voice_mailbox, 24);
|
|
|
|
|
strncpy(message->data.call_info.original_called_party_voice_mailbox, original_called_party_voice_mailbox, 24);
|
|
|
|
|
strncpy(message->data.call_info.last_redirecting_voice_mailbox, last_redirecting_voice_mailbox, 24);
|
|
|
|
|
message->data.call_info.call_instance = call_instance;
|
|
|
|
|
message->data.call_info.call_security_status = call_security_status;
|
|
|
|
|
message->data.call_info.party_pi_restriction_bits = party_pi_restriction_bits;
|
|
|
|
|
skinny_send_reply(listener, message);
|
|
|
|
|
return SWITCH_STATUS_SUCCESS;
|
|
|
|
|
return skinny_send_reply(listener, message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch_status_t open_receive_channel(listener_t *listener,
|
|
|
|
|
switch_status_t send_define_time_date(listener_t *listener,
|
|
|
|
|
uint32_t year,
|
|
|
|
|
uint32_t month,
|
|
|
|
|
uint32_t day_of_week, /* monday = 1 */
|
|
|
|
|
uint32_t day,
|
|
|
|
|
uint32_t hour,
|
|
|
|
|
uint32_t minute,
|
|
|
|
|
uint32_t seconds,
|
|
|
|
|
uint32_t milliseconds,
|
|
|
|
|
uint32_t timestamp)
|
|
|
|
|
{
|
|
|
|
|
skinny_message_t *message;
|
|
|
|
|
message = switch_core_alloc(listener->pool, 12+sizeof(message->data.define_time_date));
|
|
|
|
|
message->type = DEFINE_TIME_DATE_MESSAGE;
|
|
|
|
|
message->length = 4+sizeof(message->data.define_time_date);
|
|
|
|
|
message->data.define_time_date.year = year;
|
|
|
|
|
message->data.define_time_date.month = month;
|
|
|
|
|
message->data.define_time_date.day_of_week = day_of_week;
|
|
|
|
|
message->data.define_time_date.day = day;
|
|
|
|
|
message->data.define_time_date.hour = hour;
|
|
|
|
|
message->data.define_time_date.minute = minute;
|
|
|
|
|
message->data.define_time_date.seconds = seconds;
|
|
|
|
|
message->data.define_time_date.milliseconds = milliseconds;
|
|
|
|
|
message->data.define_time_date.timestamp = timestamp;
|
|
|
|
|
return skinny_send_reply(listener, message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch_status_t send_define_current_time_date(listener_t *listener)
|
|
|
|
|
{
|
|
|
|
|
switch_time_t ts;
|
|
|
|
|
switch_time_exp_t tm;
|
|
|
|
|
ts = switch_micro_time_now();
|
|
|
|
|
switch_time_exp_lt(&tm, ts);
|
|
|
|
|
return send_define_time_date(listener,
|
|
|
|
|
tm.tm_year + 1900,
|
|
|
|
|
tm.tm_mon + 1,
|
|
|
|
|
tm.tm_wday,
|
|
|
|
|
tm.tm_yday + 1,
|
|
|
|
|
tm.tm_hour,
|
|
|
|
|
tm.tm_min,
|
|
|
|
|
tm.tm_sec + 1,
|
|
|
|
|
tm.tm_usec / 1000,
|
|
|
|
|
ts / 1000000);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch_status_t send_capabilities_req(listener_t *listener)
|
|
|
|
|
{
|
|
|
|
|
skinny_message_t *message;
|
|
|
|
|
message = switch_core_alloc(listener->pool, 12);
|
|
|
|
|
message->type = CAPABILITIES_REQ_MESSAGE;
|
|
|
|
|
message->length = 4;
|
|
|
|
|
return skinny_send_reply(listener, message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch_status_t send_register_reject(listener_t *listener,
|
|
|
|
|
char *error)
|
|
|
|
|
{
|
|
|
|
|
skinny_message_t *message;
|
|
|
|
|
message = switch_core_alloc(listener->pool, 12+sizeof(message->data.reg_rej));
|
|
|
|
|
message->type = REGISTER_REJECT_MESSAGE;
|
|
|
|
|
message->length = 4 + sizeof(message->data.reg_rej);
|
|
|
|
|
strncpy(message->data.reg_rej.error, error, 33);
|
|
|
|
|
return skinny_send_reply(listener, message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch_status_t send_open_receive_channel(listener_t *listener,
|
|
|
|
|
uint32_t conference_id,
|
|
|
|
|
uint32_t pass_thru_party_id,
|
|
|
|
|
uint32_t packets,
|
|
|
|
@ -1141,11 +1220,10 @@ switch_status_t open_receive_channel(listener_t *listener,
|
|
|
|
|
message->data.open_receive_channel.reserved[8] = reserved[8];
|
|
|
|
|
message->data.open_receive_channel.reserved[9] = reserved[9];
|
|
|
|
|
*/
|
|
|
|
|
skinny_send_reply(listener, message);
|
|
|
|
|
return SWITCH_STATUS_SUCCESS;
|
|
|
|
|
return skinny_send_reply(listener, message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch_status_t close_receive_channel(listener_t *listener,
|
|
|
|
|
switch_status_t send_close_receive_channel(listener_t *listener,
|
|
|
|
|
uint32_t conference_id,
|
|
|
|
|
uint32_t pass_thru_party_id,
|
|
|
|
|
uint32_t conference_id2)
|
|
|
|
@ -1157,8 +1235,7 @@ switch_status_t close_receive_channel(listener_t *listener,
|
|
|
|
|
message->data.close_receive_channel.conference_id = conference_id;
|
|
|
|
|
message->data.close_receive_channel.pass_thru_party_id = pass_thru_party_id;
|
|
|
|
|
message->data.close_receive_channel.conference_id2 = conference_id2;
|
|
|
|
|
skinny_send_reply(listener, message);
|
|
|
|
|
return SWITCH_STATUS_SUCCESS;
|
|
|
|
|
return skinny_send_reply(listener, message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch_status_t send_select_soft_keys(listener_t *listener,
|
|
|
|
@ -1175,8 +1252,7 @@ switch_status_t send_select_soft_keys(listener_t *listener,
|
|
|
|
|
message->data.select_soft_keys.call_id = call_id;
|
|
|
|
|
message->data.select_soft_keys.soft_key_set = soft_key_set;
|
|
|
|
|
message->data.select_soft_keys.valid_key_mask = valid_key_mask;
|
|
|
|
|
skinny_send_reply(listener, message);
|
|
|
|
|
return SWITCH_STATUS_SUCCESS;
|
|
|
|
|
return skinny_send_reply(listener, message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch_status_t send_call_state(listener_t *listener,
|
|
|
|
@ -1191,11 +1267,10 @@ switch_status_t send_call_state(listener_t *listener,
|
|
|
|
|
message->data.call_state.call_state = call_state;
|
|
|
|
|
message->data.call_state.line_instance = line_instance;
|
|
|
|
|
message->data.call_state.call_id = call_id;
|
|
|
|
|
skinny_send_reply(listener, message);
|
|
|
|
|
return SWITCH_STATUS_SUCCESS;
|
|
|
|
|
return skinny_send_reply(listener, message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch_status_t display_prompt_status(listener_t *listener,
|
|
|
|
|
switch_status_t send_display_prompt_status(listener_t *listener,
|
|
|
|
|
uint32_t timeout,
|
|
|
|
|
char display[32],
|
|
|
|
|
uint32_t line_instance,
|
|
|
|
@ -1206,14 +1281,13 @@ switch_status_t display_prompt_status(listener_t *listener,
|
|
|
|
|
message->type = DISPLAY_PROMPT_STATUS_MESSAGE;
|
|
|
|
|
message->length = 4 + sizeof(message->data.display_prompt_status);
|
|
|
|
|
message->data.display_prompt_status.timeout = timeout;
|
|
|
|
|
strcpy(message->data.display_prompt_status.display, display);
|
|
|
|
|
strncpy(message->data.display_prompt_status.display, display, 32);
|
|
|
|
|
message->data.display_prompt_status.line_instance = line_instance;
|
|
|
|
|
message->data.display_prompt_status.call_id = call_id;
|
|
|
|
|
skinny_send_reply(listener, message);
|
|
|
|
|
return SWITCH_STATUS_SUCCESS;
|
|
|
|
|
return skinny_send_reply(listener, message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch_status_t clear_prompt_status(listener_t *listener,
|
|
|
|
|
switch_status_t send_clear_prompt_status(listener_t *listener,
|
|
|
|
|
uint32_t line_instance,
|
|
|
|
|
uint32_t call_id)
|
|
|
|
|
{
|
|
|
|
@ -1223,11 +1297,10 @@ switch_status_t clear_prompt_status(listener_t *listener,
|
|
|
|
|
message->length = 4 + sizeof(message->data.clear_prompt_status);
|
|
|
|
|
message->data.clear_prompt_status.line_instance = line_instance;
|
|
|
|
|
message->data.clear_prompt_status.call_id = call_id;
|
|
|
|
|
skinny_send_reply(listener, message);
|
|
|
|
|
return SWITCH_STATUS_SUCCESS;
|
|
|
|
|
return skinny_send_reply(listener, message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch_status_t activate_call_plane(listener_t *listener,
|
|
|
|
|
switch_status_t send_activate_call_plane(listener_t *listener,
|
|
|
|
|
uint32_t line_instance)
|
|
|
|
|
{
|
|
|
|
|
skinny_message_t *message;
|
|
|
|
@ -1235,8 +1308,7 @@ switch_status_t activate_call_plane(listener_t *listener,
|
|
|
|
|
message->type = ACTIVATE_CALL_PLANE_MESSAGE;
|
|
|
|
|
message->length = 4 + sizeof(message->data.activate_call_plane);
|
|
|
|
|
message->data.activate_call_plane.line_instance = line_instance;
|
|
|
|
|
skinny_send_reply(listener, message);
|
|
|
|
|
return SWITCH_STATUS_SUCCESS;
|
|
|
|
|
return skinny_send_reply(listener, message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch_status_t send_dialed_number(listener_t *listener,
|
|
|
|
@ -1248,11 +1320,10 @@ switch_status_t send_dialed_number(listener_t *listener,
|
|
|
|
|
message = switch_core_alloc(listener->pool, 12+sizeof(message->data.dialed_number));
|
|
|
|
|
message->type = DIALED_NUMBER_MESSAGE;
|
|
|
|
|
message->length = 4 + sizeof(message->data.dialed_number);
|
|
|
|
|
strcpy(message->data.dialed_number.called_party, called_party);
|
|
|
|
|
strncpy(message->data.dialed_number.called_party, called_party, 24);
|
|
|
|
|
message->data.dialed_number.line_instance = line_instance;
|
|
|
|
|
message->data.dialed_number.call_id = call_id;
|
|
|
|
|
skinny_send_reply(listener, message);
|
|
|
|
|
return SWITCH_STATUS_SUCCESS;
|
|
|
|
|
return skinny_send_reply(listener, message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch_status_t send_display_pri_notify(listener_t *listener,
|
|
|
|
@ -1267,8 +1338,7 @@ switch_status_t send_display_pri_notify(listener_t *listener,
|
|
|
|
|
message->data.display_pri_notify.message_timeout = message_timeout;
|
|
|
|
|
message->data.display_pri_notify.priority = priority;
|
|
|
|
|
strncpy(message->data.display_pri_notify.notify, notify, 32);
|
|
|
|
|
skinny_send_reply(listener, message);
|
|
|
|
|
return SWITCH_STATUS_SUCCESS;
|
|
|
|
|
return skinny_send_reply(listener, message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1279,8 +1349,7 @@ switch_status_t send_reset(listener_t *listener, uint32_t reset_type)
|
|
|
|
|
message->type = RESET_MESSAGE;
|
|
|
|
|
message->length = 4 + sizeof(message->data.reset);
|
|
|
|
|
message->data.reset.reset_type = reset_type;
|
|
|
|
|
skinny_send_reply(listener, message);
|
|
|
|
|
return SWITCH_STATUS_SUCCESS;
|
|
|
|
|
return skinny_send_reply(listener, message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Message handling */
|
|
|
|
@ -1308,7 +1377,6 @@ switch_status_t skinny_handle_alarm(listener_t *listener, skinny_message_t *requ
|
|
|
|
|
switch_status_t skinny_handle_register(listener_t *listener, skinny_message_t *request)
|
|
|
|
|
{
|
|
|
|
|
switch_status_t status = SWITCH_STATUS_FALSE;
|
|
|
|
|
skinny_message_t *message;
|
|
|
|
|
skinny_profile_t *profile;
|
|
|
|
|
switch_event_t *event = NULL;
|
|
|
|
|
switch_event_t *params = NULL;
|
|
|
|
@ -1322,11 +1390,7 @@ switch_status_t skinny_handle_register(listener_t *listener, skinny_message_t *r
|
|
|
|
|
if(!zstr(listener->device_name)) {
|
|
|
|
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
|
|
|
|
|
"A device is already registred on this listener.\n");
|
|
|
|
|
message = switch_core_alloc(listener->pool, 12+sizeof(message->data.reg_rej));
|
|
|
|
|
message->type = REGISTER_REJ_MESSAGE;
|
|
|
|
|
message->length = 4 + sizeof(message->data.reg_rej);
|
|
|
|
|
strcpy(message->data.reg_rej.error, "A device is already registred on this listener");
|
|
|
|
|
skinny_send_reply(listener, message);
|
|
|
|
|
send_register_reject(listener, "A device is already registred on this listener");
|
|
|
|
|
return SWITCH_STATUS_FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -1338,11 +1402,7 @@ switch_status_t skinny_handle_register(listener_t *listener, skinny_message_t *r
|
|
|
|
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Can't find device [%s@%s]\n"
|
|
|
|
|
"You must define a domain called '%s' in your directory and add a user with id=\"%s\".\n"
|
|
|
|
|
, request->data.reg.device_name, profile->domain, profile->domain, request->data.reg.device_name);
|
|
|
|
|
message = switch_core_alloc(listener->pool, 12+sizeof(message->data.reg_rej));
|
|
|
|
|
message->type = REGISTER_REJ_MESSAGE;
|
|
|
|
|
message->length = 4 + sizeof(message->data.reg_rej);
|
|
|
|
|
strcpy(message->data.reg_rej.error, "Device not found");
|
|
|
|
|
skinny_send_reply(listener, message);
|
|
|
|
|
send_register_reject(listener, "Device not found");
|
|
|
|
|
status = SWITCH_STATUS_FALSE;
|
|
|
|
|
goto end;
|
|
|
|
|
}
|
|
|
|
@ -1364,7 +1424,7 @@ switch_status_t skinny_handle_register(listener_t *listener, skinny_message_t *r
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
strcpy(listener->device_name, request->data.reg.device_name);
|
|
|
|
|
strncpy(listener->device_name, request->data.reg.device_name, 16);
|
|
|
|
|
listener->device_instance = request->data.reg.instance;
|
|
|
|
|
|
|
|
|
|
xskinny = switch_xml_child(xuser, "skinny");
|
|
|
|
@ -1424,19 +1484,10 @@ switch_status_t skinny_handle_register(listener_t *listener, skinny_message_t *r
|
|
|
|
|
status = SWITCH_STATUS_SUCCESS;
|
|
|
|
|
|
|
|
|
|
/* Reply with RegisterAckMessage */
|
|
|
|
|
message = switch_core_alloc(listener->pool, 12+sizeof(message->data.reg_ack));
|
|
|
|
|
message->type = REGISTER_ACK_MESSAGE;
|
|
|
|
|
message->length = 4 + sizeof(message->data.reg_ack);
|
|
|
|
|
message->data.reg_ack.keep_alive = profile->keep_alive;
|
|
|
|
|
memcpy(message->data.reg_ack.date_format, profile->date_format, 6);
|
|
|
|
|
message->data.reg_ack.secondary_keep_alive = profile->keep_alive;
|
|
|
|
|
skinny_send_reply(listener, message);
|
|
|
|
|
send_register_ack(listener, profile->keep_alive, profile->date_format, "", profile->keep_alive, "");
|
|
|
|
|
|
|
|
|
|
/* Send CapabilitiesReqMessage */
|
|
|
|
|
message = switch_core_alloc(listener->pool, 12);
|
|
|
|
|
message->type = CAPABILITIES_REQ_MESSAGE;
|
|
|
|
|
message->length = 4;
|
|
|
|
|
skinny_send_reply(listener, message);
|
|
|
|
|
send_capabilities_req(listener);
|
|
|
|
|
|
|
|
|
|
/* skinny::register event */
|
|
|
|
|
skinny_device_event(listener, &event, SWITCH_EVENT_CUSTOM, SKINNY_EVENT_REGISTER);
|
|
|
|
@ -1471,11 +1522,11 @@ int skinny_config_stat_res_callback(void *pArg, int argc, char **argv, char **co
|
|
|
|
|
int number_lines = atoi(argv[5]);
|
|
|
|
|
int number_speed_dials = atoi(argv[6]);
|
|
|
|
|
|
|
|
|
|
strcpy(message->data.config_res.device_name, device_name);
|
|
|
|
|
strncpy(message->data.config_res.device_name, device_name, 16);
|
|
|
|
|
message->data.config_res.user_id = user_id;
|
|
|
|
|
message->data.config_res.instance = instance;
|
|
|
|
|
strcpy(message->data.config_res.user_name, user_name);
|
|
|
|
|
strcpy(message->data.config_res.server_name, server_name);
|
|
|
|
|
strncpy(message->data.config_res.user_name, user_name, 40);
|
|
|
|
|
strncpy(message->data.config_res.server_name, server_name, 40);
|
|
|
|
|
message->data.config_res.number_lines = number_lines;
|
|
|
|
|
message->data.config_res.number_speed_dials = number_speed_dials;
|
|
|
|
|
|
|
|
|
@ -1841,26 +1892,7 @@ switch_status_t skinny_handle_register_available_lines_message(listener_t *liste
|
|
|
|
|
|
|
|
|
|
switch_status_t skinny_handle_time_date_request(listener_t *listener, skinny_message_t *request)
|
|
|
|
|
{
|
|
|
|
|
skinny_message_t *message;
|
|
|
|
|
switch_time_t ts;
|
|
|
|
|
switch_time_exp_t tm;
|
|
|
|
|
|
|
|
|
|
message = switch_core_alloc(listener->pool, 12+sizeof(message->data.define_time_date));
|
|
|
|
|
message->type = DEFINE_TIME_DATE_MESSAGE;
|
|
|
|
|
message->length = 4+sizeof(message->data.define_time_date);
|
|
|
|
|
ts = switch_micro_time_now();
|
|
|
|
|
switch_time_exp_lt(&tm, ts);
|
|
|
|
|
message->data.define_time_date.year = tm.tm_year + 1900;
|
|
|
|
|
message->data.define_time_date.month = tm.tm_mon + 1;
|
|
|
|
|
message->data.define_time_date.day_of_week = tm.tm_wday;
|
|
|
|
|
message->data.define_time_date.day = tm.tm_yday + 1;
|
|
|
|
|
message->data.define_time_date.hour = tm.tm_hour;
|
|
|
|
|
message->data.define_time_date.minute = tm.tm_min;
|
|
|
|
|
message->data.define_time_date.seconds = tm.tm_sec + 1;
|
|
|
|
|
message->data.define_time_date.milliseconds = tm.tm_usec / 1000;
|
|
|
|
|
message->data.define_time_date.timestamp = ts / 1000000;
|
|
|
|
|
skinny_send_reply(listener, message);
|
|
|
|
|
return SWITCH_STATUS_SUCCESS;
|
|
|
|
|
return send_define_current_time_date(listener);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch_status_t skinny_handle_keep_alive_message(listener_t *listener, skinny_message_t *request)
|
|
|
|
@ -2069,7 +2101,7 @@ switch_status_t skinny_handle_open_receive_channel_ack_message(listener_t *liste
|
|
|
|
|
tech_pvt->read_impl.microseconds_per_packet / 1000,
|
|
|
|
|
switch_rtp_ready(tech_pvt->rtp_session) ? "SUCCESS" : err);
|
|
|
|
|
inet_aton(tech_pvt->local_sdp_audio_ip, &addr);
|
|
|
|
|
start_media_transmission(listener,
|
|
|
|
|
send_start_media_transmission(listener,
|
|
|
|
|
tech_pvt->call_id, /* uint32_t conference_id, */
|
|
|
|
|
tech_pvt->party_id, /* uint32_t pass_thru_party_id, */
|
|
|
|
|
addr.s_addr, /* uint32_t remote_ip, */
|
|
|
|
|