mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 12:16:00 +00:00
Make voicemail segmentable into multiple contexts
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@986 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
2
CHANGES
2
CHANGES
@@ -1,3 +1,5 @@
|
||||
-- Make voicemail segmentable by context (app_voicemail2)
|
||||
-- Major restructuring of voicemail (app_voicemail2)
|
||||
-- Add initial ENUM support
|
||||
-- Add malloc debugging support
|
||||
-- Add preliminary Voicetronix support
|
||||
|
21
Makefile
21
Makefile
@@ -223,6 +223,7 @@ bininstall: all
|
||||
mkdir -p $(ASTBINDIR)
|
||||
mkdir -p $(ASTSBINDIR)
|
||||
mkdir -p $(ASTVARRUNDIR)
|
||||
mkdir -p $(ASTSPOOLDIR)/voicemail
|
||||
install -m 755 asterisk $(ASTSBINDIR)/
|
||||
install -m 755 astgenkey $(ASTSBINDIR)/
|
||||
install -m 755 safe_asterisk $(ASTSBINDIR)/
|
||||
@@ -230,7 +231,14 @@ bininstall: all
|
||||
install -d $(ASTHEADERDIR)
|
||||
install include/asterisk/*.h $(ASTHEADERDIR)
|
||||
rm -f $(ASTVARLIBDIR)/sounds/vm
|
||||
mkdir -p $(ASTSPOOLDIR)/vm
|
||||
rm -f $(ASTVARLIBDIR)/sounds/voicemail
|
||||
if [ ! -h $(ASTSPOOLDIR)/vm ] && [ -d $(ASTSPOOLDIR)/vm ]; then \
|
||||
mv $(ASTSPOOLDIR)/vm $(ASTSPOOLDIR)/voicemail/default; \
|
||||
else \
|
||||
mkdir -p $(ASTSPOOLDIR)/voicemail/default; \
|
||||
rm -f $(ASTSPOOLDIR)/vm; \
|
||||
ln -s $(ASTSPOOLDIR)/voicemail/default $(ASTSPOOLDIR)/vm; \
|
||||
fi
|
||||
rm -f $(ASTMODULESDIR)/chan_ixj.so
|
||||
rm -f $(ASTMODULESDIR)/chan_tor.so
|
||||
mkdir -p $(ASTVARLIBDIR)/sounds
|
||||
@@ -238,6 +246,7 @@ bininstall: all
|
||||
mkdir -p $(ASTVARLIBDIR)/keys
|
||||
install -m 644 keys/iaxtel.pub $(ASTVARLIBDIR)/keys
|
||||
( cd $(ASTVARLIBDIR)/sounds ; ln -s $(ASTSPOOLDIR)/vm . )
|
||||
( cd $(ASTVARLIBDIR)/sounds ; ln -s $(ASTSPOOLDIR)/voicemail . )
|
||||
@echo " +---- Asterisk Installation Complete -------+"
|
||||
@echo " + +"
|
||||
@echo " + YOU MUST READ THE SECURITY DOCUMENT +"
|
||||
@@ -299,14 +308,14 @@ samples: all datafiles adsi
|
||||
for x in sounds/*.mp3; do \
|
||||
install $$x $(ASTVARLIBDIR)/mohmp3 ; \
|
||||
done
|
||||
mkdir -p $(ASTSPOOLDIR)/vm/1234/INBOX
|
||||
:> $(ASTVARLIBDIR)/sounds/vm/1234/unavail.gsm
|
||||
mkdir -p $(ASTSPOOLDIR)/voicemail/default/1234/INBOX
|
||||
:> $(ASTVARLIBDIR)/sounds/voicemail/default/1234/unavail.gsm
|
||||
for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isunavail; do \
|
||||
cat $(ASTVARLIBDIR)/sounds/$$x.gsm >> $(ASTVARLIBDIR)/sounds/vm/1234/unavail.gsm ; \
|
||||
cat $(ASTVARLIBDIR)/sounds/$$x.gsm >> $(ASTVARLIBDIR)/sounds/voicemail/default/1234/unavail.gsm ; \
|
||||
done
|
||||
:> $(ASTVARLIBDIR)/sounds/vm/1234/busy.gsm
|
||||
:> $(ASTVARLIBDIR)/sounds/voicemail/default/1234/busy.gsm
|
||||
for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isonphone; do \
|
||||
cat $(ASTVARLIBDIR)/sounds/$$x.gsm >> $(ASTVARLIBDIR)/sounds/vm/1234/busy.gsm ; \
|
||||
cat $(ASTVARLIBDIR)/sounds/$$x.gsm >> $(ASTVARLIBDIR)/sounds/vmoicemail/default/1234/busy.gsm ; \
|
||||
done
|
||||
|
||||
webvmail:
|
||||
|
24
app.c
24
app.c
@@ -148,6 +148,7 @@ int ast_app_has_voicemail(const char *mailbox)
|
||||
char fn[256];
|
||||
char tmp[256]="";
|
||||
char *mb, *cur;
|
||||
char *context;
|
||||
int ret;
|
||||
/* If no mailbox, return immediately */
|
||||
if (!strlen(mailbox))
|
||||
@@ -156,7 +157,7 @@ int ast_app_has_voicemail(const char *mailbox)
|
||||
strncpy(tmp, mailbox, sizeof(tmp));
|
||||
mb = tmp;
|
||||
ret = 0;
|
||||
while((cur = strsep(&mb, ", "))) {
|
||||
while((cur = strsep(&mb, ","))) {
|
||||
if (strlen(cur)) {
|
||||
if (ast_app_has_voicemail(cur))
|
||||
return 1;
|
||||
@@ -164,7 +165,14 @@ int ast_app_has_voicemail(const char *mailbox)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
snprintf(fn, sizeof(fn), "%s/vm/%s/INBOX", (char *)ast_config_AST_SPOOL_DIR, mailbox);
|
||||
strncpy(tmp, mailbox, sizeof(tmp) - 1);
|
||||
context = strchr(tmp, '@');
|
||||
if (context) {
|
||||
*context = '\0';
|
||||
context++;
|
||||
} else
|
||||
context = "default";
|
||||
snprintf(fn, sizeof(fn), "%s/voicemail/%s/%s/INBOX", (char *)ast_config_AST_SPOOL_DIR, context, mailbox);
|
||||
dir = opendir(fn);
|
||||
if (!dir)
|
||||
return 0;
|
||||
@@ -185,6 +193,7 @@ int ast_app_messagecount(const char *mailbox, int *newmsgs, int *oldmsgs)
|
||||
char fn[256];
|
||||
char tmp[256]="";
|
||||
char *mb, *cur;
|
||||
char *context;
|
||||
int ret;
|
||||
if (newmsgs)
|
||||
*newmsgs = 0;
|
||||
@@ -212,8 +221,15 @@ int ast_app_messagecount(const char *mailbox, int *newmsgs, int *oldmsgs)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
strncpy(tmp, mailbox, sizeof(tmp) - 1);
|
||||
context = strchr(tmp, '@');
|
||||
if (context) {
|
||||
*context = '\0';
|
||||
context++;
|
||||
} else
|
||||
context = "default";
|
||||
if (newmsgs) {
|
||||
snprintf(fn, sizeof(fn), "%s/vm/%s/INBOX", (char *)ast_config_AST_SPOOL_DIR, mailbox);
|
||||
snprintf(fn, sizeof(fn), "%s/voicemail/%s/%s/INBOX", (char *)ast_config_AST_SPOOL_DIR, context, mailbox);
|
||||
dir = opendir(fn);
|
||||
if (dir) {
|
||||
while ((de = readdir(dir))) {
|
||||
@@ -226,7 +242,7 @@ int ast_app_messagecount(const char *mailbox, int *newmsgs, int *oldmsgs)
|
||||
}
|
||||
}
|
||||
if (oldmsgs) {
|
||||
snprintf(fn, sizeof(fn), "%s/vm/%s/Old", (char *)ast_config_AST_SPOOL_DIR, mailbox);
|
||||
snprintf(fn, sizeof(fn), "%s/voicemail/%s/%s/Old", (char *)ast_config_AST_SPOOL_DIR, context, mailbox);
|
||||
dir = opendir(fn);
|
||||
if (dir) {
|
||||
while ((de = readdir(dir))) {
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user