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
418424enum 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 ));
0 commit comments