From c478d1384ef59afc68fee76e6fe27639fe2c0349 Mon Sep 17 00:00:00 2001 From: Donat Zenichev Date: Sun, 2 Mar 2025 09:47:36 +0100 Subject: [PATCH] MT#62272 moh: mark player for play media impl. Mark the media player as used for MoH (via .opts), before actually calling the play media implementation. This allows to differentiate a default play media case from those used by MoH. Change-Id: Ic7a60b6653a505bc856fec767f88988f624bdea0 --- daemon/media_player.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/daemon/media_player.c b/daemon/media_player.c index a66367151..87a44e519 100644 --- a/daemon/media_player.c +++ b/daemon/media_player.c @@ -1571,13 +1571,16 @@ const char * call_check_moh(struct call_monologue *from_ml, struct call_monologu .file = from_ml->moh_file, .blob = from_ml->moh_blob, .db_id = from_ml->moh_db_id, + .moh = true, /* mark as moh enabled */ ); + /* whom to play the moh audio */ errstr = call_play_media_for_ml(to_ml, opts, NULL); - if (errstr) + if (errstr) { + to_ml->player->opts.moh = false; /* initialization failed, mark accordingly */ return errstr; - /* mark player as used for MoH */ - to_ml->player->opts.moh = true; + } + /* handle MoH related flags */ call_ml_moh_handle_flags(from_ml, to_ml); @@ -1587,9 +1590,6 @@ const char * call_check_moh(struct call_monologue *from_ml, struct call_monologu { /* whom to stop the moh audio */ call_stop_media_for_ml(to_ml); - /* mark MoH as already not used (it can be unset now) */ - to_ml->player->opts.moh = false; - ilog(LOG_DEBUG, "Music on hold stopped with coming SDP offer."); } return NULL; @@ -1638,6 +1638,8 @@ long long call_stop_media_for_ml(struct call_monologue *ml) /* restore to non-mixing if needed */ codec_update_all_source_handlers(ml, NULL); update_init_subscribers(ml, OP_STOP_MEDIA); + /* mark MoH as already not used (it can be unset now) */ + ml->player->opts.moh = false; return ret; #else return 0;