]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Skinny: handle Enbloc messages
authorMathieu Parent <mathieu@tourthieu.sathieu.net>
Tue, 1 Feb 2011 07:54:53 +0000 (08:54 +0100)
committerMathieu Parent <math.parent@gmail.com>
Tue, 1 Feb 2011 07:56:26 +0000 (08:56 +0100)
src/mod/endpoints/mod_skinny/skinny_protocol.h
src/mod/endpoints/mod_skinny/skinny_server.c
src/mod/endpoints/mod_skinny/skinny_tables.c
src/mod/endpoints/mod_skinny/skinny_tables.h

index 20e7d7f92f8a1c27f12a2b06d58248fbac5ff68e..1a26558ffc02d2f2dc3d3e7a6215f49d4e9321b8 100644 (file)
@@ -68,6 +68,13 @@ struct PACKED keypad_button_message {
     uint32_t call_id;
 };
 
+/* EnblocCallMessage */
+#define ENBLOC_CALL_MESSAGE 0x0004
+struct PACKED enbloc_call_message {
+    char called_party[24];
+    uint32_t line_instance;
+};
+
 /* StimulusMessage */
 #define STIMULUS_MESSAGE 0x0005
 struct PACKED stimulus_message {
@@ -562,6 +569,7 @@ union skinny_data {
     struct register_message reg;
     struct port_message port;
     struct keypad_button_message keypad_button;
+    struct enbloc_call_message enbloc_call;
     struct stimulus_message stimulus;
     struct off_hook_message off_hook;
     struct on_hook_message on_hook;
index 5874be4c6cb9b37e14b66a0f889d282681081d74..e7c761dfcab10ebf87fb51e5953d2b448b9aaa54 100644 (file)
@@ -1171,6 +1171,29 @@ switch_status_t skinny_handle_keypad_button_message(listener_t *listener, skinny
        return SWITCH_STATUS_SUCCESS;
 }
 
+switch_status_t skinny_handle_enbloc_call_message(listener_t *listener, skinny_message_t *request)
+{
+       uint32_t line_instance = 1;
+       switch_core_session_t *session = NULL;
+
+       skinny_check_data_length(request, sizeof(request->data.enbloc_call.called_party));
+
+       if(skinny_check_data_length_soft(request, sizeof(request->data.enbloc_call))) {
+               if (request->data.enbloc_call.line_instance > 0) {
+                       line_instance = request->data.enbloc_call.line_instance;
+               }
+       }
+
+       session = skinny_profile_find_session(listener->profile, listener, &line_instance, 0);
+
+       if(session) {
+               skinny_session_process_dest(session, listener, line_instance, request->data.enbloc_call.called_party, '\0', 0);
+               switch_core_session_rwunlock(session);
+       }
+
+       return SWITCH_STATUS_SUCCESS;
+}
+
 switch_status_t skinny_handle_stimulus_message(listener_t *listener, skinny_message_t *request)
 {
        switch_status_t status = SWITCH_STATUS_SUCCESS;
@@ -2004,6 +2027,8 @@ switch_status_t skinny_handle_request(listener_t *listener, skinny_message_t *re
                        return skinny_handle_port_message(listener, request);
                case KEYPAD_BUTTON_MESSAGE:
                        return skinny_handle_keypad_button_message(listener, request);
+               case ENBLOC_CALL_MESSAGE:
+                       return skinny_handle_enbloc_call_message(listener, request);
                case STIMULUS_MESSAGE:
                        return skinny_handle_stimulus_message(listener, request);
                case OFF_HOOK_MESSAGE:
index 053b350b46cc2851fd5444cab8a78722826e5127..466a70538d093be57173b742277ba3e3412b4054 100644 (file)
@@ -39,6 +39,7 @@ struct skinny_table SKINNY_MESSAGE_TYPES[] = {
     {"RegisterMessage", REGISTER_MESSAGE},
     {"PortMessage", PORT_MESSAGE},
     {"KeypadButtonMessage", KEYPAD_BUTTON_MESSAGE},
+    {"EnblocCallMessage", ENBLOC_CALL_MESSAGE},
     {"StimulusMessage", STIMULUS_MESSAGE},
     {"OffHookMessage", OFF_HOOK_MESSAGE},
     {"OnHookMessage", ON_HOOK_MESSAGE},
index c119e1f141b5d42a9f3a3a623221a8f215dae585..bc92f9f4bf60e62e0fa1f28c4601501c61ae59c0 100644 (file)
@@ -87,7 +87,7 @@ uint32_t func(const char *str)\
     }
 
 
-extern struct skinny_table SKINNY_MESSAGE_TYPES[66];
+extern struct skinny_table SKINNY_MESSAGE_TYPES[67];
 const char *skinny_message_type2str(uint32_t id);
 uint32_t skinny_str2message_type(const char *str);
 #define SKINNY_PUSH_MESSAGE_TYPES SKINNY_DECLARE_PUSH_MATCH(SKINNY_MESSAGE_TYPES)