[asterisk-commits] branch oej/astum - r8193 in /team/oej/astum: ./
apps/ channels/ include/aster...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Wed Jan 18 12:18:31 MST 2006
Author: oej
Date: Wed Jan 18 13:18:02 2006
New Revision: 8193
URL: http://svn.digium.com/view/asterisk?rev=8193&view=rev
Log:
Merged revisions 8141,8148,8150,8152-8153,8155-8157,8161,8163,8179,8186,8190 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
................
r8141 | mogorman | 2006-01-17 21:16:18 +0100 (Tue, 17 Jan 2006) | 11 lines
Merged revisions 8140 via svnmerge from
https://svn.digium.com/svn/asterisk/branches/1.2
........
r8140 | mogorman | 2006-01-17 14:10:29 -0600 (Tue, 17 Jan 2006) | 3 lines
Stop any generators running on a channel when
festival is called as described in 5996
........
................
r8148 | kpfleming | 2006-01-17 21:49:39 +0100 (Tue, 17 Jan 2006) | 2 lines
suppress compiler warning
................
r8150 | kpfleming | 2006-01-17 21:53:04 +0100 (Tue, 17 Jan 2006) | 2 lines
spelling fix
................
r8152 | mogorman | 2006-01-17 21:58:56 +0100 (Tue, 17 Jan 2006) | 3 lines
allow for multiple periodic announcements
from bug 5273 with minor changes.
................
r8153 | mogorman | 2006-01-17 22:10:38 +0100 (Tue, 17 Jan 2006) | 2 lines
oops all better now.
................
r8155 | mattf | 2006-01-18 00:13:42 +0100 (Wed, 18 Jan 2006) | 2 lines
Fix answeronpolarityswitch and hanguponpolarityswitch when both are yes (#6229)
................
r8156 | mattf | 2006-01-18 00:37:22 +0100 (Wed, 18 Jan 2006) | 2 lines
Improvements to DSP callprogress=yes code (#5009)
................
r8157 | kpfleming | 2006-01-18 00:45:05 +0100 (Wed, 18 Jan 2006) | 2 lines
remove some more deprecated (pre-1.2) stuff
................
r8161 | mogorman | 2006-01-18 01:05:09 +0100 (Wed, 18 Jan 2006) | 3 lines
cleanup the show uptime code, and minor changes
to patch 6274
................
r8163 | mogorman | 2006-01-18 01:49:43 +0100 (Wed, 18 Jan 2006) | 12 lines
Merged revisions 8162 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r8162 | mogorman | 2006-01-17 18:47:04 -0600 (Tue, 17 Jan 2006) | 4 lines
Changed order of autoload so that pbx_ comes before
channels, and in doing so cause bug 6002 to not
be an issue
........
................
r8179 | mogorman | 2006-01-18 04:53:10 +0100 (Wed, 18 Jan 2006) | 3 lines
cli.h cleanup and additional documentation
from patch 6272
................
r8186 | mogorman | 2006-01-18 16:42:48 +0100 (Wed, 18 Jan 2006) | 3 lines
allows for use of the originate function from
the cli patch 5847
................
r8190 | mogorman | 2006-01-18 17:24:29 +0100 (Wed, 18 Jan 2006) | 2 lines
oops. sorry
................
Added:
team/oej/astum/res/res_clioriginate.c
- copied unchanged from r8190, trunk/res/res_clioriginate.c
Modified:
team/oej/astum/ (props changed)
team/oej/astum/Makefile
team/oej/astum/apps/app_dial.c
team/oej/astum/apps/app_festival.c
team/oej/astum/apps/app_queue.c
team/oej/astum/channels/chan_sip.c
team/oej/astum/channels/chan_zap.c
team/oej/astum/cli.c
team/oej/astum/dsp.c
team/oej/astum/include/asterisk/cli.h
team/oej/astum/include/asterisk/module.h
team/oej/astum/loader.c
team/oej/astum/manager.c
team/oej/astum/pbx.c
team/oej/astum/pbx/pbx_dundi.c
team/oej/astum/res/Makefile
team/oej/astum/res/res_features.c
Propchange: team/oej/astum/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Jan 18 13:18:02 2006
@@ -1,1 +1,1 @@
-/trunk:1-8138
+/trunk:1-8191
Modified: team/oej/astum/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/astum/Makefile?rev=8193&r1=8192&r2=8193&view=diff
==============================================================================
--- team/oej/astum/Makefile (original)
+++ team/oej/astum/Makefile Wed Jan 18 13:18:02 2006
@@ -106,7 +106,7 @@
# Detect the busy signal looking only at tone lengths
# For example if you have 3 beeps 100ms tone, 100ms silence separated by 500 ms of silence
BUSYDETECT+= #-DBUSYDETECT_TONEONLY
-# Inforce the detection of busy singal (get rid of false hangups)
+# Enforce the detection of busy singal (get rid of false hangups)
# Don't use together with -DBUSYDETECT_TONEONLY
BUSYDETECT+= #-DBUSYDETECT_COMPARE_TONE_AND_SILENCE
Modified: team/oej/astum/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/oej/astum/apps/app_dial.c?rev=8193&r1=8192&r2=8193&view=diff
==============================================================================
--- team/oej/astum/apps/app_dial.c (original)
+++ team/oej/astum/apps/app_dial.c Wed Jan 18 13:18:02 2006
@@ -449,7 +449,8 @@
char tmpchan[256];
char *stuff;
char *tech;
- char *forward_context;
+ const char *forward_context;
+
ast_copy_string(tmpchan, o->chan->call_forward, sizeof(tmpchan));
if ((stuff = strchr(tmpchan, '/'))) {
*stuff = '\0';
Modified: team/oej/astum/apps/app_festival.c
URL: http://svn.digium.com/view/asterisk/team/oej/astum/apps/app_festival.c?rev=8193&r1=8192&r2=8193&view=diff
==============================================================================
--- team/oej/astum/apps/app_festival.c (original)
+++ team/oej/astum/apps/app_festival.c Wed Jan 18 13:18:02 2006
@@ -183,7 +183,8 @@
if (chan->_state != AST_STATE_UP)
ast_answer(chan);
ast_stopstream(chan);
-
+ ast_indicate(chan, -1);
+
owriteformat = chan->writeformat;
res = ast_set_write_format(chan, AST_FORMAT_SLINEAR);
if (res < 0) {
Modified: team/oej/astum/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/oej/astum/apps/app_queue.c?rev=8193&r1=8192&r2=8193&view=diff
==============================================================================
--- team/oej/astum/apps/app_queue.c (original)
+++ team/oej/astum/apps/app_queue.c Wed Jan 18 13:18:02 2006
@@ -114,6 +114,7 @@
#define DEFAULT_RETRY 5
#define DEFAULT_TIMEOUT 15
#define RECHECK 1 /* Recheck every second to see we we're at the top yet */
+#define MAX_PERIODIC_ANNOUNCEMENTS 10 /* The maximum periodic announcements we can have */
#define RES_OKAY 0 /* Action completed */
#define RES_EXISTS (-1) /* Entry already exists */
@@ -283,6 +284,7 @@
int prio; /*!< Our priority */
int last_pos_said; /*!< Last position we told the user */
time_t last_periodic_announce_time; /*!< The last time we played a periodic announcement */
+ int last_periodic_announce_sound; /* The last periodic announcement we made */
time_t last_pos; /*!< Last time we told the user their position */
int opos; /*!< Where we started in the queue */
int handled; /*!< Whether our call was handled */
@@ -347,7 +349,7 @@
char sound_seconds[80]; /*!< Sound file: "seconds." (def. queue-seconds) */
char sound_thanks[80]; /*!< Sound file: "Thank you for your patience." (def. queue-thankyou) */
char sound_reporthold[80]; /*!< Sound file: "Hold time" (def. queue-reporthold) */
- char sound_periodicannounce[80];/*!< Sound file: Custom announce, no default */
+ char sound_periodicannounce[MAX_PERIODIC_ANNOUNCEMENTS][80];/* Sound files: Custom announce, no default */
int count; /*!< How many entries */
int maxlen; /*!< Max number of entries */
@@ -563,6 +565,7 @@
static void init_queue(struct ast_call_queue *q)
{
+ int i;
q->dead = 0;
q->retry = DEFAULT_RETRY;
q->timeout = -1;
@@ -585,7 +588,10 @@
ast_copy_string(q->sound_thanks, "queue-thankyou", sizeof(q->sound_thanks));
ast_copy_string(q->sound_lessthan, "queue-less-than", sizeof(q->sound_lessthan));
ast_copy_string(q->sound_reporthold, "queue-reporthold", sizeof(q->sound_reporthold));
- ast_copy_string(q->sound_periodicannounce, "queue-periodic-announce", sizeof(q->sound_periodicannounce));
+ ast_copy_string(q->sound_periodicannounce[0], "queue-periodic-announce", sizeof(q->sound_periodicannounce[0]));
+ for (i=1;i<MAX_PERIODIC_ANNOUNCEMENTS;i++) {
+ q->sound_periodicannounce[i][0]='\0';
+ }
}
static void clear_queue(struct ast_call_queue *q)
@@ -606,6 +612,9 @@
extra fields in the tables. */
static void queue_set_param(struct ast_call_queue *q, const char *param, const char *val, int linenum, int failunknown)
{
+ int i = 0;
+ char *c, *lastc;
+ char buff[80];
if (!strcasecmp(param, "music") || !strcasecmp(param, "musiconhold")) {
ast_copy_string(q->moh, val, sizeof(q->moh));
} else if (!strcasecmp(param, "announce")) {
@@ -660,8 +669,24 @@
q->announceholdtime = ANNOUNCEHOLDTIME_ALWAYS;
else
q->announceholdtime = 0;
- } else if (!strcasecmp(param, "periodic-announce")) {
- ast_copy_string(q->sound_periodicannounce, val, sizeof(q->sound_periodicannounce));
+ } else if (!strcasecmp(param, "periodic-announce")) {
+ if (strchr(val,'|')) {
+ lastc = (char *)val;
+ while ((c = strchr(lastc,'|'))) {
+ if (i > MAX_PERIODIC_ANNOUNCEMENTS)
+ break;
+ strncpy(buff, lastc, abs(lastc - c));
+ buff[abs(lastc - c)] = '\0';
+ ast_copy_string(q->sound_periodicannounce[i], buff, sizeof(q->sound_periodicannounce[i]));
+ lastc = (c + 1);
+ i++;
+ }
+ if (strlen(lastc)) {
+ ast_copy_string(q->sound_periodicannounce[i], lastc, sizeof(q->sound_periodicannounce[i]));
+ }
+ } else {
+ ast_copy_string(q->sound_periodicannounce[i], val, sizeof(q->sound_periodicannounce[i]));
+ }
} else if (!strcasecmp(param, "periodic-announce-frequency")) {
q->periodicannouncefrequency = atoi(val);
} else if (!strcasecmp(param, "retry")) {
@@ -1570,8 +1595,13 @@
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Playing periodic announcement\n");
+ /* Check to make sure we have a sound file. If not, reset to the first sound file */
+ if (qe->last_periodic_announce_sound >= MAX_PERIODIC_ANNOUNCEMENTS || !strlen(qe->parent->sound_periodicannounce[qe->last_periodic_announce_sound])) {
+ qe->last_periodic_announce_sound = 0;
+ }
+
/* play the announcement */
- res = background_file(qe, qe->chan, qe->parent->sound_periodicannounce);
+ res = background_file(qe, qe->chan, qe->parent->sound_periodicannounce[qe->last_periodic_announce_sound]);
/* Resume Music on Hold */
ast_moh_start(qe->chan, qe->moh);
@@ -1579,6 +1609,9 @@
/* update last_periodic_announce_time */
qe->last_periodic_announce_time = now;
+ /* Update the current periodic announcement to the next announcement */
+ qe->last_periodic_announce_sound++;
+
return res;
}
@@ -2947,6 +2980,7 @@
qe.last_pos_said = 0;
qe.last_pos = 0;
qe.last_periodic_announce_time = time(NULL);
+ qe.last_periodic_announce_sound = 0;
if (!join_queue(queuename, &qe, &reason)) {
ast_queue_log(queuename, chan->uniqueid, "NONE", "ENTERQUEUE", "%s|%s", url ? url : "",
chan->cid.cid_num ? chan->cid.cid_num : "");
Modified: team/oej/astum/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/astum/channels/chan_sip.c?rev=8193&r1=8192&r2=8193&view=diff
==============================================================================
--- team/oej/astum/channels/chan_sip.c (original)
+++ team/oej/astum/channels/chan_sip.c Wed Jan 18 13:18:02 2006
@@ -12786,27 +12786,6 @@
static char *descrip_dtmfmode = "SIPDtmfMode(inband|info|rfc2833): Changes the dtmfmode for a SIP call\n";
static char *app_dtmfmode = "SIPDtmfMode";
-static char *app_sipaddheader = "SIPAddHeader";
-static char *synopsis_sipaddheader = "Add a SIP header to the outbound call";
-
-
-static char *descrip_sipaddheader = ""
-" SIPAddHeader(Header: Content)\n"
-"Adds a header to a SIP call placed with DIAL.\n"
-"Remember to user the X-header if you are adding non-standard SIP\n"
-"headers, like \"X-Asterisk-Accountcode:\". Use this with care.\n"
-"Adding the wrong headers may jeopardize the SIP dialog.\n"
-"Always returns 0\n";
-
-static char *app_sipgetheader = "SIPGetHeader";
-static char *synopsis_sipgetheader = "Get a SIP header from an incoming call";
-
-static char *descrip_sipgetheader = ""
-" SIPGetHeader(var=headername): \n"
-"Sets a channel variable to the content of a SIP header\n"
-"Skips to priority+101 if header does not exist\n"
-"Otherwise returns 0\n";
-
/*! \brief sip_dtmfmode: change the DTMFmode for a SIP call (application) ---*/
static int sip_dtmfmode(struct ast_channel *chan, void *data)
{
@@ -12853,90 +12832,6 @@
}
}
ast_mutex_unlock(&p->lock);
- ast_mutex_unlock(&chan->lock);
- return 0;
-}
-
-/*! \brief sip_addheader: Add a SIP header ---*/
-static int sip_addheader(struct ast_channel *chan, void *data)
-{
- int arglen;
- int no = 0;
- int ok = 0;
- const char *content = (char *) NULL;
- char varbuf[128];
-
- arglen = strlen(data);
- if (!arglen) {
- ast_log(LOG_WARNING, "This application requires the argument: Header\n");
- return 0;
- }
- ast_mutex_lock(&chan->lock);
-
- /* Check for headers */
- while (!ok && no <= 50) {
- no++;
- snprintf(varbuf, sizeof(varbuf), "_SIPADDHEADER%.2d", no);
- content = pbx_builtin_getvar_helper(chan, varbuf);
-
- if (!content)
- ok = 1;
- }
- if (ok) {
- pbx_builtin_setvar_helper (chan, varbuf, data);
- if (sipdebug)
- ast_log(LOG_DEBUG,"SIP Header added \"%s\" as %s\n", (char *) data, varbuf);
- } else {
- ast_log(LOG_WARNING, "Too many SIP headers added, max 50\n");
- }
- ast_mutex_unlock(&chan->lock);
- return 0;
-}
-
-/*! \brief sip_getheader: Get a SIP header (dialplan app) ---*/
-static int sip_getheader(struct ast_channel *chan, void *data)
-{
- static int dep_warning = 0;
- struct sip_pvt *p;
- char *argv, *varname = NULL, *header = NULL, *content;
-
- if (!dep_warning) {
- ast_log(LOG_WARNING, "SIPGetHeader is deprecated, use the SIP_HEADER function instead.\n");
- dep_warning = 1;
- }
-
- argv = ast_strdupa(data);
- if (!argv) {
- ast_log(LOG_DEBUG, "Memory allocation failed\n");
- return 0;
- }
-
- if (strchr (argv, '=') ) { /* Pick out argumenet */
- varname = strsep (&argv, "=");
- header = strsep (&argv, "\0");
- }
-
- if (!varname || !header) {
- ast_log(LOG_DEBUG, "SipGetHeader: Ignoring command, Syntax error in argument\n");
- return 0;
- }
-
- ast_mutex_lock(&chan->lock);
- if (chan->type != channeltype) {
- ast_log(LOG_WARNING, "Call this application only on incoming SIP calls\n");
- ast_mutex_unlock(&chan->lock);
- return 0;
- }
-
- p = chan->tech_pvt;
- content = get_header(&p->initreq, header); /* Get the header */
- if (!ast_strlen_zero(content)) {
- pbx_builtin_setvar_helper(chan, varname, content);
- } else {
- ast_log(LOG_WARNING,"SIP Header %s not found for channel variable %s\n", header, varname);
- ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 101);
- }
-
ast_mutex_unlock(&chan->lock);
return 0;
}
@@ -13162,10 +13057,6 @@
/* Register dialplan applications */
ast_register_application(app_dtmfmode, sip_dtmfmode, synopsis_dtmfmode, descrip_dtmfmode);
- /* These will be removed soon */
- ast_register_application(app_sipaddheader, sip_addheader, synopsis_sipaddheader, descrip_sipaddheader);
- ast_register_application(app_sipgetheader, sip_getheader, synopsis_sipgetheader, descrip_sipgetheader);
-
/* Register dialplan functions */
ast_custom_function_register(&sip_header_function);
ast_custom_function_register(&sippeer_function);
@@ -13200,8 +13091,6 @@
ast_custom_function_unregister(&checksipdomain_function);
ast_unregister_application(app_dtmfmode);
- ast_unregister_application(app_sipaddheader);
- ast_unregister_application(app_sipgetheader);
ast_cli_unregister_multiple(my_clis, sizeof(my_clis) / sizeof(my_clis[0]));
Modified: team/oej/astum/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/oej/astum/channels/chan_zap.c?rev=8193&r1=8192&r2=8193&view=diff
==============================================================================
--- team/oej/astum/channels/chan_zap.c (original)
+++ team/oej/astum/channels/chan_zap.c Wed Jan 18 13:18:02 2006
@@ -4268,6 +4268,9 @@
(ast->_state == AST_STATE_RINGING))) {
ast_log(LOG_DEBUG, "Answering on polarity switch!\n");
ast_setstate(p->owner, AST_STATE_UP);
+ if (p->hanguponpolarityswitch) {
+ gettimeofday(&p->polaritydelaytv, NULL);
+ }
} else
ast_log(LOG_DEBUG, "Ignore switch to REVERSED Polarity on channel %d, state %d\n", p->channel, ast->_state);
}
Modified: team/oej/astum/cli.c
URL: http://svn.digium.com/view/asterisk/team/oej/astum/cli.c?rev=8193&r1=8192&r2=8193&view=diff
==============================================================================
--- team/oej/astum/cli.c (original)
+++ team/oej/astum/cli.c Wed Jan 18 13:18:02 2006
@@ -278,118 +278,70 @@
" Shows Asterisk uptime information.\n"
" The seconds word returns the uptime in seconds only.\n";
-static char *format_uptimestr(time_t timeval)
-{
- int years = 0, weeks = 0, days = 0, hours = 0, mins = 0, secs = 0;
- char timestr[256]="";
- int bytes = 0;
- int maxbytes = 0;
- int offset = 0;
+static void print_uptimestr(int fd, time_t timeval, const char *prefix, int printsec)
+{
+ int x; /* the main part - years, weeks, etc. */
+ char timestr[256]="", *s = timestr;
+ size_t maxbytes = sizeof(timestr);
+
#define SECOND (1)
#define MINUTE (SECOND*60)
#define HOUR (MINUTE*60)
#define DAY (HOUR*24)
#define WEEK (DAY*7)
#define YEAR (DAY*365)
-#define ESS(x) ((x == 1) ? "" : "s")
-
- maxbytes = sizeof(timestr);
- if (timeval < 0)
- return NULL;
+#define ESS(x) ((x == 1) ? "" : "s") /* plural suffix */
+#define NEEDCOMMA(x) ((x)? ",": "") /* define if we need a comma */
+ if (timeval < 0) /* invalid, nothing to show */
+ return;
+ if (printsec) { /* plain seconds output */
+ ast_build_string(&s, &maxbytes, "%lu", (u_long)timeval);
+ timeval = 0; /* bypass the other cases */
+ }
if (timeval > YEAR) {
- years = (timeval / YEAR);
- timeval -= (years * YEAR);
- if (years > 0) {
- snprintf(timestr + offset, maxbytes, "%d year%s, ", years, ESS(years));
- bytes = strlen(timestr + offset);
- offset += bytes;
- maxbytes -= bytes;
- }
+ x = (timeval / YEAR);
+ timeval -= (x * YEAR);
+ ast_build_string(&s, &maxbytes, "%d year%s%s ", x, ESS(x),NEEDCOMMA(timeval));
}
if (timeval > WEEK) {
- weeks = (timeval / WEEK);
- timeval -= (weeks * WEEK);
- if (weeks > 0) {
- snprintf(timestr + offset, maxbytes, "%d week%s, ", weeks, ESS(weeks));
- bytes = strlen(timestr + offset);
- offset += bytes;
- maxbytes -= bytes;
- }
+ x = (timeval / WEEK);
+ timeval -= (x * WEEK);
+ ast_build_string(&s, &maxbytes, "%d week%s%s ", x, ESS(x),NEEDCOMMA(timeval));
}
if (timeval > DAY) {
- days = (timeval / DAY);
- timeval -= (days * DAY);
- if (days > 0) {
- snprintf(timestr + offset, maxbytes, "%d day%s, ", days, ESS(days));
- bytes = strlen(timestr + offset);
- offset += bytes;
- maxbytes -= bytes;
- }
+ x = (timeval / DAY);
+ timeval -= (x * DAY);
+ ast_build_string(&s, &maxbytes, "%d day%s%s ", x, ESS(x),NEEDCOMMA(timeval));
}
if (timeval > HOUR) {
- hours = (timeval / HOUR);
- timeval -= (hours * HOUR);
- if (hours > 0) {
- snprintf(timestr + offset, maxbytes, "%d hour%s, ", hours, ESS(hours));
- bytes = strlen(timestr + offset);
- offset += bytes;
- maxbytes -= bytes;
- }
+ x = (timeval / HOUR);
+ timeval -= (x * HOUR);
+ ast_build_string(&s, &maxbytes, "%d hour%s%s ", x, ESS(x),NEEDCOMMA(timeval));
}
if (timeval > MINUTE) {
- mins = (timeval / MINUTE);
- timeval -= (mins * MINUTE);
- if (mins > 0) {
- snprintf(timestr + offset, maxbytes, "%d minute%s, ", mins, ESS(mins));
- bytes = strlen(timestr + offset);
- offset += bytes;
- maxbytes -= bytes;
- }
- }
- secs = timeval;
-
- if (secs > 0) {
- snprintf(timestr + offset, maxbytes, "%d second%s", secs, ESS(secs));
- }
-
- return timestr ? strdup(timestr) : NULL;
+ x = (timeval / MINUTE);
+ timeval -= (x * MINUTE);
+ ast_build_string(&s, &maxbytes, "%d minute%s%s ", x, ESS(x),NEEDCOMMA(timeval));
+ }
+ x = timeval;
+ if (x > 0)
+ ast_build_string(&s, &maxbytes, "%d second%s ", x, ESS(x));
+ if (timestr[0] != '\0')
+ ast_cli(fd, "%s: %s\n", prefix, timestr);
}
static int handle_showuptime(int fd, int argc, char *argv[])
{
- time_t curtime, tmptime;
- char *timestr;
- int printsec;
-
- printsec = ((argc == 3) && (!strcasecmp(argv[2],"seconds")));
- if ((argc != 2) && (!printsec))
- return RESULT_SHOWUSAGE;
-
- time(&curtime);
- if (ast_startuptime) {
- tmptime = curtime - ast_startuptime;
- if (printsec) {
- ast_cli(fd, "System uptime: %lu\n",(u_long)tmptime);
- } else {
- timestr = format_uptimestr(tmptime);
- if (timestr) {
- ast_cli(fd, "System uptime: %s\n", timestr);
- free(timestr);
- }
- }
- }
- if (ast_lastreloadtime) {
- tmptime = curtime - ast_lastreloadtime;
- if (printsec) {
- ast_cli(fd, "Last reload: %lu\n", (u_long) tmptime);
- } else {
- timestr = format_uptimestr(tmptime);
- if ((timestr) && (!printsec)) {
- ast_cli(fd, "Last reload: %s\n", timestr);
- free(timestr);
- }
- }
- }
+ /* 'show uptime [seconds]' */
+ time_t curtime = time(NULL);
+ int printsec = (argc == 3 && !strcasecmp(argv[2],"seconds"));
+
+ if (argc != 2 && !printsec)
+ return RESULT_SHOWUSAGE;
+ if (ast_startuptime)
+ print_uptimestr(fd, curtime - ast_startuptime, "System uptime", printsec);
+ if (ast_lastreloadtime)
+ print_uptimestr(fd, curtime - ast_lastreloadtime, "Last reload", printsec);
return RESULT_SUCCESS;
}
Modified: team/oej/astum/dsp.c
URL: http://svn.digium.com/view/asterisk/team/oej/astum/dsp.c?rev=8193&r1=8192&r2=8193&view=diff
==============================================================================
--- team/oej/astum/dsp.c (original)
+++ team/oej/astum/dsp.c Wed Jan 18 13:18:02 2006
@@ -119,8 +119,14 @@
#define TONE_THRESH 10.0 /* How much louder the tone should be than channel energy */
#define TONE_MIN_THRESH 1e8 /* How much tone there should be at least to attempt */
-#define COUNT_THRESH 3 /* Need at least 50ms of stuff to count it */
-#define UK_HANGUP_THRESH 60 /* This is the threshold for the UK */
+
+ /* All THRESH_XXX values are in GSAMP_SIZE chunks (us = 22ms) */
+#define THRESH_RING 8 /* Need at least 150ms ring to accept */
+#define THRESH_TALK 2 /* Talk detection does not work continously */
+#define THRESH_BUSY 4 /* Need at least 80ms to accept */
+#define THRESH_CONGESTION 4 /* Need at least 80ms to accept */
+#define THRESH_HANGUP 60 /* Need at least 1300ms to accept hangup */
+#define THRESH_RING2ANSWER 300 /* Timeout from start of ring to answer (about 6600 ms) */
#define MAX_DTMF_DIGITS 128
@@ -315,6 +321,7 @@
int totalsilence;
int totalnoise;
int features;
+ int ringtimeout;
int busymaybe;
int busycount;
int busy_tonelength;
@@ -1037,7 +1044,6 @@
int pass;
int newstate = DSP_TONE_STATE_SILENCE;
int res = 0;
- int thresh = (dsp->progmode == PROG_MODE_UK) ? UK_HANGUP_THRESH : COUNT_THRESH;
while(len) {
/* Take the lesser of the number of samples we need and what we have */
pass = len;
@@ -1099,31 +1105,56 @@
}
if (newstate == dsp->tstate) {
dsp->tcount++;
- if (dsp->tcount == thresh) {
- if ((dsp->features & DSP_PROGRESS_BUSY) &&
- dsp->tstate == DSP_TONE_STATE_BUSY) {
- res = AST_CONTROL_BUSY;
- dsp->features &= ~DSP_FEATURE_CALL_PROGRESS;
- } else if ((dsp->features & DSP_PROGRESS_TALK) &&
- dsp->tstate == DSP_TONE_STATE_TALKING) {
- res = AST_CONTROL_ANSWER;
- dsp->features &= ~DSP_FEATURE_CALL_PROGRESS;
- } else if ((dsp->features & DSP_PROGRESS_RINGING) &&
- dsp->tstate == DSP_TONE_STATE_RINGING)
- res = AST_CONTROL_RINGING;
- else if ((dsp->features & DSP_PROGRESS_CONGESTION) &&
- dsp->tstate == DSP_TONE_STATE_SPECIAL3) {
- res = AST_CONTROL_CONGESTION;
- dsp->features &= ~DSP_FEATURE_CALL_PROGRESS;
- } else if ((dsp->features & DSP_FEATURE_CALL_PROGRESS) &&
- dsp->tstate == DSP_TONE_STATE_HUNGUP) {
- res = AST_CONTROL_HANGUP;
- dsp->features &= ~DSP_FEATURE_CALL_PROGRESS;
- }
+ if (dsp->ringtimeout)
+ dsp->ringtimeout++;
+ switch (dsp->tstate) {
+ case DSP_TONE_STATE_RINGING:
+ if ((dsp->features & DSP_PROGRESS_RINGING) &&
+ (dsp->tcount==THRESH_RING)) {
+ res = AST_CONTROL_RINGING;
+ dsp->ringtimeout= 1;
+ }
+ break;
+ case DSP_TONE_STATE_BUSY:
+ if ((dsp->features & DSP_PROGRESS_BUSY) &&
+ (dsp->tcount==THRESH_BUSY)) {
+ res = AST_CONTROL_BUSY;
+ dsp->features &= ~DSP_FEATURE_CALL_PROGRESS;
+ }
+ break;
+ case DSP_TONE_STATE_TALKING:
+ if ((dsp->features & DSP_PROGRESS_TALK) &&
+ (dsp->tcount==THRESH_TALK)) {
+ res = AST_CONTROL_ANSWER;
+ dsp->features &= ~DSP_FEATURE_CALL_PROGRESS;
+ }
+ break;
+ case DSP_TONE_STATE_SPECIAL3:
+ if ((dsp->features & DSP_PROGRESS_CONGESTION) &&
+ (dsp->tcount==THRESH_CONGESTION)) {
+ res = AST_CONTROL_CONGESTION;
+ dsp->features &= ~DSP_FEATURE_CALL_PROGRESS;
+ }
+ break;
+ case DSP_TONE_STATE_HUNGUP:
+ if ((dsp->features & DSP_FEATURE_CALL_PROGRESS) &&
+ (dsp->tcount==THRESH_HANGUP)) {
+ res = AST_CONTROL_HANGUP;
+ dsp->features &= ~DSP_FEATURE_CALL_PROGRESS;
+ }
+ break;
+ }
+ if (dsp->ringtimeout==THRESH_RING2ANSWER) {
+#if 0
+ ast_log(LOG_NOTICE, "Consider call as answered because of timeout after last ring\n");
+#endif
+ res = AST_CONTROL_ANSWER;
+ dsp->features &= ~DSP_FEATURE_CALL_PROGRESS;
}
} else {
#if 0
- printf("Newstate: %d\n", newstate);
+ ast_log(LOG_NOTICE, "Stop state %d with duration %d\n", dsp->tstate, dsp->tcount);
+ ast_log(LOG_NOTICE, "Start state %d\n", newstate);
#endif
dsp->tstate = newstate;
dsp->tcount = 1;
@@ -1570,6 +1601,7 @@
}
}
dsp->freqcount = max;
+ dsp->ringtimeout= 0;
}
struct ast_dsp *ast_dsp_new(void)
@@ -1681,6 +1713,7 @@
dsp->freqs[x].v2 = dsp->freqs[x].v3 = 0.0;
memset(dsp->historicsilence, 0, sizeof(dsp->historicsilence));
memset(dsp->historicnoise, 0, sizeof(dsp->historicnoise));
+ dsp->ringtimeout= 0;
}
int ast_dsp_digitmode(struct ast_dsp *dsp, int digitmode)
Modified: team/oej/astum/include/asterisk/cli.h
URL: http://svn.digium.com/view/asterisk/team/oej/astum/include/asterisk/cli.h?rev=8193&r1=8192&r2=8193&view=diff
==============================================================================
--- team/oej/astum/include/asterisk/cli.h (original)
+++ team/oej/astum/include/asterisk/cli.h Wed Jan 18 13:18:02 2006
@@ -29,7 +29,7 @@
#include <stdarg.h>
-extern void ast_cli(int fd, char *fmt, ...)
+void ast_cli(int fd, char *fmt, ...)
__attribute__ ((format (printf, 2, 3)));
#define RESULT_SUCCESS 0
@@ -45,40 +45,55 @@
/*! \brief A command line entry */
struct ast_cli_entry {
/*! Null terminated list of the words of the command */
- char *cmda[AST_MAX_CMD_LEN];
- /*! Handler for the command (fd for output, # of arguments, argument list). Returns RESULT_SHOWUSAGE for improper arguments */
+ char * cmda[AST_MAX_CMD_LEN];
+ /*! Handler for the command (fd for output, # of args, argument list).
+ Returns RESULT_SHOWUSAGE for improper arguments.
+ argv[] has argc 'useful' entries, and an additional NULL entry
+ at the end so that clients requiring NULL terminated arrays
+ can use it without need for copies.
+ You can overwrite argv or the strings it points to, but remember
+ that this memory is deallocated after the handler returns.
+ */
int (*handler)(int fd, int argc, char *argv[]);
/*! Summary of the command (< 60 characters) */
- char *summary;
+ const char *summary;
/*! Detailed usage information */
- char *usage;
- /*! Generate a list of possible completions for a given word */
- char *(*generator)(char *line, char *word, int pos, int state);
+ const char *usage;
+ /*! Generate the n-th (starting from 0) possible completion
+ for a given 'word' following 'line' in position 'pos'.
+ 'line' and 'word' must not be modified.
+ Must return a malloc'ed string with the n-th value when available,
+ or NULL if the n-th completion does not exist.
+ Typically, the function is called with increasing values for n
+ until a NULL is returned.
+ */
+ char *(*generator)(char *line, char *word, int pos, int n);
/*! For linking */
struct ast_cli_entry *next;
/*! For keeping track of usage */
int inuse;
};
+
/*! \brief Interprets a command
* Interpret a command s, sending output to fd
* Returns 0 on succes, -1 on failure
*/
-extern int ast_cli_command(int fd, char *s);
+int ast_cli_command(int fd, char *s);
/*! \brief Registers a command or an array of commands
* \param e which cli entry to register
* Register your own command
* Returns 0 on success, -1 on failure
*/
-extern int ast_cli_register(struct ast_cli_entry *e);
+int ast_cli_register(struct ast_cli_entry *e);
/*!
* \brief Register multiple commands
* \param e pointer to first cli entry to register
* \param len number of entries to register
*/
-extern void ast_cli_register_multiple(struct ast_cli_entry *e, int len);
+void ast_cli_register_multiple(struct ast_cli_entry *e, int len);
/*! \brief Unregisters a command or an array of commands
*
@@ -86,23 +101,36 @@
* Unregister your own command. You must pass a completed ast_cli_entry structure
* Returns 0.
*/
-extern int ast_cli_unregister(struct ast_cli_entry *e);
+int ast_cli_unregister(struct ast_cli_entry *e);
/*!
* \brief Unregister multiple commands
* \param e pointer to first cli entry to unregister
* \param len number of entries to unregister
*/
-extern void ast_cli_unregister_multiple(struct ast_cli_entry *e, int len);
+void ast_cli_unregister_multiple(struct ast_cli_entry *e, int len);
/*! \brief Readline madness
* Useful for readline, that's about it
* Returns 0 on success, -1 on failure
*/
-extern char *ast_cli_generator(char *, char *, int);
+char *ast_cli_generator(char *, char *, int);
-extern int ast_cli_generatornummatches(char *, char *);
-extern char **ast_cli_completion_matches(char *, char *);
+int ast_cli_generatornummatches(char *, char *);
+
+/*!
+ * \brief Generates a NULL-terminated array of strings that
+ * 1) begin with the string in the second parameter, and
+ * 2) are valid in a command after the string in the first parameter.
+ *
+ * The first entry (offset 0) of the result is the longest common substring
+ * in the results, useful to extend the string that has been completed.
+ * Subsequent entries are all possible values, followe by a NULL.
+ * All strings and the array itself are malloc'ed and must be freed
+ * by the caller.
+ */
+char **ast_cli_completion_matches(char *, char *);
+
#if defined(__cplusplus) || defined(c_plusplus)
}
Modified: team/oej/astum/include/asterisk/module.h
URL: http://svn.digium.com/view/asterisk/team/oej/astum/include/asterisk/module.h?rev=8193&r1=8192&r2=8193&view=diff
==============================================================================
--- team/oej/astum/include/asterisk/module.h (original)
+++ team/oej/astum/include/asterisk/module.h Wed Jan 18 13:18:02 2006
@@ -289,6 +289,10 @@
#define LOCAL_USER_DECL AST_MUTEX_DEFINE_STATIC(localuser_lock); \
static struct localuser *localusers = NULL; \
static int localusecnt = 0;
+
+#define STANDARD_USECOUNT_DECL \
+ AST_MUTEX_DEFINE_STATIC(localuser_lock); \
+ static int localusecnt = 0;
#define STANDARD_INCREMENT_USECOUNT \
ast_mutex_lock(&localuser_lock); \
Modified: team/oej/astum/loader.c
URL: http://svn.digium.com/view/asterisk/team/oej/astum/loader.c?rev=8193&r1=8192&r2=8193&view=diff
==============================================================================
--- team/oej/astum/loader.c (original)
+++ team/oej/astum/loader.c Wed Jan 18 13:18:02 2006
@@ -458,8 +458,8 @@
static const char *loadorder[] =
{
"res_",
+ "pbx_",
"chan_",
- "pbx_",
NULL,
};
Modified: team/oej/astum/manager.c
URL: http://svn.digium.com/view/asterisk/team/oej/astum/manager.c?rev=8193&r1=8192&r2=8193&view=diff
==============================================================================
--- team/oej/astum/manager.c (original)
+++ team/oej/astum/manager.c Wed Jan 18 13:18:02 2006
@@ -1708,12 +1708,6 @@
ast_log(LOG_WARNING, "Invalid port number '%s'\n", val);
portno = DEFAULT_MANAGER_PORT;
}
- } else if ((val = ast_variable_retrieve(cfg, "general", "portno"))) {
- if (sscanf(val, "%d", &portno) != 1) {
- ast_log(LOG_WARNING, "Invalid port number '%s'\n", val);
- portno = DEFAULT_MANAGER_PORT;
- }
- ast_log(LOG_NOTICE, "Use of portno in manager.conf deprecated. Please use 'port=%s' instead.\n", val);
}
if ((val = ast_variable_retrieve(cfg, "general", "displayconnects")))
Modified: team/oej/astum/pbx.c
URL: http://svn.digium.com/view/asterisk/team/oej/astum/pbx.c?rev=8193&r1=8192&r2=8193&view=diff
==============================================================================
--- team/oej/astum/pbx.c (original)
+++ team/oej/astum/pbx.c Wed Jan 18 13:18:02 2006
@@ -892,7 +892,7 @@
void pbx_retrieve_variable(struct ast_channel *c, const char *var, char **ret, char *workspace, int workspacelen, struct varshead *headp)
{
const char not_found = '\0';
- char tmpvar[80], *deprecated = NULL;
+ char tmpvar[80];
const char *s; /* the result */
int offset, length;
int i, need_substring;
@@ -918,38 +918,12 @@
* s = workspace if the result has been assembled there;
* s != workspace in case we have a string, that needs to be copied
* (the ast_copy_string is done once for all at the end).
- * Deprecated variables have the replacement indicated in 'deprecated'.
*/
s = ¬_found; /* default value */
if (c) { /* This group requires a valid channel */
/* Names with common parts are looked up a piece at a time using strncmp. */
if (!strncmp(var, "CALL", 4)) {
- if (!strncmp(var + 4, "ER", 2)) {
- if (!strncmp(var + 6, "ID", 2)) {
- if (!var[8]) { /* CALLERID */
- if (c->cid.cid_num) {
- if (c->cid.cid_name) {
- snprintf(workspace, workspacelen, "\"%s\" <%s>",
- c->cid.cid_name, c->cid.cid_num);
- s = workspace;
- } else {
- s = c->cid.cid_num;
- }
- } else
- s = c->cid.cid_name; /* possibly empty */
- deprecated = "CALLERID(all)";
- } else if (!strcmp(var + 8, "NUM")) { /* CALLERIDNUM */
- s = c->cid.cid_num;
- deprecated = "CALLERID(num)";
- } else if (!strcmp(var + 8, "NAME")) { /* CALLERIDNAME */
- s = c->cid.cid_name;
- deprecated = "CALLERID(name)";
- }
- } else if (!strcmp(var + 6, "ANI")) { /* CALLERANI */
- s = c->cid.cid_ani;
- deprecated = "CALLERID(ANI)";
- }
- } else if (!strncmp(var + 4, "ING", 3)) {
+ if (!strncmp(var + 4, "ING", 3)) {
if (!strcmp(var + 7, "PRES")) { /* CALLINGPRES */
snprintf(workspace, workspacelen, "%d", c->cid.cid_pres);
s = workspace;
@@ -964,18 +938,12 @@
s = workspace;
}
}
- } else if (!strcmp(var, "DNID")) {
- s = c->cid.cid_dnid;
- deprecated = "CALLERID(DNID)";
} else if (!strcmp(var, "HINT")) {
s = ast_get_hint(workspace, workspacelen, NULL, 0, c, c->context, c->exten) ? workspace : NULL;
} else if (!strcmp(var, "HINTNAME")) {
s = ast_get_hint(NULL, 0, workspace, workspacelen, c, c->context, c->exten) ? workspace : NULL;
} else if (!strcmp(var, "EXTEN")) {
s = c->exten;
- } else if (!strcmp(var, "RDNIS")) {
- s = c->cid.cid_rdnis;
- deprecated = "CALLERID(RDNIS)";
} else if (!strcmp(var, "CONTEXT")) {
s = c->context;
} else if (!strcmp(var, "PRIORITY")) {
@@ -988,48 +956,12 @@
} else if (!strcmp(var, "HANGUPCAUSE")) {
snprintf(workspace, workspacelen, "%d", c->hangupcause);
s = workspace;
- } else if (!strcmp(var, "ACCOUNTCODE")) {
- s = c->accountcode;
- deprecated = "CDR(accountcode)";
- } else if (!strcmp(var, "LANGUAGE")) {
- s = c->language;
- deprecated = "LANGUAGE()";
}
}
if (s == ¬_found) { /* look for more */
- time_t thistime;
- struct tm brokentime;
-
if (!strcmp(var, "EPOCH")) {
snprintf(workspace, workspacelen, "%u",(int)time(NULL));
s = workspace;
- } else if (!strcmp(var, "DATETIME")) {
- thistime=time(NULL);
- localtime_r(&thistime, &brokentime);
- snprintf(workspace, workspacelen, "%02d%02d%04d-%02d:%02d:%02d",
- brokentime.tm_mday,
- brokentime.tm_mon+1,
- brokentime.tm_year+1900,
- brokentime.tm_hour,
- brokentime.tm_min,
- brokentime.tm_sec
- );
- s = workspace;
- deprecated = "STRFTIME(${EPOCH},,\%d\%m\%Y-\%H:\%M:\%S)";
- } else if (!strcmp(var, "TIMESTAMP")) {
- thistime=time(NULL);
- localtime_r(&thistime, &brokentime);
- /* 20031130-150612 */
- snprintf(workspace, workspacelen, "%04d%02d%02d-%02d%02d%02d",
- brokentime.tm_year+1900,
- brokentime.tm_mon+1,
- brokentime.tm_mday,
- brokentime.tm_hour,
- brokentime.tm_min,
- brokentime.tm_sec
- );
- s = workspace;
- deprecated = "STRFTIME(${EPOCH},,\%Y\%m\%d-\%H\%M\%S)";
}
}
/* if not found, look into chanvars or global vars */
@@ -1053,9 +985,6 @@
if (need_substring)
*ret = substring(*ret, offset, length, workspace, workspacelen);
}
-
- if (deprecated)
- ast_log(LOG_WARNING, "${%s} is deprecated. Please use ${%s} instead.\n", var, deprecated);
}
/*! \brief CLI function to show installed custom functions
Modified: team/oej/astum/pbx/pbx_dundi.c
URL: http://svn.digium.com/view/asterisk/team/oej/astum/pbx/pbx_dundi.c?rev=8193&r1=8192&r2=8193&view=diff
==============================================================================
--- team/oej/astum/pbx/pbx_dundi.c (original)
+++ team/oej/astum/pbx/pbx_dundi.c Wed Jan 18 13:18:02 2006
@@ -78,20 +78,6 @@
extern char ast_config_AST_KEY_DIR[];
static char *tdesc = "Distributed Universal Number Discovery (DUNDi)";
-
-static char *app = "DUNDiLookup";
-static char *synopsis = "Look up a number with DUNDi";
-static char *descrip =
-"DUNDiLookup(number[|context[|options]])\n"
-" Looks up a given number in the global context specified or in\n"
-"the reserved 'e164' context if not specified. Returns -1 if the channel\n"
-"is hungup during the lookup or 0 otherwise. On completion, the variable\n"
-"${DUNDTECH} and ${DUNDDEST} will contain the technology and destination\n"
-"of the appropriate technology and destination to access the number. If no\n"
-"answer was found, and the priority n + 101 exists, execution will continue\n"
-"at that location. Note that this will only occur if the global priority\n"
-"jumping option is enabled in extensions.conf. If the 'b' option is specified,\n"
-"the internal DUNDi cache will by bypassed.\n";
#define DUNDI_MODEL_INBOUND (1 << 0)
#define DUNDI_MODEL_OUTBOUND (1 << 1)
@@ -3849,75 +3835,6 @@
struct dundi_hint_metadata hmd;
memset(&hmd, 0, sizeof(hmd));
return dundi_query_eid_internal(dei, dcontext, &eid, &hmd, dundi_ttl, 0, avoid);
-}
-
-/*!
- * \ingroup applications
- */
-static int dundi_lookup_exec(struct ast_channel *chan, void *data)
-{
- char *num;
- char *context;
- char *opts;
- int results;
- int x;
- int bypass = 0;
- struct localuser *u;
- struct dundi_result dr[MAX_RESULTS];
- static int dep_warning = 0;
-
- LOCAL_USER_ADD(u);
-
- if (!dep_warning) {
- ast_log(LOG_WARNING, "This application has been deprecated in favor of the DUNDILOOKUP dialplan function.\n");
- dep_warning = 1;
- }
-
- if (ast_strlen_zero(data)) {
- ast_log(LOG_WARNING, "DUNDiLookup requires an argument (number)\n");
- LOCAL_USER_REMOVE(u);
- return 0;
- }
-
- num = ast_strdupa(data);
- if (!num) {
- ast_log(LOG_ERROR, "Out of memory!\n");
- LOCAL_USER_REMOVE(u);
- return 0;
- }
-
- context = strchr(num, '|');
- if (context) {
- *context = '\0';
- context++;
[... 94 lines stripped ...]
More information about the asterisk-commits
mailing list