]> sjero.net Git - linphone/commitdiff
Add transfer_state property to LinphoneCall
authorPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@linphone.org>
Tue, 3 Apr 2012 13:34:03 +0000 (15:34 +0200)
committerPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@linphone.org>
Tue, 3 Apr 2012 14:13:12 +0000 (16:13 +0200)
coreapi/callbacks.c
coreapi/linphonecall.c
coreapi/linphonecore.c
coreapi/linphonecore.h
coreapi/private.h

index 34fd552af15461809a7592d674f863890df94ce1..c58b42e73f81361bbc3e59c5ef8e85d1a08d63d9 100644 (file)
@@ -420,6 +420,7 @@ static void call_resumed(LinphoneCore *lc, LinphoneCall *call){
        if(lc->vtable.display_status)
                lc->vtable.display_status(lc,_("We have been resumed."));
        linphone_call_set_state(call,LinphoneCallStreamsRunning,"Connected (streams running)");
+       linphone_call_set_transfer_state(call, LinphoneCallIdle);
 }
 
 static void call_paused_by_remote(LinphoneCore *lc, LinphoneCall *call){
@@ -821,8 +822,7 @@ static void notify_refer(SalOp *op, SalReferStatus status){
                default:
                        cstate=LinphoneCallError;
        }
-       if (lc->vtable.transfer_state_changed)
-               lc->vtable.transfer_state_changed(lc,call,cstate);
+       linphone_call_set_transfer_state(call, cstate);
        if (cstate==LinphoneCallConnected){
                /*automatically terminate the call as the transfer is complete.*/
                linphone_core_terminate_call(lc,call);
index 9c3ecfd11a18976aab1d1c6883913c0bdad682bb..d41c6cdadacd5319b18b6f2b133845957de9a052 100644 (file)
@@ -295,6 +295,7 @@ static void linphone_call_init_common(LinphoneCall *call, LinphoneAddress *from,
        call->magic=linphone_call_magic;
        call->refcnt=1;
        call->state=LinphoneCallIdle;
+       call->transfer_state = LinphoneCallIdle;
        call->start_time=time(NULL);
        call->media_start_time=0;
        call->log=linphone_call_log_new(call, from, to);
@@ -1675,4 +1676,16 @@ void linphone_call_log_completed(LinphoneCall *call){
        call_logs_write_to_config_file(lc);
 }
 
+LinphoneCallState linphone_call_get_transfer_state(LinphoneCall *call) {
+       return call->transfer_state;
+}
+
+void linphone_call_set_transfer_state(LinphoneCall* call, LinphoneCallState state) {
+       if (state != call->transfer_state) {
+               LinphoneCore* lc = call->core;
+               call->transfer_state = state;
+               if (lc->vtable.transfer_state_changed)
+                       lc->vtable.transfer_state_changed(lc, call, state);
+       }
+}
 
index f99cb9c2906db1681aab750309c677e6a27735ad..3a081d23dfc0fe61d5b7e079d360ed5b47aa5cd5 100644 (file)
@@ -2262,6 +2262,7 @@ int linphone_core_transfer_call(LinphoneCore *lc, LinphoneCall *call, const char
        sal_call_refer(call->op,real_url);
        ms_free(real_url);
        linphone_address_destroy(real_parsed_url);
+       linphone_call_set_transfer_state(call, LinphoneCallOutgoingInit);
        return 0;
 }
 
@@ -2278,7 +2279,9 @@ int linphone_core_transfer_call(LinphoneCore *lc, LinphoneCall *call, const char
  * close the call with us (the 'dest' call).
 **/
 int linphone_core_transfer_call_to_another(LinphoneCore *lc, LinphoneCall *call, LinphoneCall *dest){
-       return sal_call_refer_with_replaces (call->op,dest->op);
+       int result = sal_call_refer_with_replaces (call->op,dest->op);
+       linphone_call_set_transfer_state(call, LinphoneCallOutgoingInit);
+       return result;
 }
 
 bool_t linphone_core_inc_invite_pending(LinphoneCore*lc){
index 9ed6297107e65ccac6a5272bf9b73c8a10a123e8..d2860c3a2812b646a8fe86a44a7c12b741194653 100644 (file)
@@ -291,6 +291,7 @@ void linphone_call_send_vfu_request(LinphoneCall *call);
 void *linphone_call_get_user_pointer(LinphoneCall *call);
 void linphone_call_set_user_pointer(LinphoneCall *call, void *user_pointer);
 void linphone_call_set_next_video_frame_decoded_callback(LinphoneCall *call, LinphoneCallCbFunc cb, void* user_data);
+LinphoneCallState linphone_call_get_transfer_state(LinphoneCall *call);
     
 /**
  * Enables or disable echo cancellation for this call
index 425b51008e39ca4aadf2268aa3347acbecd72681..ec57eaf9cb1e0067644dae3276b24f01a1cfd54c 100644 (file)
@@ -100,6 +100,7 @@ struct _LinphoneCall
        time_t start_time; /*time at which the call was initiated*/
        time_t media_start_time; /*time at which it was accepted, media streams established*/
        LinphoneCallState       state;
+       LinphoneCallState transfer_state; /*idle if no transfer*/
        LinphoneReason reason;
        int refcnt;
        void * user_pointer;
@@ -142,6 +143,7 @@ void linphone_call_set_state(LinphoneCall *call, LinphoneCallState cstate, const
 LinphoneCallLog * linphone_call_log_new(LinphoneCall *call, LinphoneAddress *local, LinphoneAddress * remote);
 void linphone_call_log_completed(LinphoneCall *call);
 void linphone_call_log_destroy(LinphoneCallLog *cl);
+void linphone_call_set_transfer_state(LinphoneCall* call, LinphoneCallState state);
 
 void linphone_auth_info_write_config(struct _LpConfig *config, LinphoneAuthInfo *obj, int pos);