linphonecore.c: linphone_core_redirect_call should interpret url as...

linphonecore.c: linphone_core_redirect_call should interpret url as linphone_core_transfer_call does
parent 1c599d08
......@@ -743,7 +743,9 @@ lpc_cmd_redirect(LinphoneCore *lc, char *args){
while(elem!=NULL){
LinphoneCall *call=(LinphoneCall*)elem->data;
if (linphone_call_get_state(call)==LinphoneCallIncomingReceived){
linphone_core_redirect_call(lc,call,args);
if (linphone_core_redirect_call(lc,call,args) != 0) {
linphonec_out("Could not redirect call.\n");
}
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);
......
......@@ -3854,8 +3854,20 @@ static void terminate_call(LinphoneCore *lc, LinphoneCall *call){
}
int linphone_core_redirect_call(LinphoneCore *lc, LinphoneCall *call, const char *redirect_uri){
char *real_url=NULL;
LinphoneAddress *real_parsed_url=linphone_core_interpret_url(lc,redirect_uri);
if (!real_parsed_url){
/* bad url */
ms_error("Bad redirect URI: %s", redirect_uri?:"NULL");
return -1;
}
if (call->state==LinphoneCallIncomingReceived){
sal_call_decline(call->op,SalReasonRedirect,redirect_uri);
real_url=linphone_address_as_string (real_parsed_url);
sal_call_decline(call->op,SalReasonRedirect,real_url);
ms_free(real_url);
sal_error_info_set(&call->non_op_error,SalReasonRedirect,603,"Call redirected",NULL);
terminate_call(lc,call);
}else{
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment