LinphoneFriend * linphone_friend_new_from_config_file(LinphoneCore *lc, int index){ const char *tmp; char item[50]; int a; LinphoneFriend *lf; LpConfig *config=lc->config; sprintf(item,"friend_%i",index); if (!lp_config_has_section(config,item)){ return NULL; } tmp=lp_config_get_string(config,item,"url",NULL); if (tmp==NULL) { return NULL; } lf=linphone_core_create_friend_with_address(lc, tmp); if (lf==NULL) { return NULL; } tmp=lp_config_get_string(config,item,"pol",NULL); if (tmp==NULL) linphone_friend_set_inc_subscribe_policy(lf,LinphoneSPWait); else{ linphone_friend_set_inc_subscribe_policy(lf,__policy_str_to_enum(tmp)); } a=lp_config_get_int(config,item,"subscribe",0); linphone_friend_send_subscribe(lf,a); a = lp_config_get_int(config, item, "presence_received", 0); lf->presence_received = (bool_t)a; linphone_friend_set_ref_key(lf,lp_config_get_string(config,item,"refkey",NULL)); return lf; }
void linphone_call_init_media_streams(LinphoneCall *call){ LinphoneCore *lc=call->core; SalMediaDescription *md=call->localdesc; AudioStream *audiostream; call->audiostream=audiostream=audio_stream_new(md->streams[0].port,linphone_core_ipv6_enabled(lc)); if (linphone_core_echo_limiter_enabled(lc)){ const char *type=lp_config_get_string(lc->config,"sound","el_type","mic"); if (strcasecmp(type,"mic")==0) audio_stream_enable_echo_limiter(audiostream,ELControlMic); else if (strcasecmp(type,"full")==0) audio_stream_enable_echo_limiter(audiostream,ELControlFull); } audio_stream_enable_gain_control(audiostream,TRUE); if (linphone_core_echo_cancellation_enabled(lc)){ int len,delay,framesize; const char *statestr=lp_config_get_string(lc->config,"sound","ec_state",NULL); len=lp_config_get_int(lc->config,"sound","ec_tail_len",0); delay=lp_config_get_int(lc->config,"sound","ec_delay",0); framesize=lp_config_get_int(lc->config,"sound","ec_framesize",0); audio_stream_set_echo_canceller_params(audiostream,len,delay,framesize); if (statestr && audiostream->ec){ ms_filter_call_method(audiostream->ec,MS_ECHO_CANCELLER_SET_STATE_STRING,(void*)statestr); } } audio_stream_enable_automatic_gain_control(audiostream,linphone_core_agc_enabled(lc)); { int enabled=lp_config_get_int(lc->config,"sound","noisegate",0); audio_stream_enable_noise_gate(audiostream,enabled); } if (lc->a_rtp) rtp_session_set_transports(audiostream->session,lc->a_rtp,lc->a_rtcp); call->audiostream_app_evq = ortp_ev_queue_new(); rtp_session_register_event_queue(audiostream->session,call->audiostream_app_evq); #ifdef VIDEO_ENABLED if ((lc->video_conf.display || lc->video_conf.capture) && md->streams[1].port>0){ call->videostream=video_stream_new(md->streams[1].port,linphone_core_ipv6_enabled(lc)); if( lc->video_conf.displaytype != NULL) video_stream_set_display_filter_name(call->videostream,lc->video_conf.displaytype); video_stream_set_event_callback(call->videostream,video_stream_event_cb, call); if (lc->v_rtp) rtp_session_set_transports(call->videostream->session,lc->v_rtp,lc->v_rtcp); call->videostream_app_evq = ortp_ev_queue_new(); rtp_session_register_event_queue(call->videostream->session,call->videostream_app_evq); #ifdef TEST_EXT_RENDERER video_stream_set_render_callback(call->videostream,rendercb,NULL); #endif } #else call->videostream=NULL; #endif }
static const char* get_hexa_zrtp_identifier(LinphoneCore *lc){ const char *confZid=lp_config_get_string(lc->config,"rtp","zid",NULL); if (confZid != NULL) { return confZid; } else { char zidstr[128]; snprintf(zidstr,sizeof(zidstr),"%x-%x-%x",rand(),rand(),rand()); lp_config_set_string(lc->config,"rtp","zid",zidstr); return lp_config_get_string(lc->config,"rtp","zid",NULL); } }
static void linphone_lpconfig_from_buffer(){ const char* buffer = "[buffer]\ntest=ok"; const char* buffer_linebreaks = "[buffer_linebreaks]\n\n\n\r\n\n\r\ntest=ok"; LpConfig* conf; conf = lp_config_new_from_buffer(buffer); BC_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"buffer","test",""),"ok"); lp_config_destroy(conf); conf = lp_config_new_from_buffer(buffer_linebreaks); BC_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"buffer_linebreaks","test",""),"ok"); lp_config_destroy(conf); }
static void linphone_lpconfig_from_buffer_zerolen_value(){ /* parameters that have no value should return NULL, not "". */ const char* zerolen = "[test]\nzero_len=\nnon_zero_len=test"; LpConfig* conf; conf = lp_config_new_from_buffer(zerolen); BC_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"test","zero_len","LOL"),"LOL"); BC_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"test","non_zero_len",""),"test"); lp_config_set_string(conf, "test", "non_zero_len", ""); /* should remove "non_zero_len" */ BC_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"test","non_zero_len","LOL"), "LOL"); lp_config_destroy(conf); }
unsigned int linphone_core_get_audio_features(LinphoneCore *lc){ unsigned int ret=0; const char *features=lp_config_get_string(lc->config,"sound","features",NULL); if (features){ char tmp[256]={0}; char name[256]; char *p,*n; strncpy(tmp,features,sizeof(tmp)-1); for(p=tmp;*p!='\0';p++){ if (*p==' ') continue; n=strchr(p,'|'); if (n) *n='\0'; sscanf(p,"%s",name); ms_message("Found audio feature %s",name); if (strcasecmp(name,"PLC")==0) ret|=AUDIO_STREAM_FEATURE_PLC; else if (strcasecmp(name,"EC")==0) ret|=AUDIO_STREAM_FEATURE_EC; else if (strcasecmp(name,"EQUALIZER")==0) ret|=AUDIO_STREAM_FEATURE_EQUALIZER; else if (strcasecmp(name,"VOL_SND")==0) ret|=AUDIO_STREAM_FEATURE_VOL_SND; else if (strcasecmp(name,"VOL_RCV")==0) ret|=AUDIO_STREAM_FEATURE_VOL_RCV; else if (strcasecmp(name,"DTMF")==0) ret|=AUDIO_STREAM_FEATURE_DTMF; else if (strcasecmp(name,"DTMF_ECHO")==0) ret|=AUDIO_STREAM_FEATURE_DTMF_ECHO; else if (strcasecmp(name,"ALL")==0) ret|=AUDIO_STREAM_FEATURE_ALL; else if (strcasecmp(name,"NONE")==0) ret=0; else ms_error("Unsupported audio feature %s requested in config file.",name); if (!n) break; p=n; } }else ret=AUDIO_STREAM_FEATURE_ALL; return ret; }
const char* lp_config_get_default_string(const LpConfig *lpconfig, const char *section, const char *key, const char *default_value) { char default_section[MAX_LEN]; strcpy(default_section, section); strcat(default_section, DEFAULT_VALUES_SUFFIX); return lp_config_get_string(lpconfig, default_section, key, default_value); }
LinphoneAccountCreatorStatus linphone_account_creator_set_username(LinphoneAccountCreator *creator, const char *username) { int min_length = lp_config_get_int(creator->core->config, "assistant", "username_min_length", -1); int fixed_length = lp_config_get_int(creator->core->config, "assistant", "username_length", -1); int max_length = lp_config_get_int(creator->core->config, "assistant", "username_max_length", -1); bool_t use_phone_number = lp_config_get_int(creator->core->config, "assistant", "use_phone_number", 0); const char* regex = lp_config_get_string(creator->core->config, "assistant", "username_regex", 0); LinphoneAccountCreatorStatus status; if (min_length > 0 && strlen(username) < (size_t)min_length) { return LinphoneAccountCreatorUsernameTooShort; } else if (max_length > 0 && strlen(username) > (size_t)max_length) { return LinphoneAccountCreatorUsernameTooLong; } else if (fixed_length > 0 && strlen(username) != (size_t)fixed_length) { return LinphoneAccountCreatorUsernameInvalidSize; } else if (use_phone_number && !linphone_proxy_config_is_phone_number(NULL, username)) { return LinphoneAccountCreatorUsernameInvalid; } else if (regex && !is_matching_regex(username, regex)) { return LinphoneAccountCreatorUsernameInvalid; } else if ((status = validate_uri(username, NULL, NULL, NULL)) != LinphoneAccountCreatorOK) { return status; } set_string(&creator->username, username, TRUE); return LinphoneAccountCreatorOK; }
float lp_config_get_float(LpConfig *lpconfig,const char *section, const char *key, float default_value){ const char *str=lp_config_get_string(lpconfig,section,key,NULL); float ret=default_value; if (str==NULL) return default_value; sscanf(str,"%f",&ret); return ret; }
LinphoneAuthInfo *linphone_auth_info_new_from_config_file(LpConfig * config, int pos) { char key[50]; const char *username,*userid,*passwd,*ha1,*realm; sprintf(key,"auth_info_%i",pos); if (!lp_config_has_section(config,key)){ return NULL; } username=lp_config_get_string(config,key,"username",NULL); userid=lp_config_get_string(config,key,"userid",NULL); passwd=lp_config_get_string(config,key,"passwd",NULL); ha1=lp_config_get_string(config,key,"ha1",NULL); realm=lp_config_get_string(config,key,"realm",NULL); return linphone_auth_info_new(username,userid,passwd,ha1,realm); }
const gchar *linphone_gtk_get_ui_config(const char *key, const char *def){ LinphoneCore *lc=linphone_gtk_get_core(); if (lc){ LpConfig *cfg=linphone_core_get_config(linphone_gtk_get_core()); return lp_config_get_string(cfg,"GtkUi",key,def); }else{ g_error ("Cannot read config, no core created yet."); return NULL; } }
void call_logs_read_from_config_file(LinphoneCore *lc){ char logsection[32]; int i; const char *tmp; uint64_t sec; LpConfig *cfg=lc->config; for(i=0;;++i){ snprintf(logsection,sizeof(logsection),"call_log_%i",i); if (lp_config_has_section(cfg,logsection)){ LinphoneCallLog *cl; LinphoneAddress *from=NULL,*to=NULL; tmp=lp_config_get_string(cfg,logsection,"from",NULL); if (tmp) from=linphone_address_new(tmp); tmp=lp_config_get_string(cfg,logsection,"to",NULL); if (tmp) to=linphone_address_new(tmp); if (!from || !to) continue; cl=linphone_call_log_new(lp_config_get_int(cfg,logsection,"dir",0),from,to); cl->status=lp_config_get_int(cfg,logsection,"status",0); sec=lp_config_get_int64(cfg,logsection,"start_date_time",0); if (sec) { /*new call log format with date expressed in seconds */ cl->start_date_time=(time_t)sec; set_call_log_date(cl,cl->start_date_time); }else{ tmp=lp_config_get_string(cfg,logsection,"start_date",NULL); if (tmp) { strncpy(cl->start_date,tmp,sizeof(cl->start_date)); cl->start_date_time=string_to_time(cl->start_date); } } cl->duration=lp_config_get_int(cfg,logsection,"duration",0); tmp=lp_config_get_string(cfg,logsection,"refkey",NULL); if (tmp) cl->refkey=ms_strdup(tmp); cl->quality=lp_config_get_float(cfg,logsection,"quality",-1); cl->video_enabled=lp_config_get_int(cfg,logsection,"video_enabled",0); tmp=lp_config_get_string(cfg,logsection,"call_id",NULL); if (tmp) cl->call_id=ms_strdup(tmp); lc->call_logs=ms_list_append(lc->call_logs,cl); }else break; } }
static const char *get_client_cert_path(LinphoneCore *lc) { static char cldir[200] = {0}; #ifdef HAVE_GETENV if (!cldir[0]) { static char default_path[200] = {0}; snprintf(default_path, sizeof(default_path), "%s%s", getenv("HOME"), "/linphone_certs"); snprintf(cldir, sizeof(cldir), "%s", lp_config_get_string(lc->config,"sip","client_certificates_dir", default_path)); } #endif return cldir; }
static void linphone_lpconfig_from_xml_zerolen_value(){ const char* zero_xml_file = "remote_zero_length_params_rc"; char* xml_path = ms_strdup_printf("%s/rcfiles/%s", bc_tester_read_dir_prefix, zero_xml_file); LpConfig* conf; LinphoneCoreManager* mgr = linphone_core_manager_new2("empty_rc",FALSE); BC_ASSERT_EQUAL(linphone_remote_provisioning_load_file(mgr->lc, xml_path), 0, int, "%d"); conf = mgr->lc->config; BC_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"test","zero_len","LOL"),"LOL"); BC_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"test","non_zero_len",""),"test"); lp_config_set_string(conf, "test", "non_zero_len", ""); /* should remove "non_zero_len" */ BC_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"test","non_zero_len","LOL"), "LOL"); linphone_core_manager_destroy(mgr); ms_free(xml_path); }
static int processEntry(const char *section, const char *entry, xmlNode *node, lpc2xml_context *ctx) { const char *content = lp_config_get_string(ctx->lpc, section, entry, NULL); if (content == NULL) { lpc2xml_log(ctx, LPC2XML_ERROR, "Issue when reading the lpc"); return -1; } lpc2xml_log(ctx, LPC2XML_MESSAGE, "Set %s|%s = %s", section, entry, content); xmlNodeSetContent(node, (const xmlChar *) content); return 0; }
int lp_config_get_int(const LpConfig *lpconfig,const char *section, const char *key, int default_value){ const char *str=lp_config_get_string(lpconfig,section,key,NULL); if (str!=NULL) { int ret=0; if (strstr(str,"0x")==str){ sscanf(str,"%x",&ret); }else ret=atoi(str); return ret; } else return default_value; }
int64_t lp_config_get_int64(const LpConfig *lpconfig,const char *section, const char *key, int64_t default_value){ const char *str=lp_config_get_string(lpconfig,section,key,NULL); if (str!=NULL) { #ifdef WIN32 return (int64_t)_atoi64(str); #else return atoll(str); #endif } else return default_value; }
LinphoneAccountCreator * linphone_account_creator_new(LinphoneCore *core, const char *xmlrpc_url) { LinphoneAccountCreator *creator; const char* domain = lp_config_get_string(core->config, "assistant", "domain", NULL); creator = belle_sip_object_new(LinphoneAccountCreator); creator->callbacks = linphone_account_creator_cbs_new(); creator->core = core; creator->xmlrpc_session = linphone_xml_rpc_session_new(core, xmlrpc_url); if (domain) { linphone_account_creator_set_domain(creator, domain); } return creator; }
static void linphone_lpconfig_from_file_zerolen_value(){ /* parameters that have no value should return NULL, not "". */ const char* zero_rc_file = "zero_length_params_rc"; char* rc_path = ms_strdup_printf("%s/rcfiles/%s", bc_tester_read_dir_prefix, zero_rc_file); LpConfig* conf; /* not using lp_config_new() because it expects a readable file, and iOS (for instance) stores the app bundle in read-only */ conf = lp_config_new_with_factory(NULL, rc_path); BC_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"test","zero_len","LOL"),"LOL"); // non_zero_len=test -> should return test BC_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"test","non_zero_len",""),"test"); lp_config_set_string(conf, "test", "non_zero_len", ""); /* should remove "non_zero_len" */ BC_ASSERT_STRING_EQUAL(lp_config_get_string(conf,"test","non_zero_len","LOL"), "LOL"); ms_free(rc_path); lp_config_destroy(conf); }
void linphone_call_enable_echo_limiter(LinphoneCall *call, bool_t val){ if (call!=NULL && call->audiostream!=NULL ) { if (val) { const char *type=lp_config_get_string(call->core->config,"sound","el_type","mic"); if (strcasecmp(type,"mic")==0) audio_stream_enable_echo_limiter(call->audiostream,ELControlMic); else if (strcasecmp(type,"full")==0) audio_stream_enable_echo_limiter(call->audiostream,ELControlFull); } else { audio_stream_enable_echo_limiter(call->audiostream,ELInactive); } } }
LinphoneProxyConfig *linphone_proxy_config_new_from_config_file(LpConfig *config, int index) { const char *tmp; const char *identity; const char *proxy; LinphoneProxyConfig *cfg; char key[50]; sprintf(key,"proxy_%i",index); if (!lp_config_has_section(config,key)){ return NULL; } cfg=linphone_proxy_config_new(); identity=lp_config_get_string(config,key,"reg_identity",NULL); proxy=lp_config_get_string(config,key,"reg_proxy",NULL); linphone_proxy_config_set_identity(cfg,identity); linphone_proxy_config_set_server_addr(cfg,proxy); tmp=lp_config_get_string(config,key,"reg_route",NULL); if (tmp!=NULL) linphone_proxy_config_set_route(cfg,tmp); linphone_proxy_config_expires(cfg,lp_config_get_int(config,key,"reg_expires",600)); linphone_proxy_config_enableregister(cfg,lp_config_get_int(config,key,"reg_sendregister",0)); linphone_proxy_config_enable_publish(cfg,lp_config_get_int(config,key,"publish",0)); linphone_proxy_config_set_dial_escape_plus(cfg,lp_config_get_int(config,key,"dial_escape_plus",0)); linphone_proxy_config_set_dial_prefix(cfg,lp_config_get_string(config,key,"dial_prefix",NULL)); tmp=lp_config_get_string(config,key,"type",NULL); if (tmp!=NULL && strlen(tmp)>0) linphone_proxy_config_set_sip_setup(cfg,tmp); return cfg; }
LinphoneNatPolicy * linphone_core_create_nat_policy_from_config(LinphoneCore *lc, const char *ref) { LpConfig *config = lc->config; LinphoneNatPolicy *policy = NULL; char *section; int index; bool_t finished = FALSE; for (index = 0; finished != TRUE; index++) { section = belle_sip_strdup_printf("nat_policy_%i", index); if (lp_config_has_section(config, section)) { const char *config_ref = lp_config_get_string(config, section, "ref", NULL); if ((config_ref != NULL) && (strcmp(config_ref, ref) == 0)) { const char *server = lp_config_get_string(config, section, "stun_server", NULL); const char *username = lp_config_get_string(config, section, "stun_server_username", NULL); bctbx_list_t *l = lp_config_get_string_list(config, section, "protocols", NULL); policy = _linphone_nat_policy_new_with_ref(lc, ref); if (server != NULL) linphone_nat_policy_set_stun_server(policy, server); if (username != NULL) linphone_nat_policy_set_stun_server_username(policy, username); if (l != NULL) { bool_t upnp_enabled = FALSE; bctbx_list_t *elem; for (elem = l; elem != NULL; elem = elem->next) { const char *value = (const char *)elem->data; if (strcmp(value, "stun") == 0) linphone_nat_policy_enable_stun(policy, TRUE); else if (strcmp(value, "turn") == 0) linphone_nat_policy_enable_turn(policy, TRUE); else if (strcmp(value, "ice") == 0) linphone_nat_policy_enable_ice(policy, TRUE); else if (strcmp(value, "upnp") == 0) upnp_enabled = TRUE; } if (upnp_enabled) linphone_nat_policy_enable_upnp(policy, TRUE); } finished = TRUE; } } else finished = TRUE; belle_sip_free(section); } return policy; }
static void remote_provisioning_default_values(void) { LinphoneProxyConfig *lpc; LinphoneCoreManager* marie = linphone_core_manager_new2("marie_remote_default_values_rc", FALSE); CU_ASSERT_TRUE(wait_for(marie->lc,NULL,&marie->stat.number_of_LinphoneConfiguringSuccessful,1)); lpc = linphone_core_create_proxy_config(marie->lc); CU_ASSERT_TRUE(lpc->reg_sendregister == TRUE); CU_ASSERT_TRUE(lpc->expires == 604800); CU_ASSERT_STRING_EQUAL(lpc->reg_proxy, "<sip:sip.linphone.org:5223;transport=tls>"); CU_ASSERT_STRING_EQUAL(lpc->reg_route, "<sip:sip.linphone.org:5223;transport=tls>"); CU_ASSERT_STRING_EQUAL(lpc->reg_identity, "sip:[email protected]"); { LpConfig* lp = linphone_core_get_config(marie->lc); CU_ASSERT_STRING_EQUAL(lp_config_get_string(lp,"app","toto","empty"),"titi"); } linphone_core_manager_destroy(marie); }
bool_t lp_config_get_range(const LpConfig *lpconfig, const char *section, const char *key, int *min, int *max, int default_min, int default_max) { const char *str = lp_config_get_string(lpconfig, section, key, NULL); if (str != NULL) { char *minusptr = strchr(str, '-'); if ((minusptr == NULL) || (minusptr == str)) { *min = default_min; *max = default_max; return FALSE; } *min = atoi(str); *max = atoi(minusptr + 1); return TRUE; } else { *min = default_min; *max = default_max; return TRUE; } }
static void parametrize_equalizer(LinphoneCore *lc, AudioStream *st){ if (st->equalizer){ MSFilter *f=st->equalizer; int enabled=lp_config_get_int(lc->config,"sound","eq_active",0); const char *gains=lp_config_get_string(lc->config,"sound","eq_gains",NULL); ms_filter_call_method(f,MS_EQUALIZER_SET_ACTIVE,&enabled); if (enabled){ if (gains){ do{ int bytes; MSEqualizerGain g; if (sscanf(gains,"%f:%f:%f %n",&g.frequency,&g.gain,&g.width,&bytes)==3){ ms_message("Read equalizer gains: %f(~%f) --> %f",g.frequency,g.width,g.gain); ms_filter_call_method(f,MS_EQUALIZER_SET_GAIN,&g); gains+=bytes; }else break; }while(1); } } } }
void linphone_nat_policy_save_to_config(const LinphoneNatPolicy *policy) { LpConfig *config = policy->lc->config; char *section; int index; bool_t finished = FALSE; for (index = 0; finished != TRUE; index++) { section = belle_sip_strdup_printf("nat_policy_%i", index); if (lp_config_has_section(config, section)) { const char *config_ref = lp_config_get_string(config, section, "ref", NULL); if ((config_ref != NULL) && (strcmp(config_ref, policy->ref) == 0)) { _linphone_nat_policy_save_to_config(policy, config, index); finished = TRUE; } } else { _linphone_nat_policy_save_to_config(policy, config, index); finished = TRUE; } belle_sip_free(section); } }
LinphoneAuthInfo *linphone_auth_info_new_from_config_file(LpConfig * config, int pos) { char key[50]; const char *username,*userid,*passwd,*ha1,*realm,*domain,*tls_cert_path,*tls_key_path; LinphoneAuthInfo *ret; sprintf(key, "auth_info_%i", pos); if (!lp_config_has_section(config, key)) { return NULL; } username = lp_config_get_string(config, key, "username", NULL); userid = lp_config_get_string(config, key, "userid", NULL); passwd = lp_config_get_string(config, key, "passwd", NULL); ha1 = lp_config_get_string(config, key, "ha1", NULL); realm = lp_config_get_string(config, key, "realm", NULL); domain = lp_config_get_string(config, key, "domain", NULL); tls_cert_path = lp_config_get_string(config, key, "client_cert_chain", NULL); tls_key_path = lp_config_get_string(config, key, "client_cert_key", NULL); ret = linphone_auth_info_new(username, userid, passwd, ha1, realm, domain); linphone_auth_info_set_tls_cert_path(ret, tls_cert_path); linphone_auth_info_set_tls_key_path(ret, tls_key_path); return ret; }
unsigned int linphone_core_get_audio_features(LinphoneCore *lc){ unsigned int ret=0; const char *features=lp_config_get_string(lc->config,"sound","features",NULL); if (features){ char tmp[256]={0}; char name[256]; char *p,*n; strncpy(tmp,features,sizeof(tmp)-1); for(p=tmp;*p!='\0';p++){ if (*p==' ') continue; n=strchr(p,'|'); if (n) *n='\0'; sscanf(p,"%s",name); ms_message("Found audio feature %s",name); if (strcasecmp(name,"PLC")==0) ret|=AUDIO_STREAM_FEATURE_PLC; else if (strcasecmp(name,"EC")==0) ret|=AUDIO_STREAM_FEATURE_EC; else if (strcasecmp(name,"EQUALIZER")==0) ret|=AUDIO_STREAM_FEATURE_EQUALIZER; else if (strcasecmp(name,"VOL_SND")==0) ret|=AUDIO_STREAM_FEATURE_VOL_SND; else if (strcasecmp(name,"VOL_RCV")==0) ret|=AUDIO_STREAM_FEATURE_VOL_RCV; else if (strcasecmp(name,"DTMF")==0) ret|=AUDIO_STREAM_FEATURE_DTMF; else if (strcasecmp(name,"DTMF_ECHO")==0) ret|=AUDIO_STREAM_FEATURE_DTMF_ECHO; else if (strcasecmp(name,"MIXED_RECORDING")==0) ret|=AUDIO_STREAM_FEATURE_MIXED_RECORDING; else if (strcasecmp(name,"ALL")==0) ret|=AUDIO_STREAM_FEATURE_ALL; else if (strcasecmp(name,"NONE")==0) ret=0; else ms_error("Unsupported audio feature %s requested in config file.",name); if (!n) break; p=n; } }else ret=AUDIO_STREAM_FEATURE_ALL; if (ret==AUDIO_STREAM_FEATURE_ALL){ /*since call recording is specified before creation of the stream in linphonecore, * it will be requested on demand. It is not necessary to include it all the time*/ ret&=~AUDIO_STREAM_FEATURE_MIXED_RECORDING; } return ret; }
static int processEntry(xmlElement *element, const char *sectionName, xml2lpc_context *ctx) { xmlNode *cur_attr = NULL; const char *name = NULL; const char *value = NULL; bool_t overwrite = FALSE; for (cur_attr = (xmlNode *)element->attributes; cur_attr; cur_attr = cur_attr->next) { dumpAttr(cur_attr, ctx); if(strcmp((const char*)cur_attr->name, "name") == 0) { name = (const char*)cur_attr->children->content; } else if(strcmp((const char*)cur_attr->name, "overwrite") == 0) { if(strcmp((const char*)cur_attr->children->content, "true") == 0) { overwrite = TRUE; } } } dumpContent((xmlNode *)element, ctx); if (element->children) value = (const char *)element->children->content; else value = ""; if(name != NULL) { const char *str = lp_config_get_string(ctx->lpc, sectionName, name, NULL); if(str == NULL || overwrite) { xml2lpc_log(ctx, XML2LPC_MESSAGE, "Set %s|%s = %s", sectionName, name, value); lp_config_set_string(ctx->lpc, sectionName, name, value); } else { xml2lpc_log(ctx, XML2LPC_MESSAGE, "Don't touch %s|%s = %s",sectionName, name, str); } } else { xml2lpc_log(ctx, XML2LPC_WARNING, "ignored entry with no \"name\" attribute line:%d",xmlGetLineNo((xmlNode*)element)); } return 0; }
int lp_config_get_int(LpConfig *lpconfig,const char *section, const char *key, int default_value){ const char *str=lp_config_get_string(lpconfig,section,key,NULL); if (str!=NULL) return atoi(str); else return default_value; }