[asterisk-commits] may: branch may/chan_ooh323_evo r368564 - in /team/may/chan_ooh323_evo: ./ ap...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Jun 5 19:22:55 CDT 2012
Author: may
Date: Tue Jun 5 19:22:47 2012
New Revision: 368564
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=368564
Log:
Multiple revisions 368435,368441,368455,368466-368467,368472,368500,368519,368529,368537,368550
........
r368435 | mmichelson | 2012-06-05 00:26:12 +0400 (Tue, 05 Jun 2012) | 35 lines
Merge changes dealing with support for Digium phones.
Presence support has been added. This is accomplished by
allowing for presence hints in addition to device state
hints. A dialplan function called PRESENCE_STATE has been
added to allow for setting and reading presence. Presence
can be transmitted to Digium phones using custom XML
elements in a PIDF presence document.
Voicemail has new APIs that allow for moving, removing,
forwarding, and playing messages. Messages have had a new
unique message ID added to them so that the APIs will work
reliably. The state of a voicemail mailbox can be obtained
using an API that allows one to get a snapshot of the mailbox.
A voicemail Dialplan App called VoiceMailPlayMsg has been
added to be able to play back a specific message.
Configuration hooks have been added. Configuration hooks
allow for a piece of code to be executed when a specific
configuration file is loaded by a specific module. This is
useful for modules that are dependent on the configuration
of other modules.
chan_sip now has a public method that allows for a custom
SIP INFO request to be sent mid-dialog. Digium phones use
this in order to display progress bars when files are played.
Messaging support has been expanded a bit. The main
visible difference is the addition of an AMI action
MessageSend.
Finally, a ParkingLots manager action has been added in order
to get a list of parking lots.
........
r368441 | mmichelson | 2012-06-05 00:30:07 +0400 (Tue, 05 Jun 2012) | 3 lines
Remove automerge properties.
........
r368455 | mmichelson | 2012-06-05 00:40:12 +0400 (Tue, 05 Jun 2012) | 3 lines
Remove some extra debugging I forgot to remove in the merge of Digium phone support.
........
r368466 | mmichelson | 2012-06-05 00:51:17 +0400 (Tue, 05 Jun 2012) | 8 lines
Add vim syntax highlighting for type=line, type=phone, and type=application.
(closes issue ASTERISK-19800)
Reported by: Billy Chia
Patches:
asterisk.vim.patch uploaded by Billy Chia (license #6381)
........
r368467 | mmichelson | 2012-06-05 00:53:43 +0400 (Tue, 05 Jun 2012) | 3 lines
Also have vim syntax-highlight type=network.
........
r368472 | rmudgett | 2012-06-05 01:18:04 +0400 (Tue, 05 Jun 2012) | 13 lines
Document BLINDTRANSFER behavior change.
(issue ASTERISK-19322)
(closes issue ASTERISK-19875)
Reported by: call
........
Merged revisions 368469 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 368470 from http://svn.asterisk.org/svn/asterisk/branches/10
........
r368500 | mmichelson | 2012-06-05 02:12:19 +0400 (Tue, 05 Jun 2012) | 19 lines
Relay proper SIP responses on calling side.
Revision 351130 broke corect HANGUPCAUSE setting
for the 404 case in chan_sip. Other cases were also
potentially broken. This patch fixes the relaying
of causes to be what they used to be.
(closes issue ASTERISK-19914)
Reported by Pavel Troller
Tested by Walter Doekes (via a reviewboard test to be committed later)
Patches:
chan_sip.diff uploaded by Pavel Troller (license #6302)
........
Merged revisions 368498 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 368499 from http://svn.asterisk.org/svn/asterisk/branches/10
........
r368519 | kmoore | 2012-06-05 18:41:43 +0400 (Tue, 05 Jun 2012) | 11 lines
Convert AST_FLAG_ANSWERED_ELSEWHERE usage to AST_CAUSE_ANSWERED_ELSEWHERE
This was essentially duplicated functionality where normal channels used
AST_CAUSE_ANSWERED_ELSEWHERE while local channels and queues used
AST_FLAG_ANSWERED_ELSEWHERE. This removes the flag and converts that usage
into AST_CAUSE_ANSWERED_ELSEWHER usage.
Review: https://reviewboard.asterisk.org/r/1944
(closes issue ASTERISK-19865)
Patch-by: Birger Harzenetter
........
r368529 | kmoore | 2012-06-05 19:23:43 +0400 (Tue, 05 Jun 2012) | 14 lines
Ensure that pages and emails are sent using RFC822-compliant date format
When localization was added to app_voicemail, these headers were altered
when they should have remained in en_US format for RFC compliance. This
reverts the changes to those two lines.
(closes issue ASTERISK-19876)
........
Merged revisions 368520 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 368524 from http://svn.asterisk.org/svn/asterisk/branches/10
........
r368537 | kmoore | 2012-06-05 19:28:28 +0400 (Tue, 05 Jun 2012) | 11 lines
Recorded merge of revisions 368536 from http://svn.asterisk.org/svn/asterisk/branches/10
........
Resolve some build warnings
My newly upgraded compiler caught these usages of uninitialized values.
They weren't actually used.
........
Merged revisions 368533 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
r368550 | jrose | 2012-06-05 20:25:14 +0400 (Tue, 05 Jun 2012) | 3 lines
Merge 'core' and 'core changes' sections in CHANGES file.
........
Merged revisions 368435,368441,368455,368466-368467,368472,368500,368519,368529,368537,368550 from http://svn.asterisk.org/svn/asterisk/trunk
Added:
team/may/chan_ooh323_evo/channels/chan_sip.exports.in
- copied unchanged from r368550, trunk/channels/chan_sip.exports.in
team/may/chan_ooh323_evo/funcs/func_presencestate.c
- copied unchanged from r368550, trunk/funcs/func_presencestate.c
team/may/chan_ooh323_evo/include/asterisk/app_voicemail.h
- copied unchanged from r368550, trunk/include/asterisk/app_voicemail.h
team/may/chan_ooh323_evo/include/asterisk/presencestate.h
- copied unchanged from r368550, trunk/include/asterisk/presencestate.h
team/may/chan_ooh323_evo/include/asterisk/sip_api.h
- copied unchanged from r368550, trunk/include/asterisk/sip_api.h
team/may/chan_ooh323_evo/main/presencestate.c
- copied unchanged from r368550, trunk/main/presencestate.c
team/may/chan_ooh323_evo/tests/test_voicemail_api.c
- copied unchanged from r368550, trunk/tests/test_voicemail_api.c
Modified:
team/may/chan_ooh323_evo/ (props changed)
team/may/chan_ooh323_evo/CHANGES
team/may/chan_ooh323_evo/UPGRADE.txt
team/may/chan_ooh323_evo/apps/app_dial.c
team/may/chan_ooh323_evo/apps/app_mixmonitor.c
team/may/chan_ooh323_evo/apps/app_queue.c
team/may/chan_ooh323_evo/apps/app_voicemail.c
team/may/chan_ooh323_evo/apps/app_voicemail.exports.in
team/may/chan_ooh323_evo/channels/chan_local.c
team/may/chan_ooh323_evo/channels/chan_sip.c
team/may/chan_ooh323_evo/channels/chan_skinny.c
team/may/chan_ooh323_evo/channels/chan_unistim.c
team/may/chan_ooh323_evo/channels/sip/include/sip.h
team/may/chan_ooh323_evo/configs/manager.conf.sample
team/may/chan_ooh323_evo/contrib/editors/asterisk.vim
team/may/chan_ooh323_evo/contrib/realtime/mysql/voicemail_messages.sql
team/may/chan_ooh323_evo/include/asterisk/app.h
team/may/chan_ooh323_evo/include/asterisk/callerid.h
team/may/chan_ooh323_evo/include/asterisk/channel.h
team/may/chan_ooh323_evo/include/asterisk/config.h
team/may/chan_ooh323_evo/include/asterisk/event_defs.h
team/may/chan_ooh323_evo/include/asterisk/file.h
team/may/chan_ooh323_evo/include/asterisk/manager.h
team/may/chan_ooh323_evo/include/asterisk/message.h
team/may/chan_ooh323_evo/include/asterisk/pbx.h
team/may/chan_ooh323_evo/main/app.c
team/may/chan_ooh323_evo/main/asterisk.c
team/may/chan_ooh323_evo/main/callerid.c
team/may/chan_ooh323_evo/main/channel_internal_api.c
team/may/chan_ooh323_evo/main/config.c
team/may/chan_ooh323_evo/main/event.c
team/may/chan_ooh323_evo/main/features.c
team/may/chan_ooh323_evo/main/file.c
team/may/chan_ooh323_evo/main/manager.c
team/may/chan_ooh323_evo/main/message.c
team/may/chan_ooh323_evo/main/pbx.c
team/may/chan_ooh323_evo/tests/test_config.c
Propchange: team/may/chan_ooh323_evo/
------------------------------------------------------------------------------
branch-10-digiumphones-merged = /branches/10-digiumphones:364766,365396
Propchange: team/may/chan_ooh323_evo/
------------------------------------------------------------------------------
Binary property 'branch-10-merged' - no diff available.
Propchange: team/may/chan_ooh323_evo/
------------------------------------------------------------------------------
certified-branch-1.8.11-merged = /certified/branches/1.8.11:364761,365395
Propchange: team/may/chan_ooh323_evo/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jun 5 19:22:47 2012
@@ -1,1 +1,2 @@
-/trunk:356965-357014,364966
+/team/mmichelson/private/phones-trunk:358764-361321
+/trunk:356965-357014,364966,368435-368550
Propchange: team/may/chan_ooh323_evo/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Jun 5 19:22:47 2012
@@ -1,1 +1,1 @@
-/trunk:1-368433
+/trunk:1-368563
Modified: team/may/chan_ooh323_evo/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_evo/CHANGES?view=diff&rev=368564&r1=368563&r2=368564
==============================================================================
--- team/may/chan_ooh323_evo/CHANGES (original)
+++ team/may/chan_ooh323_evo/CHANGES Tue Jun 5 19:22:47 2012
@@ -31,6 +31,13 @@
* The minimum DTMF duration can now be configured in asterisk.conf
as "mindtmfduration". The default value is (as before) set to 80 ms.
(previously it was only available in source code)
+ * Each logging destination and console now have an independent notion of the
+ current verbosity level. Logger.conf now allows an optional argument to
+ the 'verbose' specifier, indicating the level of verbosity sent to that
+ particular logging destination. Additionally, remote consoles now each
+ have their own verbosity level. The command 'core set verbose' will now set
+ a separate level for each remote console without affecting any other
+ console.
CLI Changes
-------------------
@@ -202,16 +209,6 @@
-------------
* Allow the built in variables ${NUMBER}, ${IPADDR} and ${SECRET} to be
used within the dynamic weight attribute when specifying a mapping.
-
-Core changes
-------------
- * Each logging destination and console now have an independent notion of the
- current verbosity level. Logger.conf now allows an optional argument to
- the 'verbose' specifier, indicating the level of verbosity sent to that
- particular logging destination. Additionally, remote consoles now each
- have their own verbosity level. The command 'core set verbose' will now set
- a separate level for each remote console without affecting any other
- console.
Dialplan functions
------------------
Modified: team/may/chan_ooh323_evo/UPGRADE.txt
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_evo/UPGRADE.txt?view=diff&rev=368564&r1=368563&r2=368564
==============================================================================
--- team/may/chan_ooh323_evo/UPGRADE.txt (original)
+++ team/may/chan_ooh323_evo/UPGRADE.txt Tue Jun 5 19:22:47 2012
@@ -25,6 +25,11 @@
Parking:
- The comebacktoorigin setting must now be set per parking lot. The setting in
the general section will not be applied automatically to each parking lot.
+ - The BLINDTRANSFER channel variable is deleted from a channel when it is
+ bridged to prevent subtle bugs in the parking feature. The channel
+ variable is used by Asterisk internally for the Park application to work
+ properly. If you were using it for your own purposes, copy it to your
+ own channel variable before the channel is bridged.
res_ais:
- Users of res_ais in versions of Asterisk prior to Asterisk 11 must change
Modified: team/may/chan_ooh323_evo/apps/app_dial.c
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_evo/apps/app_dial.c?view=diff&rev=368564&r1=368563&r2=368564
==============================================================================
--- team/may/chan_ooh323_evo/apps/app_dial.c (original)
+++ team/may/chan_ooh323_evo/apps/app_dial.c Tue Jun 5 19:22:47 2012
@@ -133,8 +133,7 @@
<para>Reset the call detail record (CDR) for this call.</para>
</option>
<option name="c">
- <para>If the Dial() application cancels this call, always set the flag to tell the channel
- driver that the call is answered elsewhere.</para>
+ <para>If the Dial() application cancels this call, always set HANGUPCAUSE to 'answered elsewhere'</para>
</option>
<option name="d">
<para>Allow the calling user to dial a 1 digit extension while waiting for
@@ -727,8 +726,6 @@
/* Hangup any existing lines we have open */
if (outgoing->chan && (outgoing->chan != exception)) {
if (answered_elsewhere) {
- /* The flag is used for local channel inheritance and stuff */
- ast_set_flag(ast_channel_flags(outgoing->chan), AST_FLAG_ANSWERED_ELSEWHERE);
/* This is for the channel drivers */
ast_channel_hangupcause_set(outgoing->chan, AST_CAUSE_ANSWERED_ELSEWHERE);
}
@@ -2515,12 +2512,12 @@
if (outbound_group)
ast_app_group_set_channel(tc, outbound_group);
/* If the calling channel has the ANSWERED_ELSEWHERE flag set, inherit it. This is to support local channels */
- if (ast_test_flag(ast_channel_flags(chan), AST_FLAG_ANSWERED_ELSEWHERE))
- ast_set_flag(ast_channel_flags(tc), AST_FLAG_ANSWERED_ELSEWHERE);
+ if (ast_channel_hangupcause(chan) == AST_CAUSE_ANSWERED_ELSEWHERE)
+ ast_channel_hangupcause_set(tc, AST_CAUSE_ANSWERED_ELSEWHERE);
/* Check if we're forced by configuration */
if (ast_test_flag64(&opts, OPT_CANCEL_ELSEWHERE))
- ast_set_flag(ast_channel_flags(tc), AST_FLAG_ANSWERED_ELSEWHERE);
+ ast_channel_hangupcause_set(tc, AST_CAUSE_ANSWERED_ELSEWHERE);
/* Inherit context and extension */
@@ -3079,11 +3076,11 @@
}
ast_channel_early_bridge(chan, NULL);
- hanguptree(&out_chans, NULL, 0); /* In this case, there's no answer anywhere */
+ hanguptree(&out_chans, NULL, ast_channel_hangupcause(chan)==AST_CAUSE_ANSWERED_ELSEWHERE ? 1 : 0 ); /* forward 'answered elsewhere' if we received it */
pbx_builtin_setvar_helper(chan, "DIALSTATUS", pa.status);
senddialendevent(chan, pa.status);
ast_debug(1, "Exiting with DIALSTATUS=%s.\n", pa.status);
-
+
if ((ast_test_flag64(peerflags, OPT_GO_ON)) && !ast_check_hangup(chan) && (res != AST_PBX_INCOMPLETE)) {
if (!ast_tvzero(calldurationlimit))
memset(ast_channel_whentohangup(chan), 0, sizeof(*ast_channel_whentohangup(chan)));
Modified: team/may/chan_ooh323_evo/apps/app_mixmonitor.c
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_evo/apps/app_mixmonitor.c?view=diff&rev=368564&r1=368563&r2=368564
==============================================================================
--- team/may/chan_ooh323_evo/apps/app_mixmonitor.c (original)
+++ team/may/chan_ooh323_evo/apps/app_mixmonitor.c Tue Jun 5 19:22:47 2012
@@ -42,6 +42,7 @@
ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/paths.h" /* use ast_config_AST_MONITOR_DIR */
+#include "asterisk/stringfields.h"
#include "asterisk/file.h"
#include "asterisk/audiohook.h"
#include "asterisk/pbx.h"
@@ -51,6 +52,7 @@
#include "asterisk/channel.h"
#include "asterisk/autochan.h"
#include "asterisk/manager.h"
+#include "asterisk/callerid.h"
#include "asterisk/mod_format.h"
#include "asterisk/linkedlists.h"
@@ -111,6 +113,12 @@
<option name="i">
<argument name="chanvar" required="true" />
<para>Stores the MixMonitor's ID on this channel variable.</para>
+ </option>
+ <option name="m">
+ <argument name="mailbox" required="true" />
+ <para>Create a copy of the recording as a voicemail in the indicated <emphasis>mailbox</emphasis>(es)
+ separated by commas eg. m(1111 at default,2222 at default,...). Folders can be optionally specified using
+ the syntax: mailbox at context/folder</para>
</option>
</optionlist>
</parameter>
@@ -238,6 +246,17 @@
static const char * const mixmonitor_spy_type = "MixMonitor";
+/*!
+ * \internal
+ * \brief This struct is a list item holds data needed to find a vm_recipient within voicemail
+ */
+struct vm_recipient {
+ char mailbox[AST_MAX_CONTEXT];
+ char context[AST_MAX_EXTENSION];
+ char folder[80];
+ AST_LIST_ENTRY(vm_recipient) list;
+};
+
struct mixmonitor {
struct ast_audiohook audiohook;
struct ast_callid *callid;
@@ -249,6 +268,20 @@
unsigned int flags;
struct ast_autochan *autochan;
struct mixmonitor_ds *mixmonitor_ds;
+
+ /* the below string fields describe data used for creating voicemails from the recording */
+ AST_DECLARE_STRING_FIELDS(
+ AST_STRING_FIELD(call_context);
+ AST_STRING_FIELD(call_macrocontext);
+ AST_STRING_FIELD(call_extension);
+ AST_STRING_FIELD(call_callerchan);
+ AST_STRING_FIELD(call_callerid);
+ );
+ int call_priority;
+
+ /* FUTURE DEVELOPMENT NOTICE
+ * recipient_list will need locks if we make it editable after the monitor is started */
+ AST_LIST_HEAD_NOLOCK(, vm_recipient) recipient_list;
};
enum mixmonitor_flags {
@@ -260,7 +293,8 @@
MUXFLAG_READ = (1 << 6),
MUXFLAG_WRITE = (1 << 7),
MUXFLAG_COMBINED = (1 << 8),
- MUXFLAG_UID = (1 << 9),
+ MUXFLAG_UID = (1 << 9),
+ MUXFLAG_VMRECIPIENTS = (1 << 10),
};
enum mixmonitor_args {
@@ -269,7 +303,8 @@
OPT_ARG_VOLUME,
OPT_ARG_WRITENAME,
OPT_ARG_READNAME,
- OPT_ARG_UID,
+ OPT_ARG_UID,
+ OPT_ARG_VMRECIPIENTS,
OPT_ARG_ARRAY_SIZE, /* Always last element of the enum */
};
@@ -282,6 +317,7 @@
AST_APP_OPTION_ARG('r', MUXFLAG_READ, OPT_ARG_READNAME),
AST_APP_OPTION_ARG('t', MUXFLAG_WRITE, OPT_ARG_WRITENAME),
AST_APP_OPTION_ARG('i', MUXFLAG_UID, OPT_ARG_UID),
+ AST_APP_OPTION_ARG('m', MUXFLAG_VMRECIPIENTS, OPT_ARG_VMRECIPIENTS),
});
struct mixmonitor_ds {
@@ -380,6 +416,70 @@
ast_softhangup(peer, AST_SOFTHANGUP_UNBRIDGE);
return res;
+}
+
+/*!
+ * \internal
+ * \brief adds recipients to a mixmonitor's recipient list
+ * \param mixmonitor mixmonitor being affected
+ * \param vm_recipients string containing the desired recipients to add
+ */
+static void add_vm_recipients_from_string(struct mixmonitor *mixmonitor, const char *vm_recipients)
+{
+ /* recipients are in a single string with a format format resembling "mailbox at context/INBOX,mailbox2 at context2,mailbox3 at context3/Work" */
+ char *cur_mailbox = ast_strdupa(vm_recipients);
+ char *cur_context;
+ char *cur_folder;
+ char *next;
+ int elements_processed = 0;
+
+ while (!ast_strlen_zero(cur_mailbox)) {
+ ast_debug(3, "attempting to add next element %d from %s\n", elements_processed, cur_mailbox);
+ if ((next = strchr(cur_mailbox, ',')) || (next = strchr(cur_mailbox, '&'))) {
+ *(next++) = '\0';
+ }
+
+ if ((cur_folder = strchr(cur_mailbox, '/'))) {
+ *(cur_folder++) = '\0';
+ } else {
+ cur_folder = "INBOX";
+ }
+
+ if ((cur_context = strchr(cur_mailbox, '@'))) {
+ *(cur_context++) = '\0';
+ } else {
+ cur_context = "default";
+ }
+
+ if (!ast_strlen_zero(cur_mailbox) && !ast_strlen_zero(cur_context)) {
+ struct vm_recipient *recipient;
+ if (!(recipient = ast_malloc(sizeof(*recipient)))) {
+ ast_log(LOG_ERROR, "Failed to allocate recipient. Aborting function.\n");
+ return;
+ }
+ ast_copy_string(recipient->context, cur_context, sizeof(recipient->context));
+ ast_copy_string(recipient->mailbox, cur_mailbox, sizeof(recipient->mailbox));
+ ast_copy_string(recipient->folder, cur_folder, sizeof(recipient->folder));
+
+ /* Add to list */
+ ast_verb(5, "Adding %s@%s to recipient list\n", recipient->mailbox, recipient->context);
+ AST_LIST_INSERT_HEAD(&mixmonitor->recipient_list, recipient, list);
+ } else {
+ ast_log(LOG_ERROR, "Failed to properly parse extension and/or context from element %d of recipient string: %s\n", elements_processed, vm_recipients);
+ }
+
+ cur_mailbox = next;
+ elements_processed++;
+ }
+}
+
+static void clear_mixmonitor_recipient_list(struct mixmonitor *mixmonitor)
+{
+ struct vm_recipient *current;
+ while ((current = AST_LIST_REMOVE_HEAD(&mixmonitor->recipient_list, list))) {
+ /* Clear list element data */
+ ast_free(current);
+ }
}
#define SAMPLES_PER_FRAME 160
@@ -397,6 +497,12 @@
ast_free(mixmonitor->post_process);
}
+ /* Free everything in the recipient list */
+ clear_mixmonitor_recipient_list(mixmonitor);
+
+ /* clean stringfields */
+ ast_string_field_free_memory(mixmonitor);
+
if (mixmonitor->callid) {
ast_callid_unref(mixmonitor->callid);
}
@@ -404,10 +510,50 @@
}
}
-static void mixmonitor_save_prep(struct mixmonitor *mixmonitor, char *filename, struct ast_filestream **fs, unsigned int *oflags, int *errflag)
+/*!
+ * \internal
+ * \brief Copies the mixmonitor to all voicemail recipients
+ * \param mixmonitor The mixmonitor that needs to forward its file to recipients
+ * \param ext Format of the file that was saved
+ */
+static void copy_to_voicemail(struct mixmonitor *mixmonitor, const char *ext, const char *filename)
+{
+ struct vm_recipient *recipient = NULL;
+ struct ast_vm_recording_data recording_data;
+ if (ast_string_field_init(&recording_data, 512)) {
+ ast_log(LOG_ERROR, "Failed to string_field_init, skipping copy_to_voicemail\n");
+ return;
+ }
+
+ /* Copy strings to stringfields that will be used for all recipients */
+ ast_string_field_set(&recording_data, recording_file, filename);
+ ast_string_field_set(&recording_data, recording_ext, ext);
+ ast_string_field_set(&recording_data, call_context, mixmonitor->call_context);
+ ast_string_field_set(&recording_data, call_macrocontext, mixmonitor->call_macrocontext);
+ ast_string_field_set(&recording_data, call_extension, mixmonitor->call_extension);
+ ast_string_field_set(&recording_data, call_callerchan, mixmonitor->call_callerchan);
+ ast_string_field_set(&recording_data, call_callerid, mixmonitor->call_callerid);
+ /* and call_priority gets copied too */
+ recording_data.call_priority = mixmonitor->call_priority;
+
+ AST_LIST_TRAVERSE(&mixmonitor->recipient_list, recipient, list) {
+ /* context, mailbox, and folder need to be set per recipient */
+ ast_string_field_set(&recording_data, context, recipient->context);
+ ast_string_field_set(&recording_data, mailbox, recipient->mailbox);
+ ast_string_field_set(&recording_data, folder, recipient->folder);
+
+ ast_verb(4, "MixMonitor attempting to send voicemail copy to %s@%s\n", recording_data.mailbox,
+ recording_data.context);
+ ast_app_copy_recording_to_vm(&recording_data);
+ }
+
+ /* Free the string fields for recording_data before exiting the function. */
+ ast_string_field_free_memory(&recording_data);
+}
+
+static void mixmonitor_save_prep(struct mixmonitor *mixmonitor, char *filename, struct ast_filestream **fs, unsigned int *oflags, int *errflag, char **ext)
{
/* Initialize the file if not already done so */
- char *ext = NULL;
char *last_slash = NULL;
if (!ast_strlen_zero(filename)) {
if (!*fs && !*errflag && !mixmonitor->mixmonitor_ds->fs_quit) {
@@ -416,14 +562,15 @@
last_slash = strrchr(filename, '/');
- if ((ext = strrchr(filename, '.')) && (ext > last_slash)) {
- *(ext++) = '\0';
+ if ((*ext = strrchr(filename, '.')) && (*ext > last_slash)) {
+ **ext = '\0';
+ *ext = *ext + 1;
} else {
- ext = "raw";
+ *ext = "raw";
}
- if (!(*fs = ast_writefile(filename, ext, NULL, *oflags, 0, 0666))) {
- ast_log(LOG_ERROR, "Cannot open %s.%s\n", filename, ext);
+ if (!(*fs = ast_writefile(filename, *ext, NULL, *oflags, 0, 0666))) {
+ ast_log(LOG_ERROR, "Cannot open %s.%s\n", filename, *ext);
*errflag = 1;
} else {
struct ast_filestream *tmp = *fs;
@@ -436,6 +583,9 @@
static void *mixmonitor_thread(void *obj)
{
struct mixmonitor *mixmonitor = obj;
+ char *fs_ext = "";
+ char *fs_read_ext = "";
+ char *fs_write_ext = "";
struct ast_filestream **fs = NULL;
struct ast_filestream **fs_read = NULL;
@@ -457,9 +607,9 @@
fs_write = &mixmonitor->mixmonitor_ds->fs_write;
ast_mutex_lock(&mixmonitor->mixmonitor_ds->lock);
- mixmonitor_save_prep(mixmonitor, mixmonitor->filename, fs, &oflags, &errflag);
- mixmonitor_save_prep(mixmonitor, mixmonitor->filename_read, fs_read, &oflags, &errflag);
- mixmonitor_save_prep(mixmonitor, mixmonitor->filename_write, fs_write, &oflags, &errflag);
+ mixmonitor_save_prep(mixmonitor, mixmonitor->filename, fs, &oflags, &errflag, &fs_ext);
+ mixmonitor_save_prep(mixmonitor, mixmonitor->filename_read, fs_read, &oflags, &errflag, &fs_read_ext);
+ mixmonitor_save_prep(mixmonitor, mixmonitor->filename_write, fs_write, &oflags, &errflag, &fs_write_ext);
ast_format_set(&format_slin, ast_format_slin_by_rate(mixmonitor->mixmonitor_ds->samp_rate), 0);
@@ -554,6 +704,27 @@
}
ast_verb(2, "End MixMonitor Recording %s\n", mixmonitor->name);
+
+ if (!AST_LIST_EMPTY(&mixmonitor->recipient_list)) {
+ if (ast_strlen_zero(fs_ext)) {
+ ast_log(LOG_ERROR, "No file extension set for Mixmonitor %s. Skipping copy to voicemail.\n",
+ mixmonitor -> name);
+ } else {
+ ast_verb(3, "Copying recordings for Mixmonitor %s to voicemail recipients\n", mixmonitor->name);
+ copy_to_voicemail(mixmonitor, fs_ext, mixmonitor->filename);
+ }
+ if (!ast_strlen_zero(fs_read_ext)) {
+ ast_verb(3, "Copying read recording for Mixmonitor %s to voicemail recipients\n", mixmonitor->name);
+ copy_to_voicemail(mixmonitor, fs_read_ext, mixmonitor->filename_read);
+ }
+ if (!ast_strlen_zero(fs_write_ext)) {
+ ast_verb(3, "Copying write recording for Mixmonitor %s to voicemail recipients\n", mixmonitor->name);
+ copy_to_voicemail(mixmonitor, fs_write_ext, mixmonitor->filename_write);
+ }
+ } else {
+ ast_debug(3, "No recipients to forward monitor to, moving on.\n");
+ }
+
mixmonitor_free(mixmonitor);
return NULL;
}
@@ -597,7 +768,8 @@
static void launch_monitor_thread(struct ast_channel *chan, const char *filename,
unsigned int flags, int readvol, int writevol,
const char *post_process, const char *filename_write,
- char *filename_read, const char *uid_channel_var)
+ char *filename_read, const char *uid_channel_var,
+ const char *recipients)
{
pthread_t thread;
struct mixmonitor *mixmonitor;
@@ -623,6 +795,12 @@
return;
}
+ /* Now that the struct has been calloced, go ahead and initialize the string fields. */
+ if (ast_string_field_init(mixmonitor, 512)) {
+ mixmonitor_free(mixmonitor);
+ return;
+ }
+
/* Setup the actual spy before creating our thread */
if (ast_audiohook_init(&mixmonitor->audiohook, AST_AUDIOHOOK_TYPE_SPY, mixmonitor_spy_type, 0)) {
mixmonitor_free(mixmonitor);
@@ -650,7 +828,6 @@
}
ast_free(datastore_id);
-
mixmonitor->name = ast_strdup(ast_channel_name(chan));
if (!ast_strlen_zero(postprocess2)) {
@@ -667,6 +844,35 @@
if (!ast_strlen_zero(filename_read)) {
mixmonitor->filename_read = ast_strdup(filename_read);
+ }
+
+ if (!ast_strlen_zero(recipients)) {
+ char callerid[256];
+ struct ast_party_connected_line *connected;
+
+ ast_channel_lock(chan);
+
+ /* We use the connected line of the invoking channel for caller ID. */
+
+ connected = ast_channel_connected(chan);
+ ast_debug(3, "Connected Line CID = %d - %s : %d - %s\n", connected->id.name.valid,
+ connected->id.name.str, connected->id.number.valid,
+ connected->id.number.str);
+ ast_callerid_merge(callerid, sizeof(callerid),
+ S_COR(connected->id.name.valid, connected->id.name.str, NULL),
+ S_COR(connected->id.number.valid, connected->id.number.str, NULL),
+ "Unknown");
+
+ ast_string_field_set(mixmonitor, call_context, ast_channel_context(chan));
+ ast_string_field_set(mixmonitor, call_macrocontext, ast_channel_macrocontext(chan));
+ ast_string_field_set(mixmonitor, call_extension, ast_channel_exten(chan));
+ ast_string_field_set(mixmonitor, call_callerchan, ast_channel_name(chan));
+ ast_string_field_set(mixmonitor, call_callerid, callerid);
+ mixmonitor->call_priority = ast_channel_priority(chan);
+
+ ast_channel_unlock(chan);
+
+ add_vm_recipients_from_string(mixmonitor, recipients);
}
ast_set_flag(&mixmonitor->audiohook, AST_AUDIOHOOK_TRIGGER_SYNC);
@@ -723,6 +929,7 @@
char *uid_channel_var = NULL;
struct ast_flags flags = { 0 };
+ char *recipients = NULL;
char *parse;
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(filename);
@@ -774,6 +981,14 @@
}
}
+ if (ast_test_flag(&flags, MUXFLAG_VMRECIPIENTS)) {
+ if (ast_strlen_zero(opts[OPT_ARG_VMRECIPIENTS])) {
+ ast_log(LOG_WARNING, "No voicemail recipients were specified for the vm copy ('m') option.\n");
+ } else {
+ recipients = ast_strdupa(opts[OPT_ARG_VMRECIPIENTS]);
+ }
+ }
+
if (ast_test_flag(&flags, MUXFLAG_WRITE)) {
filename_write = ast_strdupa(filename_parse(opts[OPT_ARG_WRITENAME], filename_buffer, sizeof(filename_buffer)));
}
@@ -799,7 +1014,16 @@
}
pbx_builtin_setvar_helper(chan, "MIXMONITOR_FILENAME", args.filename);
- launch_monitor_thread(chan, args.filename, flags.flags, readvol, writevol, args.post_process, filename_write, filename_read, uid_channel_var);
+ launch_monitor_thread(chan,
+ args.filename,
+ flags.flags,
+ readvol,
+ writevol,
+ args.post_process,
+ filename_write,
+ filename_read,
+ uid_channel_var,
+ recipients);
return 0;
}
Modified: team/may/chan_ooh323_evo/apps/app_queue.c
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_evo/apps/app_queue.c?view=diff&rev=368564&r1=368563&r2=368564
==============================================================================
--- team/may/chan_ooh323_evo/apps/app_queue.c (original)
+++ team/may/chan_ooh323_evo/apps/app_queue.c Tue Jun 5 19:22:47 2012
@@ -1703,12 +1703,18 @@
return state;
}
-static int extension_state_cb(const char *context, const char *exten, enum ast_extension_states state, void *data)
+static int extension_state_cb(char *context, char *exten, struct ast_state_cb_info *info, void *data)
{
struct ao2_iterator miter, qiter;
struct member *m;
struct call_queue *q;
+ int state = info->exten_state;
int found = 0, device_state = extensionstate2devicestate(state);
+
+ /* only interested in extension state updates involving device states */
+ if (info->reason != AST_HINT_UPDATE_DEVICE) {
+ return 0;
+ }
qiter = ao2_iterator_init(queues, 0);
while ((q = ao2_t_iterator_next(&qiter, "Iterate through queues"))) {
@@ -3097,7 +3103,7 @@
/* Hangup any existing lines we have open */
if (outgoing->chan && (outgoing->chan != exception)) {
if (exception || cancel_answered_elsewhere) {
- ast_set_flag(ast_channel_flags(outgoing->chan), AST_FLAG_ANSWERED_ELSEWHERE);
+ ast_channel_hangupcause_set(outgoing->chan, AST_CAUSE_ANSWERED_ELSEWHERE);
}
ast_hangup(outgoing->chan);
}
@@ -3351,7 +3357,7 @@
ast_channel_lock_both(tmp->chan, qe->chan);
if (qe->cancel_answered_elsewhere) {
- ast_set_flag(ast_channel_flags(tmp->chan), AST_FLAG_ANSWERED_ELSEWHERE);
+ ast_channel_hangupcause_set(tmp->chan, AST_CAUSE_ANSWERED_ELSEWHERE);
}
ast_channel_appl_set(tmp->chan, "AppQueue");
ast_channel_data_set(tmp->chan, "(Outgoing Line)");
@@ -4819,10 +4825,10 @@
qe->cancel_answered_elsewhere = 1;
}
- /* if the calling channel has the ANSWERED_ELSEWHERE flag set, make sure this is inherited.
+ /* if the calling channel has AST_CAUSE_ANSWERED_ELSEWHERE set, make sure this is inherited.
(this is mainly to support chan_local)
*/
- if (ast_test_flag(ast_channel_flags(qe->chan), AST_FLAG_ANSWERED_ELSEWHERE)) {
+ if (ast_channel_hangupcause(qe->chan) == AST_CAUSE_ANSWERED_ELSEWHERE) {
qe->cancel_answered_elsewhere = 1;
}
Modified: team/may/chan_ooh323_evo/apps/app_voicemail.c
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_evo/apps/app_voicemail.c?view=diff&rev=368564&r1=368563&r2=368564
==============================================================================
--- team/may/chan_ooh323_evo/apps/app_voicemail.c (original)
+++ team/may/chan_ooh323_evo/apps/app_voicemail.c Tue Jun 5 19:22:47 2012
@@ -113,12 +113,14 @@
#include "asterisk/module.h"
#include "asterisk/adsi.h"
#include "asterisk/app.h"
+#include "asterisk/app_voicemail.h"
#include "asterisk/manager.h"
#include "asterisk/dsp.h"
#include "asterisk/localtime.h"
#include "asterisk/cli.h"
#include "asterisk/utils.h"
#include "asterisk/stringfields.h"
+#include "asterisk/strings.h"
#include "asterisk/smdi.h"
#include "asterisk/astobj2.h"
#include "asterisk/event.h"
@@ -334,6 +336,30 @@
</enumlist>
</description>
</application>
+ <application name="VoiceMailPlayMsg" language="en_US">
+ <synopsis>
+ Play a single voice mail msg from a mailbox by msg id.
+ </synopsis>
+ <syntax>
+ <parameter name="mailbox" required="true" argsep="@">
+ <argument name="mailbox" />
+ <argument name="context" />
+ </parameter>
+ <parameter name="msg_id" required="true">
+ <para>The msg id of the msg to play back. </para>
+ </parameter>
+ </syntax>
+ <description>
+ <para>This application sets the following channel variable upon completion:</para>
+ <variablelist>
+ <variable name="VOICEMAIL_PLAYBACKSTATUS">
+ <para>The status of the playback attempt as a text string.</para>
+ <value name="SUCCESS"/>
+ <value name="FAILED"/>
+ </variable>
+ </variablelist>
+ </description>
+ </application>
<application name="VMSayName" language="en_US">
<synopsis>
Play the name of a voicemail user
@@ -469,7 +495,8 @@
static void get_mailbox_delimiter(struct vm_state *vms, MAILSTREAM *stream);
static void mm_parsequota (MAILSTREAM *stream, unsigned char *msg, QUOTALIST *pquota);
static void imap_mailbox_name(char *spec, size_t len, struct vm_state *vms, int box, int target);
-static int imap_store_file(const char *dir, const char *mailboxuser, const char *mailboxcontext, int msgnum, struct ast_channel *chan, struct ast_vm_user *vmu, char *fmt, int duration, struct vm_state *vms, const char *flag);
+static int imap_store_file(const char *dir, const char *mailboxuser, const char *mailboxcontext, int msgnum, struct ast_channel *chan, struct ast_vm_user *vmu, char *fmt, int duration, struct vm_state *vms, const char *flag, const char *msg_id);
+static void vm_imap_update_msg_id(char *dir, int msgnum, const char *msg_id, struct ast_vm_user *vmu, struct ast_config *msg_cfg, int folder);
static void update_messages_by_imapuser(const char *user, unsigned long number);
static int vm_delete(char *file);
@@ -552,7 +579,6 @@
#define ERROR_LOCK_PATH -100
#define OPERATOR_EXIT 300
-
enum vm_box {
NEW_FOLDER,
OLD_FOLDER,
@@ -599,6 +625,25 @@
AST_APP_OPTION('U', OPT_MESSAGE_Urgent),
AST_APP_OPTION('P', OPT_MESSAGE_PRIORITY)
});
+
+static const char * const mailbox_folders[] = {
+#ifdef IMAP_STORAGE
+ imapfolder,
+#else
+ "INBOX",
+#endif
+ "Old",
+ "Work",
+ "Family",
+ "Friends",
+ "Cust1",
+ "Cust2",
+ "Cust3",
+ "Cust4",
+ "Cust5",
+ "Deleted",
+ "Urgent",
+};
static int load_config(int reload);
#ifdef TEST_FRAMEWORK
@@ -793,28 +838,31 @@
static char odbc_table[80];
#define RETRIEVE(a,b,c,d) retrieve_file(a,b)
#define DISPOSE(a,b) remove_file(a,b)
-#define STORE(a,b,c,d,e,f,g,h,i,j) store_file(a,b,c,d)
+#define STORE(a,b,c,d,e,f,g,h,i,j,k) store_file(a,b,c,d)
#define EXISTS(a,b,c,d) (message_exists(a,b))
#define RENAME(a,b,c,d,e,f,g,h) (rename_file(a,b,c,d,e,f))
#define COPY(a,b,c,d,e,f,g,h) (copy_file(a,b,c,d,e,f))
#define DELETE(a,b,c,d) (delete_file(a,b))
+#define UPDATE_MSG_ID(a, b, c, d, e, f) (odbc_update_msg_id((a), (b), (c)))
#else
#ifdef IMAP_STORAGE
#define DISPOSE(a,b) (imap_remove_file(a,b))
-#define STORE(a,b,c,d,e,f,g,h,i,j) (imap_store_file(a,b,c,d,e,f,g,h,i,j))
+#define STORE(a,b,c,d,e,f,g,h,i,j,k) (imap_store_file(a,b,c,d,e,f,g,h,i,j,k))
#define RETRIEVE(a,b,c,d) imap_retrieve_file(a,b,c,d)
#define EXISTS(a,b,c,d) (ast_fileexists(c,NULL,d) > 0)
#define RENAME(a,b,c,d,e,f,g,h) (rename_file(g,h));
#define COPY(a,b,c,d,e,f,g,h) (copy_file(g,h));
#define DELETE(a,b,c,d) (vm_imap_delete(a,b,d))
+#define UPDATE_MSG_ID(a, b, c, d, e, f) (vm_imap_update_msg_id((a), (b), (c), (d), (e), (f)))
#else
#define RETRIEVE(a,b,c,d)
#define DISPOSE(a,b)
-#define STORE(a,b,c,d,e,f,g,h,i,j)
+#define STORE(a,b,c,d,e,f,g,h,i,j,k)
#define EXISTS(a,b,c,d) (ast_fileexists(c,NULL,d) > 0)
#define RENAME(a,b,c,d,e,f,g,h) (rename_file(g,h));
#define COPY(a,b,c,d,e,f,g,h) (copy_plain_file(g,h));
#define DELETE(a,b,c,d) (vm_delete(c))
+#define UPDATE_MSG_ID(a, b, c, d, e, f)
#endif
#endif
@@ -851,6 +899,8 @@
static char *app3 = "MailboxExists";
static char *app4 = "VMAuthenticate";
+
+static char *playmsg_app = "VoiceMailPlayMsg";
static char *sayname_app = "VMSayName";
@@ -976,21 +1026,39 @@
/* Forward declarations - generic */
static int open_mailbox(struct vm_state *vms, struct ast_vm_user *vmu, int box);
+static int close_mailbox(struct vm_state *vms, struct ast_vm_user *vmu);
static int advanced_options(struct ast_channel *chan, struct ast_vm_user *vmu, struct vm_state *vms, int msg, int option, signed char record_gain);
static int dialout(struct ast_channel *chan, struct ast_vm_user *vmu, char *num, char *outgoing_context);
static int play_record_review(struct ast_channel *chan, char *playfile, char *recordfile, int maxtime,
char *fmt, int outsidecaller, struct ast_vm_user *vmu, int *duration, int *sound_duration, const char *unlockdir,
- signed char record_gain, struct vm_state *vms, char *flag);
+ signed char record_gain, struct vm_state *vms, char *flag, const char *msg_id);
static int vm_tempgreeting(struct ast_channel *chan, struct ast_vm_user *vmu, struct vm_state *vms, char *fmtc, signed char record_gain);
static int vm_play_folder_name(struct ast_channel *chan, char *mbox);
static int notify_new_message(struct ast_channel *chan, struct ast_vm_user *vmu, struct vm_state *vms, int msgnum, long duration, char *fmt, char *cidnum, char *cidname, const char *flag);
-static void make_email_file(FILE *p, char *srcemail, struct ast_vm_user *vmu, int msgnum, char *context, char *mailbox, const char *fromfolder, char *cidnum, char *cidname, char *attach, char *attach2, char *format, int duration, int attach_user_voicemail, struct ast_channel *chan, const char *category, int imap, const char *flag);
+static void make_email_file(FILE *p, char *srcemail, struct ast_vm_user *vmu, int msgnum, char *context, char *mailbox, const char *fromfolder, char *cidnum, char *cidname, char *attach, char *attach2, char *format, int duration, int attach_user_voicemail, struct ast_channel *chan, const char *category, int imap, const char *flag, const char *msg_id);
static void apply_options(struct ast_vm_user *vmu, const char *options);
static int add_email_attachment(FILE *p, struct ast_vm_user *vmu, char *format, char *attach, char *greeting_attachment, char *mailbox, char *bound, char *filename, int last, int msgnum);
static int is_valid_dtmf(const char *key);
static void read_password_from_file(const char *secretfn, char *password, int passwordlen);
static int write_password_to_file(const char *secretfn, const char *password);
+struct ast_str *vm_mailbox_snapshot_str(const char *mailbox, const char *context);
static const char *substitute_escapes(const char *value);
[... 5421 lines stripped ...]
More information about the asterisk-commits
mailing list