[asterisk-commits] may: branch may/chan_ooh323_rework r226054 - in /team/may/chan_ooh323_rework:...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Oct 26 18:55:35 CDT 2009
Author: may
Date: Mon Oct 26 18:55:29 2009
New Revision: 226054
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=226054
Log:
up to trunk
Modified:
team/may/chan_ooh323_rework/CHANGES
team/may/chan_ooh323_rework/Makefile
team/may/chan_ooh323_rework/README
team/may/chan_ooh323_rework/agi/Makefile
team/may/chan_ooh323_rework/apps/app_chanspy.c
team/may/chan_ooh323_rework/apps/app_directed_pickup.c
team/may/chan_ooh323_rework/apps/app_externalivr.c
team/may/chan_ooh323_rework/apps/app_meetme.c
team/may/chan_ooh323_rework/apps/app_softhangup.c
team/may/chan_ooh323_rework/apps/app_voicemail.c
team/may/chan_ooh323_rework/channels/chan_dahdi.c
team/may/chan_ooh323_rework/channels/chan_iax2.c
team/may/chan_ooh323_rework/channels/chan_sip.c
team/may/chan_ooh323_rework/channels/sig_analog.c
team/may/chan_ooh323_rework/channels/sig_pri.c
team/may/chan_ooh323_rework/channels/sig_pri.h
team/may/chan_ooh323_rework/codecs/codec_dahdi.c
team/may/chan_ooh323_rework/configs/chan_dahdi.conf.sample
team/may/chan_ooh323_rework/configs/iax.conf.sample
team/may/chan_ooh323_rework/configs/sip.conf.sample
team/may/chan_ooh323_rework/configs/voicemail.conf.sample
team/may/chan_ooh323_rework/configure.ac
team/may/chan_ooh323_rework/doc/janitor-projects.txt
team/may/chan_ooh323_rework/doc/tex/manager.tex
team/may/chan_ooh323_rework/doc/valgrind.txt
team/may/chan_ooh323_rework/funcs/func_callerid.c
team/may/chan_ooh323_rework/funcs/func_channel.c
team/may/chan_ooh323_rework/funcs/func_connectedline.c
team/may/chan_ooh323_rework/funcs/func_speex.c
team/may/chan_ooh323_rework/include/asterisk/astobj2.h
team/may/chan_ooh323_rework/include/asterisk/autoconfig.h.in
team/may/chan_ooh323_rework/include/asterisk/channel.h
team/may/chan_ooh323_rework/include/asterisk/doxyref.h
team/may/chan_ooh323_rework/include/asterisk/dsp.h
team/may/chan_ooh323_rework/include/asterisk/frame.h
team/may/chan_ooh323_rework/include/asterisk/lock.h
team/may/chan_ooh323_rework/include/asterisk/tcptls.h
team/may/chan_ooh323_rework/include/asterisk/translate.h
team/may/chan_ooh323_rework/main/astmm.c
team/may/chan_ooh323_rework/main/astobj2.c
team/may/chan_ooh323_rework/main/audiohook.c
team/may/chan_ooh323_rework/main/channel.c
team/may/chan_ooh323_rework/main/cli.c
team/may/chan_ooh323_rework/main/dsp.c
team/may/chan_ooh323_rework/main/features.c
team/may/chan_ooh323_rework/main/frame.c
team/may/chan_ooh323_rework/main/manager.c
team/may/chan_ooh323_rework/main/pbx.c
team/may/chan_ooh323_rework/main/tcptls.c
team/may/chan_ooh323_rework/main/translate.c
team/may/chan_ooh323_rework/res/snmp/agent.c
team/may/chan_ooh323_rework/utils/Makefile
Modified: team/may/chan_ooh323_rework/CHANGES
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_rework/CHANGES?view=diff&rev=226054&r1=226053&r2=226054
==============================================================================
--- team/may/chan_ooh323_rework/CHANGES (original)
+++ team/may/chan_ooh323_rework/CHANGES Mon Oct 26 18:55:29 2009
@@ -9,7 +9,7 @@
======================================================================
------------------------------------------------------------------------------
---- Functionality changes from Asterisk 1.6.2 to Asterisk 1.6.3 -------------
+--- Functionality changes from Asterisk 1.6.2 to Asterisk 1.8 ----------------
------------------------------------------------------------------------------
SIP Changes
@@ -48,6 +48,8 @@
configuration for the externip and externhost options when tcp or tls is used.
* Added support for message body (stored in content variable) to SIP NOTIFY message
accessible via AMI and CLI.
+ * Added 'media_address' configuration option which can be used to explicitly specify
+ the IP address to use in the SDP for media (audio, video, and text) streams.
IAX2 Changes
-----------
@@ -78,11 +80,20 @@
to spy on.
* The ChanSpy application also now has the 'E' option, which spies on a single
channel and exits when that channel hangs up.
+ * The MeetMe application now turns on the DENOISE() function by default, for
+ each participant. In our tests, this has significantly decreased background
+ noise (especially noisy data centers).
+ * Voicemail now permits storage of secrets in a separate file, located in the
+ spool directory of each individual user. The control for this is located in
+ the "passwordlocation" option in voicemail.conf. Please see the sample
+ configuration for more information.
Dialplan Functions
------------------
* Added new dialplan functions CONNECTEDLINE and REDIRECTING which permits
setting various connected line and redirecting party information.
+ * CALLERID and CONNECTEDLINE dialplan functions have been extended to
+ support ISDN subaddressing.
* The CHANNEL() function now supports the "name" option.
* For DAHDI channels, the CHANNEL() dialplan function now
supports changing the channel's buffer policy (for the current
@@ -211,6 +222,18 @@
Number (MSN) list for PTMP CPE interfaces.
* Added dynamic range compression support for dahdi channels. It is
configured via the rxdrc and txdrc parameters in chan_dahdi.conf.
+ * Added support for ISDN calling and called subaddress with partial support
+ for connected line subaddress.
+ * Added support for BRI PTMP NT mode. (Requires latest LibPRI.)
+ * Added handling of received HOLD/RETRIEVE messages and the optional ability
+ to transfer a held call on disconnect similar to an analog phone.
+ * Added CallRerouting/CallDeflection support for Q.SIG, ETSI PTP, ETSI PTMP.
+ Will reroute/deflect an outgoing call when receive the message.
+ Can use the DAHDISendCallreroutingFacility to send the message for the
+ supported switches.
+ * Added ability to send/receive keypad digits in the SETUP message.
+ Send keypad digits in SETUP message: Dial(DAHDI/g1[/K<keypad_digits>][/extension])
+ Access any received keypad digits in SETUP message by: ${CHANNEL(keypad_digits)}
Asterisk Manager Interface
--------------------------
Modified: team/may/chan_ooh323_rework/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_rework/Makefile?view=diff&rev=226054&r1=226053&r2=226054
==============================================================================
--- team/may/chan_ooh323_rework/Makefile (original)
+++ team/may/chan_ooh323_rework/Makefile Mon Oct 26 18:55:29 2009
@@ -369,8 +369,8 @@
@echo "****"
@exit 1
-menuselect.makeopts: menuselect/menuselect menuselect-tree makeopts
- menuselect/menuselect --check-deps menuselect.makeopts $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS)
+menuselect.makeopts: menuselect/menuselect menuselect-tree makeopts build_tools/menuselect-deps $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS)
+ menuselect/menuselect --check-deps $@ $(GLOBAL_MAKEOPTS) $(USER_MAKEOPTS)
$(MOD_SUBDIRS_EMBED_LDSCRIPT):
+ at echo "EMBED_LDSCRIPTS+="`$(SILENTMAKE) -C $(@:-embed-ldscript=) SUBDIR=$(@:-embed-ldscript=) __embed_ldscript` >> makeopts.embed_rules
@@ -940,7 +940,7 @@
menuselect/makeopts: makeopts
+$(MAKE_MENUSELECT) makeopts
-menuselect-tree: $(foreach dir,$(filter-out main,$(MOD_SUBDIRS)),$(wildcard $(dir)/*.c) $(wildcard $(dir)/*.cc)) build_tools/cflags.xml build_tools/cflags-devmode.xml sounds/sounds.xml build_tools/embed_modules.xml configure
+menuselect-tree: $(foreach dir,$(filter-out main,$(MOD_SUBDIRS)),$(wildcard $(dir)/*.c) $(wildcard $(dir)/*.cc)) build_tools/cflags.xml build_tools/cflags-devmode.xml sounds/sounds.xml build_tools/embed_modules.xml utils/utils.xml agi/agi.xml configure
@echo "Generating input for menuselect ..."
@echo "<?xml version=\"1.0\"?>" > $@
@echo >> $@
@@ -951,6 +951,8 @@
@if [ "${AST_DEVMODE}" = "yes" ]; then \
cat build_tools/cflags-devmode.xml >> $@; \
fi
+ @cat utils/utils.xml >> $@
+ @cat agi/agi.xml >> $@
@cat build_tools/embed_modules.xml >> $@
@cat sounds/sounds.xml >> $@
@echo "</menu>" >> $@
@@ -959,7 +961,32 @@
asterisk.pdf:
$(MAKE) -C doc/tex asterisk.pdf
-.PHONY: menuselect menuselect.makeopts main sounds clean dist-clean distclean all prereqs cleantest uninstall _uninstall uninstall-all pdf dont-optimize $(SUBDIRS_INSTALL) $(SUBDIRS_DIST_CLEAN) $(SUBDIRS_CLEAN) $(SUBDIRS_UNINSTALL) $(SUBDIRS) $(MOD_SUBDIRS_EMBED_LDSCRIPT) $(MOD_SUBDIRS_EMBED_LDFLAGS) $(MOD_SUBDIRS_EMBED_LIBS) badshell installdirs validate-docs _clean
+.PHONY: menuselect
+.PHONY: main
+.PHONY: sounds
+.PHONY: clean
+.PHONY: dist-clean
+.PHONY: distclean
+.PHONY: all
+.PHONY: prereqs
+.PHONY: cleantest
+.PHONY: uninstall
+.PHONY: _uninstall
+.PHONY: uninstall-all
+.PHONY: pdf
+.PHONY: dont-optimize
+.PHONY: badshell
+.PHONY: installdirs
+.PHONY: validate-docs
+.PHONY: _clean
+.PHONY: $(SUBDIRS_INSTALL)
+.PHONY: $(SUBDIRS_DIST_CLEAN)
+.PHONY: $(SUBDIRS_CLEAN)
+.PHONY: $(SUBDIRS_UNINSTALL)
+.PHONY: $(SUBDIRS)
+.PHONY: $(MOD_SUBDIRS_EMBED_LDSCRIPT)
+.PHONY: $(MOD_SUBDIRS_EMBED_LDFLAGS)
+.PHONY: $(MOD_SUBDIRS_EMBED_LIBS)
FORCE:
Modified: team/may/chan_ooh323_rework/README
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_rework/README?view=diff&rev=226054&r1=226053&r2=226054
==============================================================================
--- team/may/chan_ooh323_rework/README (original)
+++ team/may/chan_ooh323_rework/README Mon Oct 26 18:55:29 2009
@@ -146,8 +146,8 @@
*CLI>
- You can type "help" at any time to get help with the system. For help
-with a specific command, type "help <command>". To start the PBX using
+ You can type "core show help" at any time to get help with the system. For help
+with a specific command, type "core show help <command>". To start the PBX using
your sound card, you can type "console dial" to dial the PBX. Then you can use
"console answer", "console hangup", and "console dial" to simulate the actions
of a telephone. Remember that if you don't have a full duplex sound card
Modified: team/may/chan_ooh323_rework/agi/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_rework/agi/Makefile?view=diff&rev=226054&r1=226053&r2=226054
==============================================================================
--- team/may/chan_ooh323_rework/agi/Makefile (original)
+++ team/may/chan_ooh323_rework/agi/Makefile Mon Oct 26 18:55:29 2009
@@ -11,9 +11,12 @@
# the GNU General Public License
#
+ASTTOPDIR?=..
+-include $(ASTTOPDIR)/menuselect.makeopts
+
.PHONY: clean all uninstall
-AGIS=agi-test.agi eagi-test eagi-sphinx-test jukebox.agi
+AGIS=$(MENUSELECT_AGIS)
ifeq ($(OSARCH),SunOS)
LIBS+=-lsocket -lnsl
Modified: team/may/chan_ooh323_rework/apps/app_chanspy.c
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_rework/apps/app_chanspy.c?view=diff&rev=226054&r1=226053&r2=226054
==============================================================================
--- team/may/chan_ooh323_rework/apps/app_chanspy.c (original)
+++ team/may/chan_ooh323_rework/apps/app_chanspy.c Mon Oct 26 18:55:29 2009
@@ -786,11 +786,11 @@
/* Set up the iterator we'll be using during this call */
if (!ast_strlen_zero(spec)) {
- iter = ast_channel_iterator_by_name_new(0, spec, strlen(spec));
+ iter = ast_channel_iterator_by_name_new(spec, strlen(spec));
} else if (!ast_strlen_zero(exten)) {
- iter = ast_channel_iterator_by_exten_new(0, exten, context);
+ iter = ast_channel_iterator_by_exten_new(exten, context);
} else {
- iter = ast_channel_iterator_all_new(0);
+ iter = ast_channel_iterator_all_new();
}
if (!iter) {
Modified: team/may/chan_ooh323_rework/apps/app_directed_pickup.c
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_rework/apps/app_directed_pickup.c?view=diff&rev=226054&r1=226053&r2=226054
==============================================================================
--- team/may/chan_ooh323_rework/apps/app_directed_pickup.c (original)
+++ team/may/chan_ooh323_rework/apps/app_directed_pickup.c Mon Oct 26 18:55:29 2009
@@ -210,7 +210,7 @@
struct ast_channel_iterator *iter;
int res = -1;
- if (!(iter = ast_channel_iterator_by_exten_new(0, exten, context))) {
+ if (!(iter = ast_channel_iterator_by_exten_new(exten, context))) {
return -1;
}
@@ -222,6 +222,8 @@
ast_channel_unlock(target);
target = ast_channel_unref(target);
}
+
+ ast_channel_iterator_destroy(iter);
if (target) {
res = pickup_do(chan, target);
Modified: team/may/chan_ooh323_rework/apps/app_externalivr.c
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_rework/apps/app_externalivr.c?view=diff&rev=226054&r1=226053&r2=226054
==============================================================================
--- team/may/chan_ooh323_rework/apps/app_externalivr.c (original)
+++ team/may/chan_ooh323_rework/apps/app_externalivr.c Mon Oct 26 18:55:29 2009
@@ -457,9 +457,7 @@
ivr_desc.local_address.sin_family = AF_INET;
ivr_desc.local_address.sin_port = htons(port);
memcpy(&ivr_desc.local_address.sin_addr.s_addr, hp.hp.h_addr, hp.hp.h_length);
- ser = ast_tcptls_client_start(&ivr_desc);
-
- if (!ser) {
+ if (!(ser = ast_tcptls_client_create(&ivr_desc)) || !(ser = ast_tcptls_client_start(ser))) {
goto exit;
}
res = eivr_comm(chan, u, ser->fd, ser->fd, -1, pipe_delim_args, flags);
Modified: team/may/chan_ooh323_rework/apps/app_meetme.c
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_rework/apps/app_meetme.c?view=diff&rev=226054&r1=226053&r2=226054
==============================================================================
--- team/may/chan_ooh323_rework/apps/app_meetme.c (original)
+++ team/may/chan_ooh323_rework/apps/app_meetme.c Mon Oct 26 18:55:29 2009
@@ -2072,7 +2072,7 @@
struct timeval now;
struct ast_dsp *dsp = NULL;
struct ast_app *agi_app;
- char *agifile;
+ char *agifile, *mod_speex;
const char *agifiledefault = "conf-background.agi", *tmpvar;
char meetmesecs[30] = "";
char exitcontext[AST_MAX_CONTEXT] = "";
@@ -2404,6 +2404,12 @@
if (ast_set_read_format(chan, AST_FORMAT_SLINEAR) < 0) {
ast_log(LOG_WARNING, "Unable to set '%s' to read linear mode\n", chan->name);
goto outrun;
+ }
+
+ /* Reduce background noise from each participant */
+ if ((mod_speex = ast_module_helper("", "codec_speex", 0, 0, 0, 0))) {
+ ast_free(mod_speex);
+ ast_func_write(chan, "DENOISE(rx)", "on");
}
retrydahdi = (strcasecmp(chan->tech->type, "DAHDI") || (chan->audiohooks || chan->monitor) ? 1 : 0);
@@ -5212,7 +5218,7 @@
ast_indicate(event->trunk_ref->trunk->chan, AST_CONTROL_HOLD);
}
- ast_softhangup(event->trunk_ref->chan, AST_CAUSE_NORMAL);
+ ast_softhangup(event->trunk_ref->chan, AST_SOFTHANGUP_DEV);
event->trunk_ref->chan = NULL;
}
Modified: team/may/chan_ooh323_rework/apps/app_softhangup.c
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_rework/apps/app_softhangup.c?view=diff&rev=226054&r1=226053&r2=226054
==============================================================================
--- team/may/chan_ooh323_rework/apps/app_softhangup.c (original)
+++ team/may/chan_ooh323_rework/apps/app_softhangup.c Mon Oct 26 18:55:29 2009
@@ -94,7 +94,7 @@
ast_app_parse_options(app_opts, &flags, opts, args.options);
lenmatch = strlen(args.channel);
- if (!(iter = ast_channel_iterator_by_name_new(0, args.channel, lenmatch))) {
+ if (!(iter = ast_channel_iterator_by_name_new(args.channel, lenmatch))) {
return -1;
}
Modified: team/may/chan_ooh323_rework/apps/app_voicemail.c
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_rework/apps/app_voicemail.c?view=diff&rev=226054&r1=226053&r2=226054
==============================================================================
--- team/may/chan_ooh323_rework/apps/app_voicemail.c (original)
+++ team/may/chan_ooh323_rework/apps/app_voicemail.c Mon Oct 26 18:55:29 2009
@@ -471,6 +471,12 @@
OPT_ARG_ARRAY_SIZE = 3,
};
+enum vm_passwordlocation {
+ OPT_PWLOC_VOICEMAILCONF = 0,
+ OPT_PWLOC_SPOOLDIR = 1,
+ OPT_PWLOC_USERSCONF = 2,
+};
+
AST_APP_OPTIONS(vm_app_options, {
AST_APP_OPTION('s', OPT_SILENT),
AST_APP_OPTION('b', OPT_BUSY_GREETING),
@@ -601,6 +607,7 @@
int maxmsg; /*!< Maximum number of msgs per folder for this mailbox */
int maxdeletedmsg; /*!< Maximum number of deleted msgs saved for this mailbox */
int maxsecs; /*!< Maximum number of seconds per message for this mailbox */
+ int passwordlocation; /*!< Storage location of the password */
#ifdef IMAP_STORAGE
char imapuser[80]; /*!< IMAP server login */
char imappassword[80]; /*!< IMAP server password if authpassword not defined */
@@ -738,6 +745,7 @@
static int skipms;
static int maxlogins;
static int minpassword;
+static int passwordlocation;
/*! Poll mailboxes for changes since there is something external to
* app_voicemail that may change them. */
@@ -838,6 +846,8 @@
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);
#if !(defined(ODBC_STORAGE) || defined(IMAP_STORAGE))
static int __has_voicemail(const char *context, const char *mailbox, const char *folder, int shortcircuit);
@@ -875,6 +885,7 @@
static void populate_defaults(struct ast_vm_user *vmu)
{
ast_copy_flags(vmu, (&globalflags), AST_FLAGS_ALL);
+ vmu->passwordlocation = passwordlocation;
if (saydurationminfo)
vmu->saydurationm = saydurationminfo;
ast_copy_string(vmu->callback, callcontext, sizeof(vmu->callback));
@@ -996,6 +1007,12 @@
}
} else if (!strcasecmp(var, "volgain")) {
sscanf(value, "%30lf", &vmu->volgain);
+ } else if (!strcasecmp(var, "passwordlocation")) {
+ if (!strcasecmp(value, "spooldir")) {
+ vmu->passwordlocation = OPT_PWLOC_SPOOLDIR;
+ } else {
+ vmu->passwordlocation = OPT_PWLOC_VOICEMAILCONF;
+ }
} else if (!strcasecmp(var, "options")) {
apply_options(vmu, value);
}
@@ -1316,65 +1333,94 @@
char *category = NULL, *value = NULL, *new = NULL;
const char *tmp = NULL;
struct ast_flags config_flags = { CONFIG_FLAG_WITHCOMMENTS };
+ char secretfn[PATH_MAX] = "";
+ int found = 0;
+
if (!change_password_realtime(vmu, newpassword))
return;
- /* check voicemail.conf */
- if ((cfg = ast_config_load(VOICEMAIL_CONFIG, config_flags)) && cfg != CONFIG_STATUS_FILEINVALID) {
- while ((category = ast_category_browse(cfg, category))) {
- if (!strcasecmp(category, vmu->context)) {
- if (!(tmp = ast_variable_retrieve(cfg, category, vmu->mailbox))) {
- ast_log(AST_LOG_WARNING, "We could not find the mailbox.\n");
+ /* check if we should store the secret in the spool directory next to the messages */
+ switch (vmu->passwordlocation) {
+ case OPT_PWLOC_SPOOLDIR:
+ snprintf(secretfn, sizeof(secretfn), "%s%s/%s/secret.conf", VM_SPOOL_DIR, vmu->context, vmu->mailbox);
+ if (write_password_to_file(secretfn, newpassword) == 0) {
+ ast_verb(4, "Writing voicemail password to file %s succeeded\n", secretfn);
+ reset_user_pw(vmu->context, vmu->mailbox, newpassword);
+ ast_copy_string(vmu->password, newpassword, sizeof(vmu->password));
+ break;
+ } else {
+ ast_verb(4, "Writing voicemail password to file %s failed, falling back to config file\n", secretfn);
+ }
+ /* Fall-through */
+ case OPT_PWLOC_VOICEMAILCONF:
+ if ((cfg = ast_config_load(VOICEMAIL_CONFIG, config_flags)) && cfg != CONFIG_STATUS_FILEINVALID) {
+ while ((category = ast_category_browse(cfg, category))) {
+ if (!strcasecmp(category, vmu->context)) {
+ if (!(tmp = ast_variable_retrieve(cfg, category, vmu->mailbox))) {
+ ast_log(AST_LOG_WARNING, "We could not find the mailbox.\n");
+ break;
+ }
+ value = strstr(tmp, ",");
+ if (!value) {
+ ast_log(AST_LOG_WARNING, "variable has bad format.\n");
+ break;
+ }
+ new = alloca((strlen(value) + strlen(newpassword) + 1));
+ sprintf(new, "%s%s", newpassword, value);
+ if (!(cat = ast_category_get(cfg, category))) {
+ ast_log(AST_LOG_WARNING, "Failed to get category structure.\n");
+ break;
+ }
+ ast_variable_update(cat, vmu->mailbox, new, NULL, 0);
+ found = 1;
+ }
+ }
+ /* save the results */
+ if (found) {
+ reset_user_pw(vmu->context, vmu->mailbox, newpassword);
+ ast_copy_string(vmu->password, newpassword, sizeof(vmu->password));
+ ast_config_text_file_save(VOICEMAIL_CONFIG, cfg, "AppVoicemail");
+ break;
+ }
+ }
+ /* Fall-through */
+ case OPT_PWLOC_USERSCONF:
+ /* check users.conf and update the password stored for the mailbox */
+ /* if no vmsecret entry exists create one. */
+ if ((cfg = ast_config_load("users.conf", config_flags)) && cfg != CONFIG_STATUS_FILEINVALID) {
+ ast_debug(4, "we are looking for %s\n", vmu->mailbox);
+ for (category = ast_category_browse(cfg, NULL); category; category = ast_category_browse(cfg, category)) {
+ ast_debug(4, "users.conf: %s\n", category);
+ if (!strcasecmp(category, vmu->mailbox)) {
+ if (!(tmp = ast_variable_retrieve(cfg, category, "vmsecret"))) {
+ ast_debug(3, "looks like we need to make vmsecret!\n");
+ var = ast_variable_new("vmsecret", newpassword, "");
+ } else {
+ var = NULL;
+ }
+ new = alloca(strlen(newpassword) + 1);
+ sprintf(new, "%s", newpassword);
+ if (!(cat = ast_category_get(cfg, category))) {
+ ast_debug(4, "failed to get category!\n");
+ ast_free(var);
+ break;
+ }
+ if (!var) {
+ ast_variable_update(cat, "vmsecret", new, NULL, 0);
+ } else {
+ ast_variable_append(cat, var);
+ }
+ found = 1;
break;
}
- value = strstr(tmp, ",");
- if (!value) {
- ast_log(AST_LOG_WARNING, "variable has bad format.\n");
- break;
- }
- new = alloca((strlen(value)+strlen(newpassword)+1));
- sprintf(new, "%s%s", newpassword, value);
- if (!(cat = ast_category_get(cfg, category))) {
- ast_log(AST_LOG_WARNING, "Failed to get category structure.\n");
- break;
- }
- ast_variable_update(cat, vmu->mailbox, new, NULL, 0);
- }
- }
- /* save the results */
- reset_user_pw(vmu->context, vmu->mailbox, newpassword);
- ast_copy_string(vmu->password, newpassword, sizeof(vmu->password));
- ast_config_text_file_save(VOICEMAIL_CONFIG, cfg, "AppVoicemail");
- }
- category = NULL;
- var = NULL;
- /* check users.conf and update the password stored for the mailbox*/
- /* if no vmsecret entry exists create one. */
- if ((cfg = ast_config_load("users.conf", config_flags)) && cfg != CONFIG_STATUS_FILEINVALID) {
- ast_debug(4, "we are looking for %s\n", vmu->mailbox);
- while ((category = ast_category_browse(cfg, category))) {
- ast_debug(4, "users.conf: %s\n", category);
- if (!strcasecmp(category, vmu->mailbox)) {
- if (!(tmp = ast_variable_retrieve(cfg, category, "vmsecret"))) {
- ast_debug(3, "looks like we need to make vmsecret!\n");
- var = ast_variable_new("vmsecret", newpassword, "");
- }
- new = alloca(strlen(newpassword)+1);
- sprintf(new, "%s", newpassword);
- if (!(cat = ast_category_get(cfg, category))) {
- ast_debug(4, "failed to get category!\n");
- break;
- }
- if (!var)
- ast_variable_update(cat, "vmsecret", new, NULL, 0);
- else
- ast_variable_append(cat, var);
- }
- }
- /* save the results and clean things up */
- reset_user_pw(vmu->context, vmu->mailbox, newpassword);
- ast_copy_string(vmu->password, newpassword, sizeof(vmu->password));
- ast_config_text_file_save("users.conf", cfg, "AppVoicemail");
+ }
+ /* save the results and clean things up */
+ if (found) {
+ reset_user_pw(vmu->context, vmu->mailbox, newpassword);
+ ast_copy_string(vmu->password, newpassword, sizeof(vmu->password));
+ ast_config_text_file_save("users.conf", cfg, "AppVoicemail");
+ }
+ }
}
}
@@ -9860,25 +9906,37 @@
struct ast_vm_user *vmu;
char *mailbox_full;
int new = 0, old = 0, urgent = 0;
+ char secretfn[PATH_MAX] = "";
tmp = ast_strdupa(data);
if (!(vmu = find_or_create(context, box)))
return -1;
-
+
populate_defaults(vmu);
stringp = tmp;
- if ((s = strsep(&stringp, ",")))
+ if ((s = strsep(&stringp, ","))) {
ast_copy_string(vmu->password, s, sizeof(vmu->password));
- if (stringp && (s = strsep(&stringp, ",")))
+ }
+ if (stringp && (s = strsep(&stringp, ","))) {
ast_copy_string(vmu->fullname, s, sizeof(vmu->fullname));
- if (stringp && (s = strsep(&stringp, ",")))
+ }
+ if (stringp && (s = strsep(&stringp, ","))) {
ast_copy_string(vmu->email, s, sizeof(vmu->email));
- if (stringp && (s = strsep(&stringp, ",")))
+ }
+ if (stringp && (s = strsep(&stringp, ","))) {
ast_copy_string(vmu->pager, s, sizeof(vmu->pager));
- if (stringp && (s = strsep(&stringp, ",")))
+ }
+ if (stringp && (s = strsep(&stringp, ","))) {
apply_options(vmu, s);
+ }
+
+ switch (vmu->passwordlocation) {
+ case OPT_PWLOC_SPOOLDIR:
+ snprintf(secretfn, sizeof(secretfn), "%s%s/%s/secret.conf", VM_SPOOL_DIR, vmu->context, vmu->mailbox);
+ read_password_from_file(secretfn, vmu->password, sizeof(vmu->password));
+ }
mailbox_full = alloca(strlen(box) + strlen(context) + 1);
strcpy(mailbox_full, box);
@@ -10563,6 +10621,7 @@
int x;
int tmpadsi[4];
struct ast_flags config_flags = { reload ? CONFIG_FLAG_FILEUNCHANGED : 0 };
+ char secretfn[PATH_MAX] = "";
ast_unload_realtime("voicemail");
ast_unload_realtime("voicemail_data");
@@ -11061,6 +11120,15 @@
val = "no";
ast_set2_flag((&globalflags), ast_true(val), VM_DIRECFORWARD);
+ if (!(val = ast_variable_retrieve(cfg, "general", "passwordlocation"))) {
+ val = "voicemail.conf";
+ }
+ if (!(strcmp(val, "spooldir"))) {
+ passwordlocation = OPT_PWLOC_SPOOLDIR;
+ } else {
+ passwordlocation = OPT_PWLOC_VOICEMAILCONF;
+ }
+
poll_freq = DEFAULT_POLL_FREQ;
if ((val = ast_variable_retrieve(cfg, "general", "pollfreq"))) {
if (sscanf(val, "%30u", &poll_freq) != 1) {
@@ -11081,6 +11149,15 @@
populate_defaults(current);
apply_options_full(current, ast_variable_browse(ucfg, cat));
ast_copy_string(current->context, userscontext, sizeof(current->context));
+ if (!ast_strlen_zero(current->password) && current->passwordlocation == OPT_PWLOC_VOICEMAILCONF) {
+ current->passwordlocation = OPT_PWLOC_USERSCONF;
+ }
+
+ switch (current->passwordlocation) {
+ case OPT_PWLOC_SPOOLDIR:
+ snprintf(secretfn, sizeof(secretfn), "%s%s/%s/secret.conf", VM_SPOOL_DIR, current->context, current->mailbox);
+ read_password_from_file(secretfn, current->password, sizeof(current->password));
+ }
}
}
ast_config_destroy(ucfg);
@@ -11216,6 +11293,47 @@
return res;
}
+static void read_password_from_file(const char *secretfn, char *password, int passwordlen) {
+ struct ast_config *pwconf;
+ struct ast_flags config_flags = { 0 };
+
+ pwconf = ast_config_load(secretfn, config_flags);
+ if (pwconf) {
+ const char *val = ast_variable_retrieve(pwconf, "general", "password");
+ if (val) {
+ ast_copy_string(password, val, passwordlen);
+ return;
+ }
+ }
+ ast_log(LOG_NOTICE, "Failed reading voicemail password from %s, using secret from config file\n", secretfn);
+}
+
+static int write_password_to_file(const char *secretfn, const char *password) {
+ struct ast_config *conf;
+ struct ast_category *cat;
+ struct ast_variable *var;
+
+ if (!(conf=ast_config_new())) {
+ ast_log(LOG_ERROR, "Error creating new config structure\n");
+ return -1;
+ }
+ if (!(cat=ast_category_new("general","",1))) {
+ ast_log(LOG_ERROR, "Error creating new category structure\n");
+ return -1;
+ }
+ if (!(var=ast_variable_new("password",password,""))) {
+ ast_log(LOG_ERROR, "Error creating new variable structure\n");
+ return -1;
+ }
+ ast_category_append(conf,cat);
+ ast_variable_append(cat,var);
+ if (ast_config_text_file_save(secretfn, conf, "app_voicemail")) {
+ ast_log(LOG_ERROR, "Error writing voicemail password to %s\n", secretfn);
+ return -1;
+ }
+ return 0;
+}
+
static int reload(void)
{
return load_config(1);
Modified: team/may/chan_ooh323_rework/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/may/chan_ooh323_rework/channels/chan_dahdi.c?view=diff&rev=226054&r1=226053&r2=226054
==============================================================================
--- team/may/chan_ooh323_rework/channels/chan_dahdi.c (original)
+++ team/may/chan_ooh323_rework/channels/chan_dahdi.c Mon Oct 26 18:55:29 2009
@@ -684,6 +684,9 @@
enum DAHDI_IFLIST {
DAHDI_IFLIST_NONE, /*!< The dahdi_pvt is not in any list. */
DAHDI_IFLIST_MAIN, /*!< The dahdi_pvt is in the main interface list */
+#if defined(HAVE_PRI)
+ DAHDI_IFLIST_NO_B_CHAN, /*!< The dahdi_pvt is in a no B channel interface list */
+#endif /* defined(HAVE_PRI) */
};
struct dahdi_pvt {
@@ -1261,6 +1264,15 @@
static struct dahdi_pvt *iflist = NULL; /*!< Main interface list start */
static struct dahdi_pvt *ifend = NULL; /*!< Main interface list end */
+#if defined(HAVE_PRI)
+static struct dahdi_parms_pseudo {
+ int buf_no; /*!< Number of buffers */
+ int buf_policy; /*!< Buffer policy */
+ int faxbuf_no; /*!< Number of Fax buffers */
+ int faxbuf_policy; /*!< Fax buffer policy */
+} dahdi_pseudo_parms;
+#endif /* defined(HAVE_PRI) */
+
/*! \brief Channel configuration from chan_dahdi.conf .
* This struct is used for parsing the [channels] section of chan_dahdi.conf.
* Generally there is a field here for every possible configuration item.
@@ -2762,6 +2774,8 @@
ast_copy_string(p->rdnis, rdnis, sizeof(p->rdnis));
}
+static int dahdi_new_pri_nobch_channel(struct sig_pri_pri *pri);
+
static struct sig_pri_callback dahdi_pri_callbacks =
{
.handle_dchan_exception = my_handle_dchan_exception,
@@ -2776,6 +2790,7 @@
.set_callerid = my_pri_set_callerid,
.set_dnid = my_pri_set_dnid,
.set_rdnis = my_pri_set_rdnis,
+ .new_nobch_intf = dahdi_new_pri_nobch_channel,
};
#endif /* defined(HAVE_PRI) */
@@ -4070,7 +4085,6 @@
static void dahdi_enable_ec(struct dahdi_pvt *p)
{
- int x;
int res;
if (!p)
return;
@@ -4083,17 +4097,36 @@
return;
}
if (p->echocancel.head.tap_length) {
+#if defined(HAVE_PRI) || defined(HAVE_SS7)
switch (p->sig) {
+#if defined(HAVE_PRI)
case SIG_PRI_LIB_HANDLE_CASES:
+ if (((struct sig_pri_chan *) p->sig_pvt)->no_b_channel) {
+ /*
+ * PRI nobch pseudo channel. Does not need ec anyway.
+ * Does not handle ioctl(DAHDI_AUDIOMODE)
+ */
+ return;
+ }
+ /* Fall through */
+#endif /* defined(HAVE_PRI) */
+#if defined(HAVE_SS7)
case SIG_SS7:
- x = 1;
- res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_AUDIOMODE, &x);
- if (res)
- ast_log(LOG_WARNING, "Unable to enable audio mode on channel %d (%s)\n", p->channel, strerror(errno));
+#endif /* defined(HAVE_SS7) */
+ {
+ int x = 1;
+
+ res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_AUDIOMODE, &x);
+ if (res)
+ ast_log(LOG_WARNING,
+ "Unable to enable audio mode on channel %d (%s)\n",
+ p->channel, strerror(errno));
+ }
break;
default:
break;
}
+#endif /* defined(HAVE_PRI) || defined(HAVE_SS7) */
res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_ECHOCANCEL_PARAMS, &p->echocancel);
if (res) {
ast_log(LOG_WARNING, "Unable to enable echo cancellation on channel %d (%s)\n", p->channel, strerror(errno));
@@ -4334,20 +4367,35 @@
static inline int dahdi_confmute(struct dahdi_pvt *p, int muted)
{
- int x, y, res;
+ int x, res;
x = muted;
+#if defined(HAVE_PRI) || defined(HAVE_SS7)
switch (p->sig) {
+#if defined(HAVE_PRI)
case SIG_PRI_LIB_HANDLE_CASES:
+ if (((struct sig_pri_chan *) p->sig_pvt)->no_b_channel) {
+ /* PRI nobch pseudo channel. Does not handle ioctl(DAHDI_AUDIOMODE) */
+ break;
+ }
+ /* Fall through */
+#endif /* defined(HAVE_PRI) */
+#if defined(HAVE_SS7)
case SIG_SS7:
- y = 1;
- res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_AUDIOMODE, &y);
- if (res)
- ast_log(LOG_WARNING, "Unable to set audio mode on %d: %s\n", p->channel, strerror(errno));
+#endif /* defined(HAVE_SS7) */
+ {
+ int y = 1;
+
+ res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_AUDIOMODE, &y);
+ if (res)
+ ast_log(LOG_WARNING, "Unable to set audio mode on %d: %s\n",
+ p->channel, strerror(errno));
+ }
break;
default:
break;
}
+#endif /* defined(HAVE_PRI) || defined(HAVE_SS7) */
res = ioctl(p->subs[SUB_REAL].dfd, DAHDI_CONFMUTE, &x);
if (res < 0)
ast_log(LOG_WARNING, "DAHDI confmute(%d) failed on channel %d: %s\n", muted, p->channel, strerror(errno));
@@ -4863,6 +4911,101 @@
#if defined(HAVE_PRI)
/*!
* \internal
+ * \brief Insert the given chan_dahdi interface structure into the no B channel list.
+ * \since 1.6.3
+ *
+ * \param pri sig_pri span control structure holding no B channel list.
+ * \param pvt chan_dahdi private interface structure to insert.
+ *
+ * \details
+ * The interface list is a doubly linked list sorted by the chan_dahdi channel number.
+ * Any duplicates are inserted after the existing entries.
+ *
+ * \note The new interface must not already be in the list.
+ *
+ * \return Nothing
+ */
+static void dahdi_nobch_insert(struct sig_pri_pri *pri, struct dahdi_pvt *pvt)
+{
+ struct dahdi_pvt *cur;
+
+ pvt->which_iflist = DAHDI_IFLIST_NO_B_CHAN;
+
+ /* Find place in middle of list for the new interface. */
+ for (cur = pri->no_b_chan_iflist; cur; cur = cur->next) {
+ if (pvt->channel < cur->channel) {
+ /* New interface goes before the current interface. */
+ pvt->prev = cur->prev;
+ pvt->next = cur;
+ if (cur->prev) {
+ /* Insert into the middle of the list. */
+ cur->prev->next = pvt;
+ } else {
+ /* Insert at head of list. */
+ pri->no_b_chan_iflist = pvt;
+ }
+ cur->prev = pvt;
+ return;
+ }
+ }
+
+ /* New interface goes onto the end of the list */
+ pvt->prev = pri->no_b_chan_end;
+ pvt->next = NULL;
+ if (pri->no_b_chan_end) {
+ ((struct dahdi_pvt *) pri->no_b_chan_end)->next = pvt;
+ }
+ pri->no_b_chan_end = pvt;
+ if (!pri->no_b_chan_iflist) {
+ /* List was empty */
+ pri->no_b_chan_iflist = pvt;
+ }
+}
+#endif /* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
+/*!
+ * \internal
+ * \brief Extract the given chan_dahdi interface structure from the no B channel list.
+ * \since 1.6.3
+ *
+ * \param pri sig_pri span control structure holding no B channel list.
+ * \param pvt chan_dahdi private interface structure to extract.
+ *
+ * \note
+ * The given interface structure can be either in the interface list or a stand alone
+ * structure that has not been put in the list if the next and prev pointers are NULL.
+ *
+ * \return Nothing
+ */
+static void dahdi_nobch_extract(struct sig_pri_pri *pri, struct dahdi_pvt *pvt)
+{
+ /* Extract from the forward chain. */
+ if (pvt->prev) {
+ pvt->prev->next = pvt->next;
+ } else if (pri->no_b_chan_iflist == pvt) {
+ /* Node is at the head of the list. */
+ pri->no_b_chan_iflist = pvt->next;
+ }
+
+ /* Extract from the reverse chain. */
+ if (pvt->next) {
+ pvt->next->prev = pvt->prev;
+ } else if (pri->no_b_chan_end == pvt) {
+ /* Node is at the end of the list. */
+ pri->no_b_chan_end = pvt->prev;
+ }
+
+ /* Node is no longer in the list. */
+ pvt->which_iflist = DAHDI_IFLIST_NONE;
+ pvt->prev = NULL;
+ pvt->next = NULL;
+}
+#endif /* defined(HAVE_PRI) */
+
+#if defined(HAVE_PRI)
+/*!
+ * \internal
* \brief Unlink the channel interface from the PRI private pointer array.
* \since 1.6.3
*
@@ -4906,6 +5049,13 @@
case DAHDI_IFLIST_MAIN:
dahdi_iflist_extract(p);
break;
+#if defined(HAVE_PRI)
+ case DAHDI_IFLIST_NO_B_CHAN:
+ if (p->pri) {
+ dahdi_nobch_extract(p->pri, p);
+ }
+ break;
+#endif /* defined(HAVE_PRI) */
}
if (p->sig_pvt) {
@@ -4956,6 +5106,10 @@
static void destroy_all_channels(void)
{
int chan;
+#if defined(HAVE_PRI)
+ unsigned span;
+ struct sig_pri_pri *pri;
+#endif /* defined(HAVE_PRI) */
struct dahdi_pvt *p;
while (num_restart_pending) {
@@ -4989,6 +5143,21 @@
}
ifcount = 0;
ast_mutex_unlock(&iflock);
+
+#if defined(HAVE_PRI)
+ /* Destroy all of the no B channel interface lists */
+ for (span = 0; span < NUM_SPANS; ++span) {
+ pri = &pris[span].pri;
+ ast_mutex_lock(&pri->lock);
+ while (pri->no_b_chan_iflist) {
+ p = pri->no_b_chan_iflist;
+
+ /* Free associated memory */
+ destroy_dahdi_pvt(p);
+ }
+ ast_mutex_unlock(&pri->lock);
+ }
+#endif /* defined(HAVE_PRI) */
}
#if defined(HAVE_PRI)
@@ -5024,7 +5193,7 @@
static int dahdi_send_callrerouting_facility_exec(struct ast_channel *chan, const char *data)
{
/* Data will be our digit string */
- struct dahdi_pvt *p;
+ struct dahdi_pvt *pvt;
char *parse;
int res = -1;
AST_DECLARE_APP_ARGS(args,
@@ -5037,11 +5206,21 @@
ast_log(LOG_DEBUG, "No data sent to application!\n");
return -1;
}
-
- p = (struct dahdi_pvt *)chan->tech_pvt;
-
- if (!p) {
+ if (chan->tech != &dahdi_tech) {
+ ast_log(LOG_DEBUG, "Only DAHDI technology accepted!\n");
+ return -1;
+ }
+ pvt = (struct dahdi_pvt *) chan->tech_pvt;
+ if (!pvt) {
ast_log(LOG_DEBUG, "Unable to find technology private\n");
+ return -1;
+ }
+ switch (pvt->sig) {
+ case SIG_PRI_LIB_HANDLE_CASES:
+ break;
+ default:
+ ast_log(LOG_DEBUG, "callrerouting attempted on non-ISDN channel %s\n",
+ chan->name);
return -1;
}
@@ -5063,7 +5242,8 @@
args.reason = NULL;
}
- pri_send_callrerouting_facility_exec(p->sig_pvt, chan->_state, args.destination, args.original, args.reason);
+ pri_send_callrerouting_facility_exec(pvt->sig_pvt, chan->_state, args.destination,
+ args.original, args.reason);
return res;
}
@@ -5865,6 +6045,14 @@
ast_dsp_set_digitmode(p->dsp, ((*cp) ? DSP_DIGITMODE_RELAXDTMF : DSP_DIGITMODE_DTMF) | p->dtmfrelax);
break;
case AST_OPTION_AUDIO_MODE: /* Set AUDIO mode (or not) */
+#if defined(HAVE_PRI)
+ if (dahdi_sig_pri_lib_handles(p->sig)
+ && ((struct sig_pri_chan *) p->sig_pvt)->no_b_channel) {
+ /* PRI nobch pseudo channel. Does not handle ioctl(DAHDI_AUDIOMODE) */
+ break;
+ }
+#endif /* defined(HAVE_PRI) */
+
cp = (char *) data;
if (!*cp) {
ast_debug(1, "Set option AUDIO MODE, value: OFF(0) on %s\n", chan->name);
@@ -5954,6 +6142,7 @@
ast_mutex_lock(&p->lock);
snprintf(buf, len, "%f", p->txgain);
ast_mutex_unlock(&p->lock);
+#if defined(HAVE_PRI)
#if defined(HAVE_PRI_REVERSE_CHARGE)
} else if (!strcasecmp(data, "reversecharge")) {
ast_mutex_lock(&p->lock);
@@ -5968,6 +6157,22 @@
}
ast_mutex_unlock(&p->lock);
#endif
+#if defined(HAVE_PRI_SETUP_KEYPAD)
+ } else if (!strcasecmp(data, "keypad_digits")) {
+ ast_mutex_lock(&p->lock);
+ switch (p->sig) {
+ case SIG_PRI_LIB_HANDLE_CASES:
+ ast_copy_string(buf, ((struct sig_pri_chan *) p->sig_pvt)->keypad_digits,
+ len);
+ break;
+ default:
+ *buf = '\0';
+ res = -1;
+ break;
+ }
+ ast_mutex_unlock(&p->lock);
+#endif /* defined(HAVE_PRI_SETUP_KEYPAD) */
+#endif /* defined(HAVE_PRI) */
} else {
*buf = '\0';
res = -1;
@@ -6225,6 +6430,23 @@
ast_log(LOG_NOTICE, "Avoiding deadlock...\n");
return AST_BRIDGE_RETRY;
}
+
+#if defined(HAVE_PRI)
+ if ((dahdi_sig_pri_lib_handles(p0->sig)
+ && ((struct sig_pri_chan *) p0->sig_pvt)->no_b_channel)
+ || (dahdi_sig_pri_lib_handles(p1->sig)
+ && ((struct sig_pri_chan *) p1->sig_pvt)->no_b_channel)) {
+ /*
+ * PRI nobch channels (hold and call waiting) are equivalent to
+ * pseudo channels and cannot be done here.
+ */
[... 5791 lines stripped ...]
More information about the asterisk-commits
mailing list