Commit 42654a32 authored by jehan's avatar jehan

add LinphoneReasonUnauthorized

parent 6bf8c5c9
......@@ -334,6 +334,9 @@ SalReason sal_reason_to_sip_code(SalReason r){
case SalReasonRequestPending:
ret=491;
break;
case SalReasonUnauthorized:
ret=401;
break;
}
return ret;
}
......@@ -343,6 +346,11 @@ void sal_compute_sal_errors_from_code(int code ,SalError* sal_err,SalReason* sal
case 400:
*sal_err=SalErrorUnknown;
break;
case 401:
case 407:
*sal_err=SalErrorFailure;
*sal_reason=SalReasonUnauthorized;
break;
case 403:
*sal_err=SalErrorFailure;
*sal_reason=SalReasonForbidden;
......
......@@ -5787,6 +5787,8 @@ const char *linphone_reason_to_string(LinphoneReason err){
return "IO error";
case LinphoneReasonDoNotDisturb:
return "Do not distrub";
case LinphoneReasonUnauthorized:
return "Unauthorized";
}
return "unknown error";
}
......
......@@ -129,14 +129,16 @@ typedef struct _LinphoneCall LinphoneCall;
enum _LinphoneReason{
LinphoneReasonNone,
LinphoneReasonNoResponse, /**<No response received from remote*/
LinphoneReasonBadCredentials, /**<Authentication failed due to bad or missing credentials*/
LinphoneReasonBadCredentials, /**<Authentication failed due to bad*/
LinphoneReasonDeclined, /**<The call has been declined*/
LinphoneReasonNotFound, /**<Destination of the calls was not found.*/
LinphoneReasonNotAnswered, /**<The call was not answered in time*/
LinphoneReasonBusy, /**<Phone line was busy */
LinphoneReasonMedia, /**<Incompatible media */
LinphoneReasonIOError, /**<Transport error: connection failures, disconnections etc...*/
LinphoneReasonDoNotDisturb /**<Do not disturb reason*/
LinphoneReasonDoNotDisturb, /**<Do not disturb reason*/
LinphoneReasonUnauthorized /**<Operation is unauthorized because missing credential*/
};
/**
......
......@@ -1181,6 +1181,8 @@ SalReason linphone_reason_to_sal(LinphoneReason reason){
return SalReasonServiceUnavailable;
case LinphoneReasonDoNotDisturb:
return SalReasonDoNotDisturb;
case LinphoneReasonUnauthorized:
return SalReasonUnauthorized;
}
return SalReasonUnknown;
}
......@@ -1221,6 +1223,9 @@ LinphoneReason linphone_reason_from_sal(SalReason r){
case SalReasonRequestPending:
ret=LinphoneReasonNone;
break;
case SalReasonUnauthorized:
ret=LinphoneReasonUnauthorized;
break;
}
return ret;
}
......
......@@ -274,7 +274,8 @@ typedef enum SalReason{
SalReasonForbidden,
SalReasonUnknown,
SalReasonServiceUnavailable,
SalReasonRequestPending
SalReasonRequestPending,
SalReasonUnauthorized
}SalReason;
const char* sal_reason_to_string(const SalReason reason);
......
......@@ -44,6 +44,10 @@ public class Reason {
* Transport error: connection failures, disconnections etc...
* */
static public Reason DoNotDisturb = new Reason(9,"DoNotDisturb");
/**
* Operation not authorized because no credentials found
* */
static public Reason Unauthorized = new Reason(10,"Unauthorized");
protected final int mValue;
private final String mStringValue;
......
......@@ -97,7 +97,9 @@ static void register_with_refresh_base_2(LinphoneCore* lc, bool_t refresh,const
while (counters->number_of_LinphoneRegistrationOk<1+(refresh!=0) && retry++ <310) {
linphone_core_iterate(lc);
if (counters->number_of_auth_info_requested>0 && late_auth_info) {
if (counters->number_of_auth_info_requested>0 && linphone_proxy_config_get_state(proxy_cfg) == LinphoneRegistrationFailed && late_auth_info) {
if (!linphone_core_get_auth_info_list(lc))
CU_ASSERT_EQUAL(linphone_proxy_config_get_error(proxy_cfg),LinphoneReasonUnauthorized);
info=linphone_auth_info_new(test_username,NULL,test_password,NULL,auth_domain); /*create authentication structure from identity*/
linphone_core_add_auth_info(lc,info); /*add authentication info to LinphoneCore*/
}
......
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