]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Skinny: implement hold/resume
authorMathieu Parent <math.parent@gmail.com>
Fri, 9 Apr 2010 14:12:58 +0000 (16:12 +0200)
committerMathieu Parent <math.parent@gmail.com>
Fri, 9 Apr 2010 14:12:58 +0000 (16:12 +0200)
Also rework a bit softkey sets

src/mod/endpoints/mod_skinny/mod_skinny.c
src/mod/endpoints/mod_skinny/skinny_protocol.c
src/mod/endpoints/mod_skinny/skinny_protocol.h

index d086c9deb0e8bb3ab4baa76bb15a9db64eadf833..7b5be3529f4be20b88373e07864f4c70ed1f6319 100644 (file)
@@ -642,16 +642,7 @@ int channel_on_hangup_callback(void *pArg, int argc, char **argv, char **columnN
                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);
index 3d72a22640fc1286b011b230d41f91deccad250f..2361fa2801618843d3d0fdbb373d678b70eacce3 100644 (file)
@@ -784,17 +784,66 @@ switch_status_t skinny_session_hold_line(switch_core_session_t *session, listene
        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");
-
-       switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
+       skinny_session_stop_media(session, listener, line_instance);
+       switch_ivr_hold(session, NULL, 1);
+
+       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;
 }
 
@@ -1840,10 +1889,21 @@ switch_status_t skinny_handle_soft_key_set_request(listener_t *listener, skinny_
        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);
 
index ea004f12fc12ca3ab12d15bd71dd6606c8eddf6e..74a24a05907847e2a7fda6ed3b42e25141eb697b 100644 (file)
@@ -630,6 +630,7 @@ switch_status_t skinny_session_answer(switch_core_session_t *session, listener_t
 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);