Commit 2e94f78c authored by Ghislain MARY's avatar Ghislain MARY

SalCallOp::decline_with_error_info() is now taking a SalAddress as parameter instead of an uri.

parent bb5d418a
......@@ -122,8 +122,10 @@ static void call_received(SalCallOp *h) {
SalErrorInfo sei;
memset(&sei, 0, sizeof(sei));
sal_error_info_set(&sei, SalReasonRedirect, "SIP", 0, nullptr, nullptr);
h->decline_with_error_info(&sei, altContact);
SalAddress *altAddr = sal_address_new(altContact);
h->decline_with_error_info(&sei, altAddr);
ms_free(altContact);
sal_address_unref(altAddr);
LinphoneErrorInfo *ei = linphone_error_info_new();
linphone_error_info_set(ei, nullptr, LinphoneReasonMovedPermanently, 302, "Moved permanently", nullptr);
linphone_core_report_early_failed_call(lc, LinphoneCallIncoming, fromAddr, toAddr, ei);
......
......@@ -972,18 +972,16 @@ belle_sip_header_reason_t *SalCallOp::make_reason_header( const SalErrorInfo *in
return NULL;
}
int SalCallOp::decline_with_error_info(const SalErrorInfo *info, const char *redirection /*optional*/){
int SalCallOp::decline_with_error_info(const SalErrorInfo *info, const SalAddress *redirectionAddr /*optional*/){
belle_sip_response_t* response;
belle_sip_header_contact_t* contact=NULL;
int status = info->protocol_code;
belle_sip_transaction_t *trans;
if (info->reason==SalReasonRedirect){
if (redirection!=NULL) {
if (strstr(redirection,"sip:")!=0) status=302;
else status=380;
contact= belle_sip_header_contact_new();
belle_sip_header_address_set_uri(BELLE_SIP_HEADER_ADDRESS(contact),belle_sip_uri_parse(redirection));
if (redirectionAddr) {
status = 302;
contact = belle_sip_header_contact_create(BELLE_SIP_HEADER_ADDRESS(redirectionAddr));
} else {
ms_error("Cannot redirect to null");
}
......
......@@ -40,7 +40,7 @@ public:
int notify_ringing(bool_t early_media);
int accept();
int decline(SalReason reason, const char *redirection /*optional*/);
int decline_with_error_info(const SalErrorInfo *info, const char *redirection /*optional*/);
int decline_with_error_info(const SalErrorInfo *info, const SalAddress *redirectionAddr /*optional*/);
int update(const char *subject, bool_t no_user_consent);
void cancel_invite() {cancel_invite_with_info(NULL);}
void cancel_invite_with_info(const SalErrorInfo *info);
......
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