Commit bcae09e4 authored by Simon Morlat's avatar Simon Morlat

Fix bug when setting up custom tone twice.

parent f37e3f53
...@@ -1372,7 +1372,7 @@ const char *linphone_core_get_tone_file(const LinphoneCore *lc, LinphoneToneID i ...@@ -1372,7 +1372,7 @@ const char *linphone_core_get_tone_file(const LinphoneCore *lc, LinphoneToneID i
} }
void _linphone_core_set_tone(LinphoneCore *lc, LinphoneReason reason, LinphoneToneID id, const char *audiofile){ void _linphone_core_set_tone(LinphoneCore *lc, LinphoneReason reason, LinphoneToneID id, const char *audiofile){
LinphoneToneDescription *tone=linphone_core_get_call_error_tone(lc,reason); LinphoneToneDescription *tone = linphone_core_lookup_tone(lc,reason, id);
if (tone){ if (tone){
lc->tones=bctbx_list_remove(lc->tones,tone); lc->tones=bctbx_list_remove(lc->tones,tone);
linphone_tone_description_destroy(tone); linphone_tone_description_destroy(tone);
......
...@@ -383,6 +383,25 @@ static void codec_setup(void){ ...@@ -383,6 +383,25 @@ static void codec_setup(void){
} }
static void custom_tones_setup(void){
LinphoneCoreManager *mgr = linphone_core_manager_new2("empty_rc", FALSE);
const char *tone;
linphone_core_set_tone(mgr->lc, LinphoneToneCallOnHold, "callonhold.wav");
tone = linphone_core_get_tone_file(mgr->lc, LinphoneToneCallOnHold);
BC_ASSERT_PTR_NOT_NULL(tone);
if (tone){
BC_ASSERT_STRING_EQUAL(tone, "callonhold.wav");
}
linphone_core_set_tone(mgr->lc, LinphoneToneCallOnHold, "callonhold2.wav");
tone = linphone_core_get_tone_file(mgr->lc, LinphoneToneCallOnHold);
BC_ASSERT_PTR_NOT_NULL(tone);
if (tone){
BC_ASSERT_STRING_EQUAL(tone, "callonhold2.wav");
}
linphone_core_manager_destroy(mgr);
}
test_t setup_tests[] = { test_t setup_tests[] = {
TEST_NO_TAG("Version check", linphone_version_test), TEST_NO_TAG("Version check", linphone_version_test),
TEST_NO_TAG("Linphone Address", linphone_address_test), TEST_NO_TAG("Linphone Address", linphone_address_test),
...@@ -398,7 +417,8 @@ test_t setup_tests[] = { ...@@ -398,7 +417,8 @@ test_t setup_tests[] = {
TEST_NO_TAG("Chat room", chat_room_test), TEST_NO_TAG("Chat room", chat_room_test),
TEST_NO_TAG("Devices reload", devices_reload_test), TEST_NO_TAG("Devices reload", devices_reload_test),
TEST_NO_TAG("Codec usability", codec_usability_test), TEST_NO_TAG("Codec usability", codec_usability_test),
TEST_NO_TAG("Codec setup", codec_setup) TEST_NO_TAG("Codec setup", codec_setup),
TEST_NO_TAG("Custom tones setup", custom_tones_setup)
}; };
test_suite_t setup_test_suite = {"Setup", NULL, NULL, liblinphone_tester_before_each, liblinphone_tester_after_each, test_suite_t setup_test_suite = {"Setup", NULL, NULL, liblinphone_tester_before_each, liblinphone_tester_after_each,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment