Skip to content

Commit

Permalink
MT#61630 moh: mark music-on-hold SDPs
Browse files Browse the repository at this point in the history
Mark those SDPs which trigger processing
of music-on-hold.

Is defined by the config option:
`moh-attr-name`. If not defined then
is not used.

Will be useful for cases when it's important
for remote components to detect ongoing hold.

Change-Id: I0f2a284955dbc045b51920174f1f4fbefcb93907
  • Loading branch information
zenichev committed Jan 9, 2025
1 parent 51a0175 commit 30b42d8
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions daemon/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,7 @@ static void options(int *argc, char ***argv, GHashTable *templates) {
{ "rtcp-interval", 0,0, G_OPTION_ARG_INT, &rtpe_config.rtcp_interval,"Delay in milliseconds between RTCP packets when generate-rtcp flag is on, where random dispersion < 1 sec is added on top","INT"},
{ "moh-max-duration", 0,0, G_OPTION_ARG_INT, &rtpe_config.moh_max_duration, "Max possible duration (in milliseconds) that can be spent on playing a file. If set to 0 then will be ignored.", "INT"},
{ "moh-max-repeats", 0,0, G_OPTION_ARG_INT, &rtpe_config.moh_max_repeats, "Max possible amount of playback repeats for the music on hold. player-max-duration always takes a precedence over it.", "INT"},
{ "moh-attr-name", 0,0, G_OPTION_ARG_INT, &rtpe_config.moh_attr_name, "Controls the value to be added to the session level of SDP whenever MoH is triggered.", "STRING"},
{ "max-recv-iters", 0, 0, G_OPTION_ARG_INT, &rtpe_config.max_recv_iters, "Maximum continuous reading cycles in UDP poller loop.", "INT"},
{ "vsc-start-rec",0,0, G_OPTION_ARG_STRING, &rtpe_config.vsc_start_rec.s,"DTMF VSC to start recording.", "STRING"},
{ "vsc-stop-rec",0,0, G_OPTION_ARG_STRING, &rtpe_config.vsc_stop_rec.s,"DTMF VSC to stop recording.", "STRING"},
Expand Down
2 changes: 2 additions & 0 deletions daemon/media_player.c
Original file line number Diff line number Diff line change
Expand Up @@ -1317,6 +1317,8 @@ 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->moh = false;
}
return NULL;
#else
Expand Down
7 changes: 6 additions & 1 deletion daemon/sdp.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "call_interfaces.h"
#include "rtplib.h"
#include "codec.h"
#include "media_player.h"

enum attr_id {
ATTR_OTHER = 0,
Expand Down Expand Up @@ -2821,7 +2822,11 @@ static void sdp_out_add_other(GString *out, struct call_monologue *monologue,
/* add loop protectio if required */
if (flags->loop_protect)
append_attr_to_gstring(out, "rtpengine", &rtpe_instance_id, flags, media->type_id);

#ifdef WITH_TRANSCODING
if (monologue->player && monologue->player->moh && rtpe_config.moh_attr_name) {
append_attr_to_gstring(out, rtpe_config.moh_attr_name, NULL, flags, media->type_id);
}
#endif
/* ice-lite */
if (media_has_ice && media_has_ice_lite_self)
append_attr_to_gstring(out, "ice-lite", NULL, flags, media->type_id);
Expand Down
4 changes: 4 additions & 0 deletions etc/rtpengine.conf
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ recording-method = proc
# By default is always 999 if not defined otherwise.
# moh-max-repeats = 999

# controls the value to be added to the session level of SDP
# whenever MoH is triggered. If not defined, then not in use.
# moh-attr-name = rtpengine-hold

# signalling templates (see key `templates` above)
[templates]
WebRTC = transport-protocol=UDP/TLS/RTP/SAVPF ICE=force trickle-ICE rtcp-mux=[offer require] no-rtcp-attribute SDES=off generate-mid
Expand Down
1 change: 1 addition & 0 deletions include/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ enum endpoint_learning {
X(redis_hostname) \
X(redis_write_hostname) \
X(redis_subscribe_hostname) \
X(moh_attr_name) \
X(spooldir) \
X(rec_method) \
X(rec_format) \
Expand Down

0 comments on commit 30b42d8

Please sign in to comment.