diff --git a/console/commands.c b/console/commands.c index aaa72fa87..372eef24e 100644 --- a/console/commands.c +++ b/console/commands.c @@ -745,14 +745,16 @@ lpc_cmd_redirect(LinphoneCore *lc, char *args){ if (linphone_call_get_state(call)==LinphoneCallIncomingReceived){ if (linphone_core_redirect_call(lc,call,args) != 0) { linphonec_out("Could not redirect call.\n"); + elem=elem->next; + } else { + didit=1; + /*as the redirection closes the call, we need to re-check the call list that is invalidated.*/ + elem=linphone_core_get_calls(lc); } - didit=1; - /*as the redirection closes the call, we need to re-check the call list that is invalidated.*/ - elem=linphone_core_get_calls(lc); }else elem=elem->next; } if (didit==0){ - linphonec_out("There is no pending incoming call to redirect."); + linphonec_out("There is no pending incoming call to redirect.\n"); } return 1; }