mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-28 08:39:20 +00:00
add access to country code from iso name
This commit is contained in:
parent
feebeb262e
commit
ba4ff464b3
2 changed files with 27 additions and 7 deletions
|
|
@ -86,7 +86,15 @@ typedef bool_t (*LinphoneCoreIterateHook)(void *data);
|
|||
void linphone_core_add_iterate_hook(LinphoneCore *lc, LinphoneCoreIterateHook hook, void *hook_data);
|
||||
|
||||
void linphone_core_remove_iterate_hook(LinphoneCore *lc, LinphoneCoreIterateHook hook, void *hook_data);
|
||||
|
||||
/**
|
||||
* @ingroup misc
|
||||
*Function to get call country code from ISO 3166-1 alpha-2 code, ex: FR returns 33
|
||||
*@param iso country code alpha2
|
||||
*@return call country code or -1 if not found
|
||||
*/
|
||||
int linphone_dial_plan_lookup_ccc_from_iso(const char* iso);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -375,21 +375,33 @@ bool_t linphone_proxy_config_get_dial_escape_plus(const LinphoneProxyConfig *cfg
|
|||
*/
|
||||
typedef struct dial_plan{
|
||||
const char *country;
|
||||
const char* iso_country_code; /* ISO 3166-1 alpha-2 code, ex: FR for France*/
|
||||
char ccc[8]; /*country calling code*/
|
||||
int nnl; /*maximum national number length*/
|
||||
const char * icp; /*international call prefix, ex: 00 in europe*/
|
||||
|
||||
}dial_plan_t;
|
||||
|
||||
/* TODO: fill with information for all countries over the world*/
|
||||
static dial_plan_t const dial_plans[]={
|
||||
{"France" , "33" , 9 , "00" },
|
||||
{"United States", "1" , 10 , "011" },
|
||||
{"Turkey" , "90" , 10 , "00" },
|
||||
{"Switzerland" , "41" , 9 , "00" },
|
||||
{NULL , "" , 0 , NULL }
|
||||
{"France" ,"FR" , "33" , 9 , "00" },
|
||||
{"United States" ,"US" , "1" , 10 , "011" },
|
||||
{"Turkey" ,"TR" , "90" , 10 , "00" },
|
||||
{"Switzerland" ,"XK" , "41" , 9 , "00" },
|
||||
{NULL ,NULL,"" , 0 , NULL }
|
||||
};
|
||||
|
||||
static dial_plan_t most_common_dialplan={ "generic" , "", 10, "00"};
|
||||
static dial_plan_t most_common_dialplan={ "generic" ,"", "", 10, "00"};
|
||||
|
||||
int linphone_dial_plan_lookup_ccc_from_iso(const char* iso) {
|
||||
dial_plan_t* dial_plan;
|
||||
for (dial_plan=(dial_plan_t*)dial_plans; dial_plan->country!=NULL; dial_plan++) {
|
||||
if (strcmp(iso, dial_plan->iso_country_code)==0) {
|
||||
return atoi(dial_plan->ccc);
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static void lookup_dial_plan(const char *ccc, dial_plan_t *plan){
|
||||
int i;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue