Revision
17264
Author
math.parent
Date
2010-04-09 09:12:58 -0500 (Fri, 09 Apr 2010)

Log Message

Skinny: implement hold/resume

Also rework a bit softkey sets

Modified Paths

Diff

Modified: freeswitch/trunk/src/mod/endpoints/mod_skinny/mod_skinny.c (17263 => 17264)


--- freeswitch/trunk/src/mod/endpoints/mod_skinny/mod_skinny.c	2010-04-09 12:59:18 UTC (rev 17263)
+++ freeswitch/trunk/src/mod/endpoints/mod_skinny/mod_skinny.c	2010-04-09 14:12:58 UTC (rev 17264)
@@ -642,16 +642,7 @@
 		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 */
-			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, */
-			);
-			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, */
-			);
+			skinny_session_stop_media(helper->tech_pvt->session, listener, line_instance);
 		}
 
 		skinny_line_set_state(listener, line_instance, call_id, SKINNY_ON_HOOK);

Modified: freeswitch/trunk/src/mod/endpoints/mod_skinny/skinny_protocol.c (17263 => 17264)


--- freeswitch/trunk/src/mod/endpoints/mod_skinny/skinny_protocol.c	2010-04-09 12:59:18 UTC (rev 17263)
+++ freeswitch/trunk/src/mod/endpoints/mod_skinny/skinny_protocol.c	2010-04-09 14:12:58 UTC (rev 17264)
@@ -784,20 +784,69 @@
 	channel = switch_core_session_get_channel(session);
 	tech_pvt = switch_core_session_get_private(session);
 
-	/* TODO */
-	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Hold is not implemented yet. Hanging up the line.\n");
+	skinny_session_stop_media(session, listener, line_instance);
+	switch_ivr_hold(session, NULL, 1);
 
-	switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
+	send_define_current_time_date(listener);
+	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, "\200\003",
+		line_instance, tech_pvt->call_id);
+	skinny_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);
 
 	return SWITCH_STATUS_SUCCESS;
 }
 
 switch_status_t skinny_session_unhold_line(switch_core_session_t *session, listener_t *listener, uint32_t line_instance)
 {
-	/* TODO */
+	switch_channel_t *channel = NULL;
+	private_t *tech_pvt = NULL;
+
+	switch_assert(session);
+	switch_assert(listener);
+	switch_assert(listener->profile);
+	
+	channel = switch_core_session_get_channel(session);
+	tech_pvt = switch_core_session_get_private(session);
+
+	send_set_ringer(listener, SKINNY_RING_OFF, SKINNY_RING_FOREVER, 0, tech_pvt->call_id);
+	send_set_speaker_mode(listener, SKINNY_SPEAKER_ON);
+	send_select_soft_keys(listener, line_instance, tech_pvt->call_id, SKINNY_KEY_SET_RING_OUT, 0xffff);
+	skinny_session_start_media(session, listener, line_instance);
+	switch_ivr_unhold(session);
+	send_set_lamp(listener, SKINNY_BUTTON_LINE, line_instance, SKINNY_LAMP_ON);
 	return SWITCH_STATUS_SUCCESS;
 }
 
+switch_status_t skinny_session_stop_media(switch_core_session_t *session, listener_t *listener, uint32_t line_instance)
+{
+	switch_channel_t *channel = NULL;
+	private_t *tech_pvt = NULL;
+
+	switch_assert(session);
+	switch_assert(listener);
+	switch_assert(listener->profile);
+	
+	channel = switch_core_session_get_channel(session);
+	tech_pvt = switch_core_session_get_private(session);
+
+	send_close_receive_channel(listener,
+		tech_pvt->call_id, /* uint32_t conference_id, */
+		tech_pvt->party_id, /* uint32_t pass_thru_party_id, */
+		tech_pvt->call_id /* uint32_t conference_id2, */
+	);
+	send_stop_media_transmission(listener,
+		tech_pvt->call_id, /* uint32_t conference_id, */
+		tech_pvt->party_id, /* uint32_t pass_thru_party_id, */
+		tech_pvt->call_id /* uint32_t conference_id2, */
+	);
+	 
+	return SWITCH_STATUS_SUCCESS;
+}
+
 /*****************************************************************************/
 /* SKINNY BUTTONS */
 /*****************************************************************************/
@@ -1840,11 +1889,22 @@
 	message->data.soft_key_set.total_soft_key_set_count = 11;
 
 	/* TODO fill the set */
-	message->data.soft_key_set.soft_key_set[SKINNY_KEY_SET_ON_HOOK].soft_key_template_index[0] = SOFTKEY_REDIAL;
-	message->data.soft_key_set.soft_key_set[SKINNY_KEY_SET_ON_HOOK].soft_key_template_index[1] = SOFTKEY_NEWCALL;
+	message->data.soft_key_set.soft_key_set[SKINNY_KEY_SET_ON_HOOK].soft_key_template_index[0] = SOFTKEY_NEWCALL;
+	message->data.soft_key_set.soft_key_set[SKINNY_KEY_SET_ON_HOOK].soft_key_template_index[1] = SOFTKEY_REDIAL;
+	
+	message->data.soft_key_set.soft_key_set[SKINNY_KEY_SET_OFF_HOOK].soft_key_template_index[0] = SOFTKEY_BACKSPACE;
+	message->data.soft_key_set.soft_key_set[SKINNY_KEY_SET_OFF_HOOK].soft_key_template_index[1] = SOFTKEY_REDIAL;
+
 	message->data.soft_key_set.soft_key_set[SKINNY_KEY_SET_CONNECTED].soft_key_template_index[0] = SOFTKEY_ENDCALL;
+	message->data.soft_key_set.soft_key_set[SKINNY_KEY_SET_CONNECTED].soft_key_template_index[1] = SOFTKEY_HOLD;
+	
 	message->data.soft_key_set.soft_key_set[SKINNY_KEY_SET_RING_IN].soft_key_template_index[0] = SOFTKEY_ENDCALL;
+	message->data.soft_key_set.soft_key_set[SKINNY_KEY_SET_RING_IN].soft_key_template_index[1] = SOFTKEY_ANSWER;
 
+	message->data.soft_key_set.soft_key_set[SKINNY_KEY_SET_ON_HOLD].soft_key_template_index[0] = SOFTKEY_RESUME;
+	message->data.soft_key_set.soft_key_set[SKINNY_KEY_SET_ON_HOLD].soft_key_template_index[1] = SOFTKEY_NEWCALL;
+	message->data.soft_key_set.soft_key_set[SKINNY_KEY_SET_ON_HOLD].soft_key_template_index[2] = SOFTKEY_ENDCALL;
+
 	skinny_send_reply(listener, message);
 
 	/* Init the states */

Modified: freeswitch/trunk/src/mod/endpoints/mod_skinny/skinny_protocol.h (17263 => 17264)


--- freeswitch/trunk/src/mod/endpoints/mod_skinny/skinny_protocol.h	2010-04-09 12:59:18 UTC (rev 17263)
+++ freeswitch/trunk/src/mod/endpoints/mod_skinny/skinny_protocol.h	2010-04-09 14:12:58 UTC (rev 17264)
@@ -630,6 +630,7 @@
 switch_status_t skinny_session_start_media(switch_core_session_t *session, listener_t *listener, uint32_t line_instance);
 switch_status_t skinny_session_hold_line(switch_core_session_t *session, listener_t *listener, uint32_t line_instance);
 switch_status_t skinny_session_unhold_line(switch_core_session_t *session, listener_t *listener, uint32_t line_instance);
+switch_status_t skinny_session_stop_media(switch_core_session_t *session, listener_t *listener, uint32_t line_instance);
 
 void skinny_line_get(listener_t *listener, uint32_t instance, struct line_stat_res_message **button);
 void skinny_speed_dial_get(listener_t *listener, uint32_t instance, struct speed_dial_stat_res_message **button);