[asterisk-commits] oej: branch oej/tdd-sip r101225 - in /team/oej/tdd-sip: ./ apps/ build_tools/...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Jan 30 09:54:53 CST 2008
Author: oej
Date: Wed Jan 30 09:54:52 2008
New Revision: 101225
URL: http://svn.digium.com/view/asterisk?view=rev&rev=101225
Log:
Reset, resolve
Added:
team/oej/tdd-sip/configs/cli.conf.sample
- copied unchanged from r101217, trunk/configs/cli.conf.sample
team/oej/tdd-sip/configs/res_ldap.conf.sample
- copied unchanged from r101217, trunk/configs/res_ldap.conf.sample
team/oej/tdd-sip/contrib/scripts/asterisk.ldap-schema
- copied unchanged from r101217, trunk/contrib/scripts/asterisk.ldap-schema
team/oej/tdd-sip/contrib/scripts/asterisk.ldif
- copied unchanged from r101217, trunk/contrib/scripts/asterisk.ldif
team/oej/tdd-sip/doc/ldap.txt
- copied unchanged from r101217, trunk/doc/ldap.txt
team/oej/tdd-sip/main/features.c
- copied unchanged from r101217, trunk/main/features.c
team/oej/tdd-sip/res/res_config_ldap.c
- copied unchanged from r101217, trunk/res/res_config_ldap.c
Removed:
team/oej/tdd-sip/res/res_features.c
Modified:
team/oej/tdd-sip/ (props changed)
team/oej/tdd-sip/.cleancount
team/oej/tdd-sip/CHANGES
team/oej/tdd-sip/CREDITS
team/oej/tdd-sip/Makefile
team/oej/tdd-sip/apps/app_chanspy.c
team/oej/tdd-sip/apps/app_dial.c
team/oej/tdd-sip/apps/app_externalivr.c
team/oej/tdd-sip/apps/app_followme.c
team/oej/tdd-sip/apps/app_queue.c
team/oej/tdd-sip/apps/app_rpt.c
team/oej/tdd-sip/apps/app_speech_utils.c
team/oej/tdd-sip/apps/app_voicemail.c
team/oej/tdd-sip/build_tools/make_defaults_h
team/oej/tdd-sip/build_tools/make_version
team/oej/tdd-sip/build_tools/menuselect-deps.in
team/oej/tdd-sip/channels/chan_agent.c
team/oej/tdd-sip/channels/chan_h323.c
team/oej/tdd-sip/channels/chan_iax2.c
team/oej/tdd-sip/channels/chan_local.c
team/oej/tdd-sip/channels/chan_mgcp.c
team/oej/tdd-sip/channels/chan_misdn.c
team/oej/tdd-sip/channels/chan_sip.c
team/oej/tdd-sip/channels/chan_zap.c
team/oej/tdd-sip/channels/misdn_config.c
team/oej/tdd-sip/configs/rtp.conf.sample
team/oej/tdd-sip/configure
team/oej/tdd-sip/configure.ac
team/oej/tdd-sip/doc/tex/channelvariables.tex
team/oej/tdd-sip/include/asterisk/_private.h
team/oej/tdd-sip/include/asterisk/app.h
team/oej/tdd-sip/include/asterisk/autoconfig.h.in
team/oej/tdd-sip/include/asterisk/channel.h
team/oej/tdd-sip/include/asterisk/dial.h
team/oej/tdd-sip/include/asterisk/features.h
team/oej/tdd-sip/include/asterisk/sched.h
team/oej/tdd-sip/main/Makefile
team/oej/tdd-sip/main/acl.c
team/oej/tdd-sip/main/asterisk.c
team/oej/tdd-sip/main/astmm.c
team/oej/tdd-sip/main/cdr.c
team/oej/tdd-sip/main/channel.c
team/oej/tdd-sip/main/dial.c
team/oej/tdd-sip/main/dnsmgr.c
team/oej/tdd-sip/main/file.c
team/oej/tdd-sip/main/loader.c
team/oej/tdd-sip/main/logger.c
team/oej/tdd-sip/main/pbx.c
team/oej/tdd-sip/main/rtp.c
team/oej/tdd-sip/main/tcptls.c
team/oej/tdd-sip/makeopts.in
team/oej/tdd-sip/pbx/pbx_dundi.c
team/oej/tdd-sip/res/res_config_curl.c
team/oej/tdd-sip/res/res_odbc.c
team/oej/tdd-sip/res/res_phoneprov.c
Propchange: team/oej/tdd-sip/
------------------------------------------------------------------------------
Binary property 'branch-1.4-blocked' - no diff available.
Propchange: team/oej/tdd-sip/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Propchange: team/oej/tdd-sip/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Jan 30 09:54:52 2008
@@ -1,1 +1,1 @@
-/trunk:1-99542
+/trunk:1-101217
Modified: team/oej/tdd-sip/.cleancount
URL: http://svn.digium.com/view/asterisk/team/oej/tdd-sip/.cleancount?view=diff&rev=101225&r1=101224&r2=101225
==============================================================================
--- team/oej/tdd-sip/.cleancount (original)
+++ team/oej/tdd-sip/.cleancount Wed Jan 30 09:54:52 2008
@@ -1,1 +1,1 @@
-33
+35
Modified: team/oej/tdd-sip/CHANGES
URL: http://svn.digium.com/view/asterisk/team/oej/tdd-sip/CHANGES?view=diff&rev=101225&r1=101224&r2=101225
==============================================================================
--- team/oej/tdd-sip/CHANGES (original)
+++ team/oej/tdd-sip/CHANGES Wed Jan 30 09:54:52 2008
@@ -66,6 +66,10 @@
the existence of a dialplan target.
* Added two new dialplan functions, TOUPPER and TOLOWER, which convert a string to
upper and lower case, respectively.
+ * When bridging, Asterisk sets the BRIDGEPVTCALLID to the channel drivers unique
+ ID for the call (not the Asterisk call ID or unique ID), provided that the
+ channel driver supports this. For SIP, you get the SIP call-ID for the
+ bridged channel which you can store in the CDR with a custom field.
CLI Changes
-----------
@@ -80,8 +84,7 @@
* New CLI commands "dialplan set extenpatternmatching true/false"
* New CLI command: "core set chanvar" to set a channel variable from the CLI.
* Added an easy way to execute Asterisk CLI commands at startup. Any commands
- listed in the startup_commands file in the Asterisk configuration directory
- will get executed.
+ listed in the startup_commands section of cli.conf will get executed.
SIP changes
-----------
@@ -406,6 +409,8 @@
* Updated the ParkedCall application to allow you to not specify a parking
extension. If you don't specify a parking space to pick up, it will grab
the first one available.
+ * Added cli command 'features reload' to reload call features from features.conf
+ * Moved into core asterisk binary.
Language Support Changes
------------------------
@@ -460,6 +465,10 @@
to retrieve, create, update, and delete realtime information from a remote
web server. Note that this module requires func_curl.so to be loaded for
backend functionality.
+ * Added a new module, res_config_ldap, which permits the use of an LDAP
+ server for realtime data access.
+ * Added support for writing and running your dialplan in lua using the pbx_lua
+ module. See configs/extensions.lua.sample for examples of how to do this.
Miscellaneous
-------------
@@ -479,8 +488,6 @@
will now be available in the failed extension using the REASON dialplan variable.
* Added support for reading the TOUCH_MONITOR_PREFIX channel variable.
It allows you to configure a prefix for auto-monitor recordings.
- * Added support for writing and running your dialplan in lua. See
- configs/extensions.lua.sample for examples of how to do this.
* A new extension pattern matching algorithm, based on a trie, is introduced
here, that could noticeably speed up mid-sized to large dialplans.
It is NOT used by default, as duplicating the behaviour of the old pattern
@@ -493,4 +500,7 @@
specifying which socket to use to connect to the running Asterisk daemon
(-s)
* Added logging to 'make update' command. See update.log
-
+ * Added strictrtp option to rtp.conf. If enabled this will drop RTP packets that
+ do not come from the remote party.
+ * Added the 'n' option to the SpeechBackground application to tell it to not
+ answer the channel if it has not already been answered.
Modified: team/oej/tdd-sip/CREDITS
URL: http://svn.digium.com/view/asterisk/team/oej/tdd-sip/CREDITS?view=diff&rev=101225&r1=101224&r2=101225
==============================================================================
--- team/oej/tdd-sip/CREDITS (original)
+++ team/oej/tdd-sip/CREDITS Wed Jan 30 09:54:52 2008
@@ -183,6 +183,12 @@
TCP and TLS support for SIP, and various bug fixes.
brettbryant(AT)gmail.com
+Sergey Tamkovich - Realtime support for MusicOnHold, store and destroy realtime methods and
+ implementations for odbc, sqlite, and pgsql realtime drivers, attended transfer updates,
+ multiple speeds for ControlPlayback, and multiple bug fixes
+ - See http://voip-info.org/users/view/sergee
+ serg(AT)voipsolutions.ru
+
=== OTHER CONTRIBUTIONS ===
John Todd - Monkey sounds and associated teletorture prompt
Michael Jerris - bug marshaling
Modified: team/oej/tdd-sip/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/tdd-sip/Makefile?view=diff&rev=101225&r1=101224&r2=101225
==============================================================================
--- team/oej/tdd-sip/Makefile (original)
+++ team/oej/tdd-sip/Makefile Wed Jan 30 09:54:52 2008
@@ -57,6 +57,7 @@
export ASTSPOOLDIR
export ASTVARLIBDIR
export ASTDATADIR
+export ASTDBDIR
export ASTLOGDIR
export ASTLIBDIR
export ASTMANDIR
@@ -107,7 +108,9 @@
#Uncomment this to see all build commands instead of 'quiet' output
#NOISY_BUILD=yes
-ASTTOPDIR:=$(CURDIR)
+empty:=
+space:=$(empty) $(empty)
+ASTTOPDIR:=$(subst $(space),\$(space),$(CURDIR))
# Overwite config files on "make samples"
OVERWRITE=y
Modified: team/oej/tdd-sip/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/team/oej/tdd-sip/apps/app_chanspy.c?view=diff&rev=101225&r1=101224&r2=101225
==============================================================================
--- team/oej/tdd-sip/apps/app_chanspy.c (original)
+++ team/oej/tdd-sip/apps/app_chanspy.c Wed Jan 30 09:54:52 2008
@@ -409,6 +409,7 @@
int res;
char *ptr;
int num;
+ int num_spyed_upon = 1;
if (ast_test_flag(flags, OPTION_EXIT)) {
const char *c;
@@ -428,7 +429,7 @@
waitms = 100;
for (;;) {
- if (!ast_test_flag(flags, OPTION_QUIET)) {
+ if (!ast_test_flag(flags, OPTION_QUIET) && num_spyed_upon) {
res = ast_streamfile(chan, "beep", chan->language);
if (!res)
res = ast_waitstream(chan, "");
@@ -465,6 +466,7 @@
/* reset for the next loop around, unless overridden later */
waitms = 100;
peer = prev = next = NULL;
+ num_spyed_upon = 0;
for (peer = next_channel(peer, spec, exten, context);
peer;
@@ -530,7 +532,8 @@
waitms = 5000;
res = channel_spy(chan, peer, &volfactor, fd, flags, exitcontext);
-
+ num_spyed_upon++;
+
if (res == -1) {
goto exit;
} else if (res == -2) {
Modified: team/oej/tdd-sip/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/oej/tdd-sip/apps/app_dial.c?view=diff&rev=101225&r1=101224&r2=101225
==============================================================================
--- team/oej/tdd-sip/apps/app_dial.c (original)
+++ team/oej/tdd-sip/apps/app_dial.c Wed Jan 30 09:54:52 2008
@@ -24,6 +24,11 @@
*
* \ingroup applications
*/
+
+/*** MODULEINFO
+ <depend>chan_local</depend>
+ ***/
+
#include "asterisk.h"
Modified: team/oej/tdd-sip/apps/app_externalivr.c
URL: http://svn.digium.com/view/asterisk/team/oej/tdd-sip/apps/app_externalivr.c?view=diff&rev=101225&r1=101224&r2=101225
==============================================================================
--- team/oej/tdd-sip/apps/app_externalivr.c (original)
+++ team/oej/tdd-sip/apps/app_externalivr.c Wed Jan 30 09:54:52 2008
@@ -51,7 +51,7 @@
static const char *synopsis = "Interfaces with an external IVR application";
static const char *descrip =
-" ExternalIVR(command[,arg[,arg...]]): Forks an process to run the supplied command,\n"
+" ExternalIVR(command[,arg[,arg...]]): Forks a process to run the supplied command,\n"
"and starts a generator on the channel. The generator's play list is\n"
"controlled by the external application, which can add and clear entries\n"
"via simple commands issued over its stdout. The external application\n"
Modified: team/oej/tdd-sip/apps/app_followme.c
URL: http://svn.digium.com/view/asterisk/team/oej/tdd-sip/apps/app_followme.c?view=diff&rev=101225&r1=101224&r2=101225
==============================================================================
--- team/oej/tdd-sip/apps/app_followme.c (original)
+++ team/oej/tdd-sip/apps/app_followme.c Wed Jan 30 09:54:52 2008
@@ -27,6 +27,10 @@
*
* \ingroup applications
*/
+
+/*** MODULEINFO
+ <depend>chan_local</depend>
+ ***/
#include "asterisk.h"
Modified: team/oej/tdd-sip/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/oej/tdd-sip/apps/app_queue.c?view=diff&rev=101225&r1=101224&r2=101225
==============================================================================
--- team/oej/tdd-sip/apps/app_queue.c (original)
+++ team/oej/tdd-sip/apps/app_queue.c Wed Jan 30 09:54:52 2008
@@ -1306,7 +1306,7 @@
if ((m = create_queue_member(interface, membername, penalty, paused, state_interface))) {
m->dead = 0;
m->realtime = 1;
- add_to_interfaces(state_interface);
+ add_to_interfaces(m->state_interface);
ao2_link(q->members, m);
ao2_ref(m, -1);
m = NULL;
@@ -1555,8 +1555,7 @@
char *interface = NULL;
struct ao2_iterator mem_iter;
- member_config = ast_load_realtime_multientry("queue_members", "interface LIKE", "%", "queue_name", q->name , NULL);
- if (!member_config) {
+ if (!(member_config = ast_load_realtime_multientry("queue_members", "interface LIKE", "%", "queue_name", q->name , NULL))) {
/*This queue doesn't have realtime members*/
ast_debug(3, "Queue %s has no realtime members defined. No need for update\n", q->name);
return;
@@ -1591,6 +1590,7 @@
ao2_ref(m, -1);
}
ao2_unlock(q);
+ ast_config_destroy(member_config);
}
static int join_queue(char *queuename, struct queue_ent *qe, enum queue_result *reason)
@@ -2666,8 +2666,9 @@
ast_debug(1, "There are %d available members.\n", avl);
- while ((idx < avl) && (ch) && !ch->pending && (ch != qe)) {
- idx++;
+ while ((idx < avl) && (ch) && (ch != qe)) {
+ if (!ch->pending)
+ idx++;
ch = ch->next;
}
@@ -3708,7 +3709,7 @@
ao2_lock(q);
if ((old_member = interface_exists(q, interface)) == NULL) {
if ((new_member = create_queue_member(interface, membername, penalty, paused, state_interface))) {
- add_to_interfaces(state_interface);
+ add_to_interfaces(new_member->state_interface);
new_member->dynamic = 1;
ao2_link(q->members, new_member);
q->membercount++;
@@ -4007,7 +4008,7 @@
if (set_member_paused(args.queuename, args.interface, args.reason, 1)) {
ast_log(LOG_WARNING, "Attempt to pause interface %s, not found\n", args.interface);
pbx_builtin_setvar_helper(chan, "PQMSTATUS", "NOTFOUND");
- return -1;
+ return 0;
}
pbx_builtin_setvar_helper(chan, "PQMSTATUS", "PAUSED");
@@ -4042,7 +4043,7 @@
if (set_member_paused(args.queuename, args.interface, args.reason, 0)) {
ast_log(LOG_WARNING, "Attempt to unpause interface %s, not found\n", args.interface);
pbx_builtin_setvar_helper(chan, "UPQMSTATUS", "NOTFOUND");
- return -1;
+ return 0;
}
pbx_builtin_setvar_helper(chan, "UPQMSTATUS", "UNPAUSED");
Modified: team/oej/tdd-sip/apps/app_rpt.c
URL: http://svn.digium.com/view/asterisk/team/oej/tdd-sip/apps/app_rpt.c?view=diff&rev=101225&r1=101224&r2=101225
==============================================================================
--- team/oej/tdd-sip/apps/app_rpt.c (original)
+++ team/oej/tdd-sip/apps/app_rpt.c Wed Jan 30 09:54:52 2008
@@ -2675,7 +2675,7 @@
ast_copy_string(mychannel->context, myrpt->patchcontext, sizeof(mychannel->context));
if (myrpt->p.acctcode)
- ast_copy_string((char *)mychannel->accountcode, myrpt->p.acctcode, sizeof(mychannel->accountcode));
+ ast_string_field_set(mychannel, accountcode, myrpt->p.acctcode);
mychannel->priority = 1;
ast_channel_undefer_dtmf(mychannel);
if (ast_pbx_start(mychannel) < 0) {
@@ -4637,7 +4637,7 @@
{
char *s, *modestr;
const char *val;
- int i, j, ht, k, l, ls2, res, offset, offsave, modesave, defmode;
+ int i, j, ht, k, l, ls2, res, offset, offsave, modesave, defmode = 0;
char multimode = 0;
char oc;
char tmp[20], freq[20] = "", savestr[20] = "";
Modified: team/oej/tdd-sip/apps/app_speech_utils.c
URL: http://svn.digium.com/view/asterisk/team/oej/tdd-sip/apps/app_speech_utils.c?view=diff&rev=101225&r1=101224&r2=101225
==============================================================================
--- team/oej/tdd-sip/apps/app_speech_utils.c (original)
+++ team/oej/tdd-sip/apps/app_speech_utils.c Wed Jan 30 09:54:52 2008
@@ -56,15 +56,17 @@
"fed to it. This has no arguments.\n";
static char *speechbackground_descrip =
-" SpeechBackground(Sound File,Timeout):\n"
+" SpeechBackground(<Sound File>[,Timeout[,options]]):\n"
"This application plays a sound file and waits for the person to speak. Once they start speaking playback\n"
"of the file stops, and silence is heard. Once they stop talking the processing sound is played to indicate\n"
"the speech recognition engine is working. Once results are available the application returns and results \n"
"(score and text) are available using dialplan functions.\n"
-"The first text and score are ${SPEECH_TEXT(0)} AND ${SPEECH_SCORE(0)} while the second are ${SPEECH_TEXT(1)}\n"
+" The first text and score are ${SPEECH_TEXT(0)} AND ${SPEECH_SCORE(0)} while the second are ${SPEECH_TEXT(1)}\n"
"and ${SPEECH_SCORE(1)}.\n"
-"The first argument is the sound file and the second is the timeout integer in seconds. Note the timeout will\n"
-"only start once the sound file has stopped playing.\n";
+" The first argument is the sound file and the second is the timeout integer in seconds. Note the timeout will\n"
+"only start once the sound file has stopped playing. The third argument specifies options:\n"
+" Valid Options:\n"
+" n - Don't answer the channel if it has not already been answered.\n";
static char *speechdeactivategrammar_descrip =
" SpeechDeactivateGrammar(Grammar Name):\n"
@@ -487,6 +489,14 @@
return 0;
}
+enum {
+ SB_OPT_NOANSWER = (1 << 0),
+};
+
+AST_APP_OPTIONS(speech_background_options, BEGIN_OPTIONS
+ AST_APP_OPTION('n', SB_OPT_NOANSWER),
+END_OPTIONS );
+
/*! \brief SpeechBackground(Sound File,Timeout) Dialplan Application */
static int speech_background(struct ast_channel *chan, void *data)
{
@@ -500,9 +510,11 @@
struct ast_datastore *datastore = NULL;
char *parse, *filename_tmp = NULL, *filename = NULL, tmp[2] = "", dtmf_terminator = '#';
const char *tmp2 = NULL;
+ struct ast_flags options = { 0 };
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(soundfile);
AST_APP_ARG(timeout);
+ AST_APP_ARG(options);
);
parse = ast_strdupa(data);
@@ -511,9 +523,16 @@
if (speech == NULL)
return -1;
+ if (!ast_strlen_zero(args.options)) {
+ char *options_buf = ast_strdupa(args.options);
+ ast_app_parse_options(speech_background_options, &options, NULL, options_buf);
+ }
+
/* If channel is not already answered, then answer it */
- if (chan->_state != AST_STATE_UP && ast_answer(chan))
- return -1;
+ if (chan->_state != AST_STATE_UP && !ast_test_flag(&options, SB_OPT_NOANSWER)
+ && ast_answer(chan)) {
+ return -1;
+ }
/* Record old read format */
oldreadformat = chan->readformat;
Modified: team/oej/tdd-sip/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/oej/tdd-sip/apps/app_voicemail.c?view=diff&rev=101225&r1=101224&r2=101225
==============================================================================
--- team/oej/tdd-sip/apps/app_voicemail.c (original)
+++ team/oej/tdd-sip/apps/app_voicemail.c Wed Jan 30 09:54:52 2008
@@ -157,7 +157,7 @@
static int imap_retrieve_file (char *dir, int msgnum, const char *mailbox, char *context);
static int imap_delete_old_greeting (char *dir, struct vm_state *vms);
static void check_quota(struct vm_state *vms, char *mailbox);
-static int open_mailbox(struct vm_state *vms, struct ast_vm_user *vmu,int box);
+static int open_mailbox(struct vm_state *vms, struct ast_vm_user *vmu, int box);
struct vmstate {
struct vm_state *vms;
AST_LIST_ENTRY(vmstate) list;
@@ -443,7 +443,7 @@
#define RETRIEVE(a,b,c,d) (imap_retrieve_file(a,b,c,d ))
#define DISPOSE(a,b) (imap_remove_file(a,b))
#define STORE(a,b,c,d,e,f,g,h,i) (imap_store_file(a,b,c,d,e,f,g,h,i))
-#define EXISTS(a,b,c,d) (ast_fileexists(c,NULL,d) > 0)
+#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 IMAP_DELETE(a,b,c,d) (vm_imap_delete(b,d))
@@ -452,7 +452,7 @@
#define RETRIEVE(a,b,c,d)
#define DISPOSE(a,b)
#define STORE(a,b,c,d,e,f,g,h,i)
-#define EXISTS(a,b,c,d) (ast_fileexists(c,NULL,d) > 0)
+#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) (vm_delete(c))
@@ -654,7 +654,7 @@
static char emaildateformat[32] = "%A, %B %d, %Y at %r";
/* Forward declarations - generic */
-static int open_mailbox(struct vm_state *vms, struct ast_vm_user *vmu,int box);
+static int open_mailbox(struct vm_state *vms, struct ast_vm_user *vmu, int box);
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,
@@ -711,31 +711,31 @@
#endif
} else if (!strcasecmp(var, "delete") || !strcasecmp(var, "deletevoicemail")) {
ast_set2_flag(vmu, ast_true(value), VM_DELETE);
- } else if (!strcasecmp(var, "saycid")){
+ } else if (!strcasecmp(var, "saycid")) {
ast_set2_flag(vmu, ast_true(value), VM_SAYCID);
- } else if (!strcasecmp(var,"sendvoicemail")){
+ } else if (!strcasecmp(var, "sendvoicemail")) {
ast_set2_flag(vmu, ast_true(value), VM_SVMAIL);
- } else if (!strcasecmp(var, "review")){
+ } else if (!strcasecmp(var, "review")) {
ast_set2_flag(vmu, ast_true(value), VM_REVIEW);
- } else if (!strcasecmp(var, "tempgreetwarn")){
+ } else if (!strcasecmp(var, "tempgreetwarn")) {
ast_set2_flag(vmu, ast_true(value), VM_TEMPGREETWARN);
- } else if (!strcasecmp(var, "operator")){
+ } else if (!strcasecmp(var, "operator")) {
ast_set2_flag(vmu, ast_true(value), VM_OPERATOR);
- } else if (!strcasecmp(var, "envelope")){
+ } else if (!strcasecmp(var, "envelope")) {
ast_set2_flag(vmu, ast_true(value), VM_ENVELOPE);
- } else if (!strcasecmp(var, "moveheard")){
+ } else if (!strcasecmp(var, "moveheard")) {
ast_set2_flag(vmu, ast_true(value), VM_MOVEHEARD);
- } else if (!strcasecmp(var, "sayduration")){
+ } else if (!strcasecmp(var, "sayduration")) {
ast_set2_flag(vmu, ast_true(value), VM_SAYDURATION);
- } else if (!strcasecmp(var, "saydurationm")){
+ } else if (!strcasecmp(var, "saydurationm")) {
if (sscanf(value, "%d", &x) == 1) {
vmu->saydurationm = x;
} else {
ast_log(LOG_WARNING, "Invalid min duration for say duration\n");
}
- } else if (!strcasecmp(var, "forcename")){
+ } else if (!strcasecmp(var, "forcename")) {
ast_set2_flag(vmu, ast_true(value), VM_FORCENAME);
- } else if (!strcasecmp(var, "forcegreetings")){
+ } else if (!strcasecmp(var, "forcegreetings")) {
ast_set2_flag(vmu, ast_true(value), VM_FORCEGREET);
} else if (!strcasecmp(var, "callback")) {
ast_copy_string(vmu->callback, value, sizeof(vmu->callback));
@@ -892,7 +892,7 @@
static struct ast_vm_user *find_user(struct ast_vm_user *ivm, const char *context, const char *mailbox)
{
/* This function could be made to generate one from a database, too */
- struct ast_vm_user *vmu=NULL, *cur;
+ struct ast_vm_user *vmu = NULL, *cur;
AST_LIST_LOCK(&users);
if (!context && !ast_test_flag((&globalflags), VM_SEARCH))
@@ -938,11 +938,11 @@
static void vm_change_password(struct ast_vm_user *vmu, const char *newpassword)
{
- struct ast_config *cfg=NULL;
- struct ast_variable *var=NULL;
- struct ast_category *cat=NULL;
- char *category=NULL, *value=NULL, *new=NULL;
- const char *tmp=NULL;
+ struct ast_config *cfg = NULL;
+ struct ast_variable *var = NULL;
+ struct ast_category *cat = NULL;
+ char *category = NULL, *value = NULL, *new = NULL;
+ const char *tmp = NULL;
struct ast_flags config_flags = { CONFIG_FLAG_WITHCOMMENTS };
if (!change_password_realtime(vmu, newpassword))
return;
@@ -955,13 +955,13 @@
ast_log(LOG_WARNING, "We could not find the mailbox.\n");
break;
}
- value = strstr(tmp,",");
+ value = strstr(tmp, ",");
if (!value) {
ast_log(LOG_WARNING, "variable has bad format.\n");
break;
}
- new = alloca((strlen(value)+strlen(newpassword)+1));
- sprintf(new,"%s%s", newpassword, value);
+ new = alloca(strlen(value) + strlen(newpassword) + 1);
+ sprintf(new, "%s%s", newpassword, value);
if (!(cat = ast_category_get(cfg, category))) {
ast_log(LOG_WARNING, "Failed to get category structure.\n");
break;
@@ -987,7 +987,7 @@
ast_debug(3, "looks like we need to make vmsecret!\n");
var = ast_variable_new("vmsecret", newpassword, "");
}
- new = alloca(strlen(newpassword)+1);
+ new = alloca(strlen(newpassword) + 1);
sprintf(new, "%s", newpassword);
if (!(cat = ast_category_get(cfg, category))) {
ast_debug(4, "failed to get category!\n");
@@ -1009,9 +1009,12 @@
static void vm_change_password_shell(struct ast_vm_user *vmu, char *newpassword)
{
char buf[255];
- snprintf(buf,255,"%s %s %s %s",ext_pass_cmd,vmu->context,vmu->mailbox,newpassword);
- if (!ast_safe_system(buf))
+ snprintf(buf, sizeof(buf), "%s %s %s %s", ext_pass_cmd, vmu->context, vmu->mailbox, newpassword);
+ if (!ast_safe_system(buf)) {
ast_copy_string(vmu->password, newpassword, sizeof(vmu->password));
+ /* Reset the password in memory, too */
+ reset_user_pw(vmu->context, vmu->mailbox, newpassword);
+ }
}
static int make_dir(char *dest, int len, const char *context, const char *ext, const char *folder)
@@ -1040,13 +1043,13 @@
messageNum = vms->msgArray[msgnum];
if (messageNum == 0) {
- ast_log(LOG_WARNING, "msgnum %d, mailbox message %lu is zero.\n",msgnum,messageNum);
+ ast_log(LOG_WARNING, "msgnum %d, mailbox message %lu is zero.\n", msgnum, messageNum);
return;
}
- ast_debug(3, "deleting msgnum %d, which is mailbox message %lu\n",msgnum,messageNum);
+ ast_debug(3, "deleting msgnum %d, which is mailbox message %lu\n", msgnum, messageNum);
/* delete message */
- snprintf (arg, sizeof(arg), "%lu",messageNum);
- mail_setflag (vms->mailstream,arg,"\\DELETED");
+ snprintf(arg, sizeof(arg), "%lu", messageNum);
+ mail_setflag(vms->mailstream, arg, "\\DELETED");
}
#endif
@@ -1125,13 +1128,13 @@
{
int x = 0;
int res;
- int fd=-1;
+ int fd = -1;
size_t fdlen = 0;
void *fdm = MAP_FAILED;
- SQLSMALLINT colcount=0;
+ SQLSMALLINT colcount = 0;
SQLHSTMT stmt;
char sql[PATH_MAX];
- char fmt[80]="";
+ char fmt[80] = "";
char *c;
char coltitle[256];
SQLSMALLINT collen;
@@ -1140,7 +1143,7 @@
SQLSMALLINT nullable;
SQLULEN colsize;
SQLLEN colsize2;
- FILE *f=NULL;
+ FILE *f = NULL;
char rowdata[80];
char fn[PATH_MAX];
char full_fn[PATH_MAX];
@@ -1157,7 +1160,7 @@
*c = '\0';
if (!strcasecmp(fmt, "wav49"))
strcpy(fmt, "WAV");
- snprintf(msgnums, sizeof(msgnums),"%d", msgnum);
+ snprintf(msgnums, sizeof(msgnums), "%d", msgnum);
if (msgnum > -1)
make_file(fn, sizeof(fn), dir, msgnum);
else
@@ -1170,7 +1173,7 @@
}
snprintf(full_fn, sizeof(full_fn), "%s.%s", fn, fmt);
- snprintf(sql, sizeof(sql), "SELECT * FROM %s WHERE dir=? AND msgnum=?",odbc_table);
+ snprintf(sql, sizeof(sql), "SELECT * FROM %s WHERE dir=? AND msgnum=?", odbc_table);
stmt = ast_odbc_prepare_and_execute(obj, generic_prepare, &gps);
if (!stmt) {
ast_log(LOG_WARNING, "SQL Execute error!\n[%s]\n\n", sql);
@@ -1205,7 +1208,7 @@
}
if (f)
fprintf(f, "[message]\n");
- for (x=0;x<colcount;x++) {
+ for (x = 0; x < colcount; x++) {
rowdata[0] = '\0';
collen = sizeof(coltitle);
res = SQLDescribeCol(stmt, x + 1, (unsigned char *)coltitle, sizeof(coltitle), &collen,
@@ -1221,7 +1224,7 @@
res = SQLGetData(stmt, x + 1, SQL_BINARY, rowdata, 0, &colsize2);
fdlen = colsize2;
if (fd > -1) {
- char tmp[1]="";
+ char tmp[1] = "";
lseek(fd, fdlen - 1, SEEK_SET);
if (write(fd, tmp, 1) != 1) {
close(fd);
@@ -1306,7 +1309,7 @@
struct odbc_obj *obj;
obj = ast_odbc_request_obj(odbc_database, 0);
if (obj) {
- snprintf(sql, sizeof(sql), "SELECT COUNT(*) FROM %s WHERE dir=?",odbc_table);
+ snprintf(sql, sizeof(sql), "SELECT COUNT(*) FROM %s WHERE dir=?", odbc_table);
stmt = ast_odbc_prepare_and_execute(obj, generic_prepare, &gps);
if (!stmt) {
ast_log(LOG_WARNING, "SQL Execute error!\n[%s]\n\n", sql);
@@ -1352,7 +1355,7 @@
obj = ast_odbc_request_obj(odbc_database, 0);
if (obj) {
snprintf(msgnums, sizeof(msgnums), "%d", msgnum);
- snprintf(sql, sizeof(sql), "SELECT COUNT(*) FROM %s WHERE dir=? AND msgnum=?",odbc_table);
+ snprintf(sql, sizeof(sql), "SELECT COUNT(*) FROM %s WHERE dir=? AND msgnum=?", odbc_table);
stmt = ast_odbc_prepare_and_execute(obj, generic_prepare, &gps);
if (!stmt) {
ast_log(LOG_WARNING, "SQL Execute error!\n[%s]\n\n", sql);
@@ -1400,7 +1403,7 @@
obj = ast_odbc_request_obj(odbc_database, 0);
if (obj) {
snprintf(msgnums, sizeof(msgnums), "%d", smsg);
- snprintf(sql, sizeof(sql), "DELETE FROM %s WHERE dir=? AND msgnum=?",odbc_table);
+ snprintf(sql, sizeof(sql), "DELETE FROM %s WHERE dir=? AND msgnum=?", odbc_table);
stmt = ast_odbc_prepare_and_execute(obj, generic_prepare, &gps);
if (!stmt)
ast_log(LOG_WARNING, "SQL Execute error!\n[%s]\n\n", sql);
@@ -1427,7 +1430,7 @@
if (obj) {
snprintf(msgnums, sizeof(msgnums), "%d", smsg);
snprintf(msgnumd, sizeof(msgnumd), "%d", dmsg);
- snprintf(sql, sizeof(sql), "INSERT INTO %s (dir, msgnum, context, macrocontext, callerid, origtime, duration, recording, mailboxuser, mailboxcontext) SELECT ?,?,context,macrocontext,callerid,origtime,duration,recording,?,? FROM %s WHERE dir=? AND msgnum=?",odbc_table,odbc_table);
+ snprintf(sql, sizeof(sql), "INSERT INTO %s (dir, msgnum, context, macrocontext, callerid, origtime, duration, recording, mailboxuser, mailboxcontext) SELECT ?,?,context,macrocontext,callerid,origtime,duration,recording,?,? FROM %s WHERE dir=? AND msgnum=?", odbc_table, odbc_table);
stmt = ast_odbc_prepare_and_execute(obj, generic_prepare, &gps);
if (!stmt)
ast_log(LOG_WARNING, "SQL Execute error!\n[%s] (You probably don't have MySQL 4.1 or later installed)\n\n", sql);
@@ -1452,11 +1455,11 @@
char msgnums[20];
char fn[PATH_MAX];
char full_fn[PATH_MAX];
- char fmt[80]="";
+ char fmt[80] = "";
char *c;
- const char *context="", *macrocontext="", *callerid="", *origtime="", *duration="";
+ const char *context = "", *macrocontext = "", *callerid = "", *origtime = "", *duration = "";
const char *category = "";
- struct ast_config *cfg=NULL;
+ struct ast_config *cfg = NULL;
struct odbc_obj *obj;
struct ast_flags config_flags = { CONFIG_FLAG_NOCACHE };
@@ -1469,7 +1472,7 @@
*c = '\0';
if (!strcasecmp(fmt, "wav49"))
strcpy(fmt, "WAV");
- snprintf(msgnums, sizeof(msgnums),"%d", msgnum);
+ snprintf(msgnums, sizeof(msgnums), "%d", msgnum);
if (msgnum > -1)
make_file(fn, sizeof(fn), dir, msgnum);
else
@@ -1500,7 +1503,7 @@
fdlen = lseek(fd, 0, SEEK_END);
lseek(fd, 0, SEEK_SET);
printf("Length is %zd\n", fdlen);
- fdm = mmap(NULL, fdlen, PROT_READ | PROT_WRITE, MAP_SHARED,fd, 0);
+ fdm = mmap(NULL, fdlen, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (fdm == MAP_FAILED) {
ast_log(LOG_WARNING, "Memory map failed!\n");
ast_odbc_release_obj(obj);
@@ -1513,9 +1516,9 @@
goto yuck;
}
if (!ast_strlen_zero(category))
- snprintf(sql, sizeof(sql), "INSERT INTO %s (dir,msgnum,recording,context,macrocontext,callerid,origtime,duration,mailboxuser,mailboxcontext,category) VALUES (?,?,?,?,?,?,?,?,?,?,?)",odbc_table);
+ snprintf(sql, sizeof(sql), "INSERT INTO %s (dir,msgnum,recording,context,macrocontext,callerid,origtime,duration,mailboxuser,mailboxcontext,category) VALUES (?,?,?,?,?,?,?,?,?,?,?)", odbc_table);
else
- snprintf(sql, sizeof(sql), "INSERT INTO %s (dir,msgnum,recording,context,macrocontext,callerid,origtime,duration,mailboxuser,mailboxcontext) VALUES (?,?,?,?,?,?,?,?,?,?)",odbc_table);
+ snprintf(sql, sizeof(sql), "INSERT INTO %s (dir,msgnum,recording,context,macrocontext,callerid,origtime,duration,mailboxuser,mailboxcontext) VALUES (?,?,?,?,?,?,?,?,?,?)", odbc_table);
res = SQLPrepare(stmt, (unsigned char *)sql, SQL_NTS);
if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
ast_log(LOG_WARNING, "SQL Prepare failed![%s]\n", sql);
@@ -1572,7 +1575,7 @@
if (obj) {
snprintf(msgnums, sizeof(msgnums), "%d", smsg);
snprintf(msgnumd, sizeof(msgnumd), "%d", dmsg);
- snprintf(sql, sizeof(sql), "UPDATE %s SET dir=?, msgnum=?, mailboxuser=?, mailboxcontext=? WHERE dir=? AND msgnum=?",odbc_table);
+ snprintf(sql, sizeof(sql), "UPDATE %s SET dir=?, msgnum=?, mailboxuser=?, mailboxcontext=? WHERE dir=? AND msgnum=?", odbc_table);
stmt = ast_odbc_prepare_and_execute(obj, generic_prepare, &gps);
if (!stmt)
ast_log(LOG_WARNING, "SQL Execute error!\n[%s]\n\n", sql);
@@ -1613,7 +1616,7 @@
{
char stxt[PATH_MAX];
char dtxt[PATH_MAX];
- ast_filerename(sfn,dfn,NULL);
+ ast_filerename(sfn, dfn, NULL);
snprintf(stxt, sizeof(stxt), "%s.txt", sfn);
snprintf(dtxt, sizeof(dtxt), "%s.txt", dfn);
if (ast_check_realtime("voicemail_data")) {
@@ -1675,7 +1678,7 @@
static void copy_file(char *frompath, char *topath)
{
char frompath2[PATH_MAX], topath2[PATH_MAX];
- struct ast_variable *tmp,*var = NULL;
+ struct ast_variable *tmp, *var = NULL;
const char *origmailbox = NULL, *context = NULL, *macrocontext = NULL, *exten = NULL, *priority = NULL, *callerchan = NULL, *callerid = NULL, *origdate = NULL, *origtime = NULL, *category = NULL, *duration = NULL;
ast_filecopy(frompath, topath, NULL);
snprintf(frompath2, sizeof(frompath2), "%s.txt", frompath);
@@ -1752,7 +1755,7 @@
char *txt;
int txtsize = 0;
- txtsize = (strlen(file) + 5)*sizeof(char);
+ txtsize = (strlen(file) + 5) * sizeof(char);
txt = alloca(txtsize);
/* Sprintf here would safe because we alloca'd exactly the right length,
* but trying to eliminate all sprintf's anyhow
@@ -1773,7 +1776,7 @@
if (bio->ateof)
return 0;
- if ((l = fread(bio->iobuf,1,BASEMAXINLINE,fi)) <= 0) {
+ if ((l = fread(bio->iobuf, 1, BASEMAXINLINE, fi)) <= 0) {
if (ferror(fi))
return -1;
@@ -1781,15 +1784,15 @@
return 0;
}
- bio->iolen= l;
- bio->iocp= 0;
+ bio->iolen = l;
+ bio->iocp = 0;
return 1;
}
static int inchar(struct baseio *bio, FILE *fi)
{
- if (bio->iocp>=bio->iolen) {
+ if (bio->iocp >= bio->iolen) {
if (!inbuf(bio, fi))
return EOF;
}
@@ -1800,13 +1803,13 @@
static int ochar(struct baseio *bio, int c, FILE *so)
{
if (bio->linelength >= BASELINELEN) {
- if (fputs(eol,so) == EOF)
+ if (fputs(eol, so) == EOF)
return -1;
bio->linelength= 0;
}
- if (putc(((unsigned char)c),so) == EOF)
+ if (putc(((unsigned char)c), so) == EOF)
return -1;
bio->linelength++;
@@ -1820,7 +1823,7 @@
'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0',
'1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/'};
- int i,hiteof= 0;
+ int i, hiteof = 0;
FILE *fi;
struct baseio bio;
@@ -1832,42 +1835,42 @@
return -1;
}
- while (!hiteof){
+ while (!hiteof) {
unsigned char igroup[3], ogroup[4];
- int c,n;
-
- igroup[0]= igroup[1]= igroup[2]= 0;
-
- for (n= 0;n<3;n++) {
+ int c, n;
+
+ igroup[0] = igroup[1] = igroup[2] = 0;
+
+ for (n = 0; n < 3; n++) {
if ((c = inchar(&bio, fi)) == EOF) {
- hiteof= 1;
+ hiteof = 1;
break;
}
- igroup[n]= (unsigned char)c;
- }
-
- if (n> 0) {
- ogroup[0]= dtable[igroup[0]>>2];
- ogroup[1]= dtable[((igroup[0]&3)<<4) | (igroup[1]>>4)];
- ogroup[2]= dtable[((igroup[1]&0xF)<<2) | (igroup[2]>>6)];
- ogroup[3]= dtable[igroup[2]&0x3F];
-
- if (n<3) {
- ogroup[3]= '=';
-
- if (n<2)
- ogroup[2]= '=';
- }
-
- for (i= 0;i<4;i++)
+ igroup[n] = (unsigned char)c;
+ }
+
+ if (n > 0) {
+ ogroup[0] = dtable[igroup[0] >> 2];
+ ogroup[1] = dtable[((igroup[0] & 3) << 4) | (igroup[1] >> 4)];
+ ogroup[2] = dtable[((igroup[1] & 0xF) << 2) | (igroup[2] >> 6)];
+ ogroup[3] = dtable[igroup[2] & 0x3F];
+
+ if (n < 3) {
+ ogroup[3] = '=';
+
+ if (n < 2)
+ ogroup[2] = '=';
+ }
+
+ for (i = 0; i < 4; i++)
ochar(&bio, ogroup[i], so);
}
}
fclose(fi);
- if (fputs(eol,so)==EOF)
+ if (fputs(eol, so) == EOF)
return 0;
return 1;
@@ -1966,7 +1969,7 @@
#define ENDL "\n"
#endif
- gethostname(host, sizeof(host)-1);
+ gethostname(host, sizeof(host) - 1);
if (strchr(srcemail, '@'))
ast_copy_string(who, srcemail, sizeof(who));
@@ -1988,7 +1991,7 @@
struct ast_channel *ast;
if ((ast = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, "", "", "", 0, 0))) {
char *passdata;
- int vmlen = strlen(fromstring)*3 + 200;
+ int vmlen = strlen(fromstring) * 3 + 200;
passdata = alloca(vmlen);
memset(passdata, 0, vmlen);
prep_email_sub_vars(ast, vmu, msgnum + 1, context, mailbox, cidnum, cidname, dur, date, passdata, vmlen, category);
@@ -2061,7 +2064,7 @@
struct ast_channel *ast;
if ((ast = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, "", "", "", 0, 0))) {
char *passdata;
- int vmlen = strlen(emailbody)*3 + 200;
+ int vmlen = strlen(emailbody) * 3 + 200;
passdata = alloca(vmlen);
memset(passdata, 0, vmlen);
prep_email_sub_vars(ast, vmu, msgnum + 1, context, mailbox, cidnum, cidname, dur, date, passdata, vmlen, category);
@@ -2070,7 +2073,7 @@
ast_channel_free(ast);
} else
ast_log(LOG_WARNING, "Cannot allocate the channel for variables substitution\n");
- } else if (msgnum > -1){
+ } else if (msgnum > -1) {
fprintf(p, "Dear %s:" ENDL ENDL "\tJust wanted to let you know you were just left a %s long message (number %d)" ENDL
"in mailbox %s from %s, on %s so you might" ENDL
@@ -2124,7 +2127,7 @@
static int sendmail(char *srcemail, struct ast_vm_user *vmu, int msgnum, char *context, char *mailbox, char *cidnum, char *cidname, char *attach, char *format, int duration, int attach_user_voicemail, struct ast_channel *chan, const char *category)
{
- FILE *p=NULL;
+ FILE *p = NULL;
char tmp[80] = "/tmp/astmail-XXXXXX";
char tmp2[256];
@@ -2165,7 +2168,7 @@
ast_log(LOG_WARNING, "Unable to launch '%s' (can't create temporary file)\n", mailcmd);
return -1;
}
- gethostname(host, sizeof(host)-1);
+ gethostname(host, sizeof(host) - 1);
if (strchr(srcemail, '@'))
ast_copy_string(who, srcemail, sizeof(who));
else
@@ -2178,7 +2181,7 @@
struct ast_channel *ast;
if ((ast = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, "", "", "", 0, 0))) {
char *passdata;
- int vmlen = strlen(fromstring)*3 + 200;
+ int vmlen = strlen(fromstring) * 3 + 200;
passdata = alloca(vmlen);
memset(passdata, 0, vmlen);
prep_email_sub_vars(ast, vmu, msgnum + 1, context, mailbox, cidnum, cidname, dur, date, passdata, vmlen, category);
@@ -2241,36 +2244,55 @@
return ast_strftime(s, len, "%a %b %e %r UTC %Y", &tm);
}
-static int invent_message(struct ast_channel *chan, char *context, char *ext, int busy, char *ecodes)
+static int play_greeting(struct ast_channel *chan, struct ast_vm_user *vmu, char *filename, char *ecodes)
+{
+ int res = -2;
+
+#ifdef ODBC_STORAGE
+ int success =
+#endif
+ RETRIEVE(filename, -1, vmu->mailbox, vmu->context);
+ if (ast_fileexists(filename, NULL, NULL) > 0) {
+ res = ast_streamfile(chan, filename, chan->language);
+ if (res > -1)
+ res = ast_waitstream(chan, ecodes);
+#ifdef ODBC_STORAGE
+ if (success == -1) {
[... 5343 lines stripped ...]
More information about the asterisk-commits
mailing list