mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-31 02:09:22 +00:00
proxy.c: linphone_proxy_config_normalize_number use now a default proxy config if none is provided
This commit is contained in:
parent
c0a07de3b6
commit
02b9679551
3 changed files with 14 additions and 12 deletions
|
|
@ -1077,9 +1077,10 @@ LINPHONE_PUBLIC bool_t linphone_proxy_config_is_phone_number(LinphoneProxyConfig
|
|||
|
||||
/**
|
||||
* Normalize a human readable phone number into a basic string. 888-444-222 becomes 888444222
|
||||
* or +33888444222 depending on the #LinphoneProxyConfig argument. This function will always
|
||||
* generate a normalized username; if input is not a phone number, output will be a copy of input.
|
||||
* @param proxy #LinphoneProxyConfig object containing country code and/or escape symbol.
|
||||
* or +33888444222 depending on the #LinphoneProxyConfig object. However this argument is OPTIONNAL
|
||||
* and if not provided, a default one will be used.
|
||||
* This function will always generate a normalized username; if input is not a phone number, output will be a copy of input.
|
||||
* @param proxy #LinphoneProxyConfig object containing country code and/or escape symbol. If NULL passed, will use default configuration.
|
||||
* @param username the string to parse
|
||||
* @param result the newly normalized number
|
||||
* @param result_len the size of the normalized number \a result
|
||||
|
|
|
|||
|
|
@ -416,8 +416,6 @@ void linphone_core_get_local_ip(LinphoneCore *lc, int af, const char *dest, char
|
|||
LinphoneProxyConfig *linphone_proxy_config_new_from_config_file(LinphoneCore *lc, int index);
|
||||
void linphone_proxy_config_write_to_config_file(struct _LpConfig* config,LinphoneProxyConfig *obj, int index);
|
||||
|
||||
bool_t linphone_proxy_config_normalize_number(LinphoneProxyConfig *cfg, const char *username, char *result, size_t result_len);
|
||||
|
||||
void linphone_core_message_received(LinphoneCore *lc, SalOp *op, const SalMessage *msg);
|
||||
void linphone_core_is_composing_received(LinphoneCore *lc, SalOp *op, const SalIsComposing *is_composing);
|
||||
|
||||
|
|
@ -781,7 +779,7 @@ struct _LinphoneCore
|
|||
char* user_certificates_path;
|
||||
LinphoneVideoPolicy video_policy;
|
||||
time_t network_last_check;
|
||||
|
||||
|
||||
bool_t use_files;
|
||||
bool_t apply_nat_settings;
|
||||
bool_t initial_subscribes_sent;
|
||||
|
|
@ -791,7 +789,7 @@ struct _LinphoneCore
|
|||
bool_t auto_net_state_mon;
|
||||
bool_t network_reachable;
|
||||
bool_t network_reachable_to_be_notified; /*set to true when state must be notified in next iterate*/
|
||||
|
||||
|
||||
bool_t use_preview_window;
|
||||
bool_t network_last_status;
|
||||
bool_t ringstream_autorelease;
|
||||
|
|
|
|||
|
|
@ -937,11 +937,12 @@ static void replace_icp(const char *src, char *dest, size_t destlen, const char
|
|||
}
|
||||
|
||||
|
||||
bool_t linphone_proxy_config_normalize_number(LinphoneProxyConfig *proxy, const char *username, char *result, size_t result_len){
|
||||
bool_t linphone_proxy_config_normalize_number(LinphoneProxyConfig *inproxy, const char *username, char *result, size_t result_len){
|
||||
bool_t ret;
|
||||
LinphoneProxyConfig *proxy = inproxy ? inproxy : linphone_proxy_config_new();
|
||||
memset(result, 0, result_len);
|
||||
if (linphone_proxy_config_is_phone_number(proxy, username)){
|
||||
char *flatten;
|
||||
flatten=flatten_number(username);
|
||||
char *flatten=flatten_number(username);
|
||||
ms_debug("Flattened number is '%s'",flatten);
|
||||
|
||||
if (proxy->dial_prefix==NULL || proxy->dial_prefix[0]=='\0'){
|
||||
|
|
@ -987,11 +988,13 @@ bool_t linphone_proxy_config_normalize_number(LinphoneProxyConfig *proxy, const
|
|||
}
|
||||
}
|
||||
ms_free(flatten);
|
||||
return TRUE;
|
||||
ret = TRUE;
|
||||
} else {
|
||||
strncpy(result,username,result_len-1);
|
||||
return FALSE;
|
||||
ret = FALSE;
|
||||
}
|
||||
if (inproxy==NULL) ms_free(proxy);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue