Skinny: security
- Avoid writing outside of fields - tab ident
This commit is contained in:
parent
8950d00b1f
commit
9cf882566f
|
@ -628,17 +628,17 @@ int channel_on_hangup_callback(void *pArg, int argc, char **argv, char **columnN
|
|||
skinny_profile_find_listener_by_device_name_and_instance(helper->tech_pvt->profile, device_name, device_instance, &listener);
|
||||
if(listener) {
|
||||
if(call_state == SKINNY_CONNECTED) {
|
||||
stop_tone(listener, line_instance, call_id);
|
||||
send_stop_tone(listener, line_instance, call_id);
|
||||
}
|
||||
set_lamp(listener, SKINNY_BUTTON_LINE, line_instance, SKINNY_LAMP_OFF);
|
||||
clear_prompt_status(listener, line_instance, call_id);
|
||||
send_set_lamp(listener, SKINNY_BUTTON_LINE, line_instance, SKINNY_LAMP_OFF);
|
||||
send_clear_prompt_status(listener, line_instance, call_id);
|
||||
if(call_state == SKINNY_CONNECTED) { /* calling parties */
|
||||
close_receive_channel(listener,
|
||||
send_close_receive_channel(listener,
|
||||
call_id, /* uint32_t conference_id, */
|
||||
helper->tech_pvt->party_id, /* uint32_t pass_thru_party_id, */
|
||||
call_id /* uint32_t conference_id2, */
|
||||
);
|
||||
stop_media_transmission(listener,
|
||||
send_stop_media_transmission(listener,
|
||||
call_id, /* uint32_t conference_id, */
|
||||
helper->tech_pvt->party_id, /* uint32_t pass_thru_party_id, */
|
||||
call_id /* uint32_t conference_id2, */
|
||||
|
@ -648,8 +648,8 @@ int channel_on_hangup_callback(void *pArg, int argc, char **argv, char **columnN
|
|||
skinny_line_set_state(listener, line_instance, call_id, SKINNY_ON_HOOK);
|
||||
send_select_soft_keys(listener, line_instance, call_id, SKINNY_KEY_SET_ON_HOOK, 0xffff);
|
||||
/* TODO: DefineTimeDate */
|
||||
set_speaker_mode(listener, SKINNY_SPEAKER_OFF);
|
||||
set_ringer(listener, SKINNY_RING_OFF, SKINNY_RING_FOREVER, 0, call_id);
|
||||
send_set_speaker_mode(listener, SKINNY_SPEAKER_OFF);
|
||||
send_set_ringer(listener, SKINNY_RING_OFF, SKINNY_RING_FOREVER, 0, call_id);
|
||||
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -249,7 +249,7 @@ static switch_status_t skinny_api_cmd_profile_device_send_ringer_message(const c
|
|||
listener_t *listener = NULL;
|
||||
skinny_profile_find_listener_by_device_name(profile, device_name, &listener);
|
||||
if(listener) {
|
||||
set_ringer(listener, skinny_str2ring_type(ring_type), skinny_str2ring_mode(ring_mode), 0, 0);
|
||||
send_set_ringer(listener, skinny_str2ring_type(ring_type), skinny_str2ring_mode(ring_mode), 0, 0);
|
||||
} else {
|
||||
stream->write_function(stream, "Listener not found!\n");
|
||||
}
|
||||
|
@ -268,7 +268,7 @@ static switch_status_t skinny_api_cmd_profile_device_send_lamp_message(const cha
|
|||
listener_t *listener = NULL;
|
||||
skinny_profile_find_listener_by_device_name(profile, device_name, &listener);
|
||||
if(listener) {
|
||||
set_lamp(listener, skinny_str2button(stimulus), atoi(instance), skinny_str2lamp_mode(lamp_mode));
|
||||
send_set_lamp(listener, skinny_str2button(stimulus), atoi(instance), skinny_str2lamp_mode(lamp_mode));
|
||||
} else {
|
||||
stream->write_function(stream, "Listener not found!\n");
|
||||
}
|
||||
|
@ -287,7 +287,7 @@ static switch_status_t skinny_api_cmd_profile_device_send_speaker_mode_message(c
|
|||
listener_t *listener = NULL;
|
||||
skinny_profile_find_listener_by_device_name(profile, device_name, &listener);
|
||||
if(listener) {
|
||||
set_speaker_mode(listener, skinny_str2speaker_mode(speaker_mode));
|
||||
send_set_speaker_mode(listener, skinny_str2speaker_mode(speaker_mode));
|
||||
} else {
|
||||
stream->write_function(stream, "Listener not found!\n");
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
@ -518,14 +518,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 +554,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 +596,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 +642,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 +693,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 +707,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 +932,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 +965,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 +978,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 +995,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 +1010,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 +1021,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 +1051,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 +1067,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 +1096,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 +1217,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 +1232,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 +1249,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 +1264,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 +1278,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 +1294,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 +1305,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 +1317,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 +1335,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 +1346,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 */
|
||||
|
@ -1322,11 +1388,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 +1400,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 +1422,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 +1482,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 +1520,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 +1890,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 +2099,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, */
|
||||
|
|
|
@ -347,8 +347,8 @@ struct button_template_message {
|
|||
#define CAPABILITIES_REQ_MESSAGE 0x009B
|
||||
|
||||
/* RegisterRejectMessage */
|
||||
#define REGISTER_REJ_MESSAGE 0x009D
|
||||
struct register_rej_message {
|
||||
#define REGISTER_REJECT_MESSAGE 0x009D
|
||||
struct register_reject_message {
|
||||
char error[33];
|
||||
};
|
||||
|
||||
|
@ -528,7 +528,7 @@ union skinny_data {
|
|||
struct config_stat_res_message config_res;
|
||||
struct define_time_date_message define_time_date;
|
||||
struct button_template_message button_template;
|
||||
struct register_rej_message reg_rej;
|
||||
struct register_reject_message reg_rej;
|
||||
struct reset_message reset;
|
||||
struct open_receive_channel_message open_receive_channel;
|
||||
struct close_receive_channel_message close_receive_channel;
|
||||
|
@ -642,26 +642,32 @@ switch_status_t skinny_handle_request(listener_t *listener, skinny_message_t *re
|
|||
/*****************************************************************************/
|
||||
/* SKINNY MESSAGE HELPER */
|
||||
/*****************************************************************************/
|
||||
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);
|
||||
switch_status_t send_start_tone(listener_t *listener,
|
||||
uint32_t tone,
|
||||
uint32_t reserved,
|
||||
uint32_t line_instance,
|
||||
uint32_t call_id);
|
||||
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);
|
||||
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,
|
||||
uint32_t call_id);
|
||||
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);
|
||||
switch_status_t set_speaker_mode(listener_t *listener,
|
||||
switch_status_t send_set_speaker_mode(listener_t *listener,
|
||||
uint32_t mode);
|
||||
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,
|
||||
|
@ -672,7 +678,7 @@ switch_status_t start_media_transmission(listener_t *listener,
|
|||
uint32_t silence_suppression,
|
||||
uint16_t max_frames_per_packet,
|
||||
uint32_t g723_bitrate);
|
||||
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);
|
||||
|
@ -697,7 +703,18 @@ switch_status_t send_call_info(listener_t *listener,
|
|||
uint32_t call_instance,
|
||||
uint32_t call_security_status,
|
||||
uint32_t party_pi_restriction_bits);
|
||||
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);
|
||||
switch_status_t send_define_current_time_date(listener_t *listener);
|
||||
switch_status_t send_open_receive_channel(listener_t *listener,
|
||||
uint32_t conference_id,
|
||||
uint32_t pass_thru_party_id,
|
||||
uint32_t packets,
|
||||
|
@ -706,7 +723,7 @@ switch_status_t open_receive_channel(listener_t *listener,
|
|||
uint32_t g723_bitrate,
|
||||
uint32_t conference_id2,
|
||||
uint32_t reserved[10]);
|
||||
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);
|
||||
|
@ -719,15 +736,15 @@ switch_status_t send_call_state(listener_t *listener,
|
|||
uint32_t call_state,
|
||||
uint32_t line_instance,
|
||||
uint32_t call_id);
|
||||
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,
|
||||
uint32_t call_id);
|
||||
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);
|
||||
switch_status_t activate_call_plane(listener_t *listener,
|
||||
switch_status_t send_activate_call_plane(listener_t *listener,
|
||||
uint32_t line_instance);
|
||||
switch_status_t send_dialed_number(listener_t *listener,
|
||||
char called_party[24],
|
||||
|
|
|
@ -73,7 +73,7 @@ struct skinny_table SKINNY_MESSAGE_TYPES[] = {
|
|||
{"DefineTimeDateMessage", DEFINE_TIME_DATE_MESSAGE},
|
||||
{"ButtonTemplateResMessage", BUTTON_TEMPLATE_RES_MESSAGE},
|
||||
{"CapabilitiesReqMessage", CAPABILITIES_REQ_MESSAGE},
|
||||
{"RegisterRejMessage", REGISTER_REJ_MESSAGE},
|
||||
{"RegisterRejectMessage", REGISTER_REJECT_MESSAGE},
|
||||
{"ResetMessage", RESET_MESSAGE},
|
||||
{"KeepAliveAckMessage", KEEP_ALIVE_ACK_MESSAGE},
|
||||
{"OpenReceiveChannelMessage", OPEN_RECEIVE_CHANNEL_MESSAGE},
|
||||
|
|
Loading…
Reference in New Issue