From 788f6cc4fc57b99d44cfde041623dfe781bf0251 Mon Sep 17 00:00:00 2001 From: Erwan Croze Date: Wed, 12 Oct 2016 15:16:56 +0200 Subject: [PATCH] Add error server status for xmlrpc --- coreapi/account_creator.c | 10 ++++++++-- coreapi/account_creator.h | 2 ++ .../org/linphone/core/LinphoneAccountCreator.java | 3 ++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/coreapi/account_creator.c b/coreapi/account_creator.c index 4de28cbab..8984819ed 100644 --- a/coreapi/account_creator.c +++ b/coreapi/account_creator.c @@ -559,7 +559,11 @@ static void _create_account_cb(LinphoneXmlRpcRequest *request) { LinphoneAccountCreatorStatus status = LinphoneAccountCreatorReqFailed; const char* resp = linphone_xml_rpc_request_get_string_response(request); if (linphone_xml_rpc_request_get_status(request) == LinphoneXmlRpcStatusOk) { - status = (strcmp(resp, "OK") == 0) ? LinphoneAccountCreatorAccountCreated : LinphoneAccountCreatorAccountNotCreated; + status = (strcmp(resp, "OK") == 0) ? LinphoneAccountCreatorAccountCreated + : (strcmp(resp, "ERROR_CANNOT_SEND_SMS") == 0) ? LinphoneAccountCreatorErrorServer + : (strcmp(resp, "ERROR_ACCOUNT_ALREADY_IN_USE") == 0) ? LinphoneAccountCreatorAccountExist + : (strcmp(resp, "ERROR_ALIAS_ALREADY_IN_USE") == 0) ? LinphoneAccountCreatorAccountExistWithAlias + :LinphoneAccountCreatorAccountNotCreated; } creator->callbacks->create_account(creator, status, resp); } @@ -853,7 +857,9 @@ static void _recover_phone_account_cb(LinphoneXmlRpcRequest *request) { const char* resp = linphone_xml_rpc_request_get_string_response(request); if (linphone_xml_rpc_request_get_status(request) == LinphoneXmlRpcStatusOk) { if (strstr(resp, "ERROR_") == resp) { - status = LinphoneAccountCreatorReqFailed; + status = (strstr(resp, "ERROR_CANNOT_SEND_SMS") == resp) ? LinphoneAccountCreatorErrorServer + : (strstr(resp, "ERROR_ACCOUNT_DOESNT_EXIST") == resp) ? LinphoneAccountCreatorAccountNotExist + : LinphoneAccountCreatorReqFailed; } else { status = LinphoneAccountCreatorOK; set_string(&creator->username, resp, FALSE); diff --git a/coreapi/account_creator.h b/coreapi/account_creator.h index 9651118b0..c308ba3df 100644 --- a/coreapi/account_creator.h +++ b/coreapi/account_creator.h @@ -74,6 +74,8 @@ typedef enum _LinphoneAccountCreatorStatus { LinphoneAccountCreatorDisplayNameInvalid, LinphoneAccountCreatorTransportNotSupported, LinphoneAccountCreatorCountryCodeInvalid, + + LinphoneAccountCreatorErrorServer, } LinphoneAccountCreatorStatus; /** diff --git a/java/common/org/linphone/core/LinphoneAccountCreator.java b/java/common/org/linphone/core/LinphoneAccountCreator.java index b8cad8c44..be652b5d4 100644 --- a/java/common/org/linphone/core/LinphoneAccountCreator.java +++ b/java/common/org/linphone/core/LinphoneAccountCreator.java @@ -70,6 +70,7 @@ public interface LinphoneAccountCreator { public final static Status DisplayNameInvalid = new Status(27, "DisplayNameInvalid"); public final static Status TransportNotSupported = new Status(28, "TransportNotSupported"); public final static Status CountryCodeInvalid = new Status(29, "CountryCodeInvalid"); + public final static Status ErrorServeur = new Status(30, "ErrorServer"); private Status(int value, String stringValue) { mValue = value; @@ -113,7 +114,7 @@ public interface LinphoneAccountCreator { String getHa1(); Status setActivationCode(String activationCode); - + Status setLanguage(String lang); Status setTransport(TransportType transport);