diff --git a/coreapi/misc.c b/coreapi/misc.c index 720b6827e..1d36282c7 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -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){ - LinphoneToneDescription *tone=linphone_core_get_call_error_tone(lc,reason); + LinphoneToneDescription *tone = linphone_core_lookup_tone(lc,reason, id); if (tone){ lc->tones=bctbx_list_remove(lc->tones,tone); linphone_tone_description_destroy(tone); diff --git a/tester/setup_tester.c b/tester/setup_tester.c index 4182ab6b0..2a4b08391 100644 --- a/tester/setup_tester.c +++ b/tester/setup_tester.c @@ -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_NO_TAG("Version check", linphone_version_test), TEST_NO_TAG("Linphone Address", linphone_address_test), @@ -398,7 +417,8 @@ test_t setup_tests[] = { TEST_NO_TAG("Chat room", chat_room_test), TEST_NO_TAG("Devices reload", devices_reload_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,