int ms_ticker_detach(MSTicker *ticker,MSFilter *f){ bctbx_list_t *sources=NULL; bctbx_list_t *filters=NULL; bctbx_list_t *it; if (f->ticker==NULL) { ms_message("Filter %s is not scheduled; nothing to do.",f->desc->name); return 0; } ms_mutex_lock(&ticker->lock); filters=ms_filter_find_neighbours(f); sources=get_sources(filters); if (sources==NULL){ ms_fatal("No sources found around filter %s",f->desc->name); bctbx_list_free(filters); ms_mutex_unlock(&ticker->lock); return -1; } for(it=sources;it!=NULL;it=bctbx_list_next(it)){ ticker->execution_list=bctbx_list_remove(ticker->execution_list,it->data); } ms_mutex_unlock(&ticker->lock); bctbx_list_for_each(filters,(void (*)(void*))call_postprocess); bctbx_list_free(filters); bctbx_list_free(sources); return 0; }
int ms_ticker_attach_multiple(MSTicker *ticker,MSFilter *f,...) { bctbx_list_t *sources=NULL; bctbx_list_t *filters=NULL; bctbx_list_t *it; bctbx_list_t *total_sources=NULL; va_list l; va_start(l,f); do{ if (f->ticker==NULL) { filters=ms_filter_find_neighbours(f); sources=get_sources(filters); if (sources==NULL){ ms_fatal("No sources found around filter %s",f->desc->name); bctbx_list_free(filters); break; } /*run preprocess on each filter: */ for(it=filters;it!=NULL;it=it->next) ms_filter_preprocess((MSFilter*)it->data,ticker); bctbx_list_free(filters); total_sources=bctbx_list_concat(total_sources,sources); }else ms_message("Filter %s is already being scheduled; nothing to do.",f->desc->name); }while ((f=va_arg(l,MSFilter*))!=NULL); va_end(l); if (total_sources){ ms_mutex_lock(&ticker->lock); ticker->execution_list=bctbx_list_concat(ticker->execution_list,total_sources); ms_mutex_unlock(&ticker->lock); } return 0; }
static void linphone_vcard_phone_numbers_and_sip_addresses(void) { LinphoneCoreManager* manager = linphone_core_manager_new2("empty_rc", FALSE); LinphoneVcard *lvc = linphone_vcard_context_get_vcard_from_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Sylvain Berfini\r\nIMPP:sip:[email protected]\r\nIMPP;TYPE=home:sip:[email protected]\r\nTEL;TYPE=work:0952636505\r\nEND:VCARD\r\n"); LinphoneFriend *lf = linphone_friend_new_from_vcard(lvc); bctbx_list_t *sip_addresses = linphone_friend_get_addresses(lf); bctbx_list_t *phone_numbers = linphone_friend_get_phone_numbers(lf); LinphoneAddress *addr = NULL; BC_ASSERT_EQUAL(bctbx_list_size(sip_addresses), 2, int, "%i"); BC_ASSERT_EQUAL(bctbx_list_size(phone_numbers), 1, int, "%i"); if (sip_addresses) bctbx_list_free_with_data(sip_addresses, (void (*)(void *))linphone_address_unref); if (phone_numbers) bctbx_list_free(phone_numbers); linphone_friend_unref(lf); lvc = linphone_vcard_context_get_vcard_from_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Sylvain Berfini\r\nTEL;TYPE=work:0952636505\r\nTEL:0476010203\r\nEND:VCARD\r\n"); lf = linphone_friend_new_from_vcard(lvc); sip_addresses = linphone_friend_get_addresses(lf); phone_numbers = linphone_friend_get_phone_numbers(lf); BC_ASSERT_EQUAL(bctbx_list_size(sip_addresses), 0, int, "%i"); BC_ASSERT_EQUAL(bctbx_list_size(phone_numbers), 2, int, "%i"); if (sip_addresses) bctbx_list_free_with_data(sip_addresses, (void (*)(void *))linphone_address_unref); if (phone_numbers) bctbx_list_free(phone_numbers); addr = linphone_address_new("sip:[email protected]"); linphone_friend_add_address(lf, addr); linphone_address_unref(addr); sip_addresses = linphone_friend_get_addresses(lf); BC_ASSERT_EQUAL(bctbx_list_size(sip_addresses), 1, int, "%i"); if (sip_addresses) bctbx_list_free_with_data(sip_addresses, (void (*)(void *))linphone_address_unref); linphone_friend_remove_phone_number(lf, "0952636505"); phone_numbers = linphone_friend_get_phone_numbers(lf); BC_ASSERT_EQUAL(bctbx_list_size(phone_numbers), 1, int, "%i"); if (phone_numbers) bctbx_list_free(phone_numbers); linphone_friend_remove_phone_number(lf, "0476010203"); phone_numbers = linphone_friend_get_phone_numbers(lf); BC_ASSERT_EQUAL(bctbx_list_size(phone_numbers), 0, int, "%i"); if (phone_numbers) bctbx_list_free(phone_numbers); addr = linphone_address_new("sip:[email protected]"); linphone_friend_remove_address(lf, addr); linphone_address_unref(addr); sip_addresses = linphone_friend_get_addresses(lf); BC_ASSERT_EQUAL(bctbx_list_size(sip_addresses), 0, int, "%i"); if (sip_addresses) bctbx_list_free_with_data(sip_addresses, (void (*)(void *))linphone_address_unref); linphone_friend_add_phone_number(lf, "+33952636505"); phone_numbers = linphone_friend_get_phone_numbers(lf); BC_ASSERT_EQUAL(bctbx_list_size(phone_numbers), 1, int, "%i"); if (phone_numbers) bctbx_list_free(phone_numbers); linphone_friend_unref(lf); lf = NULL; lvc = NULL; linphone_core_manager_destroy(manager); }
LinphoneFriend *linphone_friend_new_from_vcard(LinphoneVcard *vcard) { LinphoneAddress* linphone_address = NULL; LinphoneFriend *fr; char *name = NULL; bctbx_list_t *sipAddresses = NULL; if (vcard == NULL) { ms_error("Cannot create friend from null vcard"); return NULL; } name = ms_strdup(linphone_vcard_get_full_name(vcard)); sipAddresses = linphone_vcard_get_sip_addresses(vcard); fr = linphone_friend_new(); // Currently presence takes too much time when dealing with hundreds of friends, so I disabled it for now fr->pol = LinphoneSPDeny; fr->subscribe = FALSE; if (sipAddresses) { const char *sipAddress = (const char *)sipAddresses->data; linphone_address = linphone_address_new(sipAddress); if (linphone_address) { linphone_friend_set_address(fr, linphone_address); linphone_address_unref(linphone_address); } bctbx_list_free(sipAddresses); } fr->vcard = vcard; if (name) { linphone_friend_set_name(fr, name); } ms_free(name); return fr; }
bctbx_list_t* linphone_friend_get_addresses(LinphoneFriend *lf) { LinphoneVcard *vcard = NULL; bctbx_list_t *sipAddresses = NULL; bctbx_list_t *addresses = NULL; bctbx_list_t *iterator = NULL; if (!lf) { return NULL; } vcard = lf->vcard; if (!vcard) { return lf->uri ? bctbx_list_append(addresses, lf->uri) : NULL; } sipAddresses = linphone_vcard_get_sip_addresses(vcard); iterator = sipAddresses; while (iterator) { const char *sipAddress = (const char *)iterator->data; LinphoneAddress *addr = linphone_address_new(sipAddress); if (addr) { addresses = bctbx_list_append(addresses, addr); } iterator = bctbx_list_next(iterator); } if (sipAddresses) bctbx_list_free(sipAddresses); return addresses; }
static void linphone_ldap_contact_search_destroy( LinphoneLDAPContactSearch* obj ) { //ms_message("~LinphoneLDAPContactSearch(%p)", obj); bctbx_list_for_each(obj->found_entries, linphone_ldap_contact_search_destroy_friend); obj->found_entries = bctbx_list_free(obj->found_entries); if( obj->filter ) ms_free(obj->filter); }
void buddy_lookup_request_free(BuddyLookupRequest *req){ if (req->key) ms_free(req->key); if (req->results){ bctbx_list_for_each(req->results,(void (*)(void*))buddy_info_free); bctbx_list_free(req->results); } ms_free(req); }
void sip_setup_unregister_all(void){ bctbx_list_t *elem; for(elem=registered_sip_setups;elem!=NULL;elem=elem->next){ SipSetup *ss=(SipSetup*)elem->data; if (ss->initialized){ if (ss->exit) ss->exit(); ss->initialized=FALSE; } } registered_sip_setups = bctbx_list_free(registered_sip_setups); }
/** * Clear all authentication information. **/ void linphone_core_clear_all_auth_info(LinphoneCore *lc){ bctbx_list_t *elem; int i; for(i=0,elem=lc->auth_info;elem!=NULL;elem=bctbx_list_next(elem),i++){ LinphoneAuthInfo *info=(LinphoneAuthInfo*)elem->data; linphone_auth_info_destroy(info); linphone_auth_info_write_config(lc->config,NULL,i); } bctbx_list_free(lc->auth_info); lc->auth_info=NULL; }
bool_t wait_for_three_cores(LinphoneCore *lc1, LinphoneCore *lc2, LinphoneCore *lc3, int timeout) { bctbx_list_t *lcs = NULL; bool_t result; int dummy = 0; if (lc1) lcs = bctbx_list_append(lcs, lc1); if (lc2) lcs = bctbx_list_append(lcs, lc2); if (lc3) lcs = bctbx_list_append(lcs, lc3); result = wait_for_list(lcs, &dummy, 1, timeout); bctbx_list_free(lcs); return result; }
static void print_graphs(MSTicker *s, bctbx_list_t *execution_list, bool_t force_schedule){ bctbx_list_t *it; bctbx_list_t *unschedulable=NULL; for(it=execution_list;it!=NULL;it=it->next){ print_graph((MSFilter*)it->data,s,&unschedulable,force_schedule); } /* filters that are part of a loop haven't been called in process() because one of their input refers to a filter that could not be scheduled (because they could not be scheduled themselves)... Do you understand ?*/ /* we resolve this by simply assuming that they must be called anyway for the loop to run correctly*/ /* we just recall run_graphs on them, as if they were source filters */ if (unschedulable!=NULL) { print_graphs(s,unschedulable,TRUE); bctbx_list_free(unschedulable); } }
void sal_op_set_route(SalOp *op, const char *route){ char* route_string=(void *)0; SalOpBase* op_base = (SalOpBase*)op; if (op_base->route_addresses) { bctbx_list_for_each(op_base->route_addresses,(void (*)(void *))sal_address_destroy); op_base->route_addresses=bctbx_list_free(op_base->route_addresses); } if (route) { op_base->route_addresses=bctbx_list_append(NULL,NULL); assign_address((SalAddress**)&(op_base->route_addresses->data),route); route_string=sal_address_as_string((SalAddress*)op_base->route_addresses->data); \ } assign_string(&op_base->route,route_string); \ if(route_string) ms_free(route_string); }
static void carddav_clean(void) { // This is to ensure the content of the test addressbook is in the correct state for the following tests LinphoneCoreManager *manager = linphone_core_manager_new2("carddav_rc", FALSE); LinphoneFriendList *lfl = linphone_core_create_friend_list(manager->lc); LinphoneFriendListCbs *cbs = linphone_friend_list_get_callbacks(lfl); LinphoneCardDAVStats *stats = (LinphoneCardDAVStats *)ms_new0(LinphoneCardDAVStats, 1); bctbx_list_t *friends = NULL; bctbx_list_t *friends_iterator = NULL; LinphoneFriend *lf = NULL; LinphoneVcard *lvc = NULL; linphone_friend_list_cbs_set_user_data(cbs, stats); linphone_friend_list_cbs_set_contact_created(cbs, carddav_contact_created); linphone_friend_list_cbs_set_contact_deleted(cbs, carddav_contact_deleted); linphone_friend_list_cbs_set_contact_updated(cbs, carddav_contact_updated); linphone_friend_list_cbs_set_sync_status_changed(cbs, carddav_sync_status_changed); linphone_core_add_friend_list(manager->lc, lfl); linphone_friend_list_set_uri(lfl, CARDDAV_SERVER); linphone_friend_list_synchronize_friends_from_server(lfl); wait_for_until(manager->lc, NULL, &stats->sync_done_count, 1, 5000); BC_ASSERT_EQUAL(stats->sync_done_count, 1, int, "%i"); stats->sync_done_count = 0; friends = bctbx_list_copy(lfl->friends); friends_iterator = friends; while (friends_iterator) { LinphoneFriend *lf = (LinphoneFriend *)friends_iterator->data; linphone_friend_list_remove_friend(lfl, lf); wait_for_until(manager->lc, NULL, &stats->sync_done_count, 1, 5000); BC_ASSERT_EQUAL(stats->sync_done_count, 1, int, "%i"); stats->sync_done_count = 0; stats->removed_contact_count = 0; friends_iterator = bctbx_list_next(friends_iterator); } bctbx_list_free(friends); lvc = linphone_vcard_context_get_vcard_from_buffer(manager->lc->vcard_context, "BEGIN:VCARD\r\nVERSION:4.0\r\nFN:Sylvain Berfini\r\nIMPP:sip:[email protected]\r\nUID:1f08dd48-29ac-4097-8e48-8596d7776283\r\nEND:VCARD\r\n"); linphone_vcard_set_url(lvc, "http://dav.linphone.org/card.php/addressbooks/tester/default/me.vcf"); lf = linphone_friend_new_from_vcard(lvc); linphone_friend_list_add_friend(lfl, lf); wait_for_until(manager->lc, NULL, &stats->sync_done_count, 1, 5000); BC_ASSERT_EQUAL(stats->sync_done_count, 1, int, "%i"); ms_free(stats); linphone_friend_unref(lf); linphone_friend_list_unref(lfl); linphone_core_manager_destroy(manager); }
static void _linphone_nat_policy_save_to_config(const LinphoneNatPolicy *policy, LpConfig *config, int index) { char *section; bctbx_list_t *l = NULL; section = belle_sip_strdup_printf("nat_policy_%i", index); lp_config_set_string(config, section, "ref", policy->ref); lp_config_set_string(config, section, "stun_server", policy->stun_server); lp_config_set_string(config, section, "stun_server_username", policy->stun_server_username); if (linphone_nat_policy_upnp_enabled(policy)) { l = bctbx_list_append(l, "upnp"); } else { if (linphone_nat_policy_stun_enabled(policy)) l = bctbx_list_append(l, "stun"); if (linphone_nat_policy_turn_enabled(policy)) l = bctbx_list_append(l, "turn"); if (linphone_nat_policy_ice_enabled(policy)) l = bctbx_list_append(l, "ice"); } lp_config_set_string_list(config, section, "protocols", l); belle_sip_free(section); bctbx_list_free(l); }
static void subscribe_presence_expired(void){ LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc"); LinphoneCoreManager* pauline1 = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); LinphoneFriend *lf; bctbx_list_t *lcs = NULL; lcs = bctbx_list_append(lcs, marie->lc); lcs = bctbx_list_append(lcs, pauline1->lc); lp_config_set_int(marie->lc->config, "sip", "subscribe_expires", 10); lf = linphone_core_create_friend(marie->lc); linphone_friend_set_address(lf, pauline1->identity); linphone_friend_enable_subscribes(lf, TRUE); linphone_core_add_friend(marie->lc, lf); linphone_friend_unref(lf); BC_ASSERT_TRUE(wait_for_list(lcs,&pauline1->stat.number_of_NewSubscriptionRequest,1, 5000)); BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePresenceActivityOnline,1, 2000)); lf = linphone_core_find_friend(pauline1->lc, marie->identity); BC_ASSERT_PTR_NOT_NULL(lf); if (lf) { BC_ASSERT_PTR_NOT_NULL(lf->insubs); /*marie comes offline suddenly*/ linphone_core_set_network_reachable(marie->lc, FALSE); /*after a certain time, pauline shall see the incoming SUBSCRIBE expired*/ wait_for_list(lcs,NULL, 0, 11000); BC_ASSERT_PTR_NULL(lf->insubs); /*just make network reachable so that marie can unregister properly*/ linphone_core_set_network_reachable(marie->lc, TRUE); BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneRegistrationOk,2, 10000)); } linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline1); bctbx_list_free(lcs); }
int linphone_friend_list_import_friends_from_vcard4_buffer(LinphoneFriendList *list, const char *vcard_buffer) { bctbx_list_t *vcards = NULL; bctbx_list_t *vcards_iterator = NULL; int count = 0; #ifndef VCARD_ENABLED ms_error("vCard support wasn't enabled at compilation time"); return -1; #endif if (!list) { ms_error("Can't import into a NULL list"); return -1; } vcards = linphone_vcard_list_from_vcard4_buffer(list->lc->vcard_context, vcard_buffer); vcards_iterator = vcards; if (!vcards) { ms_error("Failed to parse the buffer"); return -1; } while (vcards_iterator != NULL && vcards_iterator->data != NULL) { LinphoneVcard *vcard = (LinphoneVcard *)vcards_iterator->data; LinphoneFriend *lf = linphone_friend_new_from_vcard(vcard); if (lf) { if (LinphoneFriendListOK == linphone_friend_list_import_friend(list, lf, TRUE)) { count++; } linphone_friend_unref(lf); } else { linphone_vcard_free(vcard); } vcards_iterator = bctbx_list_next(vcards_iterator); } bctbx_list_free(vcards); linphone_core_store_friends_list_in_db(list->lc, list); return count; }
static void subscribe_presence_forked(void){ LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc"); LinphoneCoreManager* pauline1 = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_tcp_rc" : "pauline_tcp_rc"); LinphoneCoreManager* pauline2 = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_tcp_rc" : "pauline_tcp_rc"); LinphoneFriend *lf; bctbx_list_t *lcs = NULL; lcs = bctbx_list_append(lcs, marie->lc); lcs = bctbx_list_append(lcs, pauline1->lc); lcs = bctbx_list_append(lcs, pauline2->lc); lf = linphone_core_create_friend(marie->lc); linphone_friend_set_address(lf, pauline1->identity); linphone_friend_enable_subscribes(lf, TRUE); linphone_core_add_friend(marie->lc, lf); linphone_friend_unref(lf); BC_ASSERT_TRUE(wait_for_list(lcs,&pauline1->stat.number_of_NewSubscriptionRequest,1, 10000)); BC_ASSERT_TRUE(wait_for_list(lcs,&pauline2->stat.number_of_NewSubscriptionRequest,1, 2000)); /*we should get only one notify*/ BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePresenceActivityOnline,1, 10000)); BC_ASSERT_FALSE(wait_for_list(lcs,&marie->stat.number_of_LinphonePresenceActivityOnline,2, 2000)); /*marie also shall receive two SUBSCRIBEs from the two paulines, but won't be notified to the app since Marie set Pauline as a friend.*/ BC_ASSERT_EQUAL(marie->stat.number_of_NewSubscriptionRequest, 0, int, "%d"); /*and the two paulines shall be notified of marie's presence*/ BC_ASSERT_TRUE(wait_for_list(lcs,&pauline1->stat.number_of_LinphonePresenceActivityOnline,1, 3000)); BC_ASSERT_TRUE(wait_for_list(lcs,&pauline2->stat.number_of_LinphonePresenceActivityOnline,1, 2000)); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline1); linphone_core_manager_destroy(pauline2); bctbx_list_free(lcs); }
static void subscribe_test_declined(void) { LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc"); LinphoneCoreManager* pauline = linphone_core_manager_new( "pauline_tcp_rc"); LinphoneContent* content; LinphoneEvent *lev; const LinphoneErrorInfo *ei; bctbx_list_t* lcs=bctbx_list_append(NULL,marie->lc); lcs=bctbx_list_append(lcs,pauline->lc); content = linphone_core_create_content(marie->lc); linphone_content_set_type(content,"application"); linphone_content_set_subtype(content,"somexml"); linphone_content_set_buffer(content,subscribe_content,strlen(subscribe_content)); pauline->decline_subscribe=TRUE; lev=linphone_core_subscribe(marie->lc,pauline->identity,"dodo",600,content); linphone_event_ref(lev); BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionOutgoingProgress,1,1000)); BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionIncomingReceived,1,3000)); BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphoneSubscriptionError,1,21000));/*yes flexisip may wait 20 secs in case of forking*/ ei=linphone_event_get_error_info(lev); BC_ASSERT_PTR_NOT_NULL(ei); if (ei){ BC_ASSERT_EQUAL(linphone_error_info_get_protocol_code(ei),603, int, "%d"); BC_ASSERT_PTR_NOT_NULL(linphone_error_info_get_phrase(ei)); } BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphoneSubscriptionTerminated,1,1000)); bctbx_list_free(lcs); linphone_content_unref(content); linphone_event_unref(lev); linphone_core_manager_destroy(marie); linphone_core_manager_destroy(pauline); }
/** * Adds authentication information to the LinphoneCore. * * This information will be used during all SIP transactions that require authentication. **/ void linphone_core_add_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *info){ LinphoneAuthInfo *ai; bctbx_list_t *elem; bctbx_list_t *l; int restarted_op_count=0; bool_t updating=FALSE; if (info->ha1==NULL && info->passwd==NULL){ ms_warning("linphone_core_add_auth_info(): info supplied with empty password or ha1."); } /* find if we are attempting to modify an existing auth info */ ai=(LinphoneAuthInfo*)linphone_core_find_auth_info(lc,info->realm,info->username,info->domain); if (ai!=NULL && ai->domain && info->domain && strcmp(ai->domain, info->domain)==0){ lc->auth_info=bctbx_list_remove(lc->auth_info,ai); linphone_auth_info_destroy(ai); updating=TRUE; } lc->auth_info=bctbx_list_append(lc->auth_info,linphone_auth_info_clone(info)); /* retry pending authentication operations */ for(l=elem=sal_get_pending_auths(lc->sal);elem!=NULL;elem=elem->next){ SalOp *op=(SalOp*)elem->data; LinphoneAuthInfo *ai; const SalAuthInfo *req_sai=sal_op_get_auth_requested(op); ai=(LinphoneAuthInfo*)_linphone_core_find_auth_info(lc,req_sai->realm,req_sai->username,req_sai->domain, FALSE); if (ai){ SalAuthInfo sai; bctbx_list_t* proxy; sai.username=ai->username; sai.userid=ai->userid; sai.realm=ai->realm; sai.password=ai->passwd; sai.ha1=ai->ha1; if (ai->tls_cert && ai->tls_key) { sal_certificates_chain_parse(&sai, ai->tls_cert, SAL_CERTIFICATE_RAW_FORMAT_PEM); sal_signing_key_parse(&sai, ai->tls_key, ""); } else if (ai->tls_cert_path && ai->tls_key_path) { sal_certificates_chain_parse_file(&sai, ai->tls_cert_path, SAL_CERTIFICATE_RAW_FORMAT_PEM); sal_signing_key_parse_file(&sai, ai->tls_key_path, ""); } /*proxy case*/ for (proxy=(bctbx_list_t*)linphone_core_get_proxy_config_list(lc);proxy!=NULL;proxy=proxy->next) { if (proxy->data == sal_op_get_user_pointer(op)) { linphone_proxy_config_set_state((LinphoneProxyConfig*)(proxy->data),LinphoneRegistrationProgress,"Authentication..."); break; } } sal_op_authenticate(op,&sai); restarted_op_count++; } } if (l){ ms_message("linphone_core_add_auth_info(): restarted [%i] operation(s) after %s auth info for\n" "\tusername: [%s]\n" "\trealm [%s]\n" "\tdomain [%s]\n", restarted_op_count, updating ? "updating" : "adding", info->username ? info->username : "", info->realm ? info->realm : "", info->domain ? info->domain : ""); } bctbx_list_free(l); write_auth_infos(lc); }
static void stateful_analyzer_uninit(MSQosAnalyzer *objbase){ MSStatefulQosAnalyzer *obj=(MSStatefulQosAnalyzer*)objbase; bctbx_list_for_each(obj->rtcpstatspoint, ms_free); bctbx_list_free(obj->rtcpstatspoint); }
void __sal_op_free(SalOp *op){ SalOpBase *b=(SalOpBase *)op; if (b->from_address){ sal_address_destroy(b->from_address); b->from_address=NULL; } if (b->to_address){ sal_address_destroy(b->to_address); b->to_address=NULL; } if (b->service_route){ sal_address_destroy(b->service_route); b->service_route=NULL; } if (b->origin_address){ sal_address_destroy(b->origin_address); b->origin_address=NULL; } if (b->from) { ms_free(b->from); b->from=NULL; } if (b->to) { ms_free(b->to); b->to=NULL; } if (b->route) { ms_free(b->route); b->route=NULL; } if (b->realm) { ms_free(b->realm); b->realm=NULL; } if (b->contact_address) { sal_address_destroy(b->contact_address); } if (b->origin){ ms_free(b->origin); b->origin=NULL; } if (b->remote_ua){ ms_free(b->remote_ua); b->remote_ua=NULL; } if (b->remote_contact){ ms_free(b->remote_contact); b->remote_contact=NULL; } if (b->remote_contact_address){ sal_address_destroy(b->remote_contact_address); } if (b->local_media) sal_media_description_unref(b->local_media); if (b->remote_media) sal_media_description_unref(b->remote_media); if (b->call_id) ms_free((void*)b->call_id); if (b->service_route) { sal_address_destroy(b->service_route); } if (b->route_addresses){ bctbx_list_for_each(b->route_addresses,(void (*)(void*)) sal_address_destroy); b->route_addresses=bctbx_list_free(b->route_addresses); } if (b->recv_custom_headers) sal_custom_header_free(b->recv_custom_headers); if (b->sent_custom_headers) sal_custom_header_free(b->sent_custom_headers); if (b->entity_tag != NULL){ ms_free(b->entity_tag); b->entity_tag = NULL; } ms_free(op); }
static void ice_turn_call_base(bool_t video_enabled, bool_t forced_relay, bool_t caller_turn_enabled, bool_t callee_turn_enabled, bool_t rtcp_mux_enabled) { LinphoneCoreManager *marie; LinphoneCoreManager *pauline; LinphoneCall *lcall; LinphoneIceState expected_ice_state = LinphoneIceStateHostConnection; LinphoneMediaDirection expected_video_dir = LinphoneMediaDirectionInactive; bctbx_list_t *lcs = NULL; marie = linphone_core_manager_new("marie_rc"); lcs = bctbx_list_append(lcs, marie->lc); pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); lcs = bctbx_list_append(lcs, pauline->lc); configure_nat_policy(marie->lc, caller_turn_enabled); configure_nat_policy(pauline->lc, callee_turn_enabled); if (forced_relay == TRUE) { linphone_core_enable_forced_ice_relay(marie->lc, TRUE); linphone_core_enable_forced_ice_relay(pauline->lc, TRUE); linphone_core_enable_short_turn_refresh(marie->lc, TRUE); linphone_core_enable_short_turn_refresh(pauline->lc, TRUE); expected_ice_state = LinphoneIceStateRelayConnection; } if (rtcp_mux_enabled == TRUE) { lp_config_set_int(linphone_core_get_config(marie->lc), "rtp", "rtcp_mux", 1); lp_config_set_int(linphone_core_get_config(pauline->lc), "rtp", "rtcp_mux", 1); } if (video_enabled) { #ifdef VIDEO_ENABLED video_call_base_2(marie, pauline, FALSE, LinphoneMediaEncryptionNone, TRUE, TRUE); expected_video_dir = LinphoneMediaDirectionSendRecv; #endif } else { BC_ASSERT_TRUE(call(marie, pauline)); } /* Wait for the ICE reINVITE to complete */ BC_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &pauline->stat.number_of_LinphoneCallStreamsRunning, 2)); BC_ASSERT_TRUE(wait_for(pauline->lc, marie->lc, &marie->stat.number_of_LinphoneCallStreamsRunning, 2)); BC_ASSERT_TRUE(check_ice(pauline, marie, expected_ice_state)); check_nb_media_starts(pauline, marie, 1, 1); check_media_direction(marie, linphone_core_get_current_call(marie->lc), lcs, LinphoneMediaDirectionSendRecv, expected_video_dir); check_media_direction(pauline, linphone_core_get_current_call(pauline->lc), lcs, LinphoneMediaDirectionSendRecv, expected_video_dir); liblinphone_tester_check_rtcp(marie, pauline); lcall = linphone_core_get_current_call(marie->lc); BC_ASSERT_PTR_NOT_NULL(lcall->ice_session); if (lcall->ice_session != NULL) { IceCheckList *cl = ice_session_check_list(lcall->ice_session, 0); BC_ASSERT_PTR_NOT_NULL(cl); if (cl != NULL) { check_turn_context_statistics(cl->rtp_turn_context, forced_relay); if (!rtcp_mux_enabled) check_turn_context_statistics(cl->rtcp_turn_context, forced_relay); } } end_call(marie, pauline); linphone_core_manager_destroy(pauline); linphone_core_manager_destroy(marie); bctbx_list_free(lcs); }