diff --git a/daemon/call.c b/daemon/call.c index aa7767171..e3b1101e9 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -3464,17 +3464,20 @@ struct media_subscription *call_ml_get_top_ms(struct call_monologue *ml) { } /** - * Checks if any present audio medias put this monologue into sendonly state. + * Checks if any present audio medias are sendonly/inactive. * Should only be used when medias are already initialized with flags. */ -bool call_ml_sendonly(struct call_monologue *ml) { +bool call_ml_sendonly_inactive(struct call_monologue *ml) { for (int i = 0; i < ml->medias->len; i++) { struct call_media * media = ml->medias->pdata[i]; if (!media || media->type_id != MT_AUDIO) continue; - /* sendonly media means it can receive packets, but doesn't send */ - if (!MEDIA_ISSET(media, SEND) && MEDIA_ISSET(media, RECV)) + /* sendonly media for rtpengine means: receive from this media, but don't send to it + * sendonly: !MEDIA_ISSET(media, SEND) && MEDIA_ISSET(media, RECV) + * inactive: !MEDIA_ISSET(media, SEND) && !MEDIA_ISSET(media, RECV) + */ + if (!MEDIA_ISSET(media, SEND)) return true; } return false; diff --git a/daemon/media_player.c b/daemon/media_player.c index 4b3665936..cef427f8b 100644 --- a/daemon/media_player.c +++ b/daemon/media_player.c @@ -1218,7 +1218,7 @@ static bool media_player_add_file(struct media_player *mp, media_player_opts_t o bool call_ml_wants_moh(struct call_monologue *ml, enum ng_opmode opmode) { - if (opmode == OP_OFFER && call_ml_sendonly(ml) && + if (opmode == OP_OFFER && call_ml_sendonly_inactive(ml) && (ml->moh_db_id > 0 || ml->moh_file.len || ml->moh_blob.len)) { return true; @@ -1230,7 +1230,7 @@ bool call_ml_stops_moh(struct call_monologue *from_ml, struct call_monologue *to enum ng_opmode opmode) { #ifdef WITH_TRANSCODING - if (opmode == OP_OFFER && !call_ml_sendonly(from_ml) && (to_ml->player && to_ml->player->moh)) + if (opmode == OP_OFFER && !call_ml_sendonly_inactive(from_ml) && (to_ml->player && to_ml->player->moh)) { return true; } diff --git a/include/call.h b/include/call.h index 47fc6002c..04223bc4f 100644 --- a/include/call.h +++ b/include/call.h @@ -816,7 +816,7 @@ struct packet_stream *__packet_stream_new(call_t *call); void __add_media_subscription(struct call_media * which, struct call_media * to, const struct sink_attrs *attrs); struct media_subscription *call_ml_get_top_ms(struct call_monologue *ml); -bool call_ml_sendonly(struct call_monologue *ml); +bool call_ml_sendonly_inactive(struct call_monologue *ml); struct media_subscription *call_media_get_top_ms(struct call_media * cm); struct media_subscription *call_get_media_subscription(subscription_ht ht, struct call_media * cm); struct call_monologue * ml_medias_subscribed_to_single_ml(struct call_monologue *ml);