create linphone address with different usernames for testing purpose

This commit is contained in:
Danmei Chen 2017-12-27 14:05:04 +01:00
parent 3b69788398
commit 675eb02a52
2 changed files with 10 additions and 2 deletions

View file

@ -334,6 +334,7 @@ void dtmf_received(LinphoneCore *lc, LinphoneCall *call, int dtmf);
void call_stats_updated(LinphoneCore *lc, LinphoneCall *call, const LinphoneCallStats *stats);
LinphoneAddress * create_linphone_address(const char * domain);
LinphoneAddress * create_linphone_address_with_username(const char * domain, const char * username);
bool_t wait_for(LinphoneCore* lc_1, LinphoneCore* lc_2,int* counter,int value);
bool_t wait_for_list(MSList* lcs,int* counter,int value,int timeout_ms);
bool_t wait_for_until(LinphoneCore* lc_1, LinphoneCore* lc_2,int* counter,int value,int timout_ms);

View file

@ -91,10 +91,17 @@ bool_t liblinphone_tester_clock_elapsed(const MSTimeSpec *start, int value_ms){
LinphoneAddress * create_linphone_address(const char * domain) {
return create_linphone_address_with_username(domain,NULL);
}
LinphoneAddress * create_linphone_address_with_username(const char * domain, const char* username) {
LinphoneAddress *addr = linphone_address_new(NULL);
if (!BC_ASSERT_PTR_NOT_NULL(addr)) return NULL;
linphone_address_set_username(addr,test_username);
BC_ASSERT_STRING_EQUAL(test_username,linphone_address_get_username(addr));
/* For test purpose, we might use different username */
if(username) linphone_address_set_username(addr,username);
else linphone_address_set_username(addr,test_username);
if(username) BC_ASSERT_STRING_EQUAL(username,linphone_address_get_username(addr));
else BC_ASSERT_STRING_EQUAL(test_username,linphone_address_get_username(addr));
if (!domain) domain= test_route;
linphone_address_set_domain(addr,domain);
BC_ASSERT_STRING_EQUAL(domain,linphone_address_get_domain(addr));