<p>Friendly Automation <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/18620">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  Kevin Harwell: Looks good to me, approved
  Friendly Automation: Approved for Submit

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_parking: Add music on hold override option.<br><br>An m option to Park and ParkAndAnnounce now allows<br>specifying a music on hold class override.<br><br>ASTERISK-30087<br><br>Change-Id: I03de8d97b100e451b2611b5a621d48750f5d6a9e<br>---<br>A doc/CHANGES-staging/res_parking_moh.txt<br>M res/parking/parking_applications.c<br>2 files changed, 29 insertions(+), 5 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/doc/CHANGES-staging/res_parking_moh.txt b/doc/CHANGES-staging/res_parking_moh.txt</span><br><span>new file mode 100644</span><br><span>index 0000000..50f589c</span><br><span>--- /dev/null</span><br><span>+++ b/doc/CHANGES-staging/res_parking_moh.txt</span><br><span>@@ -0,0 +1,4 @@</span><br><span style="color: hsl(120, 100%, 40%);">+Subject: res_parking</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+An m option to Park and ParkAndAnnounce now allows</span><br><span style="color: hsl(120, 100%, 40%);">+specifying a music on hold class override.</span><br><span>diff --git a/res/parking/parking_applications.c b/res/parking/parking_applications.c</span><br><span>index 29878f8..531db88 100644</span><br><span>--- a/res/parking/parking_applications.c</span><br><span>+++ b/res/parking/parking_applications.c</span><br><span>@@ -241,6 +241,7 @@</span><br><span> enum park_args {</span><br><span>      OPT_ARG_COMEBACK,</span><br><span>    OPT_ARG_TIMEOUT,</span><br><span style="color: hsl(120, 100%, 40%);">+      OPT_ARG_MUSICONHOLD,</span><br><span>         OPT_ARG_ARRAY_SIZE /* Always the last element of the enum */</span><br><span> };</span><br><span> </span><br><span>@@ -250,6 +251,7 @@</span><br><span>         MUXFLAG_NOANNOUNCE = (1 << 2),</span><br><span>         MUXFLAG_COMEBACK_OVERRIDE = (1 << 3),</span><br><span>  MUXFLAG_TIMEOUT_OVERRIDE = (1 << 4),</span><br><span style="color: hsl(120, 100%, 40%);">+    MUXFLAG_MUSICONHOLD = (1 << 5),</span><br><span> };</span><br><span> </span><br><span> AST_APP_OPTIONS(park_opts, {</span><br><span>@@ -258,6 +260,7 @@</span><br><span>        AST_APP_OPTION('s', MUXFLAG_NOANNOUNCE),</span><br><span>     AST_APP_OPTION_ARG('c', MUXFLAG_COMEBACK_OVERRIDE, OPT_ARG_COMEBACK),</span><br><span>        AST_APP_OPTION_ARG('t', MUXFLAG_TIMEOUT_OVERRIDE, OPT_ARG_TIMEOUT),</span><br><span style="color: hsl(120, 100%, 40%);">+   AST_APP_OPTION_ARG('m', MUXFLAG_MUSICONHOLD, OPT_ARG_MUSICONHOLD),</span><br><span> });</span><br><span> </span><br><span> static int apply_option_timeout (int *var, char *timeout_arg)</span><br><span>@@ -275,7 +278,8 @@</span><br><span>         return 0;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-static int park_app_parse_data(const char *data, int *disable_announce, int *use_ringing, int *randomize, int *time_limit, char **comeback_override, char **lot_name)</span><br><span style="color: hsl(120, 100%, 40%);">+static int park_app_parse_data(const char *data, int *disable_announce, int *use_ringing, int *randomize, int *time_limit,</span><br><span style="color: hsl(120, 100%, 40%);">+   char **comeback_override, char **lot_name, char **musicclass)</span><br><span> {</span><br><span>   char *parse;</span><br><span>         struct ast_flags flags = { 0 };</span><br><span>@@ -308,6 +312,10 @@</span><br><span>                       }</span><br><span>            }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+         if (ast_test_flag(&flags, MUXFLAG_MUSICONHOLD)) {</span><br><span style="color: hsl(120, 100%, 40%);">+                 *musicclass = ast_strdup(opts[OPT_ARG_MUSICONHOLD]);</span><br><span style="color: hsl(120, 100%, 40%);">+          }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span>          if (ast_test_flag(&flags, MUXFLAG_RINGING)) {</span><br><span>                    *use_ringing = 1;</span><br><span>            }</span><br><span>@@ -481,8 +489,8 @@</span><br><span>      return data_copy;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-struct ast_bridge *park_common_setup(struct ast_channel *parkee, struct ast_channel *parker,</span><br><span style="color: hsl(0, 100%, 40%);">-          const char *lot_name, const char *comeback_override,</span><br><span style="color: hsl(120, 100%, 40%);">+static struct ast_bridge *park_common_setup2(struct ast_channel *parkee, struct ast_channel *parker,</span><br><span style="color: hsl(120, 100%, 40%);">+            const char *lot_name, const char *comeback_override, const char *musicclass,</span><br><span>                 int use_ringing, int randomize, int time_limit, int silence_announcements)</span><br><span> {</span><br><span>      struct ast_bridge *parking_bridge;</span><br><span>@@ -518,11 +526,22 @@</span><br><span> </span><br><span>       /* Apply relevant bridge roles and such to the parking channel */</span><br><span>    parking_channel_set_roles(parkee, lot, use_ringing);</span><br><span style="color: hsl(120, 100%, 40%);">+  /* If requested, override the MOH class */</span><br><span style="color: hsl(120, 100%, 40%);">+    if (!ast_strlen_zero(musicclass)) {</span><br><span style="color: hsl(120, 100%, 40%);">+           ast_channel_set_bridge_role_option(parkee, "holding_participant", "moh_class", musicclass);</span><br><span style="color: hsl(120, 100%, 40%);">+       }</span><br><span>    setup_park_common_datastore(parkee, ast_channel_uniqueid(parker), comeback_override, randomize, time_limit,</span><br><span>          silence_announcements);</span><br><span>      return parking_bridge;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+struct ast_bridge *park_common_setup(struct ast_channel *parkee, struct ast_channel *parker,</span><br><span style="color: hsl(120, 100%, 40%);">+         const char *lot_name, const char *comeback_override,</span><br><span style="color: hsl(120, 100%, 40%);">+          int use_ringing, int randomize, int time_limit, int silence_announcements)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+ return park_common_setup2(parkee, parker, lot_name, comeback_override, NULL, use_ringing, randomize, time_limit, silence_announcements);</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> struct ast_bridge *park_application_setup(struct ast_channel *parkee, struct ast_channel *parker, const char *app_data,</span><br><span>             int *silence_announcements)</span><br><span> {</span><br><span>@@ -532,12 +551,13 @@</span><br><span> </span><br><span>         RAII_VAR(char *, comeback_override, NULL, ast_free);</span><br><span>         RAII_VAR(char *, lot_name_app_arg, NULL, ast_free);</span><br><span style="color: hsl(120, 100%, 40%);">+   RAII_VAR(char *, musicclass, NULL, ast_free);</span><br><span> </span><br><span>    if (app_data) {</span><br><span style="color: hsl(0, 100%, 40%);">-         park_app_parse_data(app_data, silence_announcements, &use_ringing, &randomize, &time_limit, &comeback_override, &lot_name_app_arg);</span><br><span style="color: hsl(120, 100%, 40%);">+               park_app_parse_data(app_data, silence_announcements, &use_ringing, &randomize, &time_limit, &comeback_override, &lot_name_app_arg, &musicclass);</span><br><span>     }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-   return park_common_setup(parkee, parker, lot_name_app_arg, comeback_override, use_ringing,</span><br><span style="color: hsl(120, 100%, 40%);">+    return park_common_setup2(parkee, parker, lot_name_app_arg, comeback_override, musicclass, use_ringing,</span><br><span>              randomize, time_limit, silence_announcements ? *silence_announcements : 0);</span><br><span> </span><br><span> }</span><br><span></span><br></pre><div style="white-space:pre-wrap"></div><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/18620">change 18620</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/18620"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 16 </div>
<div style="display:none"> Gerrit-Change-Id: I03de8d97b100e451b2611b5a621d48750f5d6a9e </div>
<div style="display:none"> Gerrit-Change-Number: 18620 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: N A <mail@interlinked.x10host.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>