Skip to content

Commit a80afc5

Browse files
committed
MT#61856 main: moh max duration, correctly parse it
The documented behavior is: - if not set at all, set to 180s by default - if set to 0, then will be ignored in media player - if set to > 0, then will be used to set the value Current code is inconsistent, 0 is always reset to 180s, hence 0 value can never lead to ignoring. Only reset to 180s the `-1` (default value, means never parsed). Also clarify a little bit more the description of the option. Change-Id: I5c3e63ffaca6271424783eeba828578e54c819e5
1 parent 0f2eaff commit a80afc5

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

daemon/main.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -893,7 +893,7 @@ static void options(int *argc, char ***argv, charp_ht templates) {
893893
#endif
894894
{ "janus-secret", 0,0, G_OPTION_ARG_STRING, &rtpe_config.janus_secret,"Admin secret for Janus protocol","STRING"},
895895
{ "rtcp-interval", 0,0, G_OPTION_ARG_INT, &rtcp_interval, "Delay in milliseconds between RTCP packets when generate-rtcp flag is on, where random dispersion < 1 sec is added on top","INT"},
896-
{ "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"},
896+
{ "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. If not set at all, will be set to 180s by default.", "INT"},
897897
{ "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"},
898898
{ "moh-attr-name", 0,0, G_OPTION_ARG_STRING, &rtpe_config.moh_attr_name, "Controls the value to be added to the session level of SDP whenever MoH is triggered.", "STRING"},
899899
{ "moh-prevent-double-hold", 0,0, G_OPTION_ARG_NONE, &rtpe_config.moh_prevent_double_hold, "Protects against double MoH played.", NULL},
@@ -1137,8 +1137,10 @@ static void options(int *argc, char ***argv, charp_ht templates) {
11371137
die("Invalid max-recv-iters value");
11381138

11391139
/* if not set, define by default to half an hour */
1140-
if (rtpe_config.moh_max_duration <= 0)
1140+
if (rtpe_config.moh_max_duration < 0) {
1141+
ilog(LOG_DEBUG, "MoH max duration corrected to 180s.\n");
11411142
rtpe_config.moh_max_duration = 1800000;
1143+
}
11421144

11431145
rtpe_config.timeout_us = timeout * 1000000LL;
11441146
if (rtpe_config.timeout_us <= 0)

0 commit comments

Comments
 (0)