fi ; \
install $$x $(ASTETCDIR)/`basename $$x .sample` ;\
done
+ echo "[directories]" > $(ASTETCDIR)/asterisk.conf
echo "astetcdir => $(ASTETCDIR)" >> $(ASTETCDIR)/asterisk.conf
echo "astmoddir => $(MODULES_DIR)" >> $(ASTETCDIR)/asterisk.conf
echo "astvarlibdir => $(ASTVARLIBDIR)" >> $(ASTETCDIR)/asterisk.conf
DIR *dir;
struct dirent *de;
char fn[256];
-
+ char tmp[256]="";
+ char *mb, *cur;
+ int ret;
/* If no mailbox, return immediately */
if (!strlen(mailbox))
return 0;
+ if (strchr(mailbox, ',')) {
+ strncpy(tmp, mailbox, sizeof(tmp));
+ mb = tmp;
+ ret = 0;
+ while((cur = strsep(&mb, ", "))) {
+ if (strlen(cur)) {
+ if (ast_app_has_voicemail(cur))
+ return 1;
+ }
+ }
+ return 0;
+ }
snprintf(fn, sizeof(fn), "%s/vm/%s/INBOX", (char *)ast_config_AST_SPOOL_DIR, mailbox);
dir = opendir(fn);
if (!dir)
#APPS+=app_sql_postgres.so
#APPS+=app_sql_odbc.so
-APPS+=$(shell if [ -f /usr/include/zap.h ]; then echo "app_zapras.so app_meetme.so app_flash.so app_zapbarge.so" ; fi)
+APPS+=$(shell if [ -f /usr/include/linux/zaptel.h ]; then echo "app_zapras.so app_meetme.so app_flash.so app_zapbarge.so" ; fi)
#APPS+=$(shell if [ -f /usr/include/zap.h ]; then echo "app_rpt.so" ; fi)
CFLAGS+=
#include <asterisk/module.h>
#include <asterisk/adsi.h>
#include <asterisk/app.h>
+#include <asterisk/manager.h>
#include <stdlib.h>
#include <errno.h>
#include <unistd.h>
ast_log(LOG_WARNING, "No entry in voicemail config file for '%s'\n", ext);
ast_destroy(cfg);
/* Leave voicemail for someone */
+ manager_event(EVENT_FLAG_CALL, "MessageWaiting", "Mailbox: %s\r\nWaiting: %d\r\n", ext, ast_app_has_voicemail(ext));
return res;
}
ast_destroy(cfg);
if (useadsi)
adsi_unload_session(chan);
+ if (valid) {
+ manager_event(EVENT_FLAG_CALL, "MessageWaiting", "Mailbox: %s\r\nWaiting: %d\r\n", username, ast_app_has_voicemail(username));
+ }
LOCAL_USER_REMOVE(u);
return res;
int ast_channel_masquerade(struct ast_channel *original, struct ast_channel *clone)
{
+ struct ast_frame null = { AST_FRAME_NULL, };
ast_log(LOG_DEBUG, "Planning to masquerade %s into the structure of %s\n",
clone->name, original->name);
if (original->masq) {
}
original->masq = clone;
clone->masqr = original;
+ /* XXX can't really hold the lock here, but at the same time, it' s
+ not really safe not to XXX */
+ ast_queue_frame(original, &null, 0);
return 0;
}
return -1;
strncpy(copy, value, sizeof(copy)-1);
stringp=copy;
- username = strsep(&stringp, "@");
- hostname = strsep(&stringp, "@");
+ username = stringp;
+ hostname = strrchr(stringp, '@');
+ if (hostname) {
+ *hostname = '\0';
+ hostname++;
+ }
if (!hostname) {
ast_log(LOG_WARNING, "Format for registration is user[:secret]@host[:port] at line %d", lineno);
return -1;
*a2 = '\0';
- if (sipdebug)
+ if (sipdebug) {
ast_verbose("Looking for %s in %s\n", c, p->context);
ast_verbose("Looking for %s in %s\n", c2, p->context);
-
+ }
if (strlen(tmp5)) {
/* This is a supervised transfer */
ast_log(LOG_DEBUG,"Assigning Replace-Call-ID Info %s to REPLACE_CALL_ID\n",tmp5);
return 0;
else
ast_log(LOG_NOTICE, "Supervised transfer requested, but unable to find callid '%s'\n", tmp5);
- } else if (ast_exists_extension(NULL, p->context, c, 1, NULL) && ast_exists_extension(NULL, p->context, c2, 1, NULL)) {
+ } else if (ast_exists_extension(NULL, p->context, c, 1, NULL)) {
/* This is an unsupervised transfer */
ast_log(LOG_DEBUG,"Assigning Extension %s to REFER-TO\n", c);
ast_log(LOG_DEBUG,"Assigning Extension %s to REFERRED-BY\n", c2);
ast_async_goto(transfer_to,"", p->refer_to,1, 1);
}
}
+ transmit_request(p, "BYE", p->outgoing);
}
} else if (!strcasecmp(cmd, "CANCEL") || !strcasecmp(cmd, "BYE")) {
copy_request(&p->initreq, req);
/*
* Asterisk -- A telephony toolkit for Linux.
*
- * Tormenta T1 Card (via Zapata library) support
+ * Zaptel Pseudo TDM interface
*
- * Copyright (C) 1999, Mark Spencer
+ * Copyright (C) 2003 Digium
*
- * Mark Spencer <markster@linux-support.net>
+ * Mark Spencer <markster@digium.com>
*
* This program is free software, distributed under the terms of
* the GNU General Public License
}
#endif
+static int check_for_conference(struct zt_pvt *p)
+{
+ ZT_CONFINFO ci;
+ /* Fine if we already have a master, etc */
+ if (p->master || (p->confno > -1))
+ return 0;
+ memset(&ci, 0, sizeof(ci));
+ if (ioctl(p->subs[SUB_REAL].zfd, ZT_GETCONF, &ci)) {
+ ast_log(LOG_WARNING, "Failed to get conference info on channel %d\n", p->channel);
+ return 0;
+ }
+ /* If we have no master and don't have a confno, then
+ if we're in a conference, it's probably a MeetMe room or
+ some such, so don't let us 3-way out! */
+ if (ci.confno) {
+ if (option_verbose > 2)
+ ast_verbose(VERBOSE_PREFIX_3 "Avoiding 3-way call when in an external conference\n");
+ return 1;
+ }
+ return 0;
+}
+
static struct ast_frame *zt_handle_event(struct ast_channel *ast)
{
int res,x;
if (p->subs[SUB_REAL].owner->bridge)
ast_moh_stop(p->subs[SUB_REAL].owner->bridge);
} else if (!p->subs[SUB_THREEWAY].owner) {
- if (p->threewaycalling) {
+ if (p->threewaycalling && !check_for_conference(p)) {
/* XXX This section needs much more error checking!!! XXX */
/* Start a 3-way call if feasible */
if ((ast->pbx) ||
; up, please go to www.gnophone.com or www.iaxtel.com
;
[iaxtel700]
-exten => _91700NXXXXXX,1,Dial(IAX/${IAXINFO}@iaxtel.com/${EXTEN-1}@iaxtel)
+exten => _91700NXXXXXX,1,Dial(IAX/${IAXINFO}@iaxtel.com/${EXTEN:1}@iaxtel)
[iaxprovider]
;switch => IAX/user:[key]@myserver/mycontext
;
; International long distance through trunk
;
-exten => 9011.,1,Dial(${TRUNK}/${EXTEN-1})
+exten => 9011.,1,Dial(${TRUNK}/${EXTEN:1})
exten => 9011.,2,Congestion
[trunkld]
;
; Long distance context accessed through trunk
;
-exten => _91NXXNXXXXXX,1,Dial(${TRUNK}/${EXTEN-1})
+exten => _91NXXNXXXXXX,1,Dial(${TRUNK}/${EXTEN:1})
exten => _91NXXNXXXXXX,2,Congestion
[trunklocal]
;
; Local seven-digit dialing accessed through trunk interface
;
-exten => _9NXXXXXX,1,Dial(${TRUNK}/${EXTEN-1})
+exten => _9NXXXXXX,1,Dial(${TRUNK}/${EXTEN:1})
exten => _9NXXXXXX,2,Congestion
[trunktollfree]
;
; Long distance context accessed through trunk interface
;
-exten => _91800NXXXXXX,1,Dial(${TRUNK}/${EXTEN-1})
+exten => _91800NXXXXXX,1,Dial(${TRUNK}/${EXTEN:1})
exten => _91800NXXXXXX,2,Congestion
-exten => _91888NXXXXXX,1,Dial(${TRUNK}/${EXTEN-1})
+exten => _91888NXXXXXX,1,Dial(${TRUNK}/${EXTEN:1})
exten => _91888NXXXXXX,2,Congestion
-exten => _91877NXXXXXX,1,Dial(${TRUNK}/${EXTEN-1})
+exten => _91877NXXXXXX,1,Dial(${TRUNK}/${EXTEN:1})
exten => _91877NXXXXXX,2,Congestion
-exten => _91866NXXXXXX,1,Dial(${TRUNK}/${EXTEN-1})
+exten => _91866NXXXXXX,1,Dial(${TRUNK}/${EXTEN:1})
exten => _91866NXXXXXX,2,Congestion
[international]
#include <asterisk/logger.h>
#include <asterisk/options.h>
#include <asterisk/cli.h>
+#include <asterisk/app.h>
#include <asterisk/pbx.h>
static int enabled = 0;
return 0;
}
+static int action_mailboxstatus(struct mansession *s, struct message *m)
+{
+ char *mailbox = get_header(m, "Mailbox");
+ if (!mailbox || !strlen(mailbox)) {
+ send_error(s, "Mailbox not specified");
+ return 0;
+ }
+ send_ack(s, "Mailbox status will follow");
+ manager_event(EVENT_FLAG_CALL, "MessageWaiting", "Mailbox: %s\r\nWaiting:%d\r\n", mailbox, ast_app_has_voicemail(mailbox));
+ return 0;
+}
+
static int process_message(struct mansession *s, struct message *m)
{
char action[80];
ast_manager_register( "Status", EVENT_FLAG_CALL, action_status, "Status" );
ast_manager_register( "Redirect", EVENT_FLAG_CALL, action_redirect, "Redirect" );
ast_manager_register( "Originate", EVENT_FLAG_CALL, action_originate, "Originate Call" );
+ ast_manager_register( "MailboxStatus", EVENT_FLAG_CALL, action_mailboxstatus, "Check Mailbox" );
ast_manager_register( "Command", EVENT_FLAG_COMMAND, action_command, "Execute Command" );
ast_cli_register(&show_mancmds_cli);
} else if (!strcmp(cp3, "EXTEN")) {
*cp4 = c->exten;
} else if (!strncmp(cp3, "EXTEN-", strlen("EXTEN-")) &&
+ /* XXX Remove me eventually */
(sscanf(cp3 + strlen("EXTEN-"), "%d", &offset) == 1)) {
if (offset < 0)
offset=0;
if (offset > strlen(c->exten))
offset = strlen(c->exten);
*cp4 = c->exten + offset;
+ ast_log(LOG_WARNING, "The use of 'EXTEN-foo' has been derprecated in favor of 'EXTEN:foo'\n");
+ } else if (!strncmp(cp3, "EXTEN:", strlen("EXTEN:")) &&
+ (sscanf(cp3 + strlen("EXTEN:"), "%d", &offset) == 1)) {
+ if (offset < 0)
+ offset=0;
+ if (offset > strlen(c->exten))
+ offset = strlen(c->exten);
+ *cp4 = c->exten + offset;
} else if (!strcmp(cp3, "RDNIS")) {
*cp4 = c->rdnis;
if (!(*cp4))
struct ast_frame *f;
tmpchan = ast_channel_alloc(0);
if (tmpchan) {
- ast_setstate(tmpchan, chan->_state);
snprintf(tmpchan->name, sizeof(tmpchan->name), "AsyncGoto/%s", chan->name);
+ ast_setstate(tmpchan, chan->_state);
/* Make formats okay */
tmpchan->readformat = chan->readformat;
tmpchan->writeformat = chan->writeformat;