Skip to content

Commit 1c8acdb

Browse files
InterLinked1jcolp
authored andcommitted
app_mixmonitor: Add option to use real Caller ID for voicemail.
MixMonitor currently uses the Connected Line as the Caller ID for voicemails. This is due to the implementation being written this way for use with Digium phones. However, in general this is not correct for generic usage in the dialplan, and people may need the real Caller ID instead. This adds an option to do that. ASTERISK-30286 #close Change-Id: I3d0ce76dfe75e2a614e0f709ab27acbd2478267c
1 parent c59eb7e commit 1c8acdb

File tree

2 files changed

+40
-11
lines changed

2 files changed

+40
-11
lines changed

Diff for: apps/app_mixmonitor.c

+35-11
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@
9090
<para>Play a periodic beep while this call is being recorded.</para>
9191
<argument name="interval"><para>Interval, in seconds. Default is 15.</para></argument>
9292
</option>
93+
<option name="c">
94+
<para>Use the real Caller ID from the channel for the voicemail Caller ID.</para>
95+
<para>By default, the Connected Line is used. If you want the channel caller's
96+
real number, you may need to specify this option.</para>
97+
</option>
9398
<option name="d">
9499
<para>Delete the recording file as soon as MixMonitor is done with it.</para>
95100
<para>For example, if you use the m option to dispatch the recording to a voicemail box,
@@ -413,6 +418,7 @@ enum mixmonitor_flags {
413418
MUXFLAG_DEPRECATED_RWSYNC = (1 << 14),
414419
MUXFLAG_NO_RWSYNC = (1 << 15),
415420
MUXFLAG_AUTO_DELETE = (1 << 16),
421+
MUXFLAG_REAL_CALLERID = (1 << 17),
416422
};
417423

418424
enum mixmonitor_args {
@@ -433,6 +439,7 @@ AST_APP_OPTIONS(mixmonitor_opts, {
433439
AST_APP_OPTION('a', MUXFLAG_APPEND),
434440
AST_APP_OPTION('b', MUXFLAG_BRIDGED),
435441
AST_APP_OPTION_ARG('B', MUXFLAG_BEEP, OPT_ARG_BEEP_INTERVAL),
442+
AST_APP_OPTION('c', MUXFLAG_REAL_CALLERID),
436443
AST_APP_OPTION('d', MUXFLAG_AUTO_DELETE),
437444
AST_APP_OPTION('p', MUXFLAG_BEEP_START),
438445
AST_APP_OPTION('P', MUXFLAG_BEEP_STOP),
@@ -1035,20 +1042,37 @@ static int launch_monitor_thread(struct ast_channel *chan, const char *filename,
10351042

10361043
if (!ast_strlen_zero(recipients)) {
10371044
char callerid[256];
1038-
struct ast_party_connected_line *connected;
10391045

10401046
ast_channel_lock(chan);
10411047

1042-
/* We use the connected line of the invoking channel for caller ID. */
1043-
1044-
connected = ast_channel_connected(chan);
1045-
ast_debug(3, "Connected Line CID = %d - %s : %d - %s\n", connected->id.name.valid,
1046-
connected->id.name.str, connected->id.number.valid,
1047-
connected->id.number.str);
1048-
ast_callerid_merge(callerid, sizeof(callerid),
1049-
S_COR(connected->id.name.valid, connected->id.name.str, NULL),
1050-
S_COR(connected->id.number.valid, connected->id.number.str, NULL),
1051-
"Unknown");
1048+
/* We use the connected line of the invoking channel for caller ID,
1049+
* unless we've been told to use the Caller ID.
1050+
* The initial use for this relied on Connected Line to get the
1051+
* actual number for recording with Digium phones,
1052+
* but in generic use the Caller ID is likely what people want.
1053+
*/
1054+
1055+
if (ast_test_flag(mixmonitor, MUXFLAG_REAL_CALLERID)) {
1056+
struct ast_party_caller *caller;
1057+
caller = ast_channel_caller(chan);
1058+
ast_debug(3, "Caller ID = %d - %s : %d - %s\n", caller->id.name.valid,
1059+
caller->id.name.str, caller->id.number.valid,
1060+
caller->id.number.str);
1061+
ast_callerid_merge(callerid, sizeof(callerid),
1062+
S_COR(caller->id.name.valid, caller->id.name.str, NULL),
1063+
S_COR(caller->id.number.valid, caller->id.number.str, NULL),
1064+
"Unknown");
1065+
} else {
1066+
struct ast_party_connected_line *connected;
1067+
connected = ast_channel_connected(chan);
1068+
ast_debug(3, "Connected Line CID = %d - %s : %d - %s\n", connected->id.name.valid,
1069+
connected->id.name.str, connected->id.number.valid,
1070+
connected->id.number.str);
1071+
ast_callerid_merge(callerid, sizeof(callerid),
1072+
S_COR(connected->id.name.valid, connected->id.name.str, NULL),
1073+
S_COR(connected->id.number.valid, connected->id.number.str, NULL),
1074+
"Unknown");
1075+
}
10521076

10531077
ast_string_field_set(mixmonitor, call_context, ast_channel_context(chan));
10541078
ast_string_field_set(mixmonitor, call_macrocontext, ast_channel_macrocontext(chan));

Diff for: doc/CHANGES-staging/app_mixmonitor_clid.txt

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Subject: app_mixmonitor
2+
3+
Adds the c option to use the real Caller ID on
4+
the channel in voicemail recordings as opposed
5+
to the Connected Line.

0 commit comments

Comments
 (0)