static void authenticated_register_with_wrong_credentials(){
	LinphoneCoreManager *mgr;
	stats* counters;
	LCSipTransports transport = {5070,5070,0,5071};
	LinphoneAuthInfo *info=linphone_auth_info_new(test_username,NULL,"wrong passwd",NULL,auth_domain); /*create authentication structure from identity*/
	char route[256];
	
	sprintf(route,"sip:%s",test_route);
	
	mgr=linphone_core_manager_new(NULL);
	mgr->lc->vtable.auth_info_requested=auth_info_requested2;
	
	linphone_core_add_auth_info(mgr->lc,info); /*add wrong authentication info to LinphoneCore*/
	counters = get_stats(mgr->lc);
	register_with_refresh_base_2(mgr->lc,TRUE,auth_domain,route,TRUE,transport);
	CU_ASSERT_EQUAL(counters->number_of_auth_info_requested,1);
	linphone_core_manager_destroy(mgr);
}
static void ipphone_auth_final(LinphoneCore *lc){
	LinphoneAuthInfo *pending_auth = auth_stack.elem[auth_stack.nitems - 1];
	char phone_name[20];
	char password[20];
	int fd;

  if ((fd = fopen(phone_info_path, "r")) == NULL)
    return;
	fscanf(fd, "phone_name = %s\n", phone_name);
  fscanf(fd, "password = %s", password);
  fclose(fd);

	if(password){
		linphone_auth_info_set_passwd(pending_auth, password);
		linphone_core_add_auth_info(lc, pending_auth);
		--(auth_stack.nitems);
	}
}
Exemple #3
0
LinphoneProxyConfig * linphone_account_creator_configure(const LinphoneAccountCreator *creator) {
	LinphoneAddress *identity;
	LinphoneAuthInfo *info;
	LinphoneProxyConfig *cfg = linphone_core_create_proxy_config(creator->core);
	char *identity_str = ms_strdup_printf("sip:%s@%s", creator->username, creator->domain);

	linphone_proxy_config_set_identity(cfg, identity_str);
	linphone_proxy_config_set_server_addr(cfg, creator->domain);
	linphone_proxy_config_set_route(cfg, creator->route);
	linphone_proxy_config_enable_publish(cfg, FALSE);
	linphone_proxy_config_enable_register(cfg, TRUE);
	ms_free(identity_str);

	if (strcmp(creator->domain, "sip.linphone.org") == 0) {
		linphone_proxy_config_enable_avpf(cfg, TRUE);
		// If account created on sip.linphone.org, we configure linphone to use TLS by default
		if (linphone_core_sip_transport_supported(creator->core, LinphoneTransportTls)) {
			LinphoneAddress *addr = linphone_address_new(linphone_proxy_config_get_server_addr(cfg));
			char *tmp;
			linphone_address_set_transport(addr, LinphoneTransportTls);
			tmp = linphone_address_as_string(addr);
			linphone_proxy_config_set_server_addr(cfg, tmp);
			linphone_proxy_config_set_route(cfg, tmp);
			ms_free(tmp);
			linphone_address_destroy(addr);
		}
		linphone_core_set_stun_server(creator->core, "stun.linphone.org");
		linphone_core_set_firewall_policy(creator->core, LinphonePolicyUseIce);
	}

	identity = linphone_address_new(linphone_proxy_config_get_identity(cfg));
	info = linphone_auth_info_new(linphone_address_get_username(identity), NULL, creator->password, NULL, NULL, linphone_address_get_domain(identity));
	linphone_core_add_auth_info(creator->core, info);
	linphone_address_destroy(identity);

	if (linphone_core_add_proxy_config(creator->core, cfg) != -1) {
		linphone_core_set_default_proxy(creator->core, cfg);
		return cfg;
	}

	linphone_core_remove_auth_info(creator->core, info);
	linphone_proxy_config_unref(cfg);
	return NULL;
}
Exemple #4
0
bool SipClient::setIdentity(const QString &identity, const QString &password)
{
	m_identity = identity;
	m_password = password;

        /* Create Proxy Config*/
	m_proxyCfg = linphone_core_create_proxy_config(lc);

        /*parse identity*/
        LinphoneAddress *from = linphone_address_new(identity.toLatin1().data());
	if (from == NULL) {
                qDebug() << __PRETTY_FUNCTION__ << " " << identity << " is not a valid sip uri, must be like sip:[email protected]";
		return false;
        }

	m_authInfo = linphone_auth_info_new(linphone_address_get_username(from), NULL, password.toLatin1().data(), NULL, NULL, NULL);
	linphone_core_add_auth_info(lc, m_authInfo);

	/* Configure proxy entries */

	/* Set identity with user name and domain*/
	linphone_proxy_config_set_identity(m_proxyCfg, identity.toLatin1().data());

	/* Extract domain address from identity*/
	const char *server_addr = linphone_address_get_domain(from);

	/* We assume domain = proxy server address*/
	linphone_proxy_config_set_server_addr(m_proxyCfg, server_addr);

	/* Activate registration for this proxy config*/
	linphone_proxy_config_enable_register(m_proxyCfg, TRUE);

	 /* Release resource*/
	linphone_address_destroy(from);

	 /* Add proxy config to linphone core*/
	linphone_core_add_proxy_config(lc, m_proxyCfg);

	 /* Set to default proxy*/
	linphone_core_set_default_proxy(lc, m_proxyCfg);

	return true;
}
Exemple #5
0
static void configure_nat_policy(LinphoneCore *lc, bool_t turn_enabled) {
	const char *username = "******";
	const char *password = "******";
	LinphoneAuthInfo *auth_info = linphone_core_create_auth_info(lc, username, NULL, password, NULL, "sip.linphone.org", NULL);
	LinphoneNatPolicy *nat_policy = linphone_core_create_nat_policy(lc);
	linphone_nat_policy_enable_ice(nat_policy, TRUE);
	if (turn_enabled) {
		linphone_nat_policy_enable_turn(nat_policy, TRUE);
		linphone_nat_policy_set_stun_server(nat_policy, "sip1.linphone.org:3479");
		linphone_nat_policy_set_stun_server_username(nat_policy, username);
	} else {
		linphone_nat_policy_enable_stun(nat_policy, TRUE);
		linphone_nat_policy_set_stun_server(nat_policy, "stun.linphone.org");
	}
	linphone_core_set_nat_policy(lc, nat_policy);
	linphone_core_add_auth_info(lc, auth_info);
	linphone_nat_policy_unref(nat_policy);
	linphone_auth_info_destroy(auth_info);
}
void AccountSettingsModel::setUsername(const QString& username) {
    if (!_authInfo || !_proxyConfig) {
        return;
    }
    LinphoneAuthInfo *ai = linphone_auth_info_clone(_authInfo);
    linphone_auth_info_set_username(ai, username.toUtf8().constData());
    linphone_core_remove_auth_info(LinphoneManager::getInstance()->getLc(), _authInfo);
    linphone_core_add_auth_info(LinphoneManager::getInstance()->getLc(), ai);
    _authInfo = ai;

    const char *identity = linphone_proxy_config_get_identity(_proxyConfig);
    LinphoneAddress *addr = linphone_core_create_address(LinphoneManager::getInstance()->getLc(), identity);
    linphone_address_set_username(addr, username.toUtf8().constData());

    linphone_proxy_config_edit(_proxyConfig);
    linphone_proxy_config_set_identity_address(_proxyConfig, addr);
    linphone_proxy_config_done(_proxyConfig);
    linphone_address_destroy(addr);
}
Exemple #7
0
LinphoneAddress *account_manager_check_account(AccountManager *m, LinphoneProxyConfig *cfg){
	LinphoneCore *lc=linphone_proxy_config_get_core(cfg);
	const char *identity=linphone_proxy_config_get_identity(cfg);
	LinphoneAddress *id_addr=linphone_address_new(identity);
	Account *account=account_manager_get_account(m,id_addr);
	LinphoneAuthInfo *ai;
	char *tmp;
	bool_t create_account=FALSE;
	const LinphoneAuthInfo *original_ai = linphone_core_find_auth_info(lc
																		,NULL
																		, linphone_address_get_username(id_addr)
																		, linphone_address_get_domain(id_addr));

	if (!account){
		account=account_new(id_addr,m->unique_id);
		ms_message("No account for %s exists, going to create one.",identity);
		create_account=TRUE;
		m->accounts=ms_list_append(m->accounts,account);
	}
	/*modify the username of the identity of the proxy config*/
	linphone_address_set_username(id_addr, linphone_address_get_username(account->modified_identity));
	tmp=linphone_address_as_string(id_addr);
	linphone_proxy_config_set_identity(cfg,tmp);
	ms_free(tmp);

	if (create_account){
		account_create_on_server(account,cfg);
	}

	/*remove previous auth info to avoid mismatching*/
	if (original_ai)
		linphone_core_remove_auth_info(lc,original_ai);

	ai=linphone_auth_info_new(linphone_address_get_username(account->modified_identity),
				NULL,
				account->password,NULL,NULL,linphone_address_get_domain(account->modified_identity));
	linphone_core_add_auth_info(lc,ai);
	linphone_auth_info_destroy(ai);

	linphone_address_unref(id_addr);
	return account->modified_identity;
}
static void register_with_refresh_with_send_error() {
	int retry=0;
	LinphoneCoreManager* lcm = create_lcm_with_auth(1);
	stats* counters = &lcm->stat;
	LinphoneAuthInfo *info=linphone_auth_info_new(test_username,NULL,test_password,NULL,auth_domain); /*create authentication structure from identity*/
	char route[256];
	sprintf(route,"sip:%s",test_route);
	linphone_core_add_auth_info(lcm->lc,info); /*add authentication info to LinphoneCore*/

	register_with_refresh_base(lcm->lc,TRUE,auth_domain,route);
	/*simultate a network error*/
	sal_set_send_error(lcm->lc->sal, -1);
	while (counters->number_of_LinphoneRegistrationProgress<2 && retry++ <20) {
			linphone_core_iterate(lcm->lc);
			ms_usleep(100000);
	}
	CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,0);
	CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationProgress,2);

	CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationCleared,0);

	linphone_core_manager_destroy(lcm);
}
static void authenticated_register_with_wrong_credentials_with_params_base(const char* user_agent,LinphoneCoreManager *mgr) {
	stats* counters;
	LCSipTransports transport = {5070,5070,0,5071};
	LinphoneAuthInfo *info=linphone_auth_info_new(test_username,NULL,"wrong passwd",NULL,auth_domain,NULL); /*create authentication structure from identity*/
	char route[256];
	
	sprintf(route,"sip:%s",test_route);
	
	sal_set_refresher_retry_after(mgr->lc->sal,500);
	if (user_agent) {
		linphone_core_set_user_agent(mgr->lc,user_agent,NULL);
	}
	linphone_core_add_auth_info(mgr->lc,info); /*add wrong authentication info to LinphoneCore*/
	counters = get_stats(mgr->lc);
	register_with_refresh_base_3(mgr->lc,TRUE,auth_domain,route,FALSE,transport,LinphoneRegistrationFailed);
	//CU_ASSERT_EQUAL(counters->number_of_auth_info_requested,3); register_with_refresh_base_3 does not alow to precisely check number of number_of_auth_info_requested
	/*wait for retry*/
	CU_ASSERT_TRUE(wait_for(mgr->lc,mgr->lc,&counters->number_of_auth_info_requested,4));
	CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,1);
	
	/*check the detailed error info */
	if (!user_agent || strcmp(user_agent,"tester-no-403")!=0){
		LinphoneProxyConfig *cfg=NULL;
		linphone_core_get_default_proxy(mgr->lc,&cfg);
		CU_ASSERT_PTR_NOT_NULL(cfg);
		if (cfg){
			const LinphoneErrorInfo *ei=linphone_proxy_config_get_error_info(cfg);
			const char *phrase=linphone_error_info_get_phrase(ei);
			CU_ASSERT_PTR_NOT_NULL(phrase);
			if (phrase) CU_ASSERT_TRUE(strcmp(phrase,"Forbidden")==0);
			CU_ASSERT_EQUAL(linphone_error_info_get_protocol_code(ei),403);
			CU_ASSERT_PTR_NULL(linphone_error_info_get_details(ei));
		}
		
	}
	}
void account_create_on_server(Account *account, const LinphoneProxyConfig *refcfg){
	LinphoneCoreVTable vtable={0};
	LinphoneCore *lc;
	LinphoneAddress *tmp_identity=linphone_address_clone(account->modified_identity);
	LinphoneProxyConfig *cfg;
	LinphoneAuthInfo *ai;
	char *tmp;
	LinphoneAddress *server_addr;
	LCSipTransports tr;

	vtable.registration_state_changed=account_created_on_server_cb;
	vtable.auth_info_requested=account_created_auth_requested_cb;
	lc=configure_lc_from(&vtable,bc_tester_read_dir_prefix,NULL,account);
	tr.udp_port=LC_SIP_TRANSPORT_RANDOM;
	tr.tcp_port=LC_SIP_TRANSPORT_RANDOM;
	tr.tls_port=LC_SIP_TRANSPORT_RANDOM;
	linphone_core_set_sip_transports(lc,&tr);

	cfg=linphone_core_create_proxy_config(lc);
	linphone_address_set_secure(tmp_identity, FALSE);
	linphone_address_set_password(tmp_identity,account->password);
	linphone_address_set_header(tmp_identity,"X-Create-Account","yes");
	tmp=linphone_address_as_string(tmp_identity);
	linphone_proxy_config_set_identity(cfg,tmp);
	ms_free(tmp);
	linphone_address_unref(tmp_identity);

	server_addr=linphone_address_new(linphone_proxy_config_get_server_addr(refcfg));
	linphone_address_set_secure(server_addr, FALSE);
	linphone_address_set_transport(server_addr,LinphoneTransportTcp); /*use tcp for account creation, we may not have certificates configured at this stage*/
	linphone_address_set_port(server_addr,0);
	tmp=linphone_address_as_string(server_addr);
	linphone_proxy_config_set_server_addr(cfg,tmp);
	ms_free(tmp);
	linphone_address_unref(server_addr);
	linphone_proxy_config_set_expires(cfg,3600);

	linphone_core_add_proxy_config(lc,cfg);

	if (wait_for_until(lc,NULL,&account->auth_requested,1,10000)==FALSE){
		ms_fatal("Account for %s could not be created on server.", linphone_proxy_config_get_identity(refcfg));
	}
	linphone_proxy_config_edit(cfg);
	tmp_identity=linphone_address_clone(account->modified_identity);
	linphone_address_set_secure(tmp_identity, FALSE);
	tmp=linphone_address_as_string(tmp_identity);
	linphone_proxy_config_set_identity(cfg,tmp); /*remove the X-Create-Account header*/
	linphone_address_unref(tmp_identity);
	ms_free(tmp);
	linphone_proxy_config_done(cfg);

	ai=linphone_auth_info_new(linphone_address_get_username(account->modified_identity),
				NULL,
				account->password,NULL,NULL,linphone_address_get_domain(account->modified_identity));
	linphone_core_add_auth_info(lc,ai);
	linphone_auth_info_destroy(ai);

	if (wait_for_until(lc,NULL,&account->created,1,3000)==FALSE){
		ms_fatal("Account for %s is not working on server.", linphone_proxy_config_get_identity(refcfg));
	}
	linphone_core_remove_proxy_config(lc,cfg);
	linphone_proxy_config_unref(cfg);
	if (wait_for_until(lc,NULL,&account->done,1,3000)==FALSE){
		ms_error("Account creation could not clean the registration context.");
	}
	linphone_core_destroy(lc);
}
Exemple #11
0
/*
 * This is called from idle_call() whenever
 * pending_auth != NULL.
 *
 * It prompts user for a password.
 * Hitting ^D (EOF) would make this function 
 * return 0 (Cancel).
 * Any other input would try to set linphone core
 * auth_password for the pending_auth, add the auth_info
 * and return 1.
 */
int
linphonec_prompt_for_auth_final(LinphoneCore *lc)
{
	char *input, *iptr;
	char auth_prompt[256];
	rl_hook_func_t *old_event_hook;

	LinphoneAuthInfo *pending_auth=auth_stack.elem[auth_stack.nitems-1];

	snprintf(auth_prompt, 256, "Password for %s on %s: ",
		pending_auth->username, pending_auth->realm);

	printf("\n");

	/*
	 * Disable event hook to avoid entering an
	 * infinite loop. This would prevent idle_call
	 * from being called during authentication reads.
	 * Note that it might be undesiderable...
	 */
	old_event_hook=rl_event_hook;
	rl_event_hook=NULL;

	while (1)
	{
		input=readline(auth_prompt);

		/*
		 * If EOF (^D) is sent you probably don't want
		 * to provide an auth password... should give up
		 * the operation, but there's no mechanism to
		 * send this info back to caller currently...
		 */
		if ( ! input )
		{
			printf("Cancel requested, but not implemented.\n"); 
			continue;
		}

		/* Strip blanks */
		iptr=lpc_strip_blanks(input);

		/*
		 * Only blanks, continue asking
		 */
		if ( ! *iptr )
		{
			free(input);
			continue;
		}

		/* Something typed, let's try */
		break;
	}

	/*
	 * No check is done here to ensure password is correct.
	 * I guess password will be asked again later.
	 */
	linphone_auth_info_set_passwd(pending_auth, input);
	linphone_core_add_auth_info(lc, pending_auth);
	--(auth_stack.nitems);

	/*
	 * Reset line_buffer, to avoid the password
	 * to be used again from outer readline
	 */
	rl_line_buffer[0]='\0';

	rl_event_hook=old_event_hook;

	return 1;
}
static void auth_info_requested(LinphoneCore *lc, const char *realm, const char *username, const char *domain) {
	LinphoneAuthInfo *info;
	info=linphone_auth_info_new(test_username,NULL,test_password,NULL,realm,domain); /*create authentication structure from identity*/
	linphone_core_add_auth_info(lc,info); /*add authentication info to LinphoneCore*/
}
static void text_message_with_credential_from_auth_cb_auth_info_requested(LinphoneCore *lc, const char *realm, const char *username, const char *domain) {
	ms_message("text_message_with_credential_from_auth_cb:Auth info requested  for user id [%s] at realm [%s]\n"
						,username
						,realm);
	linphone_core_add_auth_info(lc,text_message_with_credential_from_auth_cb_auth_info); /*add stored authentication info to LinphoneCore*/
}
Exemple #14
0
int main(int argc, char *argv[]){
	LinphoneCoreVTable vtable={0};
	MyAppData *data=ms_new0(MyAppData,1);
	char* identity=NULL;
	char* password=NULL;
	int i;
	LinphoneProxyConfig* proxy_cfg;
	LinphoneAddress *from;
	LinphoneAuthInfo *info;
	const char* server_addr;

	/* takes   sip uri  identity from the command line arguments */
	if (argc>1){
		identity=argv[1];
	}

	/* takes   password from the command line arguments */
	if (argc>2){
		password=argv[2];
	}

	signal(SIGINT,stop);

#ifdef DEBUG
	linphone_core_enable_logs(NULL); /*enable liblinphone logs.*/
#endif
	/*
	 Fill the LinphoneCoreVTable with application callbacks.
	 All are optional. Here we only use the registration_state_changed callbacks
	 in order to get notifications about the progress of the registration.
	 */
	vtable.registration_state_changed=registration_state_changed;
	vtable.subscription_state_changed=subscription_state_changed;

	/*
	 Instanciate a LinphoneCore object given the LinphoneCoreVTable
	*/
	lc=linphone_core_new(&vtable,NULL,NULL,data);

	/*create proxy config*/
	proxy_cfg = linphone_proxy_config_new();
	/*parse identity*/
	from = linphone_address_new(identity);
	if (from==NULL){
		printf("%s not a valid sip uri, must be like sip:[email protected] \n",identity);
		goto end;
	}
	if (password!=NULL){
		info=linphone_auth_info_new(linphone_address_get_username(from),NULL,password,NULL,NULL,NULL); /*create authentication structure from identity*/
		linphone_core_add_auth_info(lc,info); /*add authentication info to LinphoneCore*/
	}

	// configure proxy entries
	linphone_proxy_config_set_identity(proxy_cfg,identity); /*set identity with user name and domain*/
	server_addr = linphone_address_get_domain(from); /*extract domain address from identity*/
	linphone_proxy_config_set_server_addr(proxy_cfg,server_addr); /* we assume domain = proxy server address*/
	linphone_proxy_config_enable_register(proxy_cfg,TRUE); /*activate registration for this proxy config*/
	linphone_address_destroy(from); /*release resource*/

	linphone_core_add_proxy_config(lc,proxy_cfg); /*add proxy config to linphone core*/
	linphone_core_set_default_proxy(lc,proxy_cfg); /*set to default proxy*/

	i=0;
	/* main loop for receiving notifications and doing background linphonecore work: */
	while(running){
		linphone_core_iterate(lc); /* first iterate initiates registration */
		ms_usleep(50000);
		++i;
		if (data->ev && i%100==0){
			LinphoneContentPrivate content;
			content.type="application";
			content.subtype="goodxml";
			content.data="really cool";
			content.size=strlen((const char*)content.data);
			linphone_event_notify(data->ev,LINPHONE_CONTENT(&content));
		}
	}

	linphone_core_get_default_proxy(lc,&proxy_cfg); /* get default proxy config*/
	linphone_proxy_config_edit(proxy_cfg); /*start editing proxy configuration*/
	linphone_proxy_config_enable_register(proxy_cfg,FALSE); /*de-activate registration for this proxy config*/
	linphone_proxy_config_done(proxy_cfg); /*initiate REGISTER with expire = 0*/

	if (data->ev){
		linphone_event_terminate(data->ev);
	}

	while(linphone_proxy_config_get_state(proxy_cfg) !=  LinphoneRegistrationCleared){
		linphone_core_iterate(lc); /*to make sure we receive call backs before shutting down*/
		ms_usleep(50000);
	}

end:
	printf("Shutting down...\n");
	linphone_core_destroy(lc);
	ms_free(data);
	printf("Exited\n");
	return 0;
}
static void register_with_refresh_base_3(LinphoneCore* lc
											, bool_t refresh
											,const char* domain
											,const char* route
											,bool_t late_auth_info
											,LCSipTransports transport
											,LinphoneRegistrationState expected_final_state) {
	int retry=0;
	char* addr;
	LinphoneProxyConfig* proxy_cfg;
	stats* counters;
	LinphoneAddress *from;
	const char* server_addr;
	LinphoneAuthInfo *info;

	CU_ASSERT_PTR_NOT_NULL(lc);
	if (!lc) return;
	counters = get_stats(lc);
	reset_counters(counters);
	linphone_core_set_sip_transports(lc,&transport);

	proxy_cfg = linphone_proxy_config_new();

	from = create_linphone_address(domain);

	linphone_proxy_config_set_identity(proxy_cfg,addr=linphone_address_as_string(from));
	ms_free(addr);
	server_addr = linphone_address_get_domain(from);

	linphone_proxy_config_enable_register(proxy_cfg,TRUE);
	linphone_proxy_config_set_expires(proxy_cfg,1);
	if (route) {
		linphone_proxy_config_set_route(proxy_cfg,route);
		linphone_proxy_config_set_server_addr(proxy_cfg,route);
	} else {
		linphone_proxy_config_set_server_addr(proxy_cfg,server_addr);
	}
	linphone_address_destroy(from);

	linphone_core_add_proxy_config(lc,proxy_cfg);
	linphone_core_set_default_proxy(lc,proxy_cfg);

	while (counters->number_of_LinphoneRegistrationOk<1+(refresh!=0)
			&& retry++ <(110 /*only wait 11 s if final state is progress*/+(expected_final_state==LinphoneRegistrationProgress?0:200))) {
		linphone_core_iterate(lc);
		if (counters->number_of_auth_info_requested>0 && linphone_proxy_config_get_state(proxy_cfg) == LinphoneRegistrationFailed && late_auth_info) {
			if (!linphone_core_get_auth_info_list(lc)) {
				CU_ASSERT_EQUAL(linphone_proxy_config_get_error(proxy_cfg),LinphoneReasonUnauthorized);
				info=linphone_auth_info_new(test_username,NULL,test_password,NULL,auth_domain,NULL); /*create authentication structure from identity*/
				linphone_core_add_auth_info(lc,info); /*add authentication info to LinphoneCore*/
			}
		}
		if (linphone_proxy_config_get_error(proxy_cfg) == LinphoneReasonBadCredentials
				|| (counters->number_of_auth_info_requested>2 &&linphone_proxy_config_get_error(proxy_cfg) == LinphoneReasonUnauthorized)) /*no need to continue if auth cannot be found*/
			break; /*no need to continue*/
		ms_usleep(100000);
	}
	CU_ASSERT_EQUAL(linphone_proxy_config_is_registered(proxy_cfg),(expected_final_state == LinphoneRegistrationOk));
	CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationNone,0);
	CU_ASSERT_TRUE(counters->number_of_LinphoneRegistrationProgress>=1);
	if (expected_final_state == LinphoneRegistrationOk) {
		CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationOk,1+(refresh!=0));
		CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationFailed,late_auth_info?1:0);
	} else
		/*checking to be done outside this functions*/
	CU_ASSERT_EQUAL(counters->number_of_LinphoneRegistrationCleared,0);

}