From e744bf0385efe335830b98cd371959edf7fb78d9 Mon Sep 17 00:00:00 2001 From: Nathan Neulinger Date: Sun, 23 Jun 2013 14:19:05 -0500 Subject: [PATCH] improvements to skinny logging, table based message text ids --- .../mod_skinny/mod_skinny.2012.vcxproj | 1 - src/mod/endpoints/mod_skinny/mod_skinny.c | 54 +-- src/mod/endpoints/mod_skinny/mod_skinny.h | 23 ++ .../mod_skinny/mod_skinny_2008.vcproj | 4 - .../mod_skinny/mod_skinny_2010.vcxproj | 1 - src/mod/endpoints/mod_skinny/skinny_labels.h | 168 --------- .../endpoints/mod_skinny/skinny_protocol.c | 320 ++++++++++++++---- .../endpoints/mod_skinny/skinny_protocol.h | 147 ++++++-- src/mod/endpoints/mod_skinny/skinny_server.c | 174 ++++++---- src/mod/endpoints/mod_skinny/skinny_tables.c | 141 +++++++- src/mod/endpoints/mod_skinny/skinny_tables.h | 132 ++++++++ 11 files changed, 807 insertions(+), 358 deletions(-) delete mode 100644 src/mod/endpoints/mod_skinny/skinny_labels.h diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.2012.vcxproj b/src/mod/endpoints/mod_skinny/mod_skinny.2012.vcxproj index cbb404c20f..468ca02836 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.2012.vcxproj +++ b/src/mod/endpoints/mod_skinny/mod_skinny.2012.vcxproj @@ -142,7 +142,6 @@ - diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.c b/src/mod/endpoints/mod_skinny/mod_skinny.c index d37c728cb9..9d5b1fd303 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.c +++ b/src/mod/endpoints/mod_skinny/mod_skinny.c @@ -34,7 +34,6 @@ #include "skinny_protocol.h" #include "skinny_server.h" #include "skinny_tables.h" -#include "skinny_labels.h" #include "skinny_api.h" SWITCH_MODULE_LOAD_FUNCTION(mod_skinny_load); @@ -399,9 +398,10 @@ void skinny_line_perform_set_state(const char *file, const char *func, int line, switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-Call-State", "%d", call_state); switch_event_fire(&event); send_call_state(listener, call_state, line_instance, call_id); - switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_DEBUG, - "Device %s:%d, Line %d, Call %d Change State to %s (%d)\n", - listener->device_name, listener->device_instance, line_instance, call_id, + + skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, + "Line %d, Call %d Change State to %s (%d)\n", + line_instance, call_id, skinny_call_state2str(call_state), call_state); } @@ -620,6 +620,7 @@ int channel_on_routing_callback(void *pArg, int argc, char **argv, char **column { struct channel_on_routing_helper *helper = pArg; listener_t *listener = NULL; + char *label; char *device_name = argv[0]; uint32_t device_instance = atoi(argv[1]); @@ -654,8 +655,11 @@ int channel_on_routing_callback(void *pArg, int argc, char **argv, char **column 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_IN_USE_REMOTELY); send_select_soft_keys(listener, line_instance, helper->tech_pvt->call_id, SKINNY_KEY_SET_IN_USE_HINT, 0xffff); - send_display_prompt_status(listener, 0, SKINNY_DISP_IN_USE_REMOTE, - line_instance, helper->tech_pvt->call_id); + + label = skinny_textid2raw(SKINNY_TEXTID_IN_USE_REMOTE); + send_display_prompt_status(listener, 0, label, line_instance, helper->tech_pvt->call_id); + switch_safe_free(label); + skinny_session_send_call_info(helper->tech_pvt->session, listener, line_instance); } } @@ -751,6 +755,7 @@ int channel_on_hangup_callback(void *pArg, int argc, char **argv, char **columnN { struct channel_on_hangup_helper *helper = pArg; listener_t *listener = NULL; + char *label; char *device_name = argv[0]; uint32_t device_instance = atoi(argv[1]); @@ -782,11 +787,15 @@ int channel_on_hangup_callback(void *pArg, int argc, char **argv, char **columnN case SWITCH_CAUSE_UNALLOCATED_NUMBER: send_start_tone(listener, SKINNY_TONE_REORDER, 0, line_instance, call_id); skinny_session_send_call_info(helper->tech_pvt->session, listener, line_instance); - send_display_prompt_status(listener, 0, SKINNY_DISP_UNKNOWN_NUMBER, line_instance, call_id); + label = skinny_textid2raw(SKINNY_TEXTID_UNKNOWN_NUMBER); + send_display_prompt_status(listener, 0, label, line_instance, call_id); + switch_safe_free(label); break; case SWITCH_CAUSE_USER_BUSY: send_start_tone(listener, SKINNY_TONE_BUSYTONE, 0, line_instance, call_id); - send_display_prompt_status(listener, 0, SKINNY_DISP_BUSY, line_instance, call_id); + label = skinny_textid2raw(SKINNY_TEXTID_BUSY); + send_display_prompt_status(listener, 0, label, line_instance, call_id); + switch_safe_free(label); break; case SWITCH_CAUSE_NORMAL_CLEARING: send_clear_prompt_status(listener, line_instance, call_id); @@ -1431,11 +1440,7 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj) switch_socket_timeout_set(listener->sock, 5000000); #endif if (listener->profile->debug > 0) { - if (zstr(listener->remote_ip)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Connection Open\n"); - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Connection Open from %s:%d\n", listener->remote_ip, listener->remote_port); - } + skinny_log_l(listener, SWITCH_LOG_DEBUG, "Connection Open\n", NULL); } switch_set_flag_locked(listener, LFLAG_RUNNING); @@ -1449,8 +1454,7 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj) if (status != SWITCH_STATUS_SUCCESS) { switch(status) { case SWITCH_STATUS_TIMEOUT: - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Communication Time Out with %s:%d.\n", - listener->remote_ip, listener->remote_port); + skinny_log_l(listener, SWITCH_LOG_DEBUG, "Communication Time Out\n", NULL); if(listener->expire_time < switch_epoch_time_now(NULL)) { switch_event_t *event = NULL; @@ -1460,8 +1464,7 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj) } break; default: - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Communication Error with %s:%d.\n", - listener->remote_ip, listener->remote_port); + skinny_log_l(listener, SWITCH_LOG_DEBUG, "Communication Error\n", NULL); } switch_clear_flag_locked(listener, LFLAG_RUNNING); break; @@ -1484,8 +1487,7 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj) remove_listener(listener); if (listener->profile->debug > 0) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Communication Complete with %s:%d.\n", - listener->remote_ip, listener->remote_port); + skinny_log_l(listener, SWITCH_LOG_DEBUG, "Communication Complete\n", NULL); } switch_thread_rwlock_wrlock(listener->rwlock); @@ -1498,8 +1500,7 @@ static void *SWITCH_THREAD_FUNC listener_run(switch_thread_t *thread, void *obj) switch_thread_rwlock_unlock(listener->rwlock); if (listener->profile->debug > 0) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Communication Closed with %s:%d.\n", - listener->remote_ip, listener->remote_port); + skinny_log_l(listener, SWITCH_LOG_DEBUG, "Communication Closed\n", NULL); } if(destroy_pool == 0) { @@ -2009,8 +2010,7 @@ static void skinny_user_to_device_event_handler(switch_event_t *event) data); break; default: - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, - "Incorrect message type %s (%d).\n", skinny_message_type2str(message_type), message_type); + skinny_log_l(listener, SWITCH_LOG_WARNING, "Incorrect message type %s (%d).\n", skinny_message_type2str(message_type), message_type); } } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, @@ -2102,8 +2102,13 @@ int skinny_message_waiting_event_handler_callback(void *pArg, int argc, char **a if (listener) { if (helper->yn == SWITCH_TRUE) { char buffer[32]; + char *label; send_set_lamp(listener, SKINNY_BUTTON_VOICEMAIL, 0, SKINNY_LAMP_ON); - sprintf(buffer, "%s: (%d/%d urgents)", SKINNY_DISP_YOU_HAVE_VOICEMAIL, helper->total_new_messages, helper->total_new_urgent_messages); + + label = skinny_textid2raw(SKINNY_TEXTID_YOU_HAVE_VOICEMAIL); + sprintf(buffer, "%s: (%d/%d urgents)", label, helper->total_new_messages, helper->total_new_urgent_messages); + switch_safe_free(label); + send_display_pri_notify(listener, 5, 10, buffer); } else { send_set_lamp(listener, SKINNY_BUTTON_VOICEMAIL, 0, SKINNY_LAMP_OFF); @@ -2206,6 +2211,7 @@ static void skinny_trap_event_handler(switch_event_t *event) } } + /*****************************************************************************/ SWITCH_MODULE_LOAD_FUNCTION(mod_skinny_load) { diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.h b/src/mod/endpoints/mod_skinny/mod_skinny.h index 12926268d9..d9d53fe22b 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.h +++ b/src/mod/endpoints/mod_skinny/mod_skinny.h @@ -35,6 +35,24 @@ #include +/*****************************************************************************/ +/* LOGGING FUNCTIONS */ +/*****************************************************************************/ +#define skinny_undef_str(x) (zstr(x) ? "_undef_" : x) + +#define skinny_log_l(listener, level, _fmt, ...) switch_log_printf(SWITCH_CHANNEL_LOG, level, \ + "[%s:%d @ %s:%d] " _fmt, skinny_undef_str(listener->device_name), listener->device_instance, skinny_undef_str(listener->remote_ip), \ + listener->remote_port, __VA_ARGS__) + +#define skinny_log_l_ffl(listener, file, func, line, level, _fmt, ...) switch_log_printf( \ + SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, level, \ + "[%s:%d @ %s:%d] " _fmt, skinny_undef_str(listener->device_name), listener->device_instance, skinny_undef_str(listener->remote_ip), \ + listener->remote_port, __VA_ARGS__) + +#define skinny_log_ls(listener, session, level, _fmt, ...) switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), level, \ + "[%s:%d @ %s:%d] " _fmt, skinny_undef_str(listener->device_name), listener->device_instance, skinny_undef_str(listener->remote_ip), \ + listener->remote_port, __VA_ARGS__) + /*****************************************************************************/ /* MODULE TYPES */ /*****************************************************************************/ @@ -274,6 +292,11 @@ switch_status_t channel_kill_channel(switch_core_session_t *session, int sig); /*****************************************************************************/ switch_endpoint_interface_t *skinny_get_endpoint_interface(); +/*****************************************************************************/ +/* MODULE FUNCTIONS */ +/*****************************************************************************/ +#define skinny_textid2raw(label) (label > 0 ? switch_mprintf("\200%c", label) : switch_mprintf("")) + #endif /* _MOD_SKINNY_H */ /* For Emacs: diff --git a/src/mod/endpoints/mod_skinny/mod_skinny_2008.vcproj b/src/mod/endpoints/mod_skinny/mod_skinny_2008.vcproj index f052ce0fcd..fbf3482f7d 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny_2008.vcproj +++ b/src/mod/endpoints/mod_skinny/mod_skinny_2008.vcproj @@ -311,10 +311,6 @@ RelativePath=".\skinny_api.h" > - - diff --git a/src/mod/endpoints/mod_skinny/mod_skinny_2010.vcxproj b/src/mod/endpoints/mod_skinny/mod_skinny_2010.vcxproj index 440e2d500d..afacad5b6e 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny_2010.vcxproj +++ b/src/mod/endpoints/mod_skinny/mod_skinny_2010.vcxproj @@ -138,7 +138,6 @@ - diff --git a/src/mod/endpoints/mod_skinny/skinny_labels.h b/src/mod/endpoints/mod_skinny/skinny_labels.h deleted file mode 100644 index 6d2aae6c74..0000000000 --- a/src/mod/endpoints/mod_skinny/skinny_labels.h +++ /dev/null @@ -1,168 +0,0 @@ -/* - * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2010, Mathieu Parent - * - * Version: MPL 1.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * - * The Initial Developer of the Original Code is - * Mathieu Parent - * Portions created by the Initial Developer are Copyright (C) - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Mathieu Parent - * - * Based on chan-sccp-b (file src/sccp_labels.h) - * - * skinny_labels.h -- Skinny Call Control Protocol (SCCP) Endpoint Module - * - */ -#ifndef _SKINNY_LABELS_H -#define _SKINNY_LABELS_H - -#define SKINNY_DISP_EMPTY "" -#define SKINNY_DISP_REDIAL "\200\1" -#define SKINNY_DISP_NEWCALL "\200\2" -#define SKINNY_DISP_HOLD "\200\3" -#define SKINNY_DISP_TRANSFER "\200\4" -#define SKINNY_DISP_CFWDALL "\200\5" -#define SKINNY_DISP_CFWDBUSY "\200\6" -#define SKINNY_DISP_CFWDNOANSWER "\200\7" -#define SKINNY_DISP_BACKSPACE "\200\10" -#define SKINNY_DISP_ENDCALL "\200\11" -#define SKINNY_DISP_RESUME "\200\12" -#define SKINNY_DISP_ANSWER "\200\13" -#define SKINNY_DISP_INFO "\200\14" -#define SKINNY_DISP_CONF "\200\15" -#define SKINNY_DISP_PARK "\200\16" -#define SKINNY_DISP_JOIN "\200\17" -#define SKINNY_DISP_MEETME "\200\20" -#define SKINNY_DISP_CALLPICKUP "\200\21" -#define SKINNY_DISP_GRPCALLPICKUP "\200\22" -#define SKINNY_DISP_YOUR_CURRENT_OPTIONS "\200\23" -#define SKINNY_DISP_OFF_HOOK "\200\24" -#define SKINNY_DISP_ON_HOOK "\200\25" -#define SKINNY_DISP_RING_OUT "\200\26" -#define SKINNY_DISP_FROM "\200\27" -#define SKINNY_DISP_CONNECTED "\200\30" -#define SKINNY_DISP_BUSY "\200\31" -#define SKINNY_DISP_LINE_IN_USE "\200\32" -#define SKINNY_DISP_CALL_WAITING "\200\33" -#define SKINNY_DISP_CALL_TRANSFER "\200\34" -#define SKINNY_DISP_CALL_PARK "\200\35" -#define SKINNY_DISP_CALL_PROCEED "\200\36" -#define SKINNY_DISP_IN_USE_REMOTE "\200\37" -#define SKINNY_DISP_ENTER_NUMBER "\200\40" -#define SKINNY_DISP_CALL_PARK_AT "\200\41" -#define SKINNY_DISP_PRIMARY_ONLY "\200\42" -#define SKINNY_DISP_TEMP_FAIL "\200\43" -#define SKINNY_DISP_YOU_HAVE_VOICEMAIL "\200\44" -#define SKINNY_DISP_FORWARDED_TO "\200\45" -#define SKINNY_DISP_CAN_NOT_COMPLETE_CONFERENCE "\200\46" -#define SKINNY_DISP_NO_CONFERENCE_BRIDGE "\200\47" -#define SKINNY_DISP_CAN_NOT_HOLD_PRIMARY_CONTROL "\200\50" -#define SKINNY_DISP_INVALID_CONFERENCE_PARTICIPANT "\200\51" -#define SKINNY_DISP_IN_CONFERENCE_ALREADY "\200\52" -#define SKINNY_DISP_NO_PARTICIPANT_INFO "\200\53" -#define SKINNY_DISP_EXCEED_MAXIMUM_PARTIES "\200\54" -#define SKINNY_DISP_KEY_IS_NOT_ACTIVE "\200\55" -#define SKINNY_DISP_ERROR_NO_LICENSE "\200\56" -#define SKINNY_DISP_ERROR_DBCONFIG "\200\57" -#define SKINNY_DISP_ERROR_DATABASE "\200\60" -#define SKINNY_DISP_ERROR_PASS_LIMIT "\200\61" -#define SKINNY_DISP_ERROR_UNKNOWN "\200\62" -#define SKINNY_DISP_ERROR_MISMATCH "\200\63" -#define SKINNY_DISP_CONFERENCE "\200\64" -#define SKINNY_DISP_PARK_NUMBER "\200\65" -#define SKINNY_DISP_PRIVATE "\200\66" -#define SKINNY_DISP_NOT_ENOUGH_BANDWIDTH "\200\67" -#define SKINNY_DISP_UNKNOWN_NUMBER "\200\70" -#define SKINNY_DISP_RMLSTC "\200\71" -#define SKINNY_DISP_VOICEMAIL "\200\72" -#define SKINNY_DISP_IMMDIV "\200\73" -#define SKINNY_DISP_INTRCPT "\200\74" -#define SKINNY_DISP_SETWTCH "\200\75" -#define SKINNY_DISP_TRNSFVM "\200\76" -#define SKINNY_DISP_DND "\200\77" -#define SKINNY_DISP_DIVALL "\200\100" -#define SKINNY_DISP_CALLBACK "\200\101" -#define SKINNY_DISP_NETWORK_CONGESTION_REROUTING "\200\102" -#define SKINNY_DISP_BARGE "\200\103" -#define SKINNY_DISP_FAILED_TO_SETUP_BARGE "\200\104" -#define SKINNY_DISP_ANOTHER_BARGE_EXISTS "\200\105" -#define SKINNY_DISP_INCOMPATIBLE_DEVICE_TYPE "\200\106" -#define SKINNY_DISP_NO_PARK_NUMBER_AVAILABLE "\200\107" -#define SKINNY_DISP_CALLPARK_REVERSION "\200\110" -#define SKINNY_DISP_SERVICE_IS_NOT_ACTIVE "\200\111" -#define SKINNY_DISP_HIGH_TRAFFIC_TRY_AGAIN_LATER "\200\112" -#define SKINNY_DISP_QRT "\200\113" -#define SKINNY_DISP_MCID "\200\114" -#define SKINNY_DISP_DIRTRFR "\200\115" -#define SKINNY_DISP_SELECT "\200\116" -#define SKINNY_DISP_CONFLIST "\200\117" -#define SKINNY_DISP_IDIVERT "\200\120" -#define SKINNY_DISP_CBARGE "\200\121" -#define SKINNY_DISP_CAN_NOT_COMPLETE_TRANSFER "\200\122" -#define SKINNY_DISP_CAN_NOT_JOIN_CALLS "\200\123" -#define SKINNY_DISP_MCID_SUCCESSFUL "\200\124" -#define SKINNY_DISP_NUMBER_NOT_CONFIGURED "\200\125" -#define SKINNY_DISP_SECURITY_ERROR "\200\126" -#define SKINNY_DISP_VIDEO_BANDWIDTH_UNAVAILABLE "\200\127" -#define SKINNY_DISP_VIDMODE "\200\130" -#define SKINNY_DISP_MAX_CALL_DURATION_TIMEOUT "\200\131" -#define SKINNY_DISP_MAX_HOLD_DURATION_TIMEOUT "\200\132" -#define SKINNY_DISP_OPICKUP "\200\133" -#define SKINNY_DISP_EXTERNAL_TRANSFER_RESTRICTED "\200\141" -#define SKINNY_DISP_MAC_ADDRESS "\200\145" -#define SKINNY_DISP_HOST_NAME "\200\146" -#define SKINNY_DISP_DOMAIN_NAME "\200\147" -#define SKINNY_DISP_IP_ADDRESS "\200\150" -#define SKINNY_DISP_SUBNET_MASK "\200\151" -#define SKINNY_DISP_TFTP_SERVER_1 "\200\152" -#define SKINNY_DISP_DEFAULT_ROUTER_1 "\200\153" -#define SKINNY_DISP_DEFAULT_ROUTER_2 "\200\154" -#define SKINNY_DISP_DEFAULT_ROUTER_3 "\200\155" -#define SKINNY_DISP_DEFAULT_ROUTER_4 "\200\156" -#define SKINNY_DISP_DEFAULT_ROUTER_5 "\200\157" -#define SKINNY_DISP_DNS_SERVER_1 "\200\160" -#define SKINNY_DISP_DNS_SERVER_2 "\200\161" -#define SKINNY_DISP_DNS_SERVER_3 "\200\162" -#define SKINNY_DISP_DNS_SERVER_4 "\200\163" -#define SKINNY_DISP_DNS_SERVER_5 "\200\164" -#define SKINNY_DISP_OPERATIONAL_VLAN_ID "\200\165" -#define SKINNY_DISP_ADMIN_VLAN_ID "\200\166" -#define SKINNY_DISP_CALL_MANAGER_1 "\200\167" -#define SKINNY_DISP_CALL_MANAGER_2 "\200\170" -#define SKINNY_DISP_CALL_MANAGER_3 "\200\171" -#define SKINNY_DISP_CALL_MANAGER_4 "\200\172" -#define SKINNY_DISP_CALL_MANAGER_5 "\200\173" -#define SKINNY_DISP_INFORMATION_URL "\200\174" -#define SKINNY_DISP_DIRECTORIES_URL "\200\175" -#define SKINNY_DISP_MESSAGES_URL "\200\176" -#define SKINNY_DISP_SERVICES_URL "\200\177" - -#endif /* _SKINNY_LABELS_H */ - -/* For Emacs: - * Local Variables: - * mode:c - * indent-tabs-mode:t - * tab-width:4 - * c-basic-offset:4 - * End: - * For VIM: - * vim:set softtabstop=4 shiftwidth=4 tabstop=4: - */ diff --git a/src/mod/endpoints/mod_skinny/skinny_protocol.c b/src/mod/endpoints/mod_skinny/skinny_protocol.c index 1dab0f1c60..189a15c2f1 100644 --- a/src/mod/endpoints/mod_skinny/skinny_protocol.c +++ b/src/mod/endpoints/mod_skinny/skinny_protocol.c @@ -33,7 +33,6 @@ #include "mod_skinny.h" #include "skinny_protocol.h" #include "skinny_tables.h" -#include "skinny_labels.h" /*****************************************************************************/ /* SKINNY FUNCTIONS */ @@ -460,7 +459,8 @@ void skinny_feature_get(listener_t *listener, uint32_t instance, struct feature_ /*****************************************************************************/ /* SKINNY MESSAGE SENDER */ /*****************************************************************************/ -switch_status_t send_register_ack(listener_t *listener, +switch_status_t perform_send_register_ack(listener_t *listener, + const char *file, const char *func, int line, uint32_t keep_alive, char *date_format, char *reserved, @@ -476,10 +476,16 @@ switch_status_t send_register_ack(listener_t *listener, 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); + + skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, + "Sending Register Ack with Keep Alive (%d), Date Format (%s), Secondary Keep Alive (%d)\n", + keep_alive, date_format, secondary_keep_alive); + + return skinny_send_reply_quiet(listener, message); } -switch_status_t send_start_tone(listener_t *listener, +switch_status_t perform_send_start_tone(listener_t *listener, + const char *file, const char *func, int line, uint32_t tone, uint32_t reserved, uint32_t line_instance, @@ -493,10 +499,16 @@ switch_status_t send_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; - return skinny_send_reply(listener, message); + + skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, + "Sending Start Tone with Tone (%s), Line Instance (%d), Call ID (%d)\n", + skinny_tone2str(tone), line_instance, call_id); + + return skinny_send_reply_quiet(listener, message); } -switch_status_t send_stop_tone(listener_t *listener, +switch_status_t perform_send_stop_tone(listener_t *listener, + const char *file, const char *func, int line, uint32_t line_instance, uint32_t call_id) { @@ -506,10 +518,15 @@ switch_status_t send_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; - return skinny_send_reply(listener, message); + + skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, + "Sending Stop Tone with Line Instance (%d), Call ID (%d)\n", line_instance, call_id); + + return skinny_send_reply_quiet(listener, message); } -switch_status_t send_set_ringer(listener_t *listener, +switch_status_t perform_send_set_ringer(listener_t *listener, + const char *file, const char *func, int line, uint32_t ring_type, uint32_t ring_mode, uint32_t line_instance, @@ -523,10 +540,16 @@ switch_status_t send_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; - return skinny_send_reply(listener, message); + + skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, + "Sending SetRinger with Ring Type (%s), Mode (%s), Line Instance (%d), Call ID (%d)\n", + skinny_ring_type2str(ring_type), skinny_ring_mode2str(ring_mode), line_instance, call_id); + + return skinny_send_reply_quiet(listener, message); } -switch_status_t send_set_lamp(listener_t *listener, +switch_status_t perform_send_set_lamp(listener_t *listener, + const char *file, const char *func, int line, uint32_t stimulus, uint32_t stimulus_instance, uint32_t mode) @@ -538,10 +561,16 @@ switch_status_t send_set_lamp(listener_t *listener, message->data.lamp.stimulus = stimulus; message->data.lamp.stimulus_instance = stimulus_instance; message->data.lamp.mode = mode; - return skinny_send_reply(listener, message); + + skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, + "Sending Set Lamp with Stimulus (%s), Stimulus Instance (%d), Mode (%s)\n", + skinny_button2str(stimulus), stimulus_instance, skinny_lamp_mode2str(mode)); + + return skinny_send_reply_quiet(listener, message); } -switch_status_t send_set_speaker_mode(listener_t *listener, +switch_status_t perform_send_set_speaker_mode(listener_t *listener, + const char *file, const char *func, int line, uint32_t mode) { skinny_message_t *message; @@ -549,10 +578,15 @@ switch_status_t send_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; - return skinny_send_reply(listener, message); + + skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, + "Sending Set Speaker Mode with Mode (%s)\n", skinny_speaker_mode2str(mode)); + + return skinny_send_reply_quiet(listener, message); } -switch_status_t send_start_media_transmission(listener_t *listener, +switch_status_t perform_send_start_media_transmission(listener_t *listener, + const char *file, const char *func, int line, uint32_t conference_id, uint32_t pass_thru_party_id, uint32_t remote_ip, @@ -579,10 +613,16 @@ switch_status_t send_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; /* ... */ - return skinny_send_reply(listener, message); + + skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, + "Send Start Media Transmission with Conf ID(%d), Passthrough Party ID (%d), ...\n", + conference_id, pass_thru_party_id); + + return skinny_send_reply_quiet(listener, message); } -switch_status_t send_stop_media_transmission(listener_t *listener, +switch_status_t perform_send_stop_media_transmission(listener_t *listener, + const char *file, const char *func, int line, uint32_t conference_id, uint32_t pass_thru_party_id, uint32_t conference_id2) @@ -595,10 +635,16 @@ switch_status_t send_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; /* ... */ - return skinny_send_reply(listener, message); + + skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, + "Send Stop Media Transmission with Conf ID (%d), Passthrough Party ID (%d), Conf ID2\n", + conference_id, pass_thru_party_id, conference_id2); + + return skinny_send_reply_quiet(listener, message); } -switch_status_t skinny_send_call_info(listener_t *listener, +switch_status_t perform_send_call_info(listener_t *listener, + const char *file, const char *func, int line, const char *calling_party_name, const char *calling_party, const char *called_party_name, @@ -644,10 +690,15 @@ switch_status_t skinny_send_call_info(listener_t *listener, 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; - return skinny_send_reply(listener, message); + + skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, + "Send Call Info with ...\n", NULL); + + return skinny_send_reply_quiet(listener, message); } -switch_status_t send_define_time_date(listener_t *listener, +switch_status_t perform_send_define_time_date(listener_t *listener, + const char *file, const char *func, int line, uint32_t year, uint32_t month, uint32_t day_of_week, /* monday = 1 */ @@ -671,15 +722,25 @@ switch_status_t send_define_time_date(listener_t *listener, 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); + + skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, + "Send Define Time Date with %.4d-%.2d-%.2d %.2d:%.2d:%.2d.%d, Timestamp (%d), DOW (%d)\n", + year, month, day, hour, minute, seconds, milliseconds, timestamp, day_of_week); + + return skinny_send_reply_quiet(listener, message); } -switch_status_t send_define_current_time_date(listener_t *listener) +switch_status_t perform_send_define_current_time_date(listener_t *listener, + const char *file, const char *func, int line) { switch_time_t ts; switch_time_exp_t tm; ts = switch_micro_time_now(); switch_time_exp_lt(&tm, ts); + + skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, + "Send Define Current Time Date with Timestamp (%d)\n", ts / 1000000); + return send_define_time_date(listener, tm.tm_year + 1900, tm.tm_mon + 1, @@ -692,16 +753,22 @@ switch_status_t send_define_current_time_date(listener_t *listener) ts / 1000000); } -switch_status_t send_capabilities_req(listener_t *listener) +switch_status_t perform_send_capabilities_req(listener_t *listener, + const char *file, const char *func, int line) { 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); + + skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, + "Send Capabilities Req\n", NULL); + + return skinny_send_reply_quiet(listener, message); } -switch_status_t send_version(listener_t *listener, +switch_status_t perform_send_version(listener_t *listener, + const char *file, const char *func, int line, char *version) { skinny_message_t *message; @@ -709,10 +776,15 @@ switch_status_t send_version(listener_t *listener, message->type = VERSION_MESSAGE; message->length = 4+ sizeof(message->data.version); strncpy(message->data.version.version, version, 16); - return skinny_send_reply(listener, message); + + skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, + "Send Version with Version(%s)\n", version); + + return skinny_send_reply_quiet(listener, message); } -switch_status_t send_register_reject(listener_t *listener, +switch_status_t perform_send_register_reject(listener_t *listener, + const char *file, const char *func, int line, char *error) { skinny_message_t *message; @@ -720,10 +792,15 @@ switch_status_t send_register_reject(listener_t *listener, 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); + + skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, + "Send Register Reject with Error (%s)\n", error); + + return skinny_send_reply_quiet(listener, message); } -switch_status_t send_open_receive_channel(listener_t *listener, +switch_status_t perform_send_open_receive_channel(listener_t *listener, + const char *file, const char *func, int line, uint32_t conference_id, uint32_t pass_thru_party_id, uint32_t ms_per_packet, @@ -756,10 +833,15 @@ switch_status_t send_open_receive_channel(listener_t *listener, message->data.open_receive_channel.reserved[8] = reserved[8]; message->data.open_receive_channel.reserved[9] = reserved[9]; */ - return skinny_send_reply(listener, message); + + skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, + "Send Open Receive Channel with Conf ID (%d), ...\n", conference_id); + + return skinny_send_reply_quiet(listener, message); } -switch_status_t send_close_receive_channel(listener_t *listener, +switch_status_t perform_send_close_receive_channel(listener_t *listener, + const char *file, const char *func, int line, uint32_t conference_id, uint32_t pass_thru_party_id, uint32_t conference_id2) @@ -771,10 +853,15 @@ switch_status_t send_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; - return skinny_send_reply(listener, message); + + skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, + "Send Close Receive Channel with Conf ID (%d), ...\n", conference_id); + + return skinny_send_reply_quiet(listener, message); } -switch_status_t send_select_soft_keys(listener_t *listener, +switch_status_t perform_send_select_soft_keys(listener_t *listener, + const char *file, const char *func, int line, uint32_t line_instance, uint32_t call_id, uint32_t soft_key_set, @@ -788,10 +875,16 @@ 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; - return skinny_send_reply(listener, message); + + skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, + "Send Select Soft Keys with Line Instance (%d), Call ID (%d), Soft Key Set (%d), Valid Key Mask (%x)\n", + line_instance, call_id, soft_key_set, valid_key_mask); + + return skinny_send_reply_quiet(listener, message); } -switch_status_t send_call_state(listener_t *listener, +switch_status_t perform_send_call_state(listener_t *listener, + const char *file, const char *func, int line, uint32_t call_state, uint32_t line_instance, uint32_t call_id) @@ -803,10 +896,16 @@ 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; - return skinny_send_reply(listener, message); + + skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, + "Send Call State with State (%s), Line Instance (%d), Call ID (%d)\n", + skinny_call_state2str(call_state), line_instance, call_id); + + return skinny_send_reply_quiet(listener, message); } -switch_status_t send_display_prompt_status(listener_t *listener, +switch_status_t perform_send_display_prompt_status(listener_t *listener, + const char *file, const char *func, int line, uint32_t timeout, const char *display, uint32_t line_instance, @@ -820,10 +919,44 @@ switch_status_t send_display_prompt_status(listener_t *listener, 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; - return skinny_send_reply(listener, message); + + skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, + "Send Display Prompt Status with Timeout (%d), Display (%s), Line Instance (%d), Call ID (%d)\n", + timeout, display, line_instance, call_id); + + return skinny_send_reply_quiet(listener, message); } -switch_status_t send_clear_prompt_status(listener_t *listener, +switch_status_t perform_send_display_prompt_status_textid(listener_t *listener, + const char *file, const char *func, int line, + uint32_t timeout, + uint32_t display_textid, + uint32_t line_instance, + uint32_t call_id) +{ + skinny_message_t *message; + char *label; + message = switch_core_alloc(listener->pool, 12+sizeof(message->data.display_prompt_status)); + message->type = DISPLAY_PROMPT_STATUS_MESSAGE; + message->length = 4 + sizeof(message->data.display_prompt_status); + message->data.display_prompt_status.timeout = timeout; + + label = skinny_textid2raw(display_textid); + strncpy(message->data.display_prompt_status.display, label, 32); + switch_safe_free(label); + + message->data.display_prompt_status.line_instance = line_instance; + message->data.display_prompt_status.call_id = call_id; + + skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, + "Send Display Prompt Status with Timeout (%d), Display (%s), Line Instance (%d), Call ID (%d)\n", + timeout, skinny_textid2str(display_textid), line_instance, call_id); + + return skinny_send_reply_quiet(listener, message); +} + +switch_status_t perform_send_clear_prompt_status(listener_t *listener, + const char *file, const char *func, int line, uint32_t line_instance, uint32_t call_id) { @@ -833,10 +966,16 @@ switch_status_t send_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; - return skinny_send_reply(listener, message); + + skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, + "Send Clear Prompt Status with Line Instance (%d), Call ID (%d)\n", + line_instance, call_id); + + return skinny_send_reply_quiet(listener, message); } -switch_status_t send_activate_call_plane(listener_t *listener, +switch_status_t perform_send_activate_call_plane(listener_t *listener, + const char *file, const char *func, int line, uint32_t line_instance) { skinny_message_t *message; @@ -844,10 +983,15 @@ switch_status_t send_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; - return skinny_send_reply(listener, message); + + skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, + "Send Activate Call Plane with Line Instance (%d)\n", line_instance); + + return skinny_send_reply_quiet(listener, message); } -switch_status_t send_back_space_request(listener_t *listener, +switch_status_t perform_send_back_space_request(listener_t *listener, + const char *file, const char *func, int line, uint32_t line_instance, uint32_t call_id) { @@ -857,11 +1001,17 @@ switch_status_t send_back_space_request(listener_t *listener, message->length = 4 + sizeof(message->data.back_space_req); message->data.back_space_req.line_instance = line_instance; message->data.back_space_req.call_id = call_id; - return skinny_send_reply(listener, message); + + skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, + "Send Back Space Request with Line Instance (%d), Call ID (%d)\n", + line_instance, call_id); + + return skinny_send_reply_quiet(listener, message); } -switch_status_t send_dialed_number(listener_t *listener, +switch_status_t perform_send_dialed_number(listener_t *listener, + const char *file, const char *func, int line, char called_party[24], uint32_t line_instance, uint32_t call_id) @@ -873,10 +1023,16 @@ switch_status_t send_dialed_number(listener_t *listener, 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; - return skinny_send_reply(listener, message); + + skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, + "Send Dialed Number with Number (%s), Line Instance (%d), Call ID (%d)\n", + called_party, line_instance, call_id); + + return skinny_send_reply_quiet(listener, message); } -switch_status_t send_display_pri_notify(listener_t *listener, +switch_status_t perform_send_display_pri_notify(listener_t *listener, + const char *file, const char *func, int line, uint32_t message_timeout, uint32_t priority, char *notify) @@ -888,21 +1044,34 @@ 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); - return skinny_send_reply(listener, message); + + skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, + "Send Display Pri Notify with Timeout (%d), Priority (%d), Message (%s)\n", + message_timeout, priority, notify); + + return skinny_send_reply_quiet(listener, message); } -switch_status_t send_reset(listener_t *listener, uint32_t reset_type) +switch_status_t perform_send_reset(listener_t *listener, + const char *file, const char *func, int line, + uint32_t reset_type) { skinny_message_t *message; message = switch_core_alloc(listener->pool, 12+sizeof(message->data.reset)); message->type = RESET_MESSAGE; message->length = 4 + sizeof(message->data.reset); message->data.reset.reset_type = reset_type; - return skinny_send_reply(listener, message); + + skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, + "Send Reset with Type (%s)\n", skinny_device_reset_type2str(reset_type)); + + return skinny_send_reply_quiet(listener, message); } -switch_status_t send_data(listener_t *listener, uint32_t message_type, +switch_status_t perform_send_data(listener_t *listener, + const char *file, const char *func, int line, + uint32_t message_type, uint32_t application_id, uint32_t line_instance, uint32_t call_id, @@ -925,10 +1094,16 @@ switch_status_t send_data(listener_t *listener, uint32_t message_type, message->data.data.transaction_id = transaction_id; message->data.data.data_length = data_length; strncpy(message->data.data.data, data, data_length); - return skinny_send_reply(listener, message); + + skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, + "Send Data with Data Length (%d)\n", data_length); + + return skinny_send_reply_quiet(listener, message); } -switch_status_t send_extended_data(listener_t *listener, uint32_t message_type, +switch_status_t perform_send_extended_data(listener_t *listener, + const char *file, const char *func, int line, + uint32_t message_type, uint32_t application_id, uint32_t line_instance, uint32_t call_id, @@ -961,7 +1136,30 @@ switch_status_t send_extended_data(listener_t *listener, uint32_t message_type, message->data.extended_data.app_instance_id = app_instance_id; message->data.extended_data.routing_id = routing_id; strncpy(message->data.extended_data.data, data, data_length); - return skinny_send_reply(listener, message); + + skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, + "Send Extended Data with Application ID (%d), Line Instance (%d), Call ID (%d), ...\n", + application_id, line_instance, call_id ); + + return skinny_send_reply_quiet(listener, message); +} + +switch_status_t skinny_perform_send_reply_quiet(listener_t *listener, const char *file, const char *func, int line, skinny_message_t *reply) +{ + char *ptr; + switch_size_t len; + switch_assert(reply != NULL); + len = reply->length+8; + ptr = (char *) reply; + + if (listener_is_ready(listener)) { + return switch_socket_send(listener->sock, ptr, &len); + } else { + skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_WARNING, + "Not sending %s (type=%x,length=%d) while not ready.\n", + skinny_message_type2str(reply->type), reply->type, reply->length); + return SWITCH_STATUS_FALSE; + } } switch_status_t skinny_perform_send_reply(listener_t *listener, const char *file, const char *func, int line, skinny_message_t *reply) @@ -974,17 +1172,15 @@ switch_status_t skinny_perform_send_reply(listener_t *listener, const char *file if (listener_is_ready(listener)) { if (listener->profile->debug >= 10 || reply->type != KEEP_ALIVE_ACK_MESSAGE) { - switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_DEBUG, - "Sending %s (type=%x,length=%d) to %s:%d at %s:%d.\n", - skinny_message_type2str(reply->type), reply->type, reply->length, - listener->device_name, listener->device_instance, listener->remote_ip, listener->remote_port); + skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_DEBUG, + "Sending %s (type=%x,length=%d).\n", + skinny_message_type2str(reply->type), reply->type, reply->length); } return switch_socket_send(listener->sock, ptr, &len); } else { - switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_WARNING, - "Not sending %s (type=%x,length=%d) to %s:%d while not ready.\n", - skinny_message_type2str(reply->type), reply->type, reply->length, - listener->device_name, listener->device_instance); + skinny_log_l_ffl(listener, file, func, line, SWITCH_LOG_WARNING, + "Not sending %s (type=%x,length=%d) while not ready.\n", + skinny_message_type2str(reply->type), reply->type, reply->length); return SWITCH_STATUS_FALSE; } } diff --git a/src/mod/endpoints/mod_skinny/skinny_protocol.h b/src/mod/endpoints/mod_skinny/skinny_protocol.h index da79df8b7e..25c82ba12d 100644 --- a/src/mod/endpoints/mod_skinny/skinny_protocol.h +++ b/src/mod/endpoints/mod_skinny/skinny_protocol.h @@ -789,37 +789,59 @@ void skinny_feature_get(listener_t *listener, uint32_t instance, struct feature_ switch_status_t skinny_perform_send_reply(listener_t *listener, const char *file, const char *func, int line, skinny_message_t *reply); #define skinny_send_reply(listener, reply) skinny_perform_send_reply(listener, __FILE__, __SWITCH_FUNC__, __LINE__, reply) +switch_status_t skinny_perform_send_reply_quiet(listener_t *listener, const char *file, const char *func, int line, skinny_message_t *reply); +#define skinny_send_reply_quiet(listener, reply) skinny_perform_send_reply_quiet(listener, __FILE__, __SWITCH_FUNC__, __LINE__, reply) + switch_status_t skinny_handle_request(listener_t *listener, skinny_message_t *request); /*****************************************************************************/ /* SKINNY MESSAGE HELPER */ /*****************************************************************************/ -switch_status_t send_register_ack(listener_t *listener, +switch_status_t perform_send_register_ack(listener_t *listener, + const char *file, const char *func, int line, 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, +#define send_register_ack(listener, ...) perform_send_register_ack(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__) + +switch_status_t perform_send_start_tone(listener_t *listener, + const char *file, const char *func, int line, uint32_t tone, uint32_t reserved, uint32_t line_instance, uint32_t call_id); -switch_status_t send_stop_tone(listener_t *listener, +#define send_start_tone(listener, ...) perform_send_start_tone(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__) + +switch_status_t perform_send_stop_tone(listener_t *listener, + const char *file, const char *func, int line, uint32_t line_instance, uint32_t call_id); -switch_status_t send_set_ringer(listener_t *listener, +#define send_stop_tone(listener, ...) perform_send_stop_tone(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__) + +switch_status_t perform_send_set_ringer(listener_t *listener, + const char *file, const char *func, int line, uint32_t ring_type, uint32_t ring_mode, uint32_t line_instance, uint32_t call_id); -switch_status_t send_set_lamp(listener_t *listener, +#define send_set_ringer(listener, ...) perform_send_set_ringer(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__) + +switch_status_t perform_send_set_lamp(listener_t *listener, + const char *file, const char *func, int line, uint32_t stimulus, uint32_t stimulus_instance, uint32_t mode); -switch_status_t send_set_speaker_mode(listener_t *listener, +#define send_set_lamp(listener, ...) perform_send_set_lamp(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__) + +switch_status_t perform_send_set_speaker_mode(listener_t *listener, + const char *file, const char *func, int line, uint32_t mode); -switch_status_t send_start_media_transmission(listener_t *listener, +#define send_set_speaker_mode(listener, ...) perform_send_set_speaker_mode(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__) + +switch_status_t perform_send_start_media_transmission(listener_t *listener, + const char *file, const char *func, int line, uint32_t conference_id, uint32_t pass_thru_party_id, uint32_t remote_ip, @@ -830,11 +852,17 @@ switch_status_t send_start_media_transmission(listener_t *listener, uint32_t silence_suppression, uint16_t max_frames_per_packet, uint32_t g723_bitrate); -switch_status_t send_stop_media_transmission(listener_t *listener, +#define send_start_media_transmission(listener,...) perform_send_start_media_transmission(listener,__FILE__, __SWITCH_FUNC__, __LINE__,__VA_ARGS__) + +switch_status_t perform_send_stop_media_transmission(listener_t *listener, + const char *file, const char *func, int line, uint32_t conference_id, uint32_t pass_thru_party_id, uint32_t conference_id2); -switch_status_t skinny_send_call_info(listener_t *listener, +#define send_stop_media_transmission(listener, ...) perform_send_stop_media_transmission(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__) + +switch_status_t perform_send_call_info(listener_t *listener, + const char *file, const char *func, int line, const char *calling_party_name, const char *calling_party, const char *called_party_name, @@ -855,7 +883,10 @@ switch_status_t skinny_send_call_info(listener_t *listener, uint32_t call_instance, uint32_t call_security_status, uint32_t party_pi_restriction_bits); -switch_status_t send_define_time_date(listener_t *listener, +#define send_call_info(listener, ...) perform_send_call_info(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__) + +switch_status_t perform_send_define_time_date(listener_t *listener, + const char *file, const char *func, int line, uint32_t year, uint32_t month, uint32_t day_of_week, /* monday = 1 */ @@ -865,13 +896,28 @@ switch_status_t send_define_time_date(listener_t *listener, uint32_t seconds, uint32_t milliseconds, uint32_t timestamp); -switch_status_t send_define_current_time_date(listener_t *listener); -switch_status_t send_version(listener_t *listener, +#define send_define_time_date(listener, ...) perform_send_define_time_date(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__) + +switch_status_t perform_send_define_current_time_date(listener_t *listener, + const char *file, const char *func, int line); +#define send_define_current_time_date(listener) perform_send_define_current_time_date(listener, __FILE__, __SWITCH_FUNC__, __LINE__) + +switch_status_t perform_send_version(listener_t *listener, + const char *file, const char *func, int line, char *version); -switch_status_t send_capabilities_req(listener_t *listener); -switch_status_t send_register_reject(listener_t *listener, +#define send_version(listener, ...) perform_send_version(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__) + +switch_status_t perform_send_capabilities_req(listener_t *listener, + const char *file, const char *func, int line); +#define send_capabilities_req(listener) perform_send_capabilities_req(listener, __FILE__, __SWITCH_FUNC__, __LINE__) + +switch_status_t perform_send_register_reject(listener_t *listener, + const char *file, const char *func, int line, char *error); -switch_status_t send_open_receive_channel(listener_t *listener, +#define send_register_reject(listener, ...) perform_send_register_reject(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__) + +switch_status_t perform_send_open_receive_channel(listener_t *listener, + const char *file, const char *func, int line, uint32_t conference_id, uint32_t pass_thru_party_id, uint32_t ms_per_packet, @@ -880,52 +926,96 @@ switch_status_t send_open_receive_channel(listener_t *listener, uint32_t g723_bitrate, uint32_t conference_id2, uint32_t reserved[10]); -switch_status_t send_close_receive_channel(listener_t *listener, +#define send_open_receive_channel(listener, ...) perform_send_open_receive_channel(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__) + +switch_status_t perform_send_close_receive_channel(listener_t *listener, + const char *file, const char *func, int line, uint32_t conference_id, uint32_t pass_thru_party_id, uint32_t conference_id2); -switch_status_t send_select_soft_keys(listener_t *listener, +#define send_close_receive_channel(listener, ...) perform_send_close_receive_channel(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__) + +switch_status_t perform_send_select_soft_keys(listener_t *listener, + const char *file, const char *func, int line, uint32_t line_instance, uint32_t call_id, uint32_t soft_key_set, uint32_t valid_key_mask); -switch_status_t send_call_state(listener_t *listener, +#define send_select_soft_keys(listener, ...) perform_send_select_soft_keys(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__) + +switch_status_t perform_send_call_state(listener_t *listener, + const char *file, const char *func, int line, uint32_t call_state, uint32_t line_instance, uint32_t call_id); -switch_status_t send_display_prompt_status(listener_t *listener, +#define send_call_state(listener, ...) perform_send_call_state(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__) + +switch_status_t perform_send_display_prompt_status(listener_t *listener, + const char *file, const char *func, int line, uint32_t timeout, const char *display, uint32_t line_instance, uint32_t call_id); -switch_status_t send_clear_prompt_status(listener_t *listener, +#define send_display_prompt_status(listener, ...) perform_send_display_prompt_status(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__) + +switch_status_t perform_send_display_prompt_status_textid(listener_t *listener, + const char *file, const char *func, int line, + uint32_t timeout, + uint32_t display_textid, uint32_t line_instance, uint32_t call_id); -switch_status_t send_activate_call_plane(listener_t *listener, +#define send_display_prompt_status_textid(listener, ...) perform_send_display_prompt_status_textid(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__) + +switch_status_t perform_send_clear_prompt_status(listener_t *listener, + const char *file, const char *func, int line, + uint32_t line_instance, + uint32_t call_id); +#define send_clear_prompt_status(listener, ...) perform_send_clear_prompt_status(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__) + +switch_status_t perform_send_activate_call_plane(listener_t *listener, + const char *file, const char *func, int line, uint32_t line_instance); -switch_status_t send_back_space_request(listener_t *listener, +#define send_activate_call_plane(listener, ...) perform_send_activate_call_plane(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__) + +switch_status_t perform_send_back_space_request(listener_t *listener, + const char *file, const char *func, int line, uint32_t line_instance, uint32_t call_id); -switch_status_t send_dialed_number(listener_t *listener, +#define send_back_space_request(listener, ...) perform_send_back_space_request(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__) + +switch_status_t perform_send_dialed_number(listener_t *listener, + const char *file, const char *func, int line, char called_party[24], uint32_t line_instance, uint32_t call_id); -switch_status_t send_display_pri_notify(listener_t *listener, +#define send_dialed_number(listener, ...) perform_send_dialed_number(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__) + +switch_status_t perform_send_display_pri_notify(listener_t *listener, + const char *file, const char *func, int line, uint32_t message_timeout, uint32_t priority, char *notify); -switch_status_t send_reset(listener_t *listener, - uint32_t reset_type); +#define send_display_pri_notify(listener, ...) perform_send_display_pri_notify(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__) -switch_status_t send_data(listener_t *listener, uint32_t message_type, +switch_status_t perform_send_reset(listener_t *listener, + const char *file, const char *func, int line, + uint32_t reset_type); +#define send_reset(listener, ...) perform_send_reset(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__) + +switch_status_t perform_send_data(listener_t *listener, + const char *file, const char *func, int line, + uint32_t message_type, uint32_t application_id, uint32_t line_instance, uint32_t call_id, uint32_t transaction_id, uint32_t data_length, const char *data); +#define send_data(listener, ...) perform_send_data(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__) -switch_status_t send_extended_data(listener_t *listener, uint32_t message_type, +switch_status_t perform_send_extended_data(listener_t *listener, + const char *file, const char *func, int line, + uint32_t message_type, uint32_t application_id, uint32_t line_instance, uint32_t call_id, @@ -937,6 +1027,7 @@ switch_status_t send_extended_data(listener_t *listener, uint32_t message_type, uint32_t app_instance_id, uint32_t routing_id, const char *data); +#define send_extended_data(listener, ...) perform_send_extended_data(listener, __FILE__, __SWITCH_FUNC__, __LINE__, __VA_ARGS__) #endif /* _SKINNY_PROTOCOL_H */ diff --git a/src/mod/endpoints/mod_skinny/skinny_server.c b/src/mod/endpoints/mod_skinny/skinny_server.c index 0a661b2022..f9efb2208e 100644 --- a/src/mod/endpoints/mod_skinny/skinny_server.c +++ b/src/mod/endpoints/mod_skinny/skinny_server.c @@ -33,30 +33,52 @@ #include "mod_skinny.h" #include "skinny_protocol.h" #include "skinny_tables.h" -#include "skinny_labels.h" #include "skinny_server.h" -struct soft_key_template_definition soft_key_template_default[] = { - { SKINNY_DISP_REDIAL, SOFTKEY_REDIAL }, - { SKINNY_DISP_NEWCALL, SOFTKEY_NEWCALL }, - { SKINNY_DISP_HOLD, SOFTKEY_HOLD }, - { SKINNY_DISP_TRANSFER, SOFTKEY_TRANSFER }, - { SKINNY_DISP_CFWDALL, SOFTKEY_CFWDALL }, - { SKINNY_DISP_CFWDBUSY, SOFTKEY_CFWDBUSY }, - { SKINNY_DISP_CFWDNOANSWER, SOFTKEY_CFWDNOANSWER }, - { SKINNY_DISP_BACKSPACE, SOFTKEY_BACKSPACE }, - { SKINNY_DISP_ENDCALL, SOFTKEY_ENDCALL }, - { SKINNY_DISP_RESUME, SOFTKEY_RESUME }, - { SKINNY_DISP_ANSWER, SOFTKEY_ANSWER }, - { SKINNY_DISP_INFO, SOFTKEY_INFO }, - { SKINNY_DISP_CONF, SOFTKEY_CONF }, - { SKINNY_DISP_PARK, SOFTKEY_PARK }, - { SKINNY_DISP_JOIN, SOFTKEY_JOIN }, - { SKINNY_DISP_MEETME, SOFTKEY_MEETMECONF }, - { SKINNY_DISP_CALLPICKUP, SOFTKEY_CALLPICKUP }, - { SKINNY_DISP_GRPCALLPICKUP, SOFTKEY_GRPCALLPICKUP }, - { SKINNY_DISP_DND, SOFTKEY_DND }, - { SKINNY_DISP_IDIVERT, SOFTKEY_IDIVERT }, +uint32_t soft_key_template_default_textids[] = { + SKINNY_TEXTID_REDIAL, + SKINNY_TEXTID_NEWCALL, + SKINNY_TEXTID_HOLD, + SKINNY_TEXTID_TRANSFER, + SKINNY_TEXTID_CFWDALL, + SKINNY_TEXTID_CFWDBUSY, + SKINNY_TEXTID_CFWDNOANSWER, + SKINNY_TEXTID_BACKSPACE, + SKINNY_TEXTID_ENDCALL, + SKINNY_TEXTID_RESUME, + SKINNY_TEXTID_ANSWER, + SKINNY_TEXTID_INFO, + SKINNY_TEXTID_CONF, + SKINNY_TEXTID_PARK, + SKINNY_TEXTID_JOIN, + SKINNY_TEXTID_MEETME, + SKINNY_TEXTID_CALLPICKUP, + SKINNY_TEXTID_GRPCALLPICKUP, + SKINNY_TEXTID_DND, + SKINNY_TEXTID_IDIVERT +}; + +uint32_t soft_key_template_default_events[] = { + SOFTKEY_REDIAL, + SOFTKEY_NEWCALL, + SOFTKEY_HOLD, + SOFTKEY_TRANSFER, + SOFTKEY_CFWDALL, + SOFTKEY_CFWDBUSY, + SOFTKEY_CFWDNOANSWER, + SOFTKEY_BACKSPACE, + SOFTKEY_ENDCALL, + SOFTKEY_RESUME, + SOFTKEY_ANSWER, + SOFTKEY_INFO, + SOFTKEY_CONF, + SOFTKEY_PARK, + SOFTKEY_JOIN, + SOFTKEY_MEETMECONF, + SOFTKEY_CALLPICKUP, + SOFTKEY_GRPCALLPICKUP, + SOFTKEY_DND, + SOFTKEY_IDIVERT }; /*****************************************************************************/ @@ -91,20 +113,18 @@ switch_status_t skinny_create_incoming_session(listener_t *listener, uint32_t *l skinny_line_get(listener, *line_instance_p, &button); if (!button || !button->shortname) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Line %d not found on device %s %d\n", - *line_instance_p, listener->device_name, listener->device_instance); + skinny_log_l(listener, SWITCH_LOG_CRIT, "Line %d not found on device\n", *line_instance_p); goto error; } if (!(nsession = switch_core_session_request(skinny_get_endpoint_interface(), SWITCH_CALL_DIRECTION_INBOUND, SOF_NONE, NULL))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Error Creating Session\n"); + skinny_log_l(listener, SWITCH_LOG_CRIT, "Error Creating Session\n", NULL); goto error; } if (!(tech_pvt = (struct private_object *) switch_core_session_alloc(nsession, sizeof(*tech_pvt)))) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(nsession), SWITCH_LOG_CRIT, - "Error Creating Session private object\n"); + skinny_log_ls(listener, nsession, SWITCH_LOG_CRIT, "Error Creating Session private object\n", NULL); goto error; } @@ -119,13 +139,11 @@ switch_status_t skinny_create_incoming_session(listener_t *listener, uint32_t *l switch_channel_set_name(channel, name); if (switch_core_session_thread_launch(nsession) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(nsession), SWITCH_LOG_CRIT, - "Error Creating Session thread\n"); + skinny_log_ls(listener, nsession, SWITCH_LOG_CRIT, "Error Creating Session thread\n", NULL); goto error; } if (switch_core_session_read_lock(nsession) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(nsession), SWITCH_LOG_CRIT, - "Error Locking Session\n"); + skinny_log_ls(listener, nsession, SWITCH_LOG_CRIT, "Error Locking Session\n", NULL); goto error; } /* First create the caller profile in the patterns Dialplan */ @@ -136,8 +154,7 @@ switch_status_t skinny_create_incoming_session(listener_t *listener, uint32_t *l "skinny" /* modname */, listener->profile->patterns_context, "")) != 0) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(nsession), SWITCH_LOG_CRIT, - "Error Creating Session caller profile\n"); + skinny_log_ls(listener, nsession, SWITCH_LOG_CRIT, "Error Creating Session caller profile\n", NULL); goto error; } @@ -161,14 +178,15 @@ switch_status_t skinny_create_incoming_session(listener_t *listener, uint32_t *l 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); - send_display_prompt_status(listener, 0, SKINNY_DISP_ENTER_NUMBER, - *line_instance_p, tech_pvt->call_id); + + send_display_prompt_status_textid(listener, 0, SKINNY_TEXTID_ENTER_NUMBER, *line_instance_p, tech_pvt->call_id); + send_activate_call_plane(listener, *line_instance_p); if (switch_channel_get_state(channel) == CS_NEW) { switch_channel_set_state(channel, CS_HIBERNATE); } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(nsession), SWITCH_LOG_CRIT, - "Wow! this channel should be in CS_NEW state, but it is not!\n"); + skinny_log_ls(listener, nsession, SWITCH_LOG_CRIT, + "Wow! this channel should be in CS_NEW state, but it is not!\n", NULL); } goto done; @@ -347,7 +365,7 @@ switch_status_t skinny_session_send_call_info(switch_core_session_t *session, li } else { call_type = SKINNY_OUTBOUND_CALL; } - skinny_send_call_info(listener, + send_call_info(listener, caller_party_name, /* char calling_party_name[40], */ caller_party_number, /* char calling_party[24], */ called_party_name, /* char called_party_name[40], */ @@ -499,6 +517,7 @@ int skinny_ring_lines_callback(void *pArg, int argc, char **argv, char **columnN { struct skinny_ring_lines_helper *helper = pArg; char *tmp; + char *label; char *device_name = argv[0]; uint32_t device_instance = atoi(argv[1]); @@ -545,10 +564,14 @@ 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("%s%s", SKINNY_DISP_FROM, helper->tech_pvt->caller_profile->destination_number))) { + + label = skinny_textid2raw(SKINNY_TEXTID_FROM); + if ((tmp = switch_mprintf("%s%s", label, helper->tech_pvt->caller_profile->destination_number))) { send_display_prompt_status(listener, 0, tmp, line_instance, helper->tech_pvt->call_id); switch_safe_free(tmp); } + switch_safe_free(label); + if ((tmp = switch_mprintf("\005\000\000\000%s", helper->tech_pvt->caller_profile->destination_number))) { send_display_pri_notify(listener, 10 /* message_timeout */, 5 /* priority */, tmp); switch_safe_free(tmp); @@ -600,7 +623,9 @@ switch_status_t skinny_session_ring_out(switch_core_session_t *session, listener send_start_tone(listener, SKINNY_TONE_ALERT, 0, line_instance, tech_pvt->call_id); 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); - send_display_prompt_status(listener, 0, SKINNY_DISP_RING_OUT, line_instance, tech_pvt->call_id); + + send_display_prompt_status_textid(listener, 0, SKINNY_TEXTID_RING_OUT, line_instance, tech_pvt->call_id); + skinny_session_send_call_info(session, listener, line_instance); return SWITCH_STATUS_SUCCESS; @@ -617,6 +642,7 @@ int skinny_session_answer_callback(void *pArg, int argc, char **argv, char **col { struct skinny_session_answer_helper *helper = pArg; listener_t *listener = NULL; + char *label; char *device_name = argv[0]; uint32_t device_instance = atoi(argv[1]); @@ -647,7 +673,9 @@ int skinny_session_answer_callback(void *pArg, int argc, char **argv, char **col 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_IN_USE_REMOTELY); send_select_soft_keys(listener, line_instance, helper->tech_pvt->call_id, 10, 0x0002); - send_display_prompt_status(listener, 0, SKINNY_DISP_IN_USE_REMOTE, line_instance, helper->tech_pvt->call_id); + + send_display_prompt_status_textid(listener, 0, SKINNY_TEXTID_IN_USE_REMOTE, line_instance, helper->tech_pvt->call_id); + send_set_ringer(listener, SKINNY_RING_OFF, SKINNY_RING_FOREVER, 0, helper->tech_pvt->call_id); } } @@ -716,11 +744,8 @@ 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); - send_display_prompt_status(listener, - 0, - SKINNY_DISP_CONNECTED, - line_instance, - tech_pvt->call_id); + + send_display_prompt_status_textid(listener, 0, SKINNY_TEXTID_CONNECTED, line_instance, tech_pvt->call_id); } skinny_session_send_call_info(session, listener, line_instance); @@ -744,8 +769,9 @@ switch_status_t skinny_session_hold_line(switch_core_session_t *session, listene send_set_lamp(listener, SKINNY_BUTTON_LINE, line_instance, SKINNY_LAMP_WINK); skinny_line_set_state(listener, line_instance, tech_pvt->call_id, SKINNY_HOLD); send_select_soft_keys(listener, line_instance, tech_pvt->call_id, SKINNY_KEY_SET_ON_HOLD, 0xffff); - send_display_prompt_status(listener, 0, SKINNY_DISP_HOLD, - line_instance, tech_pvt->call_id); + + send_display_prompt_status_textid(listener, 0, SKINNY_TEXTID_HOLD, line_instance, tech_pvt->call_id); + skinny_session_send_call_info(tech_pvt->session, listener, line_instance); send_set_speaker_mode(listener, SKINNY_SPEAKER_OFF); send_set_ringer(listener, SKINNY_RING_OFF, SKINNY_RING_FOREVER, 0, tech_pvt->call_id); @@ -1220,6 +1246,9 @@ switch_status_t skinny_handle_stimulus_message(listener_t *listener, skinny_mess call_id = request->data.stimulus.call_id; } + skinny_log_l(listener, SWITCH_LOG_DEBUG, "Received stimulus message of type (%s)\n", + skinny_button2str(request->data.stimulus.instance_type)); + switch(request->data.stimulus.instance_type) { case SKINNY_BUTTON_LAST_NUMBER_REDIAL: skinny_create_incoming_session(listener, &line_instance, &session); @@ -1384,7 +1413,9 @@ switch_status_t skinny_handle_forward_stat_req_message(listener_t *listener, ski message->data.forward_stat.line_instance = request->data.forward_stat_req.line_instance; - skinny_send_reply(listener, message); + skinny_log_l(listener, SWITCH_LOG_DEBUG, "Handle Forward Stat Req Message with Line Instance (%d)\n", + request->data.forward_stat_req.line_instance); + skinny_send_reply_quiet(listener, message); return SWITCH_STATUS_SUCCESS; } @@ -1404,7 +1435,9 @@ switch_status_t skinny_handle_speed_dial_stat_request(listener_t *listener, skin memcpy(&message->data.speed_dial_res, button, sizeof(struct speed_dial_stat_res_message)); - skinny_send_reply(listener, message); + skinny_log_l(listener, SWITCH_LOG_DEBUG, "Handle Speed Dial Stat Request with Number (%s)\n", + request->data.speed_dial_req.number); + skinny_send_reply_quiet(listener, message); return SWITCH_STATUS_SUCCESS; } @@ -1661,8 +1694,7 @@ switch_status_t skinny_handle_capabilities_response(listener_t *listener, skinny skinny_execute_sql(profile, sql, profile->sql_mutex); switch_safe_free(sql); } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, - "Codecs %s supported.\n", codec_string); + skinny_log_l(listener, SWITCH_LOG_DEBUG, "Codecs %s supported.\n", codec_string); return SWITCH_STATUS_SUCCESS; } @@ -1672,10 +1704,10 @@ switch_status_t skinny_handle_alarm(listener_t *listener, skinny_message_t *requ skinny_check_data_length(request, sizeof(request->data.alarm)); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, - "Received alarm: Severity=%d, DisplayMessage=%s, Param1=%d, Param2=%d.\n", - request->data.alarm.alarm_severity, request->data.alarm.display_message, - request->data.alarm.alarm_param1, request->data.alarm.alarm_param2); + skinny_log_l(listener, SWITCH_LOG_DEBUG, "Received alarm: Severity=%d, DisplayMessage=%s, Param1=%d, Param2=%d.\n", + request->data.alarm.alarm_severity, request->data.alarm.display_message, + request->data.alarm.alarm_param1, request->data.alarm.alarm_param2); + /* skinny::alarm event */ skinny_device_event(listener, &event, SWITCH_EVENT_CUSTOM, SKINNY_EVENT_ALARM); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Skinny-Alarm-Severity", "%d", request->data.alarm.alarm_severity); @@ -1775,9 +1807,8 @@ switch_status_t skinny_handle_open_receive_channel_ack_message(listener_t *liste send_set_lamp(listener, SKINNY_BUTTON_LINE, line_instance, SKINNY_LAMP_ON); } } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, - "Unable to find session for device %s:%d (call id=%d).\n", - listener->device_name, listener->device_instance, request->data.open_receive_channel_ack.pass_thru_party_id); + skinny_log_l(listener, SWITCH_LOG_WARNING, "Unable to find session for call id=%d.\n", + request->data.open_receive_channel_ack.pass_thru_party_id); } end: if(session) { @@ -1792,15 +1823,17 @@ switch_status_t skinny_handle_soft_key_set_request(listener_t *listener, skinny_ if (listener->soft_key_set_set) { message = switch_core_hash_find(listener->profile->soft_key_set_sets_hash, listener->soft_key_set_set); + skinny_log_l(listener, SWITCH_LOG_DEBUG, "Handle Soft Key Set Request with Set (%s)\n", listener->soft_key_set_set); } if (!message) { message = switch_core_hash_find(listener->profile->soft_key_set_sets_hash, "default"); + skinny_log_l(listener, SWITCH_LOG_DEBUG, "Handle Soft Key Set Request with Set (%s)\n", "default"); } if (message) { skinny_send_reply(listener, message); } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, - "Profile %s doesn't have a default .\n", listener->profile->name); + skinny_log_l(listener, SWITCH_LOG_ERROR, "Profile %s doesn't have a default .\n", + listener->profile->name); } /* Init the states */ @@ -1933,10 +1966,15 @@ switch_status_t skinny_handle_soft_key_template_request(listener_t *listener, sk message->data.soft_key_template.soft_key_count = 21; message->data.soft_key_template.total_soft_key_count = 21; - memcpy(message->data.soft_key_template.soft_key, - soft_key_template_default, - sizeof(soft_key_template_default)); + memset(message->data.soft_key_template.soft_key, 0, sizeof(message->data.soft_key_template)); + for (int i=0; idata.soft_key_template.soft_key[i].soft_key_label, skinny_textid2raw(soft_key_template_default_textids[i])); + switch_safe_free(label); + message->data.soft_key_template.soft_key[i].soft_key_event = soft_key_template_default_events[i]; + } + skinny_send_reply(listener, message); return SWITCH_STATUS_SUCCESS; @@ -2133,8 +2171,7 @@ switch_status_t skinny_handle_xml_alarm(listener_t *listener, skinny_message_t * switch_event_t *event = NULL; char *tmp = NULL; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, - "Received XML alarm.\n"); + skinny_log_l(listener, SWITCH_LOG_INFO, "Received XML alarm (length=%d).\n", request->length); /* skinny::xml_alarm event */ skinny_device_event(listener, &event, SWITCH_EVENT_CUSTOM, SKINNY_EVENT_XML_ALARM); /* Ensure that the body is null-terminated */ @@ -2151,9 +2188,8 @@ switch_status_t skinny_handle_xml_alarm(listener_t *listener, skinny_message_t * switch_status_t skinny_handle_request(listener_t *listener, skinny_message_t *request) { if (listener->profile->debug >= 10 || request->type != KEEP_ALIVE_MESSAGE) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, - "Received %s (type=%x,length=%d) from %s:%d at %s:%d.\n", skinny_message_type2str(request->type), request->type, request->length, - listener->device_name, listener->device_instance, listener->remote_ip, listener->remote_port); + skinny_log_l(listener, SWITCH_LOG_DEBUG, "Received %s (type=%x,length=%d).\n", + skinny_message_type2str(request->type), request->type, request->length); } if(zstr(listener->device_name) && request->type != REGISTER_MESSAGE && request->type != ALARM_MESSAGE && request->type != XML_ALARM_MESSAGE) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, diff --git a/src/mod/endpoints/mod_skinny/skinny_tables.c b/src/mod/endpoints/mod_skinny/skinny_tables.c index d07366cc1c..8dd9ddd988 100644 --- a/src/mod/endpoints/mod_skinny/skinny_tables.c +++ b/src/mod/endpoints/mod_skinny/skinny_tables.c @@ -43,7 +43,7 @@ struct skinny_table SKINNY_MESSAGE_TYPES[] = { {STIMULUS_MESSAGE, "StimulusMessage"}, {OFF_HOOK_MESSAGE, "OffHookMessage"}, {ON_HOOK_MESSAGE, "OnHookMessage"}, - { FORWARD_STAT_REQ_MESSAGE, "ForwardStatReqMessage"}, + {FORWARD_STAT_REQ_MESSAGE, "ForwardStatReqMessage"}, {SPEED_DIAL_STAT_REQ_MESSAGE, "SpeedDialStatReqMessage"}, {LINE_STAT_REQ_MESSAGE, "LineStatReqMessage"}, {CONFIG_STAT_REQ_MESSAGE, "ConfigStatReqMessage"}, @@ -132,6 +132,19 @@ SKINNY_DECLARE_STR2ID(skinny_str2message_type, SKINNY_MESSAGE_TYPES, -1) SKINNY_DECLARE_ID2STR(skinny_device_type2str, SKINNY_DEVICE_TYPES, "UnknownDeviceType") SKINNY_DECLARE_STR2ID(skinny_str2device_type, SKINNY_DEVICE_TYPES, -1) + struct skinny_table SKINNY_TONS[] = { + {SKINNY_TONE_SILENCE, "Silence"}, + {SKINNY_TONE_DIALTONE, "DialTone"}, + {SKINNY_TONE_BUSYTONE, "BusyTone"}, + {SKINNY_TONE_ALERT, "Alert"}, + {SKINNY_TONE_REORDER, "Reorder"}, + {SKINNY_TONE_CALLWAITTONE, "CallWaitTone"}, + {SKINNY_TONE_NOTONE, "NoTone"}, + {0, NULL} + }; + SKINNY_DECLARE_ID2STR(skinny_tone2str, SKINNY_TONS, "UnknownTone") +SKINNY_DECLARE_STR2ID(skinny_str2tone, SKINNY_TONS, -1) + struct skinny_table SKINNY_RING_TYPES[] = { {SKINNY_RING_OFF, "RingOff"}, {SKINNY_RING_INSIDE, "RingInside"}, @@ -275,6 +288,132 @@ SKINNY_DECLARE_STR2ID(skinny_str2accessory_type, SKINNY_ACCESSORY_TYPES, -1) SKINNY_DECLARE_ID2STR(skinny_accessory_state2str, SKINNY_ACCESSORY_STATES, "AccessoryStateUnknown") SKINNY_DECLARE_STR2ID(skinny_str2accessory_state, SKINNY_ACCESSORY_STATES, -1) + struct skinny_table SKINNY_TEXTIDS[] = { + {SKINNY_TEXTID_EMPTY, "Empty"}, + {SKINNY_TEXTID_REDIAL, "Redial"}, + {SKINNY_TEXTID_NEWCALL, "Newcall"}, + {SKINNY_TEXTID_HOLD, "Hold"}, + {SKINNY_TEXTID_TRANSFER, "Transfer"}, + {SKINNY_TEXTID_CFWDALL, "Cfwdall"}, + {SKINNY_TEXTID_CFWDBUSY, "Cfwdbusy"}, + {SKINNY_TEXTID_CFWDNOANSWER, "Cfwdnoanswer"}, + {SKINNY_TEXTID_BACKSPACE, "Backspace"}, + {SKINNY_TEXTID_ENDCALL, "Endcall"}, + {SKINNY_TEXTID_RESUME, "Resume"}, + {SKINNY_TEXTID_ANSWER, "Answer"}, + {SKINNY_TEXTID_INFO, "Info"}, + {SKINNY_TEXTID_CONF, "Conf"}, + {SKINNY_TEXTID_PARK, "Park"}, + {SKINNY_TEXTID_JOIN, "Join"}, + {SKINNY_TEXTID_MEETME, "Meetme"}, + {SKINNY_TEXTID_CALLPICKUP, "Callpickup"}, + {SKINNY_TEXTID_GRPCALLPICKUP, "Grpcallpickup"}, + {SKINNY_TEXTID_YOUR_CURRENT_OPTIONS, "Your Current Options"}, + {SKINNY_TEXTID_OFF_HOOK, "Off Hook"}, + {SKINNY_TEXTID_ON_HOOK, "On Hook"}, + {SKINNY_TEXTID_RING_OUT, "Ring Out"}, + {SKINNY_TEXTID_FROM, "From"}, + {SKINNY_TEXTID_CONNECTED, "Connected"}, + {SKINNY_TEXTID_BUSY, "Busy"}, + {SKINNY_TEXTID_LINE_IN_USE, "Line In Use"}, + {SKINNY_TEXTID_CALL_WAITING, "Call Waiting"}, + {SKINNY_TEXTID_CALL_TRANSFER, "Call Transfer"}, + {SKINNY_TEXTID_CALL_PARK, "Call Park"}, + {SKINNY_TEXTID_CALL_PROCEED, "Call Proceed"}, + {SKINNY_TEXTID_IN_USE_REMOTE, "In Use Remote"}, + {SKINNY_TEXTID_ENTER_NUMBER, "Enter Number"}, + {SKINNY_TEXTID_CALL_PARK_AT, "Call Park At"}, + {SKINNY_TEXTID_PRIMARY_ONLY, "Primary Only"}, + {SKINNY_TEXTID_TEMP_FAIL, "Temp Fail"}, + {SKINNY_TEXTID_YOU_HAVE_VOICEMAIL, "You Have Voicemail"}, + {SKINNY_TEXTID_FORWARDED_TO, "Forwarded To"}, + {SKINNY_TEXTID_CAN_NOT_COMPLETE_CONFERENCE, "Can Not Complete Conference"}, + {SKINNY_TEXTID_NO_CONFERENCE_BRIDGE, "No Conference Bridge"}, + {SKINNY_TEXTID_CAN_NOT_HOLD_PRIMARY_CONTROL, "Can Not Hold Primary Control"}, + {SKINNY_TEXTID_INVALID_CONFERENCE_PARTICIPANT, "Invalid Conference Participant"}, + {SKINNY_TEXTID_IN_CONFERENCE_ALREADY, "In Conference Already"}, + {SKINNY_TEXTID_NO_PARTICIPANT_INFO, "No Participant Info"}, + {SKINNY_TEXTID_EXCEED_MAXIMUM_PARTIES, "Exceed Maximum Parties"}, + {SKINNY_TEXTID_KEY_IS_NOT_ACTIVE, "Key Is Not Active"}, + {SKINNY_TEXTID_ERROR_NO_LICENSE, "Error No License"}, + {SKINNY_TEXTID_ERROR_DBCONFIG, "Error Dbconfig"}, + {SKINNY_TEXTID_ERROR_DATABASE, "Error Database"}, + {SKINNY_TEXTID_ERROR_PASS_LIMIT, "Error Pass Limit"}, + {SKINNY_TEXTID_ERROR_UNKNOWN, "Error Unknown"}, + {SKINNY_TEXTID_ERROR_MISMATCH, "Error Mismatch"}, + {SKINNY_TEXTID_CONFERENCE, "Conference"}, + {SKINNY_TEXTID_PARK_NUMBER, "Park Number"}, + {SKINNY_TEXTID_PRIVATE, "Private"}, + {SKINNY_TEXTID_NOT_ENOUGH_BANDWIDTH, "Not Enough Bandwidth"}, + {SKINNY_TEXTID_UNKNOWN_NUMBER, "Unknown Number"}, + {SKINNY_TEXTID_RMLSTC, "Rmlstc"}, + {SKINNY_TEXTID_VOICEMAIL, "Voicemail"}, + {SKINNY_TEXTID_IMMDIV, "Immdiv"}, + {SKINNY_TEXTID_INTRCPT, "Intrcpt"}, + {SKINNY_TEXTID_SETWTCH, "Setwtch"}, + {SKINNY_TEXTID_TRNSFVM, "Trnsfvm"}, + {SKINNY_TEXTID_DND, "Dnd"}, + {SKINNY_TEXTID_DIVALL, "Divall"}, + {SKINNY_TEXTID_CALLBACK, "Callback"}, + {SKINNY_TEXTID_NETWORK_CONGESTION_REROUTING, "Network Congestion Rerouting"}, + {SKINNY_TEXTID_BARGE, "Barge"}, + {SKINNY_TEXTID_FAILED_TO_SETUP_BARGE, "Failed To Setup Barge"}, + {SKINNY_TEXTID_ANOTHER_BARGE_EXISTS, "Another Barge Exists"}, + {SKINNY_TEXTID_INCOMPATIBLE_DEVICE_TYPE, "Incompatible Device Type"}, + {SKINNY_TEXTID_NO_PARK_NUMBER_AVAILABLE, "No Park Number Available"}, + {SKINNY_TEXTID_CALLPARK_REVERSION, "Callpark Reversion"}, + {SKINNY_TEXTID_SERVICE_IS_NOT_ACTIVE, "Service Is Not Active"}, + {SKINNY_TEXTID_HIGH_TRAFFIC_TRY_AGAIN_LATER, "High Traffic Try Again Later"}, + {SKINNY_TEXTID_QRT, "Qrt"}, + {SKINNY_TEXTID_MCID, "Mcid"}, + {SKINNY_TEXTID_DIRTRFR, "Dirtrfr"}, + {SKINNY_TEXTID_SELECT, "Select"}, + {SKINNY_TEXTID_CONFLIST, "Conflist"}, + {SKINNY_TEXTID_IDIVERT, "Idivert"}, + {SKINNY_TEXTID_CBARGE, "Cbarge"}, + {SKINNY_TEXTID_CAN_NOT_COMPLETE_TRANSFER, "Can Not Complete Transfer"}, + {SKINNY_TEXTID_CAN_NOT_JOIN_CALLS, "Can Not Join Calls"}, + {SKINNY_TEXTID_MCID_SUCCESSFUL, "Mcid Successful"}, + {SKINNY_TEXTID_NUMBER_NOT_CONFIGURED, "Number Not Configured"}, + {SKINNY_TEXTID_SECURITY_ERROR, "Security Error"}, + {SKINNY_TEXTID_VIDEO_BANDWIDTH_UNAVAILABLE, "Video Bandwidth Unavailable"}, + {SKINNY_TEXTID_VIDMODE, "Vidmode"}, + {SKINNY_TEXTID_MAX_CALL_DURATION_TIMEOUT, "Max Call Duration Timeout"}, + {SKINNY_TEXTID_MAX_HOLD_DURATION_TIMEOUT, "Max Hold Duration Timeout"}, + {SKINNY_TEXTID_OPICKUP, "Opickup"}, + {SKINNY_TEXTID_EXTERNAL_TRANSFER_RESTRICTED, "External Transfer Restricted"}, + {SKINNY_TEXTID_MAC_ADDRESS, "Mac Address"}, + {SKINNY_TEXTID_HOST_NAME, "Host Name"}, + {SKINNY_TEXTID_DOMAIN_NAME, "Domain Name"}, + {SKINNY_TEXTID_IP_ADDRESS, "Ip Address"}, + {SKINNY_TEXTID_SUBNET_MASK, "Subnet Mask"}, + {SKINNY_TEXTID_TFTP_SERVER_1, "Tftp Server 1"}, + {SKINNY_TEXTID_DEFAULT_ROUTER_1, "Default Router 1"}, + {SKINNY_TEXTID_DEFAULT_ROUTER_2, "Default Router 2"}, + {SKINNY_TEXTID_DEFAULT_ROUTER_3, "Default Router 3"}, + {SKINNY_TEXTID_DEFAULT_ROUTER_4, "Default Router 4"}, + {SKINNY_TEXTID_DEFAULT_ROUTER_5, "Default Router 5"}, + {SKINNY_TEXTID_DNS_SERVER_1, "Dns Server 1"}, + {SKINNY_TEXTID_DNS_SERVER_2, "Dns Server 2"}, + {SKINNY_TEXTID_DNS_SERVER_3, "Dns Server 3"}, + {SKINNY_TEXTID_DNS_SERVER_4, "Dns Server 4"}, + {SKINNY_TEXTID_DNS_SERVER_5, "Dns Server 5"}, + {SKINNY_TEXTID_OPERATIONAL_VLAN_ID, "Operational Vlan Id"}, + {SKINNY_TEXTID_ADMIN_VLAN_ID, "Admin Vlan Id"}, + {SKINNY_TEXTID_CALL_MANAGER_1, "Call Manager 1"}, + {SKINNY_TEXTID_CALL_MANAGER_2, "Call Manager 2"}, + {SKINNY_TEXTID_CALL_MANAGER_3, "Call Manager 3"}, + {SKINNY_TEXTID_CALL_MANAGER_4, "Call Manager 4"}, + {SKINNY_TEXTID_CALL_MANAGER_5, "Call Manager 5"}, + {SKINNY_TEXTID_INFORMATION_URL, "Information Url"}, + {SKINNY_TEXTID_DIRECTORIES_URL, "Directories Url"}, + {SKINNY_TEXTID_MESSAGES_URL, "Messages Url"}, + {SKINNY_TEXTID_SERVICES_URL, "Services Url"}, + {0, NULL} + }; + SKINNY_DECLARE_ID2STR(skinny_textid2str, SKINNY_TEXTIDS, "Unknown") +SKINNY_DECLARE_STR2ID(skinny_str2textid, SKINNY_TEXTIDS, -1) + /* For Emacs: * Local Variables: * mode:c diff --git a/src/mod/endpoints/mod_skinny/skinny_tables.h b/src/mod/endpoints/mod_skinny/skinny_tables.h index e7fc4a9b7b..40d02fa501 100644 --- a/src/mod/endpoints/mod_skinny/skinny_tables.h +++ b/src/mod/endpoints/mod_skinny/skinny_tables.h @@ -106,6 +106,10 @@ enum skinny_tone { SKINNY_TONE_CALLWAITTONE = 0x2D, SKINNY_TONE_NOTONE = 0x7F, }; +extern struct skinny_table SKINNY_TONES[9]; +const char *skinny_tone2str(uint32_t id); +uint32_t skinny_str2tone(const char *str); +#define SKINNY_PUSH_TONES SKINNY_DECLARE_PUSH_MATCH(SKINNY_TONES) enum skinny_ring_type { SKINNY_RING_OFF = 1, @@ -269,6 +273,134 @@ const char *skinny_accessory_state2str(uint32_t id); uint32_t skinny_str2accessory_state(const char *str); #define SKINNY_PUSH_ACCESSORY_STATES SKINNY_DECLARE_PUSH_MATCH(SKINNY_ACCESSORY_STATES) +enum skinny_label { + SKINNY_TEXTID_EMPTY = 0, + SKINNY_TEXTID_REDIAL = 1, + SKINNY_TEXTID_NEWCALL = 2, + SKINNY_TEXTID_HOLD = 3, + SKINNY_TEXTID_TRANSFER = 4, + SKINNY_TEXTID_CFWDALL = 5, + SKINNY_TEXTID_CFWDBUSY = 6, + SKINNY_TEXTID_CFWDNOANSWER = 7, + SKINNY_TEXTID_BACKSPACE = 8, + SKINNY_TEXTID_ENDCALL = 9, + SKINNY_TEXTID_RESUME = 10, + SKINNY_TEXTID_ANSWER = 11, + SKINNY_TEXTID_INFO = 12, + SKINNY_TEXTID_CONF = 13, + SKINNY_TEXTID_PARK = 14, + SKINNY_TEXTID_JOIN = 15, + SKINNY_TEXTID_MEETME = 16, + SKINNY_TEXTID_CALLPICKUP = 17, + SKINNY_TEXTID_GRPCALLPICKUP = 18, + SKINNY_TEXTID_YOUR_CURRENT_OPTIONS = 19, + SKINNY_TEXTID_OFF_HOOK = 20, + SKINNY_TEXTID_ON_HOOK = 21, + SKINNY_TEXTID_RING_OUT = 22, + SKINNY_TEXTID_FROM = 23, + SKINNY_TEXTID_CONNECTED = 24, + SKINNY_TEXTID_BUSY = 25, + SKINNY_TEXTID_LINE_IN_USE = 26, + SKINNY_TEXTID_CALL_WAITING = 27, + SKINNY_TEXTID_CALL_TRANSFER = 28, + SKINNY_TEXTID_CALL_PARK = 29, + SKINNY_TEXTID_CALL_PROCEED = 30, + SKINNY_TEXTID_IN_USE_REMOTE = 31, + SKINNY_TEXTID_ENTER_NUMBER = 32, + SKINNY_TEXTID_CALL_PARK_AT = 33, + SKINNY_TEXTID_PRIMARY_ONLY = 34, + SKINNY_TEXTID_TEMP_FAIL = 35, + SKINNY_TEXTID_YOU_HAVE_VOICEMAIL = 36, + SKINNY_TEXTID_FORWARDED_TO = 37, + SKINNY_TEXTID_CAN_NOT_COMPLETE_CONFERENCE = 38, + SKINNY_TEXTID_NO_CONFERENCE_BRIDGE = 39, + SKINNY_TEXTID_CAN_NOT_HOLD_PRIMARY_CONTROL = 40, + SKINNY_TEXTID_INVALID_CONFERENCE_PARTICIPANT = 41, + SKINNY_TEXTID_IN_CONFERENCE_ALREADY = 42, + SKINNY_TEXTID_NO_PARTICIPANT_INFO = 43, + SKINNY_TEXTID_EXCEED_MAXIMUM_PARTIES = 44, + SKINNY_TEXTID_KEY_IS_NOT_ACTIVE = 45, + SKINNY_TEXTID_ERROR_NO_LICENSE = 46, + SKINNY_TEXTID_ERROR_DBCONFIG = 47, + SKINNY_TEXTID_ERROR_DATABASE = 48, + SKINNY_TEXTID_ERROR_PASS_LIMIT = 49, + SKINNY_TEXTID_ERROR_UNKNOWN = 50, + SKINNY_TEXTID_ERROR_MISMATCH = 51, + SKINNY_TEXTID_CONFERENCE = 52, + SKINNY_TEXTID_PARK_NUMBER = 53, + SKINNY_TEXTID_PRIVATE = 54, + SKINNY_TEXTID_NOT_ENOUGH_BANDWIDTH = 55, + SKINNY_TEXTID_UNKNOWN_NUMBER = 56, + SKINNY_TEXTID_RMLSTC = 57, + SKINNY_TEXTID_VOICEMAIL = 58, + SKINNY_TEXTID_IMMDIV = 59, + SKINNY_TEXTID_INTRCPT = 60, + SKINNY_TEXTID_SETWTCH = 61, + SKINNY_TEXTID_TRNSFVM = 62, + SKINNY_TEXTID_DND = 63, + SKINNY_TEXTID_DIVALL = 64, + SKINNY_TEXTID_CALLBACK = 65, + SKINNY_TEXTID_NETWORK_CONGESTION_REROUTING = 66, + SKINNY_TEXTID_BARGE = 67, + SKINNY_TEXTID_FAILED_TO_SETUP_BARGE = 68, + SKINNY_TEXTID_ANOTHER_BARGE_EXISTS = 69, + SKINNY_TEXTID_INCOMPATIBLE_DEVICE_TYPE = 70, + SKINNY_TEXTID_NO_PARK_NUMBER_AVAILABLE = 71, + SKINNY_TEXTID_CALLPARK_REVERSION = 72, + SKINNY_TEXTID_SERVICE_IS_NOT_ACTIVE = 73, + SKINNY_TEXTID_HIGH_TRAFFIC_TRY_AGAIN_LATER = 74, + SKINNY_TEXTID_QRT = 75, + SKINNY_TEXTID_MCID = 76, + SKINNY_TEXTID_DIRTRFR = 77, + SKINNY_TEXTID_SELECT = 78, + SKINNY_TEXTID_CONFLIST = 79, + SKINNY_TEXTID_IDIVERT = 80, + SKINNY_TEXTID_CBARGE = 81, + SKINNY_TEXTID_CAN_NOT_COMPLETE_TRANSFER = 82, + SKINNY_TEXTID_CAN_NOT_JOIN_CALLS = 83, + SKINNY_TEXTID_MCID_SUCCESSFUL = 84, + SKINNY_TEXTID_NUMBER_NOT_CONFIGURED = 85, + SKINNY_TEXTID_SECURITY_ERROR = 86, + SKINNY_TEXTID_VIDEO_BANDWIDTH_UNAVAILABLE = 87, + SKINNY_TEXTID_VIDMODE = 88, + SKINNY_TEXTID_MAX_CALL_DURATION_TIMEOUT = 89, + SKINNY_TEXTID_MAX_HOLD_DURATION_TIMEOUT = 90, + SKINNY_TEXTID_OPICKUP = 91, + SKINNY_TEXTID_EXTERNAL_TRANSFER_RESTRICTED = 97, + SKINNY_TEXTID_MAC_ADDRESS = 101, + SKINNY_TEXTID_HOST_NAME = 102, + SKINNY_TEXTID_DOMAIN_NAME = 103, + SKINNY_TEXTID_IP_ADDRESS = 104, + SKINNY_TEXTID_SUBNET_MASK = 105, + SKINNY_TEXTID_TFTP_SERVER_1 = 106, + SKINNY_TEXTID_DEFAULT_ROUTER_1 = 107, + SKINNY_TEXTID_DEFAULT_ROUTER_2 = 108, + SKINNY_TEXTID_DEFAULT_ROUTER_3 = 109, + SKINNY_TEXTID_DEFAULT_ROUTER_4 = 110, + SKINNY_TEXTID_DEFAULT_ROUTER_5 = 111, + SKINNY_TEXTID_DNS_SERVER_1 = 112, + SKINNY_TEXTID_DNS_SERVER_2 = 113, + SKINNY_TEXTID_DNS_SERVER_3 = 114, + SKINNY_TEXTID_DNS_SERVER_4 = 115, + SKINNY_TEXTID_DNS_SERVER_5 = 116, + SKINNY_TEXTID_OPERATIONAL_VLAN_ID = 117, + SKINNY_TEXTID_ADMIN_VLAN_ID = 118, + SKINNY_TEXTID_CALL_MANAGER_1 = 119, + SKINNY_TEXTID_CALL_MANAGER_2 = 120, + SKINNY_TEXTID_CALL_MANAGER_3 = 121, + SKINNY_TEXTID_CALL_MANAGER_4 = 122, + SKINNY_TEXTID_CALL_MANAGER_5 = 123, + SKINNY_TEXTID_INFORMATION_URL = 124, + SKINNY_TEXTID_DIRECTORIES_URL = 125, + SKINNY_TEXTID_MESSAGES_URL = 126, + SKINNY_TEXTID_SERVICES_URL = 127 +}; +extern struct skinny_table SKINNY_TEXTIDS[128]; +const char *skinny_textid2str(uint32_t id); +uint32_t skinny_str2textid(const char *str); +#define SKINNY_PUSH_TEXTIDS SKINNY_DECLARE_PUSH_MATCH(SKINNY_TEXTIDS) + + #endif /* _SKINNY_TABLES_H */ /* For Emacs: