- add underlay api implementation
[oweals/gnunet.git] / src / conversation / conversation_api_call.c
index 20992c6b58ce6de08fad6348230aebaea0e32e60..c3d414a50296d57369453ef6e73922918b8f3019 100644 (file)
@@ -215,10 +215,10 @@ handle_call_suspend (void *cls,
     break;
   case CS_ACTIVE:
     call->state = CS_SUSPENDED_CALLEE;
-    call->event_handler (call->event_handler_cls,
-                         GNUNET_CONVERSATION_EC_CALL_SUSPENDED);
     call->speaker->disable_speaker (call->speaker->cls);
     call->mic->disable_microphone (call->mic->cls);
+    call->event_handler (call->event_handler_cls,
+                         GNUNET_CONVERSATION_EC_CALL_SUSPENDED);
     break;
   case CS_SHUTDOWN:
     GNUNET_CONVERSATION_call_stop (call);
@@ -254,12 +254,12 @@ handle_call_resume (void *cls,
     break;
   case CS_SUSPENDED_CALLEE:
     call->state = CS_ACTIVE;
-    call->event_handler (call->event_handler_cls,
-                         GNUNET_CONVERSATION_EC_CALL_RESUMED);
     call->speaker->enable_speaker (call->speaker->cls);
     call->mic->enable_microphone (call->mic->cls,
                                   &transmit_call_audio,
                                   call);
+    call->event_handler (call->event_handler_cls,
+                         GNUNET_CONVERSATION_EC_CALL_RESUMED);
     break;
   case CS_SUSPENDED_BOTH:
     call->state = CS_SUSPENDED_CALLER;
@@ -296,12 +296,12 @@ handle_call_picked_up (void *cls,
     break;
   case CS_RINGING:
     call->state = CS_ACTIVE;
-    call->event_handler (call->event_handler_cls,
-                         GNUNET_CONVERSATION_EC_CALL_PICKED_UP);
     call->speaker->enable_speaker (call->speaker->cls);
     call->mic->enable_microphone (call->mic->cls,
                                   &transmit_call_audio,
                                   call);
+    call->event_handler (call->event_handler_cls,
+                         GNUNET_CONVERSATION_EC_CALL_PICKED_UP);
     break;
   case CS_SUSPENDED_CALLER:
   case CS_SUSPENDED_CALLEE:
@@ -328,6 +328,8 @@ handle_call_hangup (void *cls,
                     const struct GNUNET_MessageHeader *msg)
 {
   struct GNUNET_CONVERSATION_Call *call = cls;
+  GNUNET_CONVERSATION_CallEventHandler eh;
+  void *eh_cls;
 
   switch (call->state)
   {
@@ -340,9 +342,10 @@ handle_call_hangup (void *cls,
   case CS_SUSPENDED_CALLEE:
   case CS_SUSPENDED_BOTH:
   case CS_ACTIVE:
-    call->event_handler (call->event_handler_cls,
-                         GNUNET_CONVERSATION_EC_CALL_HUNG_UP);
+    eh = call->event_handler;
+    eh_cls = call->event_handler_cls;
     GNUNET_CONVERSATION_call_stop (call);
+    eh (eh_cls, GNUNET_CONVERSATION_EC_CALL_HUNG_UP);
     return;
   case CS_SHUTDOWN:
     GNUNET_CONVERSATION_call_stop (call);