From 23530ebb23f59aee1860494bc59c0a033f6480bc Mon Sep 17 00:00:00 2001
From: Nathan Neulinger <nneul@neulinger.org>
Date: Mon, 23 Sep 2013 13:18:00 -0500
Subject: [PATCH] add send of DisplayPromptStatusMessage and ForwardAll
 stimulus

---
 src/mod/endpoints/mod_skinny/skinny_api.c    | 30 ++++++++++++++++++++
 src/mod/endpoints/mod_skinny/skinny_tables.c |  1 +
 src/mod/endpoints/mod_skinny/skinny_tables.h |  3 +-
 3 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/src/mod/endpoints/mod_skinny/skinny_api.c b/src/mod/endpoints/mod_skinny/skinny_api.c
index daebbb9385..f4c9560352 100644
--- a/src/mod/endpoints/mod_skinny/skinny_api.c
+++ b/src/mod/endpoints/mod_skinny/skinny_api.c
@@ -407,6 +407,28 @@ static switch_status_t skinny_api_cmd_profile_device_send_forward_stat_message(c
 	return SWITCH_STATUS_SUCCESS;
 }
 
+static switch_status_t skinny_api_cmd_profile_device_send_display_prompt_status_message(const char *profile_name, const char *device_name, const char *display, switch_stream_handle_t *stream)
+{
+	skinny_profile_t *profile;
+
+	if ((profile = skinny_find_profile(profile_name))) {
+		listener_t *listener = NULL;
+		skinny_profile_find_listener_by_device_name(profile, device_name, &listener);
+		if(listener) {
+
+			send_display_prompt_status(listener, 0, display, 0, 0); 
+
+			stream->write_function(stream, "+OK\n");
+		} else {
+			stream->write_function(stream, "Listener not found!\n");
+		}
+	} else {
+		stream->write_function(stream, "Profile not found!\n");
+	}
+
+	return SWITCH_STATUS_SUCCESS;
+}
+
 static switch_status_t skinny_api_cmd_profile_device_send_reset_message(const char *profile_name, const char *device_name, const char *reset_type, switch_stream_handle_t *stream)
 {
 	skinny_profile_t *profile;
@@ -521,6 +543,7 @@ SWITCH_STANDARD_API(skinny_function)
 		"skinny profile <profile_name> device <device_name> send SetSpeakerModeMessage <speaker_mode>\n"
 		"skinny profile <profile_name> device <device_name> send CallStateMessage <call_state> <line_instance> <call_id>\n"
 		"skinny profile <profile_name> device <device_name> send ForwardStatMessage <number>\n"
+		"skinny profile <profile_name> device <device_name> send DisplayPromptStatus <message>\n"
 		"skinny profile <profile_name> device <device_name> send <UserToDeviceDataMessage|UserToDeviceDataVersion1Message> [ <param>=<value>;... ] <data>\n"
 		"skinny profile <profile_name> set <name> <value>\n"
 		"--------------------------------------------------------------------------------\n";
@@ -593,6 +616,12 @@ SWITCH_STANDARD_API(skinny_function)
 					status = skinny_api_cmd_profile_device_send_forward_stat_message(argv[1], argv[3], NULL, stream);
 				}
 				break;
+			case DISPLAY_PROMPT_STATUS_MESSAGE:
+				if (argc == 7) {
+					/* DisplayPromptStatus <display> */
+					status = skinny_api_cmd_profile_device_send_display_prompt_status_message(argv[1], argv[3], argv[6], stream);
+				}
+				break;
 			case RESET_MESSAGE:
 				if (argc == 7) {
 					/* ResetMessage <reset_type> */
@@ -644,6 +673,7 @@ switch_status_t skinny_api_register(switch_loadable_module_interface_t **module_
 	switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices send SetSpeakerModeMessage ::skinny::list_speaker_modes");
 	switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices send CallStateMessage ::skinny::list_call_states ::skinny::list_line_instances ::skinny::list_call_ids");
 	switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices send ForwardStatMessage");
+	switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices send DisplayPromptStatusMessage");
 	switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices send UserToDeviceDataMessage");
 	switch_console_set_complete("add skinny profile ::skinny::list_profiles device ::skinny::list_devices send UserToDeviceDataVersion1Message");
 	switch_console_set_complete("add skinny profile ::skinny::list_profiles set ::skinny::list_settings");
diff --git a/src/mod/endpoints/mod_skinny/skinny_tables.c b/src/mod/endpoints/mod_skinny/skinny_tables.c
index ea29918cbb..9c053d6b58 100644
--- a/src/mod/endpoints/mod_skinny/skinny_tables.c
+++ b/src/mod/endpoints/mod_skinny/skinny_tables.c
@@ -212,6 +212,7 @@ SKINNY_DECLARE_STR2ID(skinny_str2ring_mode, SKINNY_RING_MODES, -1)
 		{SKINNY_BUTTON_LAST_NUMBER_REDIAL, "LastNumberRedial"},
 		{SKINNY_BUTTON_SPEED_DIAL, "SpeedDial"},
 		{SKINNY_BUTTON_HOLD, "Hold"},
+		{SKINNY_BUTTON_FORWARDALL, "ForwardAll"},
 		{SKINNY_BUTTON_TRANSFER, "Transfer"},
 		{SKINNY_BUTTON_LINE, "Line"},
 		{SKINNY_BUTTON_VOICEMAIL, "Voicemail"},
diff --git a/src/mod/endpoints/mod_skinny/skinny_tables.h b/src/mod/endpoints/mod_skinny/skinny_tables.h
index 647837f212..4fea984756 100644
--- a/src/mod/endpoints/mod_skinny/skinny_tables.h
+++ b/src/mod/endpoints/mod_skinny/skinny_tables.h
@@ -165,13 +165,14 @@ enum skinny_button_definition {
 	SKINNY_BUTTON_SPEED_DIAL = 0x02,
 	SKINNY_BUTTON_HOLD = 0x03,
 	SKINNY_BUTTON_TRANSFER = 0x04,
+	SKINNY_BUTTON_FORWARDALL = 0x05,
 	SKINNY_BUTTON_LINE = 0x09,
 	SKINNY_BUTTON_VOICEMAIL = 0x0F,
 	SKINNY_BUTTON_PRIVACY = 0x13,
 	SKINNY_BUTTON_SERVICE_URL = 0x14,
 	SKINNY_BUTTON_UNDEFINED = 0xFF,
 };
-extern struct skinny_table SKINNY_BUTTONS[11];
+extern struct skinny_table SKINNY_BUTTONS[12];
 const char *skinny_button2str(uint32_t id);
 uint32_t skinny_str2button(const char *str);
 #define SKINNY_PUSH_STIMULI SKINNY_DECLARE_PUSH_MATCH(SKINNY_BUTTONS)