mirror of
https://github.com/asterisk/asterisk.git
synced 2025-08-18 03:56:20 +00:00
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
a49bd5cd58 | ||
|
0a9275b398 | ||
|
5f8dc7e8dc | ||
|
a54e196ea4 |
@@ -1,5 +0,0 @@
|
||||
asterisk
|
||||
build.h
|
||||
ast_expr.c
|
||||
.version
|
||||
.depend
|
34
BUGS
Executable file → Normal file
34
BUGS
Executable file → Normal file
@@ -1,3 +1,37 @@
|
||||
Known Issues in Asterisk 1.0
|
||||
============================
|
||||
In order to provide a path for a stable Asterisk 1.0, the Asterisk CVS tree
|
||||
was forked into a a 1.0-stable branch. Many new features and enhancements
|
||||
have been added to the development tree in the mean time since the branch,
|
||||
but in the interest of stability, only bug fixes were accepted into the
|
||||
stable branch, meaning that over time, there has been a substantial
|
||||
diversion of the feature set between stable (1.0) and developmental
|
||||
Asterisk. This section is a list of important differences between the
|
||||
stable (1.0) and development versions of Asterisk.
|
||||
|
||||
* The number of SIP channels that can be simultaneously run through Asterisk
|
||||
may be more limited than in development releases.
|
||||
|
||||
* When Asterisk carries media from one RTP or IAX connection to another,
|
||||
jitter on one side can sometimes be reflected in the timestamps going
|
||||
to the other, causing the audio to be broken up on poor quality network
|
||||
connections. This behavior has been changed in development releases.
|
||||
|
||||
* The MGCP channel driver has been greatly extended in development releases.
|
||||
|
||||
* The VPB (Voicetronix) driver in 1.0 only works with properly with FXO
|
||||
interfaces. Extensive work has been done on the driver in the development
|
||||
channel.
|
||||
|
||||
* The SIP channel driver's ability to negotiate codecs has been improved
|
||||
in developmental Asterisk.
|
||||
|
||||
* The return result of app_system is unrealiable in 1.0 and has gone through
|
||||
extensive rework in developmental Asterisk.
|
||||
|
||||
* The queue system has been extensively reworked with a variety of new
|
||||
features in developmental Asterisk.
|
||||
|
||||
Asterisk Bug Tracking Information
|
||||
=================================
|
||||
|
||||
|
7
CHANGES
Executable file → Normal file
7
CHANGES
Executable file → Normal file
@@ -1,3 +1,10 @@
|
||||
Asterisk 0.9.0
|
||||
-- Fixes from the bug tracker
|
||||
-- ADPCM Standardization
|
||||
-- Branch to Stable CVS
|
||||
Asterisk 0.7.2
|
||||
-- Countless small bug fixes from bug tracker
|
||||
-- DSP Fixes
|
||||
-- Fix unloading of Zaptel
|
||||
-- Pass Caller*ID/ANI properly on call forwarding
|
||||
-- Add indication for Italy
|
||||
|
2
Makefile
Executable file → Normal file
2
Makefile
Executable file → Normal file
@@ -397,7 +397,7 @@ samples: all datafiles adsi
|
||||
for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isunavail; do \
|
||||
cat $(DESTDIR)$(ASTVARLIBDIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/unavail.gsm ; \
|
||||
done
|
||||
:> $(DESTDIR)$(ASTVARLIBDIR)/sounds/voicemail/default/1234/busy.gsm
|
||||
:> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm
|
||||
for x in vm-theperson digits/1 digits/2 digits/3 digits/4 vm-isonphone; do \
|
||||
cat $(DESTDIR)$(ASTVARLIBDIR)/sounds/$$x.gsm >> $(DESTDIR)$(ASTSPOOLDIR)/voicemail/default/1234/busy.gsm ; \
|
||||
done
|
||||
|
4
README
Executable file → Normal file
4
README
Executable file → Normal file
@@ -24,7 +24,7 @@ community on this Wiki:
|
||||
must apply to all loadable modules as well, except as defined below.
|
||||
|
||||
Digium, Inc. (formerly Linux Support Services) retains copyright to all
|
||||
of the core Asterisk system, and therefore can grant, at its sole discression,
|
||||
of the core Asterisk system, and therefore can grant, at its sole discretion,
|
||||
the ability for companies, individuals, or organizations to create proprietary
|
||||
or Open Source (but non-GPL'd) modules which may be dynamically linked at
|
||||
runtime with the portions of Asterisk which fall under our copyright
|
||||
@@ -34,7 +34,7 @@ umbrella, or are distributed under more flexible licenses than GPL.
|
||||
If you wish to use our code in other GPL programs, don't worry -- there
|
||||
is no requirement that you provide the same exemption in your GPL'd
|
||||
products (although if you've written a module for Asterisk we would
|
||||
strongly encourage you to make the same excemption that we do).
|
||||
strongly encourage you to make the same exemption that we do).
|
||||
|
||||
Specific permission is also granted to OpenSSL and OpenH323 to link to
|
||||
Asterisk.
|
||||
|
22
acl.c
Executable file → Normal file
22
acl.c
Executable file → Normal file
@@ -279,7 +279,7 @@ int ast_ouraddrfor(struct in_addr *them, struct in_addr *us)
|
||||
fgets(line,sizeof(line),PROC);
|
||||
|
||||
while (!feof(PROC)) {
|
||||
char iface[8];
|
||||
char iface[256];
|
||||
unsigned int dest, gateway, mask;
|
||||
int i,fieldnum;
|
||||
char *fields[40];
|
||||
@@ -303,18 +303,20 @@ int ast_ouraddrfor(struct in_addr *them, struct in_addr *us)
|
||||
i = offset - line;
|
||||
}
|
||||
}
|
||||
if (fieldnum >= 8) {
|
||||
|
||||
sscanf(fields[0],"%s",iface);
|
||||
sscanf(fields[1],"%x",&dest);
|
||||
sscanf(fields[2],"%x",&gateway);
|
||||
sscanf(fields[7],"%x",&mask);
|
||||
sscanf(fields[0],"%s",iface);
|
||||
sscanf(fields[1],"%x",&dest);
|
||||
sscanf(fields[2],"%x",&gateway);
|
||||
sscanf(fields[7],"%x",&mask);
|
||||
#if 0
|
||||
printf("Addr: %s %08x Dest: %08x Mask: %08x\n", inet_ntoa(*them), remote_ip, dest, mask);
|
||||
printf("Addr: %s %08x Dest: %08x Mask: %08x\n", inet_ntoa(*them), remote_ip, dest, mask);
|
||||
#endif
|
||||
/* Looks simple, but here is the magic */
|
||||
if (((remote_ip & mask) ^ dest) == 0) {
|
||||
res = ast_lookup_iface(iface,us);
|
||||
break;
|
||||
/* Looks simple, but here is the magic */
|
||||
if (((remote_ip & mask) ^ dest) == 0) {
|
||||
res = ast_lookup_iface(iface,us);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
fclose(PROC);
|
||||
|
0
aescrypt.c
Executable file → Normal file
0
aescrypt.c
Executable file → Normal file
1
aesopt.h
Executable file → Normal file
1
aesopt.h
Executable file → Normal file
@@ -149,6 +149,7 @@
|
||||
/* PLATFORM SPECIFIC INCLUDES */
|
||||
|
||||
#if defined( __FreeBSD__ ) || defined( __OpenBSD__ )
|
||||
# include <sys/types.h>
|
||||
# include <sys/endian.h>
|
||||
#elif defined( BSD ) && ( BSD >= 199103 )
|
||||
# include <machine/endian.h>
|
||||
|
@@ -1,3 +0,0 @@
|
||||
eagi-test
|
||||
eagi-sphinx-test
|
||||
.depend
|
0
agi/DialAnMp3.agi
Executable file → Normal file
0
agi/DialAnMp3.agi
Executable file → Normal file
0
agi/Makefile
Executable file → Normal file
0
agi/Makefile
Executable file → Normal file
0
agi/agi-test.agi
Executable file → Normal file
0
agi/agi-test.agi
Executable file → Normal file
0
agi/eagi-sphinx-test.c
Executable file → Normal file
0
agi/eagi-sphinx-test.c
Executable file → Normal file
0
agi/eagi-test.c
Executable file → Normal file
0
agi/eagi-test.c
Executable file → Normal file
0
agi/numeralize
Executable file → Normal file
0
agi/numeralize
Executable file → Normal file
@@ -1 +0,0 @@
|
||||
.depend
|
0
apps/Makefile
Executable file → Normal file
0
apps/Makefile
Executable file → Normal file
15
apps/app_adsiprog.c
Executable file → Normal file
15
apps/app_adsiprog.c
Executable file → Normal file
@@ -666,7 +666,7 @@ static int showdisplay(char *buf, char *name, int id, char *args, struct adsi_sc
|
||||
}
|
||||
|
||||
buf[0] = id;
|
||||
buf[1] = (cmd << 6) | (disp->id & 0x2f);
|
||||
buf[1] = (cmd << 6) | (disp->id & 0x3f);
|
||||
buf[2] = ((line & 0x1f) << 3) | (flag & 0x7);
|
||||
return 3;
|
||||
}
|
||||
@@ -695,6 +695,18 @@ static int digitdirect(char *buf, char *name, int id, char *args, struct adsi_sc
|
||||
return 2;
|
||||
}
|
||||
|
||||
static int clearcbone(char *buf, char *name, int id, char *args, struct adsi_script *istate, char *script, int lineno)
|
||||
{
|
||||
char *tok;
|
||||
tok = get_token(&args, script, lineno);
|
||||
if (tok)
|
||||
ast_log(LOG_WARNING, "CLEARCB1 requires no arguments ('%s') at line %d of %s\n", tok, lineno, script);
|
||||
|
||||
buf[0] = id;
|
||||
buf[1] = 0;
|
||||
return 2;
|
||||
}
|
||||
|
||||
static int digitcollect(char *buf, char *name, int id, char *args, struct adsi_script *istate, char *script, int lineno)
|
||||
{
|
||||
char *tok;
|
||||
@@ -831,6 +843,7 @@ static struct adsi_key_cmd kcmds[] = {
|
||||
{ "VOICEMODE", 0x93 },
|
||||
/* Display call buffer 'n' */
|
||||
/* Clear call buffer 'n' */
|
||||
{ "CLEARCB1", 0x95, clearcbone },
|
||||
{ "DIGITCOLLECT", 0x96, digitcollect },
|
||||
{ "DIGITDIRECT", 0x96, digitdirect },
|
||||
{ "CLEAR", 0x97 },
|
||||
|
15
apps/app_agi.c
Executable file → Normal file
15
apps/app_agi.c
Executable file → Normal file
@@ -529,6 +529,8 @@ static int handle_recordfile(struct ast_channel *chan, AGI *agi, int argc, char
|
||||
if (!fs) {
|
||||
res = -1;
|
||||
fdprintf(agi->fd, "200 result=%d (writefile)\n", res);
|
||||
if (sildet)
|
||||
ast_dsp_free(sildet);
|
||||
return RESULT_FAILURE;
|
||||
}
|
||||
|
||||
@@ -545,12 +547,16 @@ static int handle_recordfile(struct ast_channel *chan, AGI *agi, int argc, char
|
||||
if (res < 0) {
|
||||
ast_closestream(fs);
|
||||
fdprintf(agi->fd, "200 result=%d (waitfor) endpos=%ld\n", res,sample_offset);
|
||||
if (sildet)
|
||||
ast_dsp_free(sildet);
|
||||
return RESULT_FAILURE;
|
||||
}
|
||||
f = ast_read(chan);
|
||||
if (!f) {
|
||||
fdprintf(agi->fd, "200 result=%d (hangup) endpos=%ld\n", 0, sample_offset);
|
||||
ast_closestream(fs);
|
||||
if (sildet)
|
||||
ast_dsp_free(sildet);
|
||||
return RESULT_FAILURE;
|
||||
}
|
||||
switch(f->frametype) {
|
||||
@@ -561,6 +567,8 @@ static int handle_recordfile(struct ast_channel *chan, AGI *agi, int argc, char
|
||||
fdprintf(agi->fd, "200 result=%d (dtmf) endpos=%ld\n", f->subclass, sample_offset);
|
||||
ast_closestream(fs);
|
||||
ast_frfree(f);
|
||||
if (sildet)
|
||||
ast_dsp_free(sildet);
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
break;
|
||||
@@ -596,6 +604,7 @@ static int handle_recordfile(struct ast_channel *chan, AGI *agi, int argc, char
|
||||
if (gotsilence) {
|
||||
ast_stream_rewind(fs, silence-1000);
|
||||
ast_truncstream(fs);
|
||||
sample_offset = ast_tellstream(fs);
|
||||
}
|
||||
fdprintf(agi->fd, "200 result=%d (timeout) endpos=%ld\n", res, sample_offset);
|
||||
ast_closestream(fs);
|
||||
@@ -1218,6 +1227,10 @@ static int agi_handle_command(struct ast_channel *chan, AGI *agi, char *buf)
|
||||
fdprintf(agi->fd, c->usage);
|
||||
fdprintf(agi->fd, "520 End of proper usage.\n");
|
||||
break;
|
||||
case AST_PBX_KEEPALIVE:
|
||||
/* We've been asked to keep alive, so do so */
|
||||
return AST_PBX_KEEPALIVE;
|
||||
break;
|
||||
case RESULT_FAILURE:
|
||||
/* They've already given the failure. We've been hung up on so handle this
|
||||
appropriately */
|
||||
@@ -1285,7 +1298,7 @@ static int run_agi(struct ast_channel *chan, char *request, AGI *agi, int pid)
|
||||
|
||||
returnstatus |= agi_handle_command(chan, agi, buf);
|
||||
/* If the handle_command returns -1, we need to stop */
|
||||
if (returnstatus < 0) {
|
||||
if ((returnstatus < 0) || (returnstatus == AST_PBX_KEEPALIVE)) {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
|
0
apps/app_authenticate.c
Executable file → Normal file
0
apps/app_authenticate.c
Executable file → Normal file
0
apps/app_cdr.c
Executable file → Normal file
0
apps/app_cdr.c
Executable file → Normal file
14
apps/app_chanisavail.c
Executable file → Normal file
14
apps/app_chanisavail.c
Executable file → Normal file
@@ -38,9 +38,9 @@ static char *synopsis = "Check if channel is available";
|
||||
static char *descrip =
|
||||
" ChanIsAvail(Technology/resource[&Technology2/resource2...]): \n"
|
||||
"Checks is any of the requested channels are available. If none\n"
|
||||
"of the requested channels are available the new priority will\n"
|
||||
"be n+101 (unless such a priority does not exist, in which case\n"
|
||||
"ChanIsAvail will return -1. If any of the requested channels\n"
|
||||
"of the requested channels are available the new priority will be\n"
|
||||
"n+101 (unless such a priority does not exist or on error, in which\n"
|
||||
"case ChanIsAvail will return -1). If any of the requested channels\n"
|
||||
"are available, the next priority will be n+1, the channel variable\n"
|
||||
"${AVAILCHAN} will be set to the name of the available channel and\n"
|
||||
"the ChanIsAvail app will return 0.\n";
|
||||
@@ -53,7 +53,7 @@ static int chanavail_exec(struct ast_channel *chan, void *data)
|
||||
{
|
||||
int res=-1;
|
||||
struct localuser *u;
|
||||
char info[256], *peers, *tech, *number, *rest, *cur;
|
||||
char info[512], *peers, *tech, *number, *rest, *cur;
|
||||
struct ast_channel *tempchan;
|
||||
|
||||
if (!data) {
|
||||
@@ -62,7 +62,7 @@ static int chanavail_exec(struct ast_channel *chan, void *data)
|
||||
}
|
||||
LOCAL_USER_ADD(u);
|
||||
|
||||
strncpy(info, (char *)data, strlen((char *)data) + AST_MAX_EXTENSION-1);
|
||||
strncpy(info, (char *)data, sizeof(info)-1);
|
||||
peers = info;
|
||||
if (peers) {
|
||||
cur = peers;
|
||||
@@ -76,8 +76,8 @@ static int chanavail_exec(struct ast_channel *chan, void *data)
|
||||
tech = cur;
|
||||
number = strchr(tech, '/');
|
||||
if (!number) {
|
||||
ast_log(LOG_WARNING, "ChanIsAvail argument takes format (Zap/[device])\n");
|
||||
continue;
|
||||
ast_log(LOG_WARNING, "ChanIsAvail argument takes format ([technology]/[device])\n");
|
||||
return -1;
|
||||
}
|
||||
*number = '\0';
|
||||
number++;
|
||||
|
2
apps/app_cut.c
Executable file → Normal file
2
apps/app_cut.c
Executable file → Normal file
@@ -85,6 +85,8 @@ static int cut_exec(struct ast_channel *chan, void *data)
|
||||
char *tmp2 = alloca(MAXRESULT);
|
||||
char retstring[MAXRESULT];
|
||||
|
||||
if (tmp2)
|
||||
memset(tmp2, 0, MAXRESULT);
|
||||
memset(retstring, 0, MAXRESULT);
|
||||
|
||||
if (tmp && tmp2) {
|
||||
|
0
apps/app_datetime.c
Executable file → Normal file
0
apps/app_datetime.c
Executable file → Normal file
0
apps/app_db.c
Executable file → Normal file
0
apps/app_db.c
Executable file → Normal file
31
apps/app_dial.c
Executable file → Normal file
31
apps/app_dial.c
Executable file → Normal file
@@ -49,10 +49,10 @@ static char *descrip =
|
||||
"which first answered. All other calls placed by the Dial app will be hung up\n"
|
||||
"If a timeout is not specified, the Dial application will wait indefinitely\n"
|
||||
"until either one of the called channels answers, the user hangs up, or all\n"
|
||||
"channels return busy or error. In general, the dialler will return 0 if it\n"
|
||||
"channels return busy or error. In general, the dialer will return 0 if it\n"
|
||||
"was unable to place the call, or the timeout expired. However, if all\n"
|
||||
"channels were busy, and there exists an extension with priority n+101 (where\n"
|
||||
"n is the priority of the dialler instance), then it will be the next\n"
|
||||
"n is the priority of the dialer instance), then it will be the next\n"
|
||||
"executed extension (this allows you to setup different behavior on busy from\n"
|
||||
"no-answer).\n"
|
||||
" This application returns -1 if the originating channel hangs up, or if the\n"
|
||||
@@ -69,7 +69,7 @@ static char *descrip =
|
||||
" 'A(x)' -- play an announcement to the called party, using x as file\n"
|
||||
" In addition to transferring the call, a call may be parked and then picked\n"
|
||||
"up by another user.\n"
|
||||
" The optionnal URL will be sent to the called party if the channel supports\n"
|
||||
" The optional URL will be sent to the called party if the channel supports\n"
|
||||
"it.\n";
|
||||
|
||||
/* We define a customer "local user" structure because we
|
||||
@@ -139,6 +139,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localu
|
||||
} else if (outgoing->ringbackonly) {
|
||||
ast_indicate(in, AST_CONTROL_RINGING);
|
||||
}
|
||||
sentringing++;
|
||||
}
|
||||
|
||||
while(*to && !peer) {
|
||||
@@ -171,7 +172,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localu
|
||||
/* if no one available we'd better stop MOH/ringing to */
|
||||
if (moh) {
|
||||
ast_moh_stop(in);
|
||||
} else if (ringind) {
|
||||
} else if (sentringing) {
|
||||
ast_indicate(in, -1);
|
||||
}
|
||||
return NULL;
|
||||
@@ -207,13 +208,19 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localu
|
||||
if (o->chan->callerid)
|
||||
free(o->chan->callerid);
|
||||
o->chan->callerid = malloc(strlen(in->callerid) + 1);
|
||||
strncpy(o->chan->callerid, in->callerid, strlen(in->callerid) + 1);
|
||||
if (o->chan->callerid)
|
||||
strncpy(o->chan->callerid, in->callerid, strlen(in->callerid) + 1);
|
||||
else
|
||||
ast_log(LOG_WARNING, "Out of memory\n");
|
||||
}
|
||||
if (in->ani) {
|
||||
if (o->chan->ani)
|
||||
free(o->chan->ani);
|
||||
o->chan->ani = malloc(strlen(in->ani) + 1);
|
||||
strncpy(o->chan->ani, in->ani, strlen(in->ani) + 1);
|
||||
if (o->chan->ani)
|
||||
strncpy(o->chan->ani, in->ani, strlen(in->ani) + 1);
|
||||
else
|
||||
ast_log(LOG_WARNING, "Out of memory\n");
|
||||
}
|
||||
if (ast_call(o->chan, tmpchan, 0)) {
|
||||
ast_log(LOG_NOTICE, "Failed to dial on local channel for call forward to '%s'\n", tmpchan);
|
||||
@@ -268,7 +275,6 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localu
|
||||
if (!sentringing && !moh) {
|
||||
ast_indicate(in, AST_CONTROL_RINGING);
|
||||
sentringing++;
|
||||
ringind++;
|
||||
}
|
||||
break;
|
||||
case AST_CONTROL_PROGRESS:
|
||||
@@ -280,9 +286,12 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localu
|
||||
/* Ignore going off hook */
|
||||
break;
|
||||
case -1:
|
||||
if (option_verbose > 2)
|
||||
ast_verbose( VERBOSE_PREFIX_3 "%s stopped sounds\n", o->chan->name);
|
||||
ast_indicate(in, -1);
|
||||
if (!ringind && !moh) {
|
||||
if (option_verbose > 2)
|
||||
ast_verbose( VERBOSE_PREFIX_3 "%s stopped sounds\n", o->chan->name);
|
||||
ast_indicate(in, -1);
|
||||
sentringing = 0;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ast_log(LOG_DEBUG, "Dunno what to do with control type %d\n", f->subclass);
|
||||
@@ -337,7 +346,7 @@ static struct ast_channel *wait_for_answer(struct ast_channel *in, struct localu
|
||||
}
|
||||
if (moh) {
|
||||
ast_moh_stop(in);
|
||||
} else if (ringind) {
|
||||
} else if (sentringing) {
|
||||
ast_indicate(in, -1);
|
||||
}
|
||||
|
||||
|
16
apps/app_directory.c
Executable file → Normal file
16
apps/app_directory.c
Executable file → Normal file
@@ -37,7 +37,8 @@ static char *descrip =
|
||||
"discovered from voicemail.conf. The context argument is required, and\n"
|
||||
"specifies the context in which to interpret the extensions. Returns 0\n"
|
||||
"unless the user hangs up. It also sets up the channel on exit to enter the\n"
|
||||
"extension the user selected.\n";
|
||||
"extension the user selected. Please note that the context must be the same\n"
|
||||
"as the section in voicemail.conf that the mailbox is processed from as well.\n";
|
||||
|
||||
/* For simplicity, I'm keeping the format compatible with the voicemail config,
|
||||
but i'm open to suggestions for isolating it */
|
||||
@@ -199,10 +200,15 @@ ahem:
|
||||
ast_stopstream(chan);
|
||||
if (res > -1) {
|
||||
if (res == '1') {
|
||||
strncpy(chan->exten, v->name, sizeof(chan->exten)-1);
|
||||
chan->priority = 0;
|
||||
strncpy(chan->context, context, sizeof(chan->context)-1);
|
||||
res = 0;
|
||||
if (ast_exists_extension(chan, context, v->name, 1, chan->callerid)) {
|
||||
strncpy(chan->exten, v->name, sizeof(chan->exten)-1);
|
||||
chan->priority = 0;
|
||||
strncpy(chan->context, context, sizeof(chan->context)-1);
|
||||
res = 0;
|
||||
} else {
|
||||
ast_log(LOG_WARNING, "Can't find extension '%s' in context '%s'. Did you pass the wrong context to Directory?\n", v->name, context);
|
||||
res = -1;
|
||||
}
|
||||
break;
|
||||
} else if (res == '*') {
|
||||
res = 0;
|
||||
|
0
apps/app_disa.c
Executable file → Normal file
0
apps/app_disa.c
Executable file → Normal file
0
apps/app_echo.c
Executable file → Normal file
0
apps/app_echo.c
Executable file → Normal file
0
apps/app_enumlookup.c
Executable file → Normal file
0
apps/app_enumlookup.c
Executable file → Normal file
3
apps/app_festival.c
Executable file → Normal file
3
apps/app_festival.c
Executable file → Normal file
@@ -5,7 +5,7 @@
|
||||
*
|
||||
* Copyright (C) 2002, Christos Ricudis
|
||||
*
|
||||
* Christos Ricudis <ricudis@paiko.gr>
|
||||
* Christos Ricudis <ricudis@itc.auth.gr>
|
||||
*
|
||||
* This program is free software, distributed under the terms of
|
||||
* the GNU General Public License
|
||||
@@ -376,6 +376,7 @@ static int festival_exec(struct ast_channel *chan, void *vdata)
|
||||
if (strlen((char *)data)==strln) {
|
||||
ast_log(LOG_DEBUG,"Size OK\n");
|
||||
read(fdesc,&bigstring,strln);
|
||||
bigstring[strln] = 0;
|
||||
if (strcmp(bigstring,data)==0) {
|
||||
readcache=1;
|
||||
} else {
|
||||
|
0
apps/app_flash.c
Executable file → Normal file
0
apps/app_flash.c
Executable file → Normal file
0
apps/app_getcpeid.c
Executable file → Normal file
0
apps/app_getcpeid.c
Executable file → Normal file
0
apps/app_hasnewvoicemail.c
Executable file → Normal file
0
apps/app_hasnewvoicemail.c
Executable file → Normal file
0
apps/app_image.c
Executable file → Normal file
0
apps/app_image.c
Executable file → Normal file
0
apps/app_intercom.c
Executable file → Normal file
0
apps/app_intercom.c
Executable file → Normal file
0
apps/app_lookupblacklist.c
Executable file → Normal file
0
apps/app_lookupblacklist.c
Executable file → Normal file
0
apps/app_lookupcidname.c
Executable file → Normal file
0
apps/app_lookupcidname.c
Executable file → Normal file
2
apps/app_macro.c
Executable file → Normal file
2
apps/app_macro.c
Executable file → Normal file
@@ -202,7 +202,7 @@ out:
|
||||
/* If we're leaving the macro normally, restore original information */
|
||||
chan->priority = oldpriority;
|
||||
strncpy(chan->context, oldcontext, sizeof(chan->context) - 1);
|
||||
if (!chan->_softhangup) {
|
||||
if (!(chan->_softhangup & AST_SOFTHANGUP_ASYNCGOTO)) {
|
||||
/* Copy the extension, so long as we're not in softhangup, where we could be given an asyncgoto */
|
||||
strncpy(chan->exten, oldexten, sizeof(chan->exten) - 1);
|
||||
if ((offsets = pbx_builtin_getvar_helper(chan, "MACRO_OFFSET"))) {
|
||||
|
0
apps/app_meetme.c
Executable file → Normal file
0
apps/app_meetme.c
Executable file → Normal file
0
apps/app_milliwatt.c
Executable file → Normal file
0
apps/app_milliwatt.c
Executable file → Normal file
0
apps/app_mp3.c
Executable file → Normal file
0
apps/app_mp3.c
Executable file → Normal file
15
apps/app_parkandannounce.c
Executable file → Normal file
15
apps/app_parkandannounce.c
Executable file → Normal file
@@ -68,13 +68,17 @@ static int parkandannounce_exec(struct ast_channel *chan, void *data)
|
||||
int outstate;
|
||||
|
||||
struct localuser *u;
|
||||
if (!data) {
|
||||
ast_log(LOG_WARNING, "Park requires an argument (parkinglot)\n");
|
||||
if (!data || (data && !strlen(data))) {
|
||||
ast_log(LOG_WARNING, "ParkAndAnnounce requires arguments: (announce:template|timeout|dial|[return_context])\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
l=strlen(data)+2;
|
||||
orig_s=malloc(l);
|
||||
if (!orig_s) {
|
||||
ast_log(LOG_WARNING, "Out of memory\n");
|
||||
return -1;
|
||||
}
|
||||
s=orig_s;
|
||||
strncpy(s,data,l);
|
||||
|
||||
@@ -85,9 +89,10 @@ static int parkandannounce_exec(struct ast_channel *chan, void *data)
|
||||
return -1;
|
||||
}
|
||||
|
||||
timeout = atoi(strsep(&s, "|"));
|
||||
timeout *= 1000;
|
||||
|
||||
if (s) {
|
||||
timeout = atoi(strsep(&s, "|"));
|
||||
timeout *= 1000;
|
||||
}
|
||||
dial=strsep(&s, "|");
|
||||
if (! dial) {
|
||||
ast_log(LOG_WARNING, "PARK: A dial resouce must be specified i.e: Console/dsp or Zap/g1/5551212\n");
|
||||
|
0
apps/app_playback.c
Executable file → Normal file
0
apps/app_playback.c
Executable file → Normal file
0
apps/app_privacy.c
Executable file → Normal file
0
apps/app_privacy.c
Executable file → Normal file
0
apps/app_qcall.c
Executable file → Normal file
0
apps/app_qcall.c
Executable file → Normal file
67
apps/app_queue.c
Executable file → Normal file
67
apps/app_queue.c
Executable file → Normal file
@@ -78,7 +78,7 @@ static char *descrip =
|
||||
" 'n' -- no retries on the timeout; will exit this application and go to the next step.\n"
|
||||
" In addition to transferring the call, a call may be parked and then picked\n"
|
||||
"up by another user.\n"
|
||||
" The optionnal URL will be sent to the called party if the channel supports\n"
|
||||
" The optional URL will be sent to the called party if the channel supports\n"
|
||||
"it.\n";
|
||||
|
||||
// [PHM 06/26/03]
|
||||
@@ -482,7 +482,7 @@ static struct localuser *wait_for_answer(struct queue_ent *qe, struct localuser
|
||||
if (numlines == numbusies) {
|
||||
ast_log(LOG_DEBUG, "Everyone is busy at this time\n");
|
||||
} else {
|
||||
ast_log(LOG_NOTICE, "No one is answered queue %s\n", queue);
|
||||
ast_log(LOG_NOTICE, "No one is answering queue '%s'\n", queue);
|
||||
}
|
||||
*to = 0;
|
||||
return NULL;
|
||||
@@ -1344,7 +1344,7 @@ static void reload_queues(void)
|
||||
ast_mutex_unlock(&qlock);
|
||||
}
|
||||
|
||||
static int queues_show(int fd, int argc, char **argv)
|
||||
static int __queues_show(int fd, int argc, char **argv, int queue_show)
|
||||
{
|
||||
struct ast_call_queue *q;
|
||||
struct queue_ent *qe;
|
||||
@@ -1353,19 +1353,32 @@ static int queues_show(int fd, int argc, char **argv)
|
||||
time_t now;
|
||||
char max[80];
|
||||
char calls[80];
|
||||
|
||||
time(&now);
|
||||
if (argc != 2)
|
||||
if ((!queue_show && argc != 2) || (queue_show && argc != 3))
|
||||
return RESULT_SHOWUSAGE;
|
||||
ast_mutex_lock(&qlock);
|
||||
q = queues;
|
||||
if (!q) {
|
||||
ast_mutex_unlock(&qlock);
|
||||
ast_cli(fd, "No queues.\n");
|
||||
if (queue_show)
|
||||
ast_cli(fd, "No such queue: %s.\n",argv[2]);
|
||||
else
|
||||
ast_cli(fd, "No queues.\n");
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
while(q) {
|
||||
ast_mutex_lock(&q->lock);
|
||||
if (queue_show) {
|
||||
if (strcasecmp(q->name, argv[2]) != 0) {
|
||||
ast_mutex_unlock(&q->lock);
|
||||
q = q->next;
|
||||
if (!q) {
|
||||
ast_cli(fd, "No such queue: %s.\n",argv[2]);
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (q->maxlen)
|
||||
snprintf(max, sizeof(max), "%d", q->maxlen);
|
||||
else
|
||||
@@ -1400,11 +1413,41 @@ static int queues_show(int fd, int argc, char **argv)
|
||||
ast_cli(fd, "\n");
|
||||
ast_mutex_unlock(&q->lock);
|
||||
q = q->next;
|
||||
if (queue_show)
|
||||
break;
|
||||
}
|
||||
ast_mutex_unlock(&qlock);
|
||||
return RESULT_SUCCESS;
|
||||
}
|
||||
|
||||
static int queues_show(int fd, int argc, char **argv)
|
||||
{
|
||||
return __queues_show(fd, argc, argv, 0);
|
||||
}
|
||||
|
||||
static int queue_show(int fd, int argc, char **argv)
|
||||
{
|
||||
return __queues_show(fd, argc, argv, 1);
|
||||
}
|
||||
|
||||
static char *complete_queue(char *line, char *word, int pos, int state)
|
||||
{
|
||||
struct ast_call_queue *q;
|
||||
int which=0;
|
||||
|
||||
ast_mutex_lock(&qlock);
|
||||
q = queues;
|
||||
while(q) {
|
||||
if (!strncasecmp(word, q->name, strlen(word))) {
|
||||
if (++which > state)
|
||||
break;
|
||||
}
|
||||
q = q->next;
|
||||
}
|
||||
ast_mutex_unlock(&qlock);
|
||||
return q ? strdup(q->name) : NULL;
|
||||
}
|
||||
|
||||
/* JDG: callback to display queues status in manager */
|
||||
static int manager_queues_show( struct mansession *s, struct message *m )
|
||||
{
|
||||
@@ -1469,12 +1512,23 @@ static struct ast_cli_entry cli_show_queues = {
|
||||
{ "show", "queues", NULL }, queues_show,
|
||||
"Show status of queues", show_queues_usage, NULL };
|
||||
|
||||
static char show_queue_usage[] =
|
||||
"Usage: show queue\n"
|
||||
" Provides summary information on a specified queue.\n";
|
||||
|
||||
static struct ast_cli_entry cli_show_queue = {
|
||||
{ "show", "queue", NULL }, queue_show,
|
||||
"Show status of a specified queue", show_queue_usage, complete_queue };
|
||||
|
||||
int unload_module(void)
|
||||
{
|
||||
STANDARD_HANGUP_LOCALUSERS;
|
||||
ast_cli_unregister(&cli_show_queue);
|
||||
ast_cli_unregister(&cli_show_queues);
|
||||
ast_manager_unregister( "Queues" );
|
||||
ast_manager_unregister( "QueueStatus" );
|
||||
ast_unregister_application(app_aqm);
|
||||
ast_unregister_application(app_rqm);
|
||||
return ast_unregister_application(app);
|
||||
}
|
||||
|
||||
@@ -1483,6 +1537,7 @@ int load_module(void)
|
||||
int res;
|
||||
res = ast_register_application(app, queue_exec, synopsis, descrip);
|
||||
if (!res) {
|
||||
ast_cli_register(&cli_show_queue);
|
||||
ast_cli_register(&cli_show_queues);
|
||||
ast_manager_register( "Queues", 0, manager_queues_show, "Queues" );
|
||||
ast_manager_register( "QueueStatus", 0, manager_queues_status, "Queue Status" );
|
||||
|
4
apps/app_random.c
Executable file → Normal file
4
apps/app_random.c
Executable file → Normal file
@@ -42,7 +42,7 @@ static int random_exec(struct ast_channel *chan, void *data)
|
||||
int res=0;
|
||||
struct localuser *u;
|
||||
|
||||
char *s, *ts;
|
||||
char *s;
|
||||
char *exten, *pri, *context;
|
||||
char *prob;
|
||||
int probint, priorityint;
|
||||
@@ -54,7 +54,7 @@ static int random_exec(struct ast_channel *chan, void *data)
|
||||
LOCAL_USER_ADD(u);
|
||||
s = ast_strdupa((void *) data);
|
||||
|
||||
prob = strsep(&ts,":");
|
||||
prob = strsep(&s,":");
|
||||
if ((!prob) || (sscanf(prob, "%d", &probint) != 1))
|
||||
probint = 0;
|
||||
|
||||
|
0
apps/app_read.c
Executable file → Normal file
0
apps/app_read.c
Executable file → Normal file
6
apps/app_record.c
Executable file → Normal file
6
apps/app_record.c
Executable file → Normal file
@@ -30,13 +30,13 @@ static char *app = "Record";
|
||||
static char *synopsis = "Record to a file";
|
||||
|
||||
static char *descrip =
|
||||
" Record(filename:extension|silence): Records from the channel into a given\n"
|
||||
" Record(filename:format|silence): Records from the channel into a given\n"
|
||||
"filename. If the file exists it will be overwritten. \n"
|
||||
"- 'extension' is the extension of the file type to be recorded (wav, gsm, etc).\n"
|
||||
"- 'format' is the format of the file type to be recorded (wav, gsm, etc).\n"
|
||||
"- 'silence' is the number of seconds of silence to allow before returning.\n\n"
|
||||
"If filename contains '%d', these characters will be replaced with a number\n"
|
||||
"incremented by one each time the file is recorded. \n\n"
|
||||
"Extensions: g723, g729, gsm, h263, ulaw, alaw, vox, wav, WAV\n\n"
|
||||
"Formats: g723, g729, gsm, h263, ulaw, alaw, vox, wav, WAV\n\n"
|
||||
"Returns -1 when the user hangs up.\n";
|
||||
|
||||
STANDARD_LOCAL_USER;
|
||||
|
0
apps/app_rpt.c
Executable file → Normal file
0
apps/app_rpt.c
Executable file → Normal file
0
apps/app_sayunixtime.c
Executable file → Normal file
0
apps/app_sayunixtime.c
Executable file → Normal file
0
apps/app_senddtmf.c
Executable file → Normal file
0
apps/app_senddtmf.c
Executable file → Normal file
0
apps/app_setcallerid.c
Executable file → Normal file
0
apps/app_setcallerid.c
Executable file → Normal file
0
apps/app_setcdruserfield.c
Executable file → Normal file
0
apps/app_setcdruserfield.c
Executable file → Normal file
0
apps/app_setcidname.c
Executable file → Normal file
0
apps/app_setcidname.c
Executable file → Normal file
0
apps/app_setcidnum.c
Executable file → Normal file
0
apps/app_setcidnum.c
Executable file → Normal file
0
apps/app_skel.c
Executable file → Normal file
0
apps/app_skel.c
Executable file → Normal file
0
apps/app_softhangup.c
Executable file → Normal file
0
apps/app_softhangup.c
Executable file → Normal file
2
apps/app_sql_postgres.c
Executable file → Normal file
2
apps/app_sql_postgres.c
Executable file → Normal file
@@ -5,7 +5,7 @@
|
||||
*
|
||||
* Copyright (C) 2002, Christos Ricudis
|
||||
*
|
||||
* Christos Ricudis <ricudis@paiko.gr>
|
||||
* Christos Ricudis <ricudis@itc.auth.gr>
|
||||
*
|
||||
* This program is free software, distributed under the terms of
|
||||
* the GNU General Public License
|
||||
|
0
apps/app_striplsd.c
Executable file → Normal file
0
apps/app_striplsd.c
Executable file → Normal file
0
apps/app_substring.c
Executable file → Normal file
0
apps/app_substring.c
Executable file → Normal file
5
apps/app_system.c
Executable file → Normal file
5
apps/app_system.c
Executable file → Normal file
@@ -21,6 +21,7 @@
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
@@ -53,13 +54,15 @@ static int system_exec(struct ast_channel *chan, void *data)
|
||||
LOCAL_USER_ADD(u);
|
||||
/* Do our thing here */
|
||||
res = system((char *)data);
|
||||
if (res < 0) {
|
||||
if ((res < 0) && (errno != ECHILD)) {
|
||||
ast_log(LOG_WARNING, "Unable to execute '%s'\n", (char *)data);
|
||||
res = -1;
|
||||
} else if (res == 127) {
|
||||
ast_log(LOG_WARNING, "Unable to execute '%s'\n", (char *)data);
|
||||
res = -1;
|
||||
} else {
|
||||
if (res < 0)
|
||||
res = 0;
|
||||
if (res && ast_exists_extension(chan, chan->context, chan->exten, chan->priority + 101, chan->callerid))
|
||||
chan->priority+=100;
|
||||
res = 0;
|
||||
|
0
apps/app_transfer.c
Executable file → Normal file
0
apps/app_transfer.c
Executable file → Normal file
0
apps/app_url.c
Executable file → Normal file
0
apps/app_url.c
Executable file → Normal file
108
apps/app_voicemail.c
Executable file → Normal file
108
apps/app_voicemail.c
Executable file → Normal file
@@ -148,12 +148,14 @@ static char *synopsis_vm =
|
||||
|
||||
static char *descrip_vm =
|
||||
" VoiceMail([s|u|b]extension[@context]): Leaves voicemail for a given\n"
|
||||
"extension (must be configured in voicemail.conf). If the extension is\n"
|
||||
"preceded by an 's' then instructions for leaving the message will be\n"
|
||||
"skipped. If the extension is preceeded by 'u' then the \"unavailable\"\n"
|
||||
"message will be played (/var/lib/asterisk/sounds/vm/<exten>/unavail) if it\n"
|
||||
"exists. If the extension is preceeded by a 'b' then the the busy message\n"
|
||||
"will be played (that is, busy instead of unavail).\n"
|
||||
"extension (must be configured in voicemail.conf). \n"
|
||||
" If the extension is preceded by \n"
|
||||
"* 's' instructions for leaving the message will be skipped.\n"
|
||||
"* 'u' the \"unavailable\" message will be played \n"
|
||||
" (/var/lib/asterisk/sounds/vm/<exten>/unavail) if it exists.\n"
|
||||
"* 'b' the busy message will be played (that is, busy instead of unavail).\n"
|
||||
"If the caller presses '0' (zero) during the prompt, the call jumps to\n"
|
||||
"priority 'o' in the current context.\n"
|
||||
"If the requested mailbox does not exist, and there exists a priority\n"
|
||||
"n + 101, then that priority will be taken next.\n"
|
||||
"Returns -1 on error or mailbox not found, or if the user hangs up.\n"
|
||||
@@ -167,7 +169,7 @@ static char *descrip_vmain =
|
||||
"for the checking of voicemail. The mailbox can be passed as the option,\n"
|
||||
"which will stop the voicemail system from prompting the user for the mailbox.\n"
|
||||
"If the mailbox is preceded by 's' then the password check will be skipped. If\n"
|
||||
"a context is specified, logins are considered in that context only.\n"
|
||||
"a context is specified, logins are considered in that voicemail context only.\n"
|
||||
"Returns -1 if the user hangs up or 0 otherwise.\n";
|
||||
|
||||
/* Leave a message */
|
||||
@@ -450,11 +452,14 @@ static void vm_change_password(struct ast_vm_user *vmu, char *newpassword)
|
||||
|
||||
FILE *configin;
|
||||
FILE *configout;
|
||||
int linenum=0;
|
||||
char inbuf[256];
|
||||
char orig[256];
|
||||
char currcontext[256] ="";
|
||||
char tmpin[AST_CONFIG_MAX_PATH];
|
||||
char tmpout[AST_CONFIG_MAX_PATH];
|
||||
char *user, *pass, *rest, *trim;
|
||||
char *user, *pass, *rest, *trim, *tempcontext;
|
||||
tempcontext = NULL;
|
||||
snprintf((char *)tmpin, sizeof(tmpin)-1, "%s/voicemail.conf",(char *)ast_config_AST_CONFIG_DIR);
|
||||
snprintf((char *)tmpout, sizeof(tmpout)-1, "%s/voicemail.conf.new",(char *)ast_config_AST_CONFIG_DIR);
|
||||
configin = fopen((char *)tmpin,"r");
|
||||
@@ -477,6 +482,7 @@ static void vm_change_password(struct ast_vm_user *vmu, char *newpassword)
|
||||
while (!feof(configin)) {
|
||||
/* Read in the line */
|
||||
fgets(inbuf, sizeof(inbuf), configin);
|
||||
linenum++;
|
||||
if (!feof(configin)) {
|
||||
/* Make a backup of it */
|
||||
memcpy(orig, inbuf, sizeof(orig));
|
||||
@@ -488,6 +494,18 @@ static void vm_change_password(struct ast_vm_user *vmu, char *newpassword)
|
||||
user=inbuf;
|
||||
while(*user < 33)
|
||||
user++;
|
||||
/* check for '[' (opening of context name ) */
|
||||
tempcontext = strchr(user, '[');
|
||||
if (tempcontext) {
|
||||
strncpy(currcontext, tempcontext +1,
|
||||
sizeof(currcontext) - 1);
|
||||
/* now check for ']' */
|
||||
tempcontext = strchr(currcontext, ']');
|
||||
if (tempcontext)
|
||||
*tempcontext = '\0';
|
||||
else
|
||||
currcontext[0] = '\0';
|
||||
}
|
||||
pass = strchr(user, '=');
|
||||
if (pass > user) {
|
||||
trim = pass - 1;
|
||||
@@ -512,7 +530,11 @@ static void vm_change_password(struct ast_vm_user *vmu, char *newpassword)
|
||||
}
|
||||
} else
|
||||
rest = NULL;
|
||||
if (user && pass && *user && *pass && !strcmp(user, vmu->mailbox) && !strcmp(pass, vmu->password)) {
|
||||
|
||||
/* Compare user, pass AND context */
|
||||
if (user && *user && !strcmp(user, vmu->mailbox) &&
|
||||
pass && *pass && !strcmp(pass, vmu->password) &&
|
||||
currcontext && *currcontext && !strcmp(currcontext, vmu->context)) {
|
||||
/* This is the line */
|
||||
if (rest) {
|
||||
fprintf(configout, "%s => %s,%s\n", vmu->mailbox,newpassword,rest);
|
||||
@@ -741,7 +763,7 @@ static int sendmail(char *srcemail, struct ast_vm_user *vmu, int msgnum, char *m
|
||||
|
||||
fprintf(p, "--%s\n", bound);
|
||||
}
|
||||
fprintf(p, "Content-Type: text/plain; charset=ISO-8859-1\nContent-Transfer-Encoding: 8bit\n");
|
||||
fprintf(p, "Content-Type: text/plain; charset=ISO-8859-1\nContent-Transfer-Encoding: 8bit\n\n");
|
||||
strftime(date, sizeof(date), "%A, %B %d, %Y at %r", &tm);
|
||||
if (emailbody) {
|
||||
struct ast_channel *ast = ast_channel_alloc(0);
|
||||
@@ -1318,6 +1340,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, int silent, int
|
||||
FILE *txt;
|
||||
int res = 0;
|
||||
int msgnum;
|
||||
int fd;
|
||||
char date[256];
|
||||
char dir[256];
|
||||
char fn[256];
|
||||
@@ -1453,11 +1476,15 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, int silent, int
|
||||
res = play_and_record(chan, NULL, fn, vmmaxmessage, fmt);
|
||||
if (res > 0)
|
||||
res = 0;
|
||||
txt = fopen(txtfile, "a");
|
||||
if (txt) {
|
||||
time(&end);
|
||||
fprintf(txt, "duration=%ld\n", (long)(end-start));
|
||||
fclose(txt);
|
||||
fd = open(txtfile, O_APPEND | O_WRONLY);
|
||||
if (fd > -1) {
|
||||
txt = fdopen(fd, "a");
|
||||
if (txt) {
|
||||
time(&end);
|
||||
fprintf(txt, "duration=%ld\n", (long)(end-start));
|
||||
fclose(txt);
|
||||
} else
|
||||
close(fd);
|
||||
}
|
||||
stringp = fmt;
|
||||
strsep(&stringp, "|");
|
||||
@@ -2244,7 +2271,7 @@ static int forward_message(struct ast_channel *chan, char *context, char *dir, i
|
||||
system(sys);
|
||||
|
||||
todircount = count_messages(todir);
|
||||
strncpy(tmp, fmt, sizeof(tmp));
|
||||
strncpy(tmp, fmt, sizeof(tmp) - 1);
|
||||
stringp = tmp;
|
||||
while((s = strsep(&stringp, "|"))) {
|
||||
/* XXX This is a hack -- we should use build_filename or similar XXX */
|
||||
@@ -2556,9 +2583,7 @@ static int vm_instructions(struct ast_channel *chan, struct vm_state *vms)
|
||||
if (!res) {
|
||||
vms->repeats++;
|
||||
if (vms->repeats > 2) {
|
||||
res = play_and_wait(chan, "vm-goodbye");
|
||||
if (!res)
|
||||
res = 't';
|
||||
res = 't';
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2994,22 +3019,22 @@ static int append_mailbox(char *context, char *mbox, char *data)
|
||||
char *stringp;
|
||||
char *s;
|
||||
struct ast_vm_user *vmu;
|
||||
strncpy(tmp, data, sizeof(tmp));
|
||||
strncpy(tmp, data, sizeof(tmp) - 1);
|
||||
vmu = malloc(sizeof(struct ast_vm_user));
|
||||
if (vmu) {
|
||||
memset(vmu, 0, sizeof(struct ast_vm_user));
|
||||
strncpy(vmu->context, context, sizeof(vmu->context));
|
||||
strncpy(vmu->mailbox, mbox, sizeof(vmu->mailbox));
|
||||
strncpy(vmu->context, context, sizeof(vmu->context) - 1);
|
||||
strncpy(vmu->mailbox, mbox, sizeof(vmu->mailbox) - 1);
|
||||
vmu->attach = -1;
|
||||
stringp = tmp;
|
||||
if ((s = strsep(&stringp, ",")))
|
||||
strncpy(vmu->password, s, sizeof(vmu->password));
|
||||
strncpy(vmu->password, s, sizeof(vmu->password) - 1);
|
||||
if (stringp && (s = strsep(&stringp, ",")))
|
||||
strncpy(vmu->fullname, s, sizeof(vmu->fullname));
|
||||
strncpy(vmu->fullname, s, sizeof(vmu->fullname) - 1);
|
||||
if (stringp && (s = strsep(&stringp, ",")))
|
||||
strncpy(vmu->email, s, sizeof(vmu->email));
|
||||
strncpy(vmu->email, s, sizeof(vmu->email) - 1);
|
||||
if (stringp && (s = strsep(&stringp, ",")))
|
||||
strncpy(vmu->pager, s, sizeof(vmu->pager));
|
||||
strncpy(vmu->pager, s, sizeof(vmu->pager) - 1);
|
||||
if (stringp && (s = strsep(&stringp, ",")))
|
||||
apply_options(vmu, s);
|
||||
vmu->next = NULL;
|
||||
@@ -3022,6 +3047,7 @@ static int append_mailbox(char *context, char *mbox, char *data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef USEMYSQLVM
|
||||
/* XXX TL Bug 690 */
|
||||
static char show_voicemail_users_help[] =
|
||||
"Usage: show voicemail users [for <context>]\n"
|
||||
@@ -3143,7 +3169,7 @@ static struct ast_cli_entry show_voicemail_zones_cli =
|
||||
{ { "show", "voicemail", "zones", NULL },
|
||||
handle_show_voicemail_zones, "List zone message formats",
|
||||
show_voicemail_zones_help, NULL };
|
||||
|
||||
#endif
|
||||
|
||||
static int load_config(void)
|
||||
{
|
||||
@@ -3167,6 +3193,7 @@ static int load_config(void)
|
||||
while(cur) {
|
||||
l = cur;
|
||||
cur = cur->next;
|
||||
l->alloced = 1;
|
||||
free_user(l);
|
||||
}
|
||||
zcur = zones;
|
||||
@@ -3301,16 +3328,21 @@ static int load_config(void)
|
||||
msg_format = ast_strdupa(var->value);
|
||||
if (msg_format != NULL) {
|
||||
timezone = strsep(&msg_format, "|");
|
||||
strncpy(z->name, var->name, sizeof(z->name) - 1);
|
||||
strncpy(z->timezone, timezone, sizeof(z->timezone) - 1);
|
||||
strncpy(z->msg_format, msg_format, sizeof(z->msg_format) - 1);
|
||||
z->next = NULL;
|
||||
if (zones) {
|
||||
zonesl->next = z;
|
||||
zonesl = z;
|
||||
if (msg_format) {
|
||||
strncpy(z->name, var->name, sizeof(z->name) - 1);
|
||||
strncpy(z->timezone, timezone, sizeof(z->timezone) - 1);
|
||||
strncpy(z->msg_format, msg_format, sizeof(z->msg_format) - 1);
|
||||
z->next = NULL;
|
||||
if (zones) {
|
||||
zonesl->next = z;
|
||||
zonesl = z;
|
||||
} else {
|
||||
zones = z;
|
||||
zonesl = z;
|
||||
}
|
||||
} else {
|
||||
zones = z;
|
||||
zonesl = z;
|
||||
ast_log(LOG_WARNING, "Invalid timezone definition at line %d\n", var->lineno);
|
||||
free(z);
|
||||
}
|
||||
} else {
|
||||
ast_log(LOG_WARNING, "Out of memory while reading voicemail config\n");
|
||||
@@ -3386,8 +3418,10 @@ int unload_module(void)
|
||||
res |= ast_unregister_application(app2);
|
||||
res |= ast_unregister_application(capp2);
|
||||
sql_close();
|
||||
#ifndef USEMYSQLVM
|
||||
ast_cli_unregister(&show_voicemail_users_cli);
|
||||
ast_cli_unregister(&show_voicemail_zones_cli);
|
||||
#endif
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -3409,8 +3443,10 @@ int load_module(void)
|
||||
ast_log(LOG_WARNING, "SQL init\n");
|
||||
return res;
|
||||
}
|
||||
#ifndef USEMYSQLVM
|
||||
ast_cli_register(&show_voicemail_users_cli);
|
||||
ast_cli_register(&show_voicemail_zones_cli);
|
||||
#endif
|
||||
return res;
|
||||
}
|
||||
|
||||
|
2
apps/app_waitforring.c
Executable file → Normal file
2
apps/app_waitforring.c
Executable file → Normal file
@@ -48,7 +48,7 @@ static int waitforring_exec(struct ast_channel *chan, void *data)
|
||||
int res = 0;
|
||||
int ms;
|
||||
if (!data || (sscanf(data, "%d", &ms) != 1)) {
|
||||
ast_log(LOG_WARNING, "SoftHangup requires an argument (minimum seconds)\n");
|
||||
ast_log(LOG_WARNING, "WaitForRing requires an argument (minimum seconds)\n");
|
||||
return 0;
|
||||
}
|
||||
ms *= 1000;
|
||||
|
0
apps/app_zapateller.c
Executable file → Normal file
0
apps/app_zapateller.c
Executable file → Normal file
0
apps/app_zapbarge.c
Executable file → Normal file
0
apps/app_zapbarge.c
Executable file → Normal file
2
apps/app_zapras.c
Executable file → Normal file
2
apps/app_zapras.c
Executable file → Normal file
@@ -44,7 +44,7 @@ static char *synopsis = "Executes Zaptel ISDN RAS application";
|
||||
static char *descrip =
|
||||
" ZapRAS(args): Executes a RAS server using pppd on the given channel.\n"
|
||||
"The channel must be a clear channel (i.e. PRI source) and a Zaptel\n"
|
||||
"channel to be able to use this function (No modem emulcation is included).\n"
|
||||
"channel to be able to use this function (No modem emulation is included).\n"
|
||||
"Your pppd must be patched to be zaptel aware. Arguments should be\n"
|
||||
"separated by | characters. Always returns -1.\n";
|
||||
|
||||
|
20
apps/app_zapscan.c
Executable file → Normal file
20
apps/app_zapscan.c
Executable file → Normal file
@@ -43,8 +43,8 @@ static char *app = "ZapScan";
|
||||
static char *synopsis = "Scan Zap channels to monitor calls";
|
||||
|
||||
static char *descrip =
|
||||
" ZapScan allows a call center manager to monitor\n"
|
||||
"phone conversations in a convenient way.";
|
||||
" ZapScan allows a call center manager to monitor Zap channels in\n"
|
||||
"a convenient way. Use '#' to select the next channel and use '*' to exit\n";
|
||||
|
||||
|
||||
STANDARD_LOCAL_USER;
|
||||
@@ -191,6 +191,9 @@ zapretry:
|
||||
if ((f->frametype == AST_FRAME_DTMF) && (f->subclass == '#')) {
|
||||
ret = 0;
|
||||
break;
|
||||
} else if ((f->frametype == AST_FRAME_DTMF) && (f->subclass == '*')) {
|
||||
ret = -1;
|
||||
break;
|
||||
} else if (fd != chan->fds[0]) {
|
||||
if (f->frametype == AST_FRAME_VOICE) {
|
||||
if (f->subclass == AST_FORMAT_ULAW) {
|
||||
@@ -245,6 +248,7 @@ static int conf_exec(struct ast_channel *chan, void *data)
|
||||
int confno = 0;
|
||||
char confstr[80], *tmp;
|
||||
struct ast_channel *tempchan = NULL, *lastchan = NULL;
|
||||
struct ast_frame *f;
|
||||
|
||||
LOCAL_USER_ADD(u);
|
||||
|
||||
@@ -252,10 +256,20 @@ static int conf_exec(struct ast_channel *chan, void *data)
|
||||
ast_answer(chan);
|
||||
|
||||
for (;;) {
|
||||
if (ast_waitfor(chan, 100) < 0)
|
||||
break;
|
||||
f = ast_read(chan);
|
||||
if (!f)
|
||||
break;
|
||||
if ((f->frametype == AST_FRAME_DTMF) && (f->subclass == '*')) {
|
||||
ast_frfree(f);
|
||||
break;
|
||||
}
|
||||
ast_frfree(f);
|
||||
tempchan = ast_channel_walk(tempchan);
|
||||
if ( !tempchan && !lastchan )
|
||||
break;
|
||||
if ( tempchan && (!strcmp(tempchan->type, "Zap")) && (tempchan != chan) ) {
|
||||
if ( tempchan && tempchan->type && (!strcmp(tempchan->type, "Zap")) && (tempchan != chan) ) {
|
||||
ast_verbose(VERBOSE_PREFIX_3 "Zap channel %s is in-use, monitoring...\n", tempchan->name);
|
||||
strcpy(confstr, tempchan->name);
|
||||
if ((tmp = strchr(confstr,'-'))) {
|
||||
|
0
apps/enter.h
Executable file → Normal file
0
apps/enter.h
Executable file → Normal file
0
apps/leave.h
Executable file → Normal file
0
apps/leave.h
Executable file → Normal file
0
ast_expr.y
Executable file → Normal file
0
ast_expr.y
Executable file → Normal file
49
asterisk.c
Executable file → Normal file
49
asterisk.c
Executable file → Normal file
@@ -34,7 +34,7 @@
|
||||
#include <signal.h>
|
||||
#include <sched.h>
|
||||
#include <asterisk/io.h>
|
||||
#include <pthread.h>
|
||||
#include <asterisk/lock.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
#include <sys/select.h>
|
||||
@@ -65,7 +65,7 @@ int fully_booted = 0;
|
||||
|
||||
static int ast_socket = -1; /* UNIX Socket for allowing remote control */
|
||||
static int ast_consock = -1; /* UNIX Socket for controlling another asterisk */
|
||||
static int mainpid;
|
||||
int ast_mainpid;
|
||||
struct console {
|
||||
int fd; /* File descriptor */
|
||||
int p[2]; /* Pipe */
|
||||
@@ -106,6 +106,11 @@ char ast_config_AST_PID[AST_CONFIG_MAX_PATH];
|
||||
char ast_config_AST_SOCKET[AST_CONFIG_MAX_PATH];
|
||||
char ast_config_AST_RUN_DIR[AST_CONFIG_MAX_PATH];
|
||||
|
||||
static char *_argv[256];
|
||||
static int shuttingdown = 0;
|
||||
static int restartnow = 0;
|
||||
static pthread_t consolethread = AST_PTHREADT_NULL;
|
||||
|
||||
int ast_register_atexit(void (*func)(void))
|
||||
{
|
||||
int res = -1;
|
||||
@@ -191,7 +196,7 @@ static void *netconsole(void *vconsole)
|
||||
|
||||
if (gethostname(hostname, sizeof(hostname)))
|
||||
strncpy(hostname, "<Unknown>", sizeof(hostname)-1);
|
||||
snprintf(tmp, sizeof(tmp), "%s/%d/%s\n", hostname, mainpid, ASTERISK_VERSION);
|
||||
snprintf(tmp, sizeof(tmp), "%s/%d/%s\n", hostname, ast_mainpid, ASTERISK_VERSION);
|
||||
fdprint(con->fd, tmp);
|
||||
for(;;) {
|
||||
FD_ZERO(&rfds);
|
||||
@@ -252,13 +257,15 @@ static void *listener(void *unused)
|
||||
FD_SET(ast_socket, &fds);
|
||||
s = ast_select(ast_socket + 1, &fds, NULL, NULL, NULL);
|
||||
if (s < 0) {
|
||||
ast_log(LOG_WARNING, "Select retured error: %s\n", strerror(errno));
|
||||
if (errno != EINTR)
|
||||
ast_log(LOG_WARNING, "Select returned error: %s\n", strerror(errno));
|
||||
continue;
|
||||
}
|
||||
len = sizeof(sun);
|
||||
s = accept(ast_socket, (struct sockaddr *)&sun, &len);
|
||||
if (s < 0) {
|
||||
ast_log(LOG_WARNING, "Accept retured %d: %s\n", s, strerror(errno));
|
||||
if (errno != EINTR)
|
||||
ast_log(LOG_WARNING, "Accept returned %d: %s\n", s, strerror(errno));
|
||||
} else {
|
||||
for (x=0;x<AST_MAX_CONNECTS;x++) {
|
||||
if (consoles[x].fd < 0) {
|
||||
@@ -365,6 +372,8 @@ static void hup_handler(int num)
|
||||
{
|
||||
if (option_verbose > 1)
|
||||
printf("Received HUP signal -- Reloading configs\n");
|
||||
if (restartnow)
|
||||
execvp(_argv[0], _argv);
|
||||
/* XXX This could deadlock XXX */
|
||||
ast_module_reload();
|
||||
}
|
||||
@@ -436,10 +445,6 @@ static int set_priority(int pri)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static char *_argv[256];
|
||||
|
||||
static int shuttingdown = 0;
|
||||
|
||||
static void ast_run_atexits(void)
|
||||
{
|
||||
struct ast_atexit *ae;
|
||||
@@ -536,7 +541,16 @@ static void quit_handler(int num, int nice, int safeshutdown, int restart)
|
||||
}
|
||||
if (option_verbose || option_console)
|
||||
ast_verbose("Restarting Asterisk NOW...\n");
|
||||
execvp(_argv[0], _argv);
|
||||
restartnow = 1;
|
||||
/* If there is a consolethread running send it a SIGHUP
|
||||
so it can execvp, otherwise we can do it ourselves */
|
||||
if (consolethread != AST_PTHREADT_NULL) {
|
||||
pthread_kill(consolethread, SIGHUP);
|
||||
/* Give the signal handler some time to complete */
|
||||
sleep(2);
|
||||
} else
|
||||
execvp(_argv[0], _argv);
|
||||
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
@@ -546,8 +560,6 @@ static void __quit_handler(int num)
|
||||
quit_handler(num, 0, 1, 0);
|
||||
}
|
||||
|
||||
static pthread_t consolethread = (pthread_t) -1;
|
||||
|
||||
static const char *fix_header(char *outbuf, int maxout, const char *s, char *cmp)
|
||||
{
|
||||
const char *c;
|
||||
@@ -579,7 +591,7 @@ static void console_verboser(const char *s, int pos, int replace, int complete)
|
||||
fflush(stdout);
|
||||
if (complete)
|
||||
/* Wake up a select()ing console */
|
||||
if (consolethread != (pthread_t) -1)
|
||||
if (option_console && consolethread != AST_PTHREADT_NULL)
|
||||
pthread_kill(consolethread, SIGURG);
|
||||
}
|
||||
|
||||
@@ -928,7 +940,7 @@ static char *cli_complete(EditLine *el, int ch)
|
||||
int nummatches = 0;
|
||||
char **matches;
|
||||
int retval = CC_ERROR;
|
||||
char buf[1024];
|
||||
char buf[2048];
|
||||
int res;
|
||||
|
||||
LineInfo *lf = (LineInfo *)el_line(el);
|
||||
@@ -1036,6 +1048,8 @@ static int ast_el_initialize(void)
|
||||
el_set(el, EL_BIND, "^I", "ed-complete", NULL);
|
||||
/* Bind ? to command completion */
|
||||
el_set(el, EL_BIND, "?", "ed-complete", NULL);
|
||||
/* Bind ^D to redisplay */
|
||||
el_set(el, EL_BIND, "^D", "ed-redisplay", NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1254,7 +1268,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (gethostname(hostname, sizeof(hostname)))
|
||||
strncpy(hostname, "<Unknown>", sizeof(hostname)-1);
|
||||
mainpid = getpid();
|
||||
ast_mainpid = getpid();
|
||||
ast_ulaw_init();
|
||||
ast_alaw_init();
|
||||
callerid_init();
|
||||
@@ -1462,6 +1476,8 @@ int main(int argc, char *argv[])
|
||||
ast_verbose(" ]\n");
|
||||
if (option_verbose || option_console)
|
||||
ast_verbose(term_color(tmp, "Asterisk Ready.\n", COLOR_BRWHITE, COLOR_BLACK, sizeof(tmp)));
|
||||
if (option_nofork)
|
||||
consolethread = pthread_self();
|
||||
fully_booted = 1;
|
||||
pthread_sigmask(SIG_UNBLOCK, &sigs, NULL);
|
||||
#ifdef __AST_DEBUG_MALLOC
|
||||
@@ -1481,11 +1497,10 @@ int main(int argc, char *argv[])
|
||||
/* Register our quit function */
|
||||
char title[256];
|
||||
set_icon("Asterisk");
|
||||
snprintf(title, sizeof(title), "Asterisk Console on '%s' (pid %d)", hostname, mainpid);
|
||||
snprintf(title, sizeof(title), "Asterisk Console on '%s' (pid %d)", hostname, ast_mainpid);
|
||||
set_title(title);
|
||||
ast_cli_register(&quit);
|
||||
ast_cli_register(&astexit);
|
||||
consolethread = pthread_self();
|
||||
|
||||
for (;;) {
|
||||
buf = (char *)el_gets(el, &num);
|
||||
|
0
asterisk.h
Executable file → Normal file
0
asterisk.h
Executable file → Normal file
@@ -1,2 +0,0 @@
|
||||
astman
|
||||
.depend
|
0
astman/Makefile
Executable file → Normal file
0
astman/Makefile
Executable file → Normal file
1
astman/astman.c
Executable file → Normal file
1
astman/astman.c
Executable file → Normal file
@@ -170,6 +170,7 @@ static struct event {
|
||||
{ "Status", event_status },
|
||||
{ "Link", event_ignore },
|
||||
{ "Unlink", event_ignore },
|
||||
{ "StatusComplete", event_ignore }
|
||||
};
|
||||
|
||||
static int process_message(struct ast_mansession *s, struct message *m)
|
||||
|
8
autoservice.c
Executable file → Normal file
8
autoservice.c
Executable file → Normal file
@@ -44,7 +44,7 @@ struct asent {
|
||||
};
|
||||
|
||||
static struct asent *aslist = NULL;
|
||||
static pthread_t asthread = (pthread_t) -1;
|
||||
static pthread_t asthread = AST_PTHREADT_NULL;
|
||||
|
||||
static void *autoservice_run(void *ign)
|
||||
{
|
||||
@@ -80,7 +80,7 @@ static void *autoservice_run(void *ign)
|
||||
ast_frfree(f);
|
||||
}
|
||||
}
|
||||
asthread = (pthread_t) -1;
|
||||
asthread = AST_PTHREADT_NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -90,7 +90,7 @@ int ast_autoservice_start(struct ast_channel *chan)
|
||||
struct asent *as;
|
||||
int needstart;
|
||||
ast_mutex_lock(&autolock);
|
||||
needstart = (asthread == (pthread_t) -1) ? 1 : 0 /* aslist ? 0 : 1 */;
|
||||
needstart = (asthread == AST_PTHREADT_NULL) ? 1 : 0 /* aslist ? 0 : 1 */;
|
||||
as = aslist;
|
||||
while(as) {
|
||||
if (as->chan == chan)
|
||||
@@ -142,7 +142,7 @@ int ast_autoservice_stop(struct ast_channel *chan)
|
||||
if (!chan->_softhangup)
|
||||
res = 0;
|
||||
}
|
||||
if (asthread != (pthread_t) -1)
|
||||
if (asthread != AST_PTHREADT_NULL)
|
||||
pthread_kill(asthread, SIGURG);
|
||||
ast_mutex_unlock(&autolock);
|
||||
/* Wait for it to un-block */
|
||||
|
0
callerid.c
Executable file → Normal file
0
callerid.c
Executable file → Normal file
@@ -1 +0,0 @@
|
||||
.depend
|
0
cdr/Makefile
Executable file → Normal file
0
cdr/Makefile
Executable file → Normal file
0
cdr/cdr_csv.c
Executable file → Normal file
0
cdr/cdr_csv.c
Executable file → Normal file
0
cdr/cdr_odbc.c
Executable file → Normal file
0
cdr/cdr_odbc.c
Executable file → Normal file
0
cdr/cdr_pgsql.c
Executable file → Normal file
0
cdr/cdr_pgsql.c
Executable file → Normal file
102
channel.c
Executable file → Normal file
102
channel.c
Executable file → Normal file
@@ -630,8 +630,8 @@ int ast_hangup(struct ast_channel *chan)
|
||||
/* If this channel is one which will be masqueraded into something,
|
||||
mark it as a zombie already, so we know to free it later */
|
||||
if (chan->masqr) {
|
||||
ast_mutex_unlock(&chan->lock);
|
||||
chan->zombie=1;
|
||||
ast_mutex_unlock(&chan->lock);
|
||||
return 0;
|
||||
}
|
||||
free_translation(chan);
|
||||
@@ -733,7 +733,8 @@ int ast_answer(struct ast_channel *chan)
|
||||
void ast_deactivate_generator(struct ast_channel *chan)
|
||||
{
|
||||
if (chan->generatordata) {
|
||||
chan->generator->release(chan, chan->generatordata);
|
||||
if (chan->generator && chan->generator->release)
|
||||
chan->generator->release(chan, chan->generatordata);
|
||||
chan->generatordata = NULL;
|
||||
chan->generator = NULL;
|
||||
chan->writeinterrupt = 0;
|
||||
@@ -743,7 +744,8 @@ void ast_deactivate_generator(struct ast_channel *chan)
|
||||
int ast_activate_generator(struct ast_channel *chan, struct ast_generator *gen, void *params)
|
||||
{
|
||||
if (chan->generatordata) {
|
||||
chan->generator->release(chan, chan->generatordata);
|
||||
if (chan->generator && chan->generator->release)
|
||||
chan->generator->release(chan, chan->generatordata);
|
||||
chan->generatordata = NULL;
|
||||
}
|
||||
ast_prod(chan);
|
||||
@@ -809,15 +811,26 @@ struct ast_channel *ast_waitfor_nandfds(struct ast_channel **c, int n, int *fds,
|
||||
fd_set rfds, efds;
|
||||
int res;
|
||||
int x, y, max=-1;
|
||||
time_t now = 0;
|
||||
long whentohangup = 0, havewhen = 0, diff;
|
||||
struct ast_channel *winner = NULL;
|
||||
if (outfd)
|
||||
*outfd = -1;
|
||||
*outfd = -99999;
|
||||
if (exception)
|
||||
*exception = 0;
|
||||
|
||||
/* Perform any pending masquerades */
|
||||
for (x=0;x<n;x++) {
|
||||
ast_mutex_lock(&c[x]->lock);
|
||||
if (c[x]->whentohangup) {
|
||||
if (!havewhen)
|
||||
time(&now);
|
||||
diff = c[x]->whentohangup - now;
|
||||
if (!havewhen || (diff < whentohangup)) {
|
||||
havewhen++;
|
||||
whentohangup = diff;
|
||||
}
|
||||
}
|
||||
if (c[x]->masq) {
|
||||
if (ast_do_masquerade(c[x])) {
|
||||
ast_log(LOG_WARNING, "Masquerade failed\n");
|
||||
@@ -831,6 +844,13 @@ struct ast_channel *ast_waitfor_nandfds(struct ast_channel **c, int n, int *fds,
|
||||
|
||||
tv.tv_sec = *ms / 1000;
|
||||
tv.tv_usec = (*ms % 1000) * 1000;
|
||||
|
||||
if (havewhen) {
|
||||
if ((*ms < 0) || (whentohangup * 1000 < *ms)) {
|
||||
tv.tv_sec = whentohangup;
|
||||
tv.tv_usec = 0;
|
||||
}
|
||||
}
|
||||
FD_ZERO(&rfds);
|
||||
FD_ZERO(&efds);
|
||||
|
||||
@@ -851,7 +871,7 @@ struct ast_channel *ast_waitfor_nandfds(struct ast_channel **c, int n, int *fds,
|
||||
if (fds[x] > max)
|
||||
max = fds[x];
|
||||
}
|
||||
if (*ms >= 0)
|
||||
if ((*ms >= 0) || (havewhen))
|
||||
res = ast_select(max + 1, &rfds, NULL, &efds, &tv);
|
||||
else
|
||||
res = ast_select(max + 1, &rfds, NULL, &efds, NULL);
|
||||
@@ -871,8 +891,15 @@ struct ast_channel *ast_waitfor_nandfds(struct ast_channel **c, int n, int *fds,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (havewhen)
|
||||
time(&now);
|
||||
for (x=0;x<n;x++) {
|
||||
c[x]->blocking = 0;
|
||||
if (havewhen && c[x]->whentohangup && (now > c[x]->whentohangup)) {
|
||||
c[x]->_softhangup |= AST_SOFTHANGUP_TIMEOUT;
|
||||
if (!winner)
|
||||
winner = c[x];
|
||||
}
|
||||
for (y=0;y<AST_MAX_FDS;y++) {
|
||||
if (c[x]->fds[y] > -1) {
|
||||
if ((FD_ISSET(c[x]->fds[y], &rfds) || FD_ISSET(c[x]->fds[y], &efds)) && !winner) {
|
||||
@@ -1551,6 +1578,8 @@ struct ast_channel *__ast_request_and_dial(char *type, int format, void *data, i
|
||||
state = f->subclass;
|
||||
ast_frfree(f);
|
||||
break;
|
||||
} else if (f->subclass == -1) {
|
||||
/* Ignore -- just stopping indications */
|
||||
} else {
|
||||
ast_log(LOG_NOTICE, "Don't know what to do with control frame %d\n", f->subclass);
|
||||
}
|
||||
@@ -2087,19 +2116,6 @@ static int ast_do_masquerade(struct ast_channel *original)
|
||||
/* Context, extension, priority, app data, jump table, remain the same */
|
||||
/* pvt switches. pbx stays the same, as does next */
|
||||
|
||||
/* Now, at this point, the "clone" channel is totally F'd up. We mark it as
|
||||
a zombie so nothing tries to touch it. If it's already been marked as a
|
||||
zombie, then free it now (since it already is considered invalid). */
|
||||
if (clone->zombie) {
|
||||
ast_log(LOG_DEBUG, "Destroying clone '%s'\n", clone->name);
|
||||
ast_mutex_unlock(&clone->lock);
|
||||
ast_channel_free(clone);
|
||||
manager_event(EVENT_FLAG_CALL, "Hangup", "Channel: %s\r\n", zombn);
|
||||
} else {
|
||||
ast_log(LOG_DEBUG, "Released clone lock on '%s'\n", clone->name);
|
||||
clone->zombie=1;
|
||||
ast_mutex_unlock(&clone->lock);
|
||||
}
|
||||
/* Set the write format */
|
||||
ast_set_write_format(original, wformat);
|
||||
|
||||
@@ -2120,6 +2136,21 @@ static int ast_do_masquerade(struct ast_channel *original)
|
||||
} else
|
||||
ast_log(LOG_WARNING, "Driver '%s' does not have a fixup routine (for %s)! Bad things may happen.\n",
|
||||
original->type, original->name);
|
||||
|
||||
/* Now, at this point, the "clone" channel is totally F'd up. We mark it as
|
||||
a zombie so nothing tries to touch it. If it's already been marked as a
|
||||
zombie, then free it now (since it already is considered invalid). */
|
||||
if (clone->zombie) {
|
||||
ast_log(LOG_DEBUG, "Destroying clone '%s'\n", clone->name);
|
||||
ast_mutex_unlock(&clone->lock);
|
||||
ast_channel_free(clone);
|
||||
manager_event(EVENT_FLAG_CALL, "Hangup", "Channel: %s\r\n", zombn);
|
||||
} else {
|
||||
ast_log(LOG_DEBUG, "Released clone lock on '%s'\n", clone->name);
|
||||
clone->zombie=1;
|
||||
ast_mutex_unlock(&clone->lock);
|
||||
}
|
||||
|
||||
/* Signal any blocker */
|
||||
if (original->blocking)
|
||||
pthread_kill(original->blocker, SIGURG);
|
||||
@@ -2276,7 +2307,7 @@ int ast_channel_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags
|
||||
*fo = f;
|
||||
*rc = who;
|
||||
res = 0;
|
||||
ast_log(LOG_DEBUG, "Got a FRAME_CONTROL frame on channel %s\n",who->name);
|
||||
ast_log(LOG_DEBUG, "Got a FRAME_CONTROL (%d) frame on channel %s\n", f->subclass, who->name);
|
||||
break;
|
||||
}
|
||||
if ((f->frametype == AST_FRAME_VOICE) ||
|
||||
@@ -2492,3 +2523,36 @@ int ast_tonepair(struct ast_channel *chan, int freq1, int freq2, int duration, i
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int ast_get_group(char *s)
|
||||
{
|
||||
char *copy;
|
||||
char *piece;
|
||||
char *c=NULL;
|
||||
int start=0, finish=0,x;
|
||||
unsigned int group = 0;
|
||||
copy = ast_strdupa(s);
|
||||
if (!copy) {
|
||||
ast_log(LOG_ERROR, "Out of memory\n");
|
||||
return 0;
|
||||
}
|
||||
c = copy;
|
||||
|
||||
while((piece = strsep(&c, ","))) {
|
||||
if (sscanf(piece, "%d-%d", &start, &finish) == 2) {
|
||||
/* Range */
|
||||
} else if (sscanf(piece, "%d", &start)) {
|
||||
/* Just one */
|
||||
finish = start;
|
||||
} else {
|
||||
ast_log(LOG_ERROR, "Syntax error parsing '%s' at '%s'. Using '0'\n", s,piece);
|
||||
return 0;
|
||||
}
|
||||
for (x=start;x<=finish;x++) {
|
||||
if ((x > 31) || (x < 0)) {
|
||||
ast_log(LOG_WARNING, "Ignoring invalid group %d (maximum group is 31)\n", x);
|
||||
} else
|
||||
group |= (1 << x);
|
||||
}
|
||||
}
|
||||
return group;
|
||||
}
|
||||
|
@@ -1,4 +0,0 @@
|
||||
busy.h
|
||||
gentone
|
||||
ringtone.h
|
||||
.depend
|
0
channels/DialTone.h
Executable file → Normal file
0
channels/DialTone.h
Executable file → Normal file
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user