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

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">app_mixmonitor: Add option to use real Caller ID for voicemail.<br><br>MixMonitor currently uses the Connected Line as the Caller ID<br>for voicemails. This is due to the implementation being written<br>this way for use with Digium phones. However, in general this<br>is not correct for generic usage in the dialplan, and people<br>may need the real Caller ID instead. This adds an option to do that.<br><br>ASTERISK-30286 #close<br><br>Change-Id: I3d0ce76dfe75e2a614e0f709ab27acbd2478267c<br>---<br>M apps/app_mixmonitor.c<br>A doc/CHANGES-staging/app_mixmonitor_clid.txt<br>2 files changed, 56 insertions(+), 10 deletions(-)<br><br></pre>
<pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/apps/app_mixmonitor.c b/apps/app_mixmonitor.c</span><br><span>index e2b9e8c..1592c40 100644</span><br><span>--- a/apps/app_mixmonitor.c</span><br><span>+++ b/apps/app_mixmonitor.c</span><br><span>@@ -90,6 +90,11 @@</span><br><span>                                                <para>Play a periodic beep while this call is being recorded.</para></span><br><span>                                             <argument name="interval"><para>Interval, in seconds. Default is 15.</para></argument></span><br><span>                                     </option></span><br><span style="color: hsl(120, 100%, 40%);">+                                       <option name="c"></span><br><span style="color: hsl(120, 100%, 40%);">+                                             <para>Use the real Caller ID from the channel for the voicemail Caller ID.</para></span><br><span style="color: hsl(120, 100%, 40%);">+                                         <para>By default, the Connected Line is used. If you want the channel caller's</span><br><span style="color: hsl(120, 100%, 40%);">+                                              real number, you may need to specify this option.</para></span><br><span style="color: hsl(120, 100%, 40%);">+                                        </option></span><br><span>                                      <option name="d"></span><br><span>                                            <para>Delete the recording file as soon as MixMonitor is done with it.</para></span><br><span>                                            <para>For example, if you use the m option to dispatch the recording to a voicemail box,</span><br><span>@@ -413,6 +418,7 @@</span><br><span>         MUXFLAG_DEPRECATED_RWSYNC = (1 << 14),</span><br><span>         MUXFLAG_NO_RWSYNC = (1 << 15),</span><br><span>         MUXFLAG_AUTO_DELETE = (1 << 16),</span><br><span style="color: hsl(120, 100%, 40%);">+        MUXFLAG_REAL_CALLERID = (1 << 17),</span><br><span> };</span><br><span> </span><br><span> enum mixmonitor_args {</span><br><span>@@ -433,6 +439,7 @@</span><br><span>   AST_APP_OPTION('a', MUXFLAG_APPEND),</span><br><span>         AST_APP_OPTION('b', MUXFLAG_BRIDGED),</span><br><span>        AST_APP_OPTION_ARG('B', MUXFLAG_BEEP, OPT_ARG_BEEP_INTERVAL),</span><br><span style="color: hsl(120, 100%, 40%);">+ AST_APP_OPTION('c', MUXFLAG_REAL_CALLERID),</span><br><span>  AST_APP_OPTION('d', MUXFLAG_AUTO_DELETE),</span><br><span>    AST_APP_OPTION('p', MUXFLAG_BEEP_START),</span><br><span>     AST_APP_OPTION('P', MUXFLAG_BEEP_STOP),</span><br><span>@@ -1035,20 +1042,37 @@</span><br><span> </span><br><span>        if (!ast_strlen_zero(recipients)) {</span><br><span>          char callerid[256];</span><br><span style="color: hsl(0, 100%, 40%);">-             struct ast_party_connected_line *connected;</span><br><span> </span><br><span>              ast_channel_lock(chan);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-             /* We use the connected line of the invoking channel for caller ID. */</span><br><span style="color: hsl(120, 100%, 40%);">+                /* We use the connected line of the invoking channel for caller ID,</span><br><span style="color: hsl(120, 100%, 40%);">+            * unless we've been told to use the Caller ID.</span><br><span style="color: hsl(120, 100%, 40%);">+            * The initial use for this relied on Connected Line to get the</span><br><span style="color: hsl(120, 100%, 40%);">+                * actual number for recording with Digium phones,</span><br><span style="color: hsl(120, 100%, 40%);">+             * but in generic use the Caller ID is likely what people want.</span><br><span style="color: hsl(120, 100%, 40%);">+                */</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-         connected = ast_channel_connected(chan);</span><br><span style="color: hsl(0, 100%, 40%);">-                ast_debug(3, "Connected Line CID = %d - %s : %d - %s\n", connected->id.name.valid,</span><br><span style="color: hsl(0, 100%, 40%);">-                 connected->id.name.str, connected->id.number.valid,</span><br><span style="color: hsl(0, 100%, 40%);">-                       connected->id.number.str);</span><br><span style="color: hsl(0, 100%, 40%);">-           ast_callerid_merge(callerid, sizeof(callerid),</span><br><span style="color: hsl(0, 100%, 40%);">-                  S_COR(connected->id.name.valid, connected->id.name.str, NULL),</span><br><span style="color: hsl(0, 100%, 40%);">-                    S_COR(connected->id.number.valid, connected->id.number.str, NULL),</span><br><span style="color: hsl(0, 100%, 40%);">-                        "Unknown");</span><br><span style="color: hsl(120, 100%, 40%);">+         if (ast_test_flag(mixmonitor, MUXFLAG_REAL_CALLERID)) {</span><br><span style="color: hsl(120, 100%, 40%);">+                       struct ast_party_caller *caller;</span><br><span style="color: hsl(120, 100%, 40%);">+                      caller = ast_channel_caller(chan);</span><br><span style="color: hsl(120, 100%, 40%);">+                    ast_debug(3, "Caller ID = %d - %s : %d - %s\n", caller->id.name.valid,</span><br><span style="color: hsl(120, 100%, 40%);">+                           caller->id.name.str, caller->id.number.valid,</span><br><span style="color: hsl(120, 100%, 40%);">+                           caller->id.number.str);</span><br><span style="color: hsl(120, 100%, 40%);">+                    ast_callerid_merge(callerid, sizeof(callerid),</span><br><span style="color: hsl(120, 100%, 40%);">+                                S_COR(caller->id.name.valid, caller->id.name.str, NULL),</span><br><span style="color: hsl(120, 100%, 40%);">+                                S_COR(caller->id.number.valid, caller->id.number.str, NULL),</span><br><span style="color: hsl(120, 100%, 40%);">+                            "Unknown");</span><br><span style="color: hsl(120, 100%, 40%);">+         } else {</span><br><span style="color: hsl(120, 100%, 40%);">+                      struct ast_party_connected_line *connected;</span><br><span style="color: hsl(120, 100%, 40%);">+                   connected = ast_channel_connected(chan);</span><br><span style="color: hsl(120, 100%, 40%);">+                      ast_debug(3, "Connected Line CID = %d - %s : %d - %s\n", connected->id.name.valid,</span><br><span style="color: hsl(120, 100%, 40%);">+                               connected->id.name.str, connected->id.number.valid,</span><br><span style="color: hsl(120, 100%, 40%);">+                             connected->id.number.str);</span><br><span style="color: hsl(120, 100%, 40%);">+                 ast_callerid_merge(callerid, sizeof(callerid),</span><br><span style="color: hsl(120, 100%, 40%);">+                                S_COR(connected->id.name.valid, connected->id.name.str, NULL),</span><br><span style="color: hsl(120, 100%, 40%);">+                          S_COR(connected->id.number.valid, connected->id.number.str, NULL),</span><br><span style="color: hsl(120, 100%, 40%);">+                              "Unknown");</span><br><span style="color: hsl(120, 100%, 40%);">+         }</span><br><span> </span><br><span>                ast_string_field_set(mixmonitor, call_context, ast_channel_context(chan));</span><br><span>           ast_string_field_set(mixmonitor, call_macrocontext, ast_channel_macrocontext(chan));</span><br><span>diff --git a/doc/CHANGES-staging/app_mixmonitor_clid.txt b/doc/CHANGES-staging/app_mixmonitor_clid.txt</span><br><span>new file mode 100644</span><br><span>index 0000000..a8331ec</span><br><span>--- /dev/null</span><br><span>+++ b/doc/CHANGES-staging/app_mixmonitor_clid.txt</span><br><span>@@ -0,0 +1,5 @@</span><br><span style="color: hsl(120, 100%, 40%);">+Subject: app_mixmonitor</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+Adds the c option to use the real Caller ID on</span><br><span style="color: hsl(120, 100%, 40%);">+the channel in voicemail recordings as opposed</span><br><span style="color: hsl(120, 100%, 40%);">+to the Connected Line.</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/19549">change 19549</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/+/19549"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 20 </div>
<div style="display:none"> Gerrit-Change-Id: I3d0ce76dfe75e2a614e0f709ab27acbd2478267c </div>
<div style="display:none"> Gerrit-Change-Number: 19549 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: N A <asterisk@phreaknet.org> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>