[asterisk-commits] branch oej/siptransfer r30429 - in
/team/oej/siptransfer: ./ apps/ channels/ ...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Thu May 25 14:39:05 MST 2006
Author: oej
Date: Thu May 25 16:39:04 2006
New Revision: 30429
URL: http://svn.digium.com/view/asterisk?rev=30429&view=rev
Log:
Reset, go
Added:
team/oej/siptransfer/doc/callfiles.txt
- copied unchanged from r30427, trunk/doc/callfiles.txt
Modified:
team/oej/siptransfer/ (props changed)
team/oej/siptransfer/apps/app_db.c
team/oej/siptransfer/apps/app_dial.c
team/oej/siptransfer/apps/app_echo.c
team/oej/siptransfer/apps/app_lookupblacklist.c
team/oej/siptransfer/apps/app_lookupcidname.c
team/oej/siptransfer/apps/app_meetme.c
team/oej/siptransfer/apps/app_queue.c
team/oej/siptransfer/apps/app_rpt.c
team/oej/siptransfer/apps/app_setcallerid.c
team/oej/siptransfer/apps/app_setcdruserfield.c
team/oej/siptransfer/apps/app_settransfercapability.c
team/oej/siptransfer/apps/app_speech_utils.c
team/oej/siptransfer/asterisk.c
team/oej/siptransfer/channel.c
team/oej/siptransfer/channels/chan_iax2.c
team/oej/siptransfer/channels/chan_misdn.c
team/oej/siptransfer/channels/chan_sip.c
team/oej/siptransfer/channels/chan_zap.c
team/oej/siptransfer/channels/misdn/isdn_lib.c
team/oej/siptransfer/channels/misdn/isdn_lib.h
team/oej/siptransfer/channels/misdn/isdn_msg_parser.c
team/oej/siptransfer/codecs/codec_a_mu.c
team/oej/siptransfer/codecs/codec_ulaw.c
team/oej/siptransfer/codecs/gsm/Makefile
team/oej/siptransfer/configs/extensions.conf.sample
team/oej/siptransfer/configs/misdn.conf.sample
team/oej/siptransfer/configs/sip.conf.sample
team/oej/siptransfer/doc/channelvariables.txt
team/oej/siptransfer/funcs/func_channel.c
team/oej/siptransfer/funcs/func_db.c
team/oej/siptransfer/include/asterisk/app.h
team/oej/siptransfer/include/asterisk/channel.h
team/oej/siptransfer/logger.c
team/oej/siptransfer/pbx.c
team/oej/siptransfer/pbx/pbx_spool.c
team/oej/siptransfer/res/res_agi.c
team/oej/siptransfer/res/res_jabber.c
team/oej/siptransfer/sample.call
team/oej/siptransfer/utils/Makefile
Propchange: team/oej/siptransfer/
------------------------------------------------------------------------------
Binary property 'branch-1.2-blocked' - no diff available.
Propchange: team/oej/siptransfer/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.
Propchange: team/oej/siptransfer/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu May 25 16:39:04 2006
@@ -1,1 +1,1 @@
-/trunk:1-29848
+/trunk:1-30428
Modified: team/oej/siptransfer/apps/app_db.c
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/apps/app_db.c?rev=30429&r1=30428&r2=30429&view=diff
==============================================================================
--- team/oej/siptransfer/apps/app_db.c (original)
+++ team/oej/siptransfer/apps/app_db.c Thu May 25 16:39:04 2006
@@ -48,9 +48,11 @@
#include "asterisk/lock.h"
#include "asterisk/options.h"
+/*! \todo XXX Remove this application after 1.4 is relased */
static char *d_descrip =
" DBdel(family/key): This applicaiton will delete a key from the Asterisk\n"
-"database.\n";
+"database.\n"
+" This application has been DEPRECATED in favor of the DB_DELETE function.\n";
static char *dt_descrip =
" DBdeltree(family[/keytree]): This application will delete a family or keytree\n"
@@ -109,8 +111,14 @@
{
char *argv, *family, *key;
struct localuser *u;
+ static int deprecation_warning = 0;
LOCAL_USER_ADD(u);
+
+ if (!deprecation_warning) {
+ deprecation_warning = 1;
+ ast_log(LOG_WARNING, "The DBdel application has been deprecated in favor of the DB_DELETE dialplan function!\n");
+ }
argv = ast_strdupa(data);
Modified: team/oej/siptransfer/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/apps/app_dial.c?rev=30429&r1=30428&r2=30429&view=diff
==============================================================================
--- team/oej/siptransfer/apps/app_dial.c (original)
+++ team/oej/siptransfer/apps/app_dial.c Thu May 25 16:39:04 2006
@@ -959,21 +959,27 @@
}
if(privdb_val == AST_PRIVACY_DENY ) {
+ ast_copy_string(status, "NOANSWER", sizeof(status));
if (option_verbose > 2)
ast_verbose( VERBOSE_PREFIX_3 "Privacy DB reports PRIVACY_DENY for this callerid. Dial reports unavailable\n");
res=0;
goto out;
}
else if(privdb_val == AST_PRIVACY_KILL ) {
- ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 201);
+ ast_copy_string(status, "DONTCALL", sizeof(status));
+ if (ast_opt_priority_jumping || ast_test_flag(&opts, OPT_PRIORITY_JUMP)) {
+ ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 201);
+ }
res = 0;
goto out; /* Is this right? */
}
else if(privdb_val == AST_PRIVACY_TORTURE ) {
- ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 301);
+ ast_copy_string(status, "TORTURE", sizeof(status));
+ if (ast_opt_priority_jumping || ast_test_flag(&opts, OPT_PRIORITY_JUMP)) {
+ ast_goto_if_exists(chan, chan->context, chan->exten, chan->priority + 301);
+ }
res = 0;
goto out; /* is this right??? */
-
}
else if(privdb_val == AST_PRIVACY_UNKNOWN ) {
/* Get the user's intro, store it in priv-callerintros/$CID,
@@ -1000,6 +1006,8 @@
ast_play_and_record(chan, "priv-recordintro", privintro, 4, "gsm", &duration, 128, 2000, 0); /* NOTE: I've reduced the total time to 4 sec */
/* don't think we'll need a lock removed, we took care of
conflicts by naming the privintro file */
+ if( !ast_streamfile(chan, "vm-dialout", chan->language) )
+ ast_waitstream(chan, "");
}
}
}
@@ -1312,6 +1320,7 @@
opt_args[OPT_ARG_PRIVACY], privcid);
ast_privacy_set(opt_args[OPT_ARG_PRIVACY], privcid, AST_PRIVACY_DENY);
}
+ ast_copy_string(status, "NOANSWER", sizeof(status));
ast_hangup(peer); /* hang up on the callee -- he didn't want to talk anyway! */
res=0;
goto out;
Modified: team/oej/siptransfer/apps/app_echo.c
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/apps/app_echo.c?rev=30429&r1=30428&r2=30429&view=diff
==============================================================================
--- team/oej/siptransfer/apps/app_echo.c (original)
+++ team/oej/siptransfer/apps/app_echo.c Thu May 25 16:39:04 2006
@@ -72,26 +72,30 @@
break;
f->delivery.tv_sec = 0;
f->delivery.tv_usec = 0;
- if (f->frametype == AST_FRAME_VOICE) {
- if (ast_write(chan, f))
- break;
- } else if (f->frametype == AST_FRAME_VIDEO) {
- if (ast_write(chan, f))
- break;
- } else if (f->frametype == AST_FRAME_DTMF) {
+ switch (f->frametype) {
+ case AST_FRAME_DTMF:
+ case AST_FRAME_DTMF_END:
if (f->subclass == '#') {
res = 0;
- break;
- } else {
- if (ast_write(chan, f))
- break;
+ ast_frfree(f);
+ goto end;
+ }
+ /* fall through */
+ case AST_FRAME_DTMF_BEGIN:
+ case AST_FRAME_VOICE:
+ case AST_FRAME_VIDEO:
+ case AST_FRAME_TEXT:
+ case AST_FRAME_HTML:
+ case AST_FRAME_IMAGE:
+ if (ast_write(chan, f)) {
+ ast_frfree(f);
+ goto end;
}
}
ast_frfree(f);
}
-
+end:
LOCAL_USER_REMOVE(u);
-
return res;
}
Modified: team/oej/siptransfer/apps/app_lookupblacklist.c
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/apps/app_lookupblacklist.c?rev=30429&r1=30428&r2=30429&view=diff
==============================================================================
--- team/oej/siptransfer/apps/app_lookupblacklist.c (original)
+++ team/oej/siptransfer/apps/app_lookupblacklist.c Thu May 25 16:39:04 2006
@@ -65,6 +65,32 @@
LOCAL_USER_DECL;
+static int blacklist_read(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
+{
+ char blacklist[1];
+ int bl = 0;
+
+ if (chan->cid.cid_num) {
+ if (!ast_db_get("blacklist", chan->cid.cid_num, blacklist, sizeof (blacklist)))
+ bl = 1;
+ }
+ if (chan->cid.cid_name) {
+ if (!ast_db_get("blacklist", chan->cid.cid_name, blacklist, sizeof (blacklist)))
+ bl = 1;
+ }
+
+ snprintf(buf, len, "%d", bl);
+ return 0;
+}
+
+static struct ast_custom_function blacklist_function = {
+ .name = "BLACKLIST",
+ .synopsis = "Check if the callerid is on the blacklist",
+ .desc = "Uses astdb to check if the Caller*ID is in family 'blacklist'. Returns 1 or 0.\n",
+ .syntax = "BLACKLIST()",
+ .read = blacklist_read,
+};
+
static int
lookupblacklist_exec (struct ast_channel *chan, void *data)
{
@@ -72,8 +98,14 @@
struct localuser *u;
int bl = 0;
int priority_jump = 0;
+ static int dep_warning = 0;
LOCAL_USER_ADD(u);
+
+ if (!dep_warning) {
+ dep_warning = 1;
+ ast_log(LOG_WARNING, "LookupBlacklist is deprecated. Please use ${BLACKLIST()} instead.\n");
+ }
if (!ast_strlen_zero(data)) {
if (strchr(data, 'j'))
@@ -112,6 +144,7 @@
int res;
res = ast_unregister_application(app);
+ res |= ast_custom_function_unregister(&blacklist_function);
STANDARD_HANGUP_LOCALUSERS;
@@ -120,7 +153,9 @@
static int load_module(void *mod)
{
- return ast_register_application (app, lookupblacklist_exec, synopsis,descrip);
+ int res = ast_custom_function_register(&blacklist_function);
+ res |= ast_register_application (app, lookupblacklist_exec, synopsis,descrip);
+ return res;
}
static const char *description(void)
Modified: team/oej/siptransfer/apps/app_lookupcidname.c
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/apps/app_lookupcidname.c?rev=30429&r1=30428&r2=30429&view=diff
==============================================================================
--- team/oej/siptransfer/apps/app_lookupcidname.c (original)
+++ team/oej/siptransfer/apps/app_lookupcidname.c Thu May 25 16:39:04 2006
@@ -66,8 +66,13 @@
{
char dbname[64];
struct localuser *u;
+ static int dep_warning = 0;
LOCAL_USER_ADD (u);
+ if (!dep_warning) {
+ dep_warning = 1;
+ ast_log(LOG_WARNING, "LookupCIDName is deprecated. Please use ${DB(cidname/${CALLERID(num)})} instead.\n");
+ }
if (chan->cid.cid_num) {
if (!ast_db_get ("cidname", chan->cid.cid_num, dbname, sizeof (dbname))) {
ast_set_callerid (chan, NULL, dbname, NULL);
Modified: team/oej/siptransfer/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/apps/app_meetme.c?rev=30429&r1=30428&r2=30429&view=diff
==============================================================================
--- team/oej/siptransfer/apps/app_meetme.c (original)
+++ team/oej/siptransfer/apps/app_meetme.c Thu May 25 16:39:04 2006
@@ -254,6 +254,16 @@
" 'M' -- Mute conference\n"
" 'n' -- Unmute entire conference (except admin)\n"
" 'N' -- Mute entire conference (except admin)\n"
+" 'r' -- Reset one user's volume settings\n"
+" 'R' -- Reset all users volume settings\n"
+" 's' -- Lower entire conference speaking volume\n"
+" 'S' -- Raise entire conference speaking volume\n"
+" 't' -- Lower one user's talk volume\n"
+" 'T' -- Lower all users talk volume\n"
+" 'u' -- Lower one user's listen volume\n"
+" 'U' -- Lower all users listen volume\n"
+" 'v' -- Lower entire conference listening volume\n"
+" 'V' -- Raise entire conference listening volume\n"
"";
struct ast_conference {
@@ -299,7 +309,7 @@
int talking; /*!< Is user talking */
int zapchannel; /*!< Is a Zaptel channel */
char usrvalue[50]; /*!< Custom User Value */
- char namerecloc[AST_MAX_EXTENSION]; /*!< Name Recorded file Location */
+ char namerecloc[PATH_MAX]; /*!< Name Recorded file Location */
time_t jointime; /*!< Time the user joined the conference */
struct volume talk;
struct volume listen;
@@ -883,6 +893,7 @@
int using_pseudo = 0;
int duration=20;
int hr, min, sec;
+ int sent_event = 0;
time_t now;
struct ast_dsp *dsp=NULL;
struct ast_app *app;
@@ -1135,17 +1146,20 @@
}
ast_log(LOG_DEBUG, "Placed channel %s in ZAP conf %d\n", chan->name, conf->zapconf);
- manager_event(EVENT_FLAG_CALL, "MeetmeJoin",
- "Channel: %s\r\n"
- "Uniqueid: %s\r\n"
- "Meetme: %s\r\n"
- "Usernum: %d\r\n",
- chan->name, chan->uniqueid, conf->confno, user->user_no);
+ if (!sent_event) {
+ manager_event(EVENT_FLAG_CALL, "MeetmeJoin",
+ "Channel: %s\r\n"
+ "Uniqueid: %s\r\n"
+ "Meetme: %s\r\n"
+ "Usernum: %d\r\n",
+ chan->name, chan->uniqueid, conf->confno, user->user_no);
+ sent_event = 1;
+ }
if (!firstpass && !(confflags & CONFFLAG_MONITOR) && !(confflags & CONFFLAG_ADMIN)) {
firstpass = 1;
if (!(confflags & CONFFLAG_QUIET))
- if (!(confflags & CONFFLAG_WAITMARKED) || (conf->markedusers >= 1))
+ if (!(confflags & CONFFLAG_WAITMARKED) || ((confflags & CONFFLAG_MARKEDUSER) && (conf->markedusers >= 1)))
conf_play(chan, conf, ENTER);
}
@@ -1693,19 +1707,21 @@
min = ((now - user->jointime) % 3600) / 60;
sec = (now - user->jointime) % 60;
- manager_event(EVENT_FLAG_CALL, "MeetmeLeave",
- "Channel: %s\r\n"
- "Uniqueid: %s\r\n"
- "Meetme: %s\r\n"
- "Usernum: %d\r\n"
- "CallerIDnum: %s\r\n"
- "CallerIDname: %s\r\n"
- "Duration: %ld\r\n",
- chan->name, chan->uniqueid, conf->confno,
- user->user_no,
- S_OR(user->chan->cid.cid_num, "<unknown>"),
- S_OR(user->chan->cid.cid_name, "<unknown>"),
- (now - user->jointime));
+ if (sent_event) {
+ manager_event(EVENT_FLAG_CALL, "MeetmeLeave",
+ "Channel: %s\r\n"
+ "Uniqueid: %s\r\n"
+ "Meetme: %s\r\n"
+ "Usernum: %d\r\n"
+ "CallerIDnum: %s\r\n"
+ "CallerIDname: %s\r\n"
+ "Duration: %ld\r\n",
+ chan->name, chan->uniqueid, conf->confno,
+ user->user_no,
+ S_OR(user->chan->cid.cid_num, "<unknown>"),
+ S_OR(user->chan->cid.cid_name, "<unknown>"),
+ (now - user->jointime));
+ }
conf->users--;
conf->refcount--;
@@ -2270,9 +2286,8 @@
case 77: /* M: Mute */
if (user) {
user->adminflags |= ADMINFLAG_MUTED;
- } else {
+ } else
ast_log(LOG_NOTICE, "Specified User not found!\n");
- }
break;
case 78: /* N: Mute all (non-admin) users */
AST_LIST_TRAVERSE(&cnf->userlist, user, list) {
@@ -2283,9 +2298,8 @@
case 109: /* m: Unmute */
if (user) {
user->adminflags &= ~ADMINFLAG_MUTED;
- } else {
+ } else
ast_log(LOG_NOTICE, "Specified User not found!\n");
- }
break;
case 110: /* n: Unmute all users */
AST_LIST_TRAVERSE(&cnf->userlist, user, list)
@@ -2295,6 +2309,56 @@
if (user)
user->adminflags |= ADMINFLAG_KICKME;
else
+ ast_log(LOG_NOTICE, "Specified User not found!");
+ break;
+ case 118: /* v: Lower all users listen volume */
+ AST_LIST_TRAVERSE(&cnf->userlist, user, list)
+ tweak_listen_volume(user, VOL_DOWN);
+ break;
+ case 86: /* V: Raise all users listen volume */
+ AST_LIST_TRAVERSE(&cnf->userlist, user, list)
+ tweak_listen_volume(user, VOL_UP);
+ break;
+ case 115: /* s: Lower all users speaking volume */
+ AST_LIST_TRAVERSE(&cnf->userlist, user, list)
+ tweak_talk_volume(user, VOL_DOWN);
+ break;
+ case 83: /* S: Raise all users speaking volume */
+ AST_LIST_TRAVERSE(&cnf->userlist, user, list)
+ tweak_talk_volume(user, VOL_UP);
+ break;
+ case 82: /* R: Reset all volume levels */
+ AST_LIST_TRAVERSE(&cnf->userlist, user, list)
+ reset_volumes(user);
+ break;
+ case 114: /* r: Reset user's volume level */
+ if (user)
+ reset_volumes(user);
+ else
+ ast_log(LOG_NOTICE, "Specified User not found!");
+ break;
+ case 85: /* U: Raise user's listen volume */
+ if (user)
+ tweak_listen_volume(user, VOL_UP);
+ else
+ ast_log(LOG_NOTICE, "Specified User not found!");
+ break;
+ case 117: /* u: Lower user's listen volume */
+ if (user)
+ tweak_listen_volume(user, VOL_DOWN);
+ else
+ ast_log(LOG_NOTICE, "Specified User not found!");
+ break;
+ case 84: /* T: Raise user's talk volume */
+ if (user)
+ tweak_talk_volume(user, VOL_UP);
+ else
+ ast_log(LOG_NOTICE, "Specified User not found!");
+ break;
+ case 116: /* t: Lower user's talk volume */
+ if (user)
+ tweak_talk_volume(user, VOL_DOWN);
+ else
ast_log(LOG_NOTICE, "Specified User not found!");
break;
}
Modified: team/oej/siptransfer/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/apps/app_queue.c?rev=30429&r1=30428&r2=30429&view=diff
==============================================================================
--- team/oej/siptransfer/apps/app_queue.c (original)
+++ team/oej/siptransfer/apps/app_queue.c Thu May 25 16:39:04 2006
@@ -1213,13 +1213,16 @@
ast_verbose(VERBOSE_PREFIX_3 "Told %s in %s their queue position (which was %d)\n",
qe->chan->name, qe->parent->name, qe->pos);
res = play_file(qe->chan, qe->parent->sound_thanks);
+ if (res && !valid_exit(qe, res))
+ res = 0;
playout:
/* Set our last_pos indicators */
qe->last_pos = now;
qe->last_pos_said = qe->pos;
+
/* Don't restart music on hold if we're about to exit the caller from the queue */
- if (res)
+ if (!res)
ast_moh_start(qe->chan, qe->moh);
return res;
@@ -1585,7 +1588,7 @@
if (!res) {
/* Wait for a keypress */
res = ast_waitstream(chan, AST_DIGIT_ANY);
- if (res <= 0 || !valid_exit(qe, res))
+ if (res < 0 || !valid_exit(qe, res))
res = 0;
/* Stop playback */
@@ -1628,8 +1631,9 @@
/* play the announcement */
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);
+ /* Resume Music on Hold if the caller is going to stay in the queue */
+ if (!res)
+ ast_moh_start(qe->chan, qe->moh);
/* update last_periodic_announce_time */
qe->last_periodic_announce_time = now;
@@ -1655,6 +1659,24 @@
ast_mutex_unlock(&qe->parent->lock);
}
+/*! \brief RNA == Ring No Answer. Common code that is executed when we try a queue member and they don't answer. */
+static void rna(int rnatime, struct queue_ent *qe, char *membername)
+{
+
+ if (option_verbose > 2)
+ ast_verbose( VERBOSE_PREFIX_3 "Nobody picked up in %d ms\n", rnatime);
+ ast_queue_log(qe->parent->name, qe->chan->uniqueid, membername, "RINGNOANSWER", "%d", rnatime);
+ if (qe->parent->autopause) {
+ if (!set_member_paused(qe->parent->name, membername, 1)) {
+ if (option_verbose > 2)
+ ast_verbose( VERBOSE_PREFIX_3 "Auto-Pausing Queue Member %s in queue %s since they failed to answer.\n", membername, qe->parent->name);
+ } else {
+ if (option_verbose > 2)
+ ast_verbose( VERBOSE_PREFIX_3 "Failed to pause Queue Member %s in queue %s!\n", membername, qe->parent->name);
+ }
+ }
+ return;
+}
#define AST_MAX_WATCHERS 256
@@ -1673,6 +1695,10 @@
struct ast_channel *winner;
struct ast_channel *in = qe->chan;
char on[256] = "";
+ long starttime = 0;
+ long endtime = 0;
+
+ starttime = (long)time(NULL);
while(*to && !peer) {
int numlines, retry, pos = 1;
@@ -1788,6 +1814,9 @@
if (in->cdr)
ast_cdr_busy(in->cdr);
do_hang(o);
+ endtime = (long)time(NULL);
+ endtime -= starttime;
+ rna(endtime*1000, qe, on);
if (qe->parent->strategy != QUEUE_STRATEGY_RINGALL) {
if (qe->parent->timeoutrestart)
*to = orig;
@@ -1800,6 +1829,9 @@
ast_verbose( VERBOSE_PREFIX_3 "%s is circuit-busy\n", o->chan->name);
if (in->cdr)
ast_cdr_busy(in->cdr);
+ endtime = (long)time(NULL);
+ endtime -= starttime;
+ rna(endtime*1000, qe, on);
do_hang(o);
if (qe->parent->strategy != QUEUE_STRATEGY_RINGALL) {
if (qe->parent->timeoutrestart)
@@ -1827,6 +1859,9 @@
}
ast_frfree(f);
} else {
+ endtime = (long)time(NULL);
+ endtime -= starttime;
+ rna(endtime*1000, qe, on);
do_hang(o);
if (qe->parent->strategy != QUEUE_STRATEGY_RINGALL) {
if (qe->parent->timeoutrestart)
@@ -1868,20 +1903,8 @@
}
ast_frfree(f);
}
- if (!*to) {
- if (option_verbose > 2)
- ast_verbose( VERBOSE_PREFIX_3 "Nobody picked up in %d ms\n", orig);
- ast_queue_log(qe->parent->name, qe->chan->uniqueid, on, "RINGNOANSWER", "%d", orig);
- if (qe->parent->autopause) {
- if (!set_member_paused(qe->parent->name, on, 1)) {
- if (option_verbose > 2)
- ast_verbose( VERBOSE_PREFIX_3 "Auto-Pausing Queue Member %s in queue %s since they failed to answer.\n", on, qe->parent->name);
- } else {
- if (option_verbose > 2)
- ast_verbose( VERBOSE_PREFIX_3 "Failed to pause Queue Member %s in queue %s!\n", on, qe->parent->name);
- }
- }
- }
+ if (!*to)
+ rna(orig, qe, on);
}
return peer;
@@ -1993,18 +2016,17 @@
}
/* Make a position announcement, if enabled */
- if (qe->parent->announcefrequency && !ringing)
- res = say_position(qe);
- if (res)
+ if (qe->parent->announcefrequency && !ringing &&
+ (res = say_position(qe)))
break;
/* Make a periodic announcement, if enabled */
- if (qe->parent->periodicannouncefrequency && !ringing)
- res = say_periodic_announcement(qe);
+ if (qe->parent->periodicannouncefrequency && !ringing &&
+ (res = say_periodic_announcement(qe)))
+ break;
/* Wait a second before checking again */
- if (!res) res = ast_waitfordigit(qe->chan, RECHECK * 1000);
- if (res)
+ if ((res = ast_waitfordigit(qe->chan, RECHECK * 1000)))
break;
}
return res;
@@ -2301,7 +2323,7 @@
if (res < 0) {
ast_queue_log(queuename, qe->chan->uniqueid, peer->name, "SYSCOMPAT", "%s", "");
ast_log(LOG_WARNING, "Had to drop call because I couldn't make %s compatible with %s\n", qe->chan->name, peer->name);
- record_abandoned(qe);
+ record_abandoned(qe);
ast_hangup(peer);
return -1;
}
@@ -2343,6 +2365,7 @@
}
}
+ memset(tmpid, 0, sizeof(tmpid));
pbx_substitute_variables_helper(qe->chan, tmpid2, tmpid, sizeof(tmpid) - 1);
}
@@ -2356,6 +2379,8 @@
*p = '$';
}
}
+
+ memset(meid, 0, sizeof(meid));
pbx_substitute_variables_helper(qe->chan, meid2, meid, sizeof(meid) - 1);
}
@@ -2367,14 +2392,15 @@
ast_log(LOG_WARNING, "monitor-format (in queues.conf) and MONITOR_FILENAME cannot contain a '|'! Not recording.\n");
mixmonapp = NULL;
}
+
+ if (!monitor_options)
+ monitor_options = ast_strdupa("");
if (strchr(monitor_options, '|')) {
ast_log(LOG_WARNING, "MONITOR_OPTIONS cannot contain a '|'! Not recording.\n");
mixmonapp = NULL;
}
- if (!monitor_options)
- monitor_options = ast_strdupa("");
if (mixmonapp) {
if (!ast_strlen_zero(monitor_exec) && !ast_strlen_zero(monitor_options))
@@ -2459,13 +2485,10 @@
(long)(time(NULL) - callstart));
}
- if(bridge != AST_PBX_NO_HANGUP_PEER)
+ if (bridge != AST_PBX_NO_HANGUP_PEER)
ast_hangup(peer);
update_queue(qe->parent, member);
- if (bridge == 0)
- res = 1; /* JDG: bridge successfully, leave app_queue */
- else
- res = bridge; /* bridge error, stay in the queue */
+ res = bridge ? -1 : 0;
}
out:
hangupcalls(outgoing, NULL);
@@ -3142,9 +3165,8 @@
if (makeannouncement) {
/* Make a position announcement, if enabled */
- if (qe.parent->announcefrequency && !ringing)
- res = say_position(&qe);
- if (res) {
+ if (qe.parent->announcefrequency && !ringing &&
+ (res = say_position(&qe))) {
ast_queue_log(args.queuename, chan->uniqueid, "NONE", "EXITWITHKEY", "%s|%d", qe.digits, qe.pos);
break;
}
@@ -3153,10 +3175,8 @@
makeannouncement = 1;
/* Make a periodic announcement, if enabled */
- if (qe.parent->periodicannouncefrequency && !ringing)
- res = say_periodic_announcement(&qe);
-
- if (res && valid_exit(&qe, res)) {
+ if (qe.parent->periodicannouncefrequency && !ringing &&
+ (res = say_periodic_announcement(&qe))) {
ast_queue_log(args.queuename, chan->uniqueid, "NONE", "EXITWITHKEY", "%c|%d", res, qe.pos);
break;
}
@@ -3170,8 +3190,9 @@
record_abandoned(&qe);
ast_queue_log(args.queuename, chan->uniqueid, "NONE", "ABANDON", "%d|%d|%ld", qe.pos, qe.opos, (long)time(NULL) - qe.start);
}
- } else if (res > 0)
+ } else if (valid_exit(&qe, res)) {
ast_queue_log(args.queuename, chan->uniqueid, "NONE", "EXITWITHKEY", "%s|%d", qe.digits, qe.pos);
+ }
break;
}
@@ -3234,7 +3255,7 @@
if (!is_our_turn(&qe)) {
if (option_debug)
ast_log(LOG_DEBUG, "Darn priorities, going back in queue (%s)!\n",
- qe.chan->name);
+ qe.chan->name);
goto check_turns;
}
}
Modified: team/oej/siptransfer/apps/app_rpt.c
URL: http://svn.digium.com/view/asterisk/team/oej/siptransfer/apps/app_rpt.c?rev=30429&r1=30428&r2=30429&view=diff
==============================================================================
--- team/oej/siptransfer/apps/app_rpt.c (original)
+++ team/oej/siptransfer/apps/app_rpt.c Thu May 25 16:39:04 2006
@@ -1,3 +1,4 @@
+/* #define OLD_ASTERISK */
/*
* Asterisk -- An open source telephony toolkit.
*
@@ -20,7 +21,7 @@
/*! \file
*
* \brief Radio Repeater / Remote Base program
- * version 0.42 02/25/06
+ * version 0.47 05/23/06
*
* \author Jim Dixon, WB6NIL <jim at lambdatel.com>
*
@@ -32,7 +33,18 @@
* Repeater / Remote Functions:
* "Simple" Mode: * - autopatch access, # - autopatch hangup
* Normal mode:
- * See the function list in rpt.conf
+ * See the function list in rpt.conf (autopatchup, autopatchdn)
+ * autopatchup can optionally take comma delimited setting=value pairs:
+ *
+ *
+ * context=string : Override default context with "string"
+ * dialtime=ms : Specify the max number of milliseconds between phone number digits (1000 milliseconds = 1 second)
+ * farenddisconnect=1 : Automatically disconnect when called party hangs up
+ * noct=1 : Don't send repeater courtesy tone during autopatch calls
+ * quiet=1 : Don't send dial tone, or connect messages. Do not send patch down message when called party hangs up
+ *
+ *
+ * Example: 123=autopatchup,dialtime=20000,noct=1,farenddisconnect=1
*
* To send an asterisk (*) while dialing or talking on phone,
* use the autopatch acess code.
@@ -93,6 +105,15 @@
* 140 - Link Status (brief)
*
*
+ *
+ * 'duplex' modes: (defaults to duplex=2)
+ *
+ * 0 - Only remote links key Tx and no main repeat audio.
+ * 1 - Everything other then main Rx keys Tx, no main repeat audio.
+ * 2 - Normal mode
+ * 3 - Normal except no main repeat audio.
+ * 4 - Normal except no main repeat audio during autopatch only
+ *
*/
/*** MODULEINFO
@@ -100,14 +121,15 @@
<defaultenabled>no</defaultenabled>
***/
-/* The following is JUST GROSS!! There is some soft of underlying problem,
- probably in channel_iax2.c, that causes an IAX2 connection to sometimes
- stop transmitting randomly. We have been working for weeks to try to
- locate it and fix it, but to no avail We finally decided to put our
- tail between our legs, and just make the radio system re-connect upon
- network failure. This just shouldnt have to be done. For normal operation,
- comment-out the following line */
-#define RECONNECT_KLUDGE
+/* Un-comment the following to include support for MDC-1200 digital tone
+ signalling protocol (using KA6SQG's GPL'ed implementation) */
+/* file must be downloaded separately, not part of Asterisk distribution */
+/* #include "mdc_decode.c" */
+
+/* Un-comment the following to include support for notch filters in the
+ rx audio stream (using Tony Fisher's mknotch (mkfilter) implementation) */
+/* file must be downloaded separately, not part of Asterisk distribution */
+/* #include "rpt_notch.c" */
/* maximum digits in DTMF buffer, and seconds after * for DTMF command timeout */
@@ -117,6 +139,10 @@
#define MACROPTIME 500
#define DTMF_TIMEOUT 3
+#ifdef __RPT_NOTCH
+#define MAXFILTERS 10
+#endif
+
#define DISC_TIME 10000 /* report disc after 10 seconds of no connect */
#define MAX_RETRIES 5
@@ -124,6 +150,7 @@
#define RETRY_TIMER_MS 5000
+#define MAXPEERSTR 31
#define MAXREMSTR 15
#define DELIMCHR ','
@@ -144,6 +171,8 @@
#define MAXNODESTR 300
+#define MAXPATCHCONTEXT 100
+
#define ACTIONSIZE 32
#define TELEPARAMSIZE 256
@@ -156,7 +185,7 @@
enum{ID,PROC,TERM,COMPLETE,UNKEY,REMDISC,REMALREADY,REMNOTFOUND,REMGO,
CONNECTED,CONNFAIL,STATUS,TIMEOUT,ID1, STATS_TIME,
STATS_VERSION, IDTALKOVER, ARB_ALPHA, TEST_TONE, REV_PATCH,
- TAILMSG, MACRO_NOTFOUND, MACRO_BUSY};
+ TAILMSG, MACRO_NOTFOUND, MACRO_BUSY, LASTNODEKEY};
enum {REM_SIMPLEX,REM_MINUS,REM_PLUS};
@@ -215,7 +244,7 @@
#include "asterisk/say.h"
#include "asterisk/localtime.h"
-static char *tdesc = "Radio Repeater / Remote Base version 0.42 02/25/2006";
+static char *tdesc = "Radio Repeater / Remote Base version 0.47 05/23/2006";
static char *app = "Rpt";
@@ -263,7 +292,9 @@
static char *remote_rig_ft897="ft897";
static char *remote_rig_rbi="rbi";
-struct ast_config *cfg;
+#ifdef OLD_ASTERISK
+STANDARD_LOCAL_USER;
+#endif
LOCAL_USER_DECL;
@@ -272,6 +303,7 @@
#define TOTIME 180000
#define IDTIME 300000
#define MAXRPTS 20
+#define MAX_STAT_LINKS 32
#define POLITEID 30000
#define FUNCTDELAY 1500
@@ -299,8 +331,22 @@
long retrytimer;
long retxtimer;
int retries;
+ int reconnects;
+ long long connecttime;
struct ast_channel *chan;
struct ast_channel *pchan;
+} ;
+
+struct rpt_lstat
+{
+ struct rpt_lstat *next;
+ struct rpt_lstat *prev;
+ char peer[MAXPEERSTR];
+ char name[MAXNODESTR];
+ char mode;
+ char outbound;
+ char reconnects;
+ long long connecttime;
} ;
struct rpt_tele
@@ -339,53 +385,77 @@
static struct rpt
{
+ ast_mutex_t lock;
+ struct ast_config *cfg;
+ char reload;
+
char *name;
- ast_mutex_t lock;
char *rxchanname;
char *txchanname;
- char *ourcontext;
- char *ourcallerid;
- char *acctcode;
- char *ident;
- char *tonezone;
- char *functions;
- char *link_functions;
- char *phone_functions;
- char *dphone_functions;
- char *nodes;
+ char *remote;
+
+ struct {
+
+ char *ourcontext;
+ char *ourcallerid;
+ char *acctcode;
+ char *ident;
+ char *tonezone;
+ char simple;
+ char *functions;
+ char *link_functions;
+ char *phone_functions;
+ char *dphone_functions;
+ char *nodes;
+ int hangtime;
+ int totime;
+ int idtime;
+ int tailmessagetime;
+ int tailsquashedtime;
+ int duplex;
+ int politeid;
+ char *tailmessages[500];
+ int tailmessagemax;
+ char *memory;
+ char *macro;
+ char *startupmacro;
+ int iobase;
+ char funcchar;
+ char endchar;
+ char nobusyout;
+ } p;
struct rpt_link links;
- int hangtime;
- int totime;
- int idtime;
int unkeytocttimer;
- int duplex;
char keyed;
char exttx;
char localtx;
char remoterx;
char remotetx;
char remoteon;
- char simple;
- char *remote;
char tounkeyed;
char tonotify;
char enable;
char dtmfbuf[MAXDTMF];
char macrobuf[MAXMACRO];
char rem_dtmfbuf[MAXDTMF];
+ char lastdtmfcommand[MAXDTMF];
char cmdnode[50];
struct ast_channel *rxchannel,*txchannel;
struct ast_channel *pchannel,*txpchannel, *remchannel;
struct rpt_tele tele;
+ struct timeval lasttv,curtv;
pthread_t rpt_call_thread,rpt_thread;
time_t dtmf_time,rem_dtmf_time,dtmf_time_rem;
- int tailtimer,totimer,idtimer,txconf,conf,callmode,cidx,scantimer,tmsgtimer;
+ int tailtimer,totimer,idtimer,txconf,conf,callmode,cidx,scantimer,tmsgtimer,skedtimer;
int mustid,tailid;
- int politeid;
+ int tailevent;
+ int telemrefcount;
int dtmfidx,rem_dtmfidx;
+ int dailytxtime,dailykerchunks,totalkerchunks,dailykeyups,totalkeyups,timeouts;
+ int totalexecdcommands, dailyexecdcommands;
long retxtimer;
+ long long totaltxtime;
char mydtmf;
- int iobase;
char exten[AST_MAX_EXTENSION];
char freq[MAXREMSTR],rxpl[MAXREMSTR],txpl[MAXREMSTR];
char offset;
@@ -397,9 +467,12 @@
char hfscanmode;
int hfscanstatus;
char lastlinknode[MAXNODESTR];
- char funcchar;
- char endchar;
char stopgen;
+ char patchfarenddisconnect;
+ char patchnoct;
+ char patchquiet;
+ char patchcontext[MAXPATCHCONTEXT];
+ int patchdialtime;
int macro_longest;
int phone_longestfunc;
int dphone_longestfunc;
@@ -407,18 +480,31 @@
int longestfunc;
int longestnode;
int threadrestarts;
- int tailmessagetime;
- int tailsquashedtime;
- char *tailmessages[500];
- int tailmessagemax;
int tailmessagen;
time_t disgorgetime;
time_t lastthreadrestarttime;
long macrotimer;
- char *macro;
- char *startupmacro;
- char *memory;
- char nobusyout;
+ char lastnodewhichkeyedusup[MAXNODESTR];
+#ifdef __RPT_NOTCH
+ struct rptfilter
+ {
+ char desc[100];
+ float x0;
+ float x1;
+ float x2;
+ float y0;
+ float y1;
+ float y2;
+ float gain;
+ float const0;
+ float const1;
+ float const2;
+ } filters[MAXFILTERS];
+#endif
+#ifdef _MDC_DECODE_H_
+ mdc_decoder_t *mdc;
+ unsigned short lastunit;
+#endif
} rpt_vars[MAXRPTS];
@@ -613,6 +699,10 @@
/* Debug mode */
static int rpt_do_debug(int fd, int argc, char *argv[]);
static int rpt_do_dump(int fd, int argc, char *argv[]);
+static int rpt_do_stats(int fd, int argc, char *argv[]);
+static int rpt_do_lstats(int fd, int argc, char *argv[]);
+static int rpt_do_reload(int fd, int argc, char *argv[]);
+static int rpt_do_restart(int fd, int argc, char *argv[]);
static char debug_usage[] =
"Usage: rpt debug level {0-7}\n"
@@ -622,6 +712,22 @@
"Usage: rpt dump <nodename>\n"
" Dumps struct debug info to log\n";
+static char dump_stats[] =
+"Usage: rpt stats <nodename>\n"
+" Dumps node statistics to console\n";
+
+static char dump_lstats[] =
+"Usage: rpt lstats <nodename>\n"
+" Dumps link statistics to console\n";
+
+static char reload_usage[] =
+"Usage: rpt reload\n"
+" Reloads app_rpt running config parameters\n";
+
+static char restart_usage[] =
+"Usage: rpt restart\n"
+" Restarts app_rpt\n";
+
static struct ast_cli_entry cli_debug =
{ { "rpt", "debug", "level" }, rpt_do_debug,
"Enable app_rpt debugging", debug_usage };
@@ -629,6 +735,22 @@
static struct ast_cli_entry cli_dump =
{ { "rpt", "dump" }, rpt_do_dump,
"Dump app_rpt structs for debugging", dump_usage };
+
+static struct ast_cli_entry cli_stats =
+ { { "rpt", "stats" }, rpt_do_stats,
+ "Dump node statistics", dump_stats };
+
+static struct ast_cli_entry cli_lstats =
+ { { "rpt", "lstats" }, rpt_do_lstats,
+ "Dump link statistics", dump_lstats };
+
+static struct ast_cli_entry cli_reload =
+ { { "rpt", "reload" }, rpt_do_reload,
+ "Reload app_rpt config", reload_usage };
+
+static struct ast_cli_entry cli_restart =
+ { { "rpt", "restart" }, rpt_do_restart,
+ "Restart app_rpt", restart_usage };
/*
* Telemetry defaults
@@ -682,10 +804,20 @@
{"remote", function_remote},
{"macro", function_macro}
} ;
+
+/*
+* Break up a delimited string into a table of substrings
+*
+* str - delimited string ( will be modified )
+* strp- list of pointers to substrings (this is built by this function), NULL will be placed at end of list
+* limit- maximum number of substrings to process
+*/
-static int finddelim(char *str,char *strp[])
-{
-int i,inquo;
+
+
+static int finddelim(char *str, char *strp[], int limit)
+{
+int i,l,inquo;
inquo = 0;
i = 0;
@@ -695,7 +827,7 @@
strp[0] = 0;
return(0);
}
- for(; *str; str++)
+ for(l = 0; *str && (l < limit) ; str++)
{
if (*str == QUOTECHR)
{
@@ -713,6 +845,7 @@
if ((*str == DELIMCHR) && (!inquo))
{
*str = 0;
+ l++;
strp[i++] = str + 1;
}
}
@@ -721,6 +854,53 @@
}
+/*
+* Match a keyword in a list, and return index of string plus 1 if there was a match,
+* else return 0. If param is passed in non-null, then it will be set to the first character past the match
+*/
+
+static int matchkeyword(char *string, char **param, char *keywords[])
+{
+int i,ls;
+ for( i = 0 ; keywords[i] ; i++){
+ ls = strlen(keywords[i]);
+ if(!ls){
+ *param = NULL;
+ return 0;
+ }
+ if(!strncmp(string, keywords[i], ls)){
+ if(param)
+ *param = string + ls;
+ return i + 1;
+ }
+ }
+ param = NULL;
+ return 0;
+}
+
+/*
+* Skip characters in string which are in charlist, and return a pointer to the
+* first non-matching character
+*/
+
+static char *skipchars(char *string, char *charlist)
+{
+int i;
+ while(*string){
+ for(i = 0; charlist[i] ; i++){
+ if(*string == charlist[i]){
+ string++;
+ break;
+ }
+ }
+ if(!charlist[i])
+ return string;
+ }
+ return string;
+}
+
+
+
static int myatoi(char *str)
{
int ret;
@@ -729,6 +909,248 @@
/* leave this %i alone, non-base-10 input is useful here */
if (sscanf(str,"%i",&ret) != 1) return -1;
return ret;
+}
+
+
+#ifdef __RPT_NOTCH
+
+/* rpt filter routine */
+static void rpt_filter(struct rpt *myrpt, volatile short *buf, int len)
+{
+int i,j;
+struct rptfilter *f;
+
+ for(i = 0; i < len; i++)
+ {
+ for(j = 0; j < MAXFILTERS; j++)
+ {
+ f = &myrpt->filters[j];
+ if (!*f->desc) continue;
+ f->x0 = f->x1; f->x1 = f->x2;
+ f->x2 = ((float)buf[i]) / f->gain;
+ f->y0 = f->y1; f->y1 = f->y2;
+ f->y2 = (f->x0 + f->x2) + f->const0 * f->x1
+ + (f->const1 * f->y0) + (f->const2 * f->y1);
+ buf[i] = (short)f->y2;
+ }
+ }
+}
+
+#endif
+
+/* Retrieve an int from a config file */
+
+static int retrieve_astcfgint(struct rpt *myrpt,char *category, char *name, int min, int max, int defl)
+{
+ char *var;
+ int ret;
+
+ var = ast_variable_retrieve(myrpt->cfg, category, name);
+ if(var){
+ ret = myatoi(var);
+ if(ret < min)
+ ret = min;
+ if(ret > max)
+ ret = max;
+ }
+ else
+ ret = defl;
+ return ret;
+}
+
+
+static void load_rpt_vars(int n,int init)
+{
+char *this,*val;
+int j,longestnode;
+struct ast_variable *vp;
+struct ast_config *cfg;
+#ifdef __RPT_NOTCH
+int i;
+char *strs[100];
+#endif
+
+ if (option_verbose > 2)
+ ast_verbose(VERBOSE_PREFIX_3 "%s config for repeater %s\n",
+ (init) ? "Loading initial" : "Re-Loading",rpt_vars[n].name);
+ ast_mutex_lock(&rpt_vars[n].lock);
+ if (rpt_vars[n].cfg) ast_config_destroy(rpt_vars[n].cfg);
+ cfg = ast_config_load("rpt.conf");
+ if (!cfg) {
+ ast_mutex_unlock(&rpt_vars[n].lock);
+ ast_log(LOG_NOTICE, "Unable to open radio repeater configuration rpt.conf. Radio Repeater disabled.\n");
+ pthread_exit(NULL);
+ }
+ rpt_vars[n].cfg = cfg;
+ this = rpt_vars[n].name;
+ memset(&rpt_vars[n].p,0,sizeof(rpt_vars[n].p));
+ if (init)
+ {
+ char *cp;
+ int savearea = (char *)&rpt_vars[n].p - (char *)&rpt_vars[n];
+
+ cp = (char *) &rpt_vars[n].p;
+ memset(cp + sizeof(rpt_vars[n].p),0,
+ sizeof(rpt_vars[n]) - (sizeof(rpt_vars[n].p) + savearea));
+ rpt_vars[n].tele.next = &rpt_vars[n].tele;
+ rpt_vars[n].tele.prev = &rpt_vars[n].tele;
+ rpt_vars[n].rpt_thread = AST_PTHREADT_NULL;
+ rpt_vars[n].tailmessagen = 0;
+ }
+#ifdef __RPT_NOTCH
+ /* zot out filters stuff */
+ memset(&rpt_vars[n].filters,0,sizeof(rpt_vars[n].filters));
+#endif
[... 4722 lines stripped ...]
More information about the asterisk-commits
mailing list