[asterisk-commits] mmichelson: branch mmichelson/queue_refcount_trunk r82461 - in /team/mmichels...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Sep 14 16:49:54 CDT 2007
Author: mmichelson
Date: Fri Sep 14 16:49:53 2007
New Revision: 82461
URL: http://svn.digium.com/view/asterisk?view=rev&rev=82461
Log:
Resolving conflict and resetting automerge!
Added:
team/mmichelson/queue_refcount_trunk/channels/chan_usbradio.c
- copied unchanged from r82457, trunk/channels/chan_usbradio.c
team/mmichelson/queue_refcount_trunk/channels/xpmr/
- copied from r82457, trunk/channels/xpmr/
team/mmichelson/queue_refcount_trunk/channels/xpmr/sinetabx.h
- copied unchanged from r82457, trunk/channels/xpmr/sinetabx.h
team/mmichelson/queue_refcount_trunk/channels/xpmr/xpmr.c
- copied unchanged from r82457, trunk/channels/xpmr/xpmr.c
team/mmichelson/queue_refcount_trunk/channels/xpmr/xpmr.h
- copied unchanged from r82457, trunk/channels/xpmr/xpmr.h
team/mmichelson/queue_refcount_trunk/channels/xpmr/xpmr_coef.h
- copied unchanged from r82457, trunk/channels/xpmr/xpmr_coef.h
Modified:
team/mmichelson/queue_refcount_trunk/ (props changed)
team/mmichelson/queue_refcount_trunk/CHANGES
team/mmichelson/queue_refcount_trunk/LICENSE
team/mmichelson/queue_refcount_trunk/apps/app_meetme.c
team/mmichelson/queue_refcount_trunk/apps/app_queue.c
team/mmichelson/queue_refcount_trunk/apps/app_sms.c
team/mmichelson/queue_refcount_trunk/build_tools/menuselect-deps.in
team/mmichelson/queue_refcount_trunk/cdr/cdr_csv.c
team/mmichelson/queue_refcount_trunk/channels/chan_gtalk.c
team/mmichelson/queue_refcount_trunk/channels/chan_iax2.c
team/mmichelson/queue_refcount_trunk/channels/chan_jingle.c
team/mmichelson/queue_refcount_trunk/channels/chan_skinny.c
team/mmichelson/queue_refcount_trunk/channels/chan_zap.c
team/mmichelson/queue_refcount_trunk/configs/res_config_sqlite.conf
team/mmichelson/queue_refcount_trunk/configs/skinny.conf.sample
team/mmichelson/queue_refcount_trunk/configs/zapata.conf.sample
team/mmichelson/queue_refcount_trunk/configure
team/mmichelson/queue_refcount_trunk/configure.ac
team/mmichelson/queue_refcount_trunk/doc/CODING-GUIDELINES
team/mmichelson/queue_refcount_trunk/doc/res_config_sqlite.txt
team/mmichelson/queue_refcount_trunk/funcs/func_strings.c
team/mmichelson/queue_refcount_trunk/include/asterisk.h
team/mmichelson/queue_refcount_trunk/include/asterisk/autoconfig.h.in
team/mmichelson/queue_refcount_trunk/include/asterisk/doxyref.h
team/mmichelson/queue_refcount_trunk/include/asterisk/jingle.h
team/mmichelson/queue_refcount_trunk/include/asterisk/localtime.h
team/mmichelson/queue_refcount_trunk/include/asterisk/res_odbc.h
team/mmichelson/queue_refcount_trunk/main/asterisk.c
team/mmichelson/queue_refcount_trunk/main/astobj2.c
team/mmichelson/queue_refcount_trunk/main/cdr.c
team/mmichelson/queue_refcount_trunk/main/config.c
team/mmichelson/queue_refcount_trunk/main/stdtime/localtime.c
team/mmichelson/queue_refcount_trunk/main/stdtime/tzfile.h
team/mmichelson/queue_refcount_trunk/makeopts.in
team/mmichelson/queue_refcount_trunk/pbx/pbx_spool.c
team/mmichelson/queue_refcount_trunk/res/res_agi.c
team/mmichelson/queue_refcount_trunk/res/res_config_sqlite.c
team/mmichelson/queue_refcount_trunk/res/res_odbc.c
Propchange: team/mmichelson/queue_refcount_trunk/
------------------------------------------------------------------------------
automerge = *
Propchange: team/mmichelson/queue_refcount_trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-blocked' - no diff available.
Propchange: team/mmichelson/queue_refcount_trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Propchange: team/mmichelson/queue_refcount_trunk/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Sep 14 16:49:53 2007
@@ -1,1 +1,1 @@
-/trunk:1-82284
+/trunk:1-82460
Modified: team/mmichelson/queue_refcount_trunk/CHANGES
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount_trunk/CHANGES?view=diff&rev=82461&r1=82460&r2=82461
==============================================================================
--- team/mmichelson/queue_refcount_trunk/CHANGES (original)
+++ team/mmichelson/queue_refcount_trunk/CHANGES Fri Sep 14 16:49:53 2007
@@ -1,4 +1,4 @@
--------------------------------------------------------------------------------
+------------------------------------------------------------------------------
--- Functionality changes since Asterisk 1.4-beta was branched ----------------
-------------------------------------------------------------------------------
@@ -50,6 +50,7 @@
* New CLI command "core show settings"
* Added 'core show channels count' CLI command.
* Added the ability to set the core debug and verbose values on a per-file basis.
+ * Added 'queue pause member' and 'queue unpause member' CLI commands
SIP changes
-----------
@@ -220,6 +221,7 @@
those carriers that transmit CID via dtmf after a polarity change.
* CID matching information is now shown when doing 'dialplan show'.
* Added zap show version CLI command to chan_zap.
+ * Added setvar support to zapata.conf channel entries.
H.323 Changes
-------------
Modified: team/mmichelson/queue_refcount_trunk/LICENSE
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount_trunk/LICENSE?view=diff&rev=82461&r1=82460&r2=82461
==============================================================================
--- team/mmichelson/queue_refcount_trunk/LICENSE (original)
+++ team/mmichelson/queue_refcount_trunk/LICENSE Fri Sep 14 16:49:53 2007
@@ -32,7 +32,7 @@
would strongly encourage you to make the same exception that we do).
Specific permission is also granted to link Asterisk with OpenSSL and
-OpenH323.
+OpenH323 and distribute the resulting binary files.
In addition, Asterisk implements two management/control protocols: the
Asterisk Manager Interface (AMI) and the Asterisk Gateway Interface
Modified: team/mmichelson/queue_refcount_trunk/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount_trunk/apps/app_meetme.c?view=diff&rev=82461&r1=82460&r2=82461
==============================================================================
--- team/mmichelson/queue_refcount_trunk/apps/app_meetme.c (original)
+++ team/mmichelson/queue_refcount_trunk/apps/app_meetme.c Fri Sep 14 16:49:53 2007
@@ -343,6 +343,8 @@
unsigned int isdynamic:1; /*!< Created on the fly? */
unsigned int locked:1; /*!< Is the conference locked? */
pthread_t recordthread; /*!< thread for recording */
+ ast_mutex_t recordthreadlock; /*!< control threads trying to start recordthread */
+ pthread_attr_t attr; /*!< thread attribute */
const char *recordingfilename; /*!< Filename to record the Conference into */
const char *recordingformat; /*!< Format to record the Conference in */
char pin[MAX_PIN]; /*!< If protected by a PIN */
@@ -781,6 +783,8 @@
ast_mutex_init(&cnf->playlock);
ast_mutex_init(&cnf->listenlock);
+ cnf->recordthread = AST_PTHREADT_NULL;
+ ast_mutex_init(&cnf->recordthreadlock);
ast_copy_string(cnf->confno, confno, sizeof(cnf->confno));
ast_copy_string(cnf->pin, pin, sizeof(cnf->pin));
ast_copy_string(cnf->pinadmin, pinadmin, sizeof(cnf->pinadmin));
@@ -1281,7 +1285,10 @@
ast_hangup(conf->chan);
else
close(conf->fd);
-
+
+ ast_mutex_destroy(&conf->playlock);
+ ast_mutex_destroy(&conf->listenlock);
+ ast_mutex_destroy(&conf->recordthreadlock);
ast_free(conf);
return 0;
@@ -1466,7 +1473,8 @@
}
}
- if ((conf->recording == MEETME_RECORD_OFF) && (confflags & CONFFLAG_RECORDCONF) && ((conf->lchan = ast_request("zap", AST_FORMAT_SLINEAR, "pseudo", NULL)))) {
+ ast_mutex_lock(&conf->recordthreadlock);
+ if ((conf->recordthread == AST_PTHREADT_NULL) && (confflags & CONFFLAG_RECORDCONF) && ((conf->lchan = ast_request("zap", AST_FORMAT_SLINEAR, "pseudo", NULL)))) {
ast_set_read_format(conf->lchan, AST_FORMAT_SLINEAR);
ast_set_write_format(conf->lchan, AST_FORMAT_SLINEAR);
ztc.chan = 0;
@@ -1480,6 +1488,7 @@
ast_pthread_create_detached_background(&conf->recordthread, NULL, recordthread, conf);
}
}
+ ast_mutex_unlock(&conf->recordthreadlock);
time(&user->jointime);
Modified: team/mmichelson/queue_refcount_trunk/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount_trunk/apps/app_queue.c?view=diff&rev=82461&r1=82460&r2=82461
==============================================================================
--- team/mmichelson/queue_refcount_trunk/apps/app_queue.c (original)
+++ team/mmichelson/queue_refcount_trunk/apps/app_queue.c Fri Sep 14 16:49:53 2007
@@ -368,6 +368,7 @@
unsigned int strategy:3;
unsigned int maskmemberstatus:1;
unsigned int realtime:1;
+ unsigned int found:1;
int announcefrequency; /*!< How often to announce their position */
int minannouncefrequency; /*!< The minimum number of seconds between position announcements (def. 15) */
int periodicannouncefrequency; /*!< How often to play periodic announcement */
@@ -538,21 +539,17 @@
ao2_lock(q);
mem_iter = ao2_iterator_init(q->members, 0);
- while ((member = ao2_iterator_next(&mem_iter))) {
- if (max_penalty && (member->penalty > max_penalty)) {
- ao2_ref(member, -1);
+ for (; (member = ao2_iterator_next(&mem_iter)); ao2_ref(member, -1)) {
+ if (max_penalty && (member->penalty > max_penalty))
continue;
- }
switch (member->status) {
case AST_DEVICE_INVALID:
/* nothing to do */
- ao2_ref(member, -1);
break;
case AST_DEVICE_UNAVAILABLE:
if (result != QUEUE_NO_UNPAUSED_REACHABLE_MEMBERS)
result = QUEUE_NO_REACHABLE_MEMBERS;
- ao2_ref(member, -1);
break;
default:
if (member->paused) {
@@ -566,7 +563,6 @@
}
}
- ao2_ref(member, -1);
ao2_unlock(q);
return result;
}
@@ -815,6 +811,7 @@
q->sound_callerannounce[0] = '\0'; /* Default, don't announce the caller that he has been answered */
q->members = ao2_container_alloc(37, member_hash_fn, member_cmp_fn);
q->membercount = 0;
+ q->found = 1;
ast_copy_string(q->sound_next, "queue-youarenext", sizeof(q->sound_next));
ast_copy_string(q->sound_thereare, "queue-thereare", sizeof(q->sound_thereare));
ast_copy_string(q->sound_calls, "queue-callswaiting", sizeof(q->sound_calls));
@@ -1193,6 +1190,7 @@
queue_unref(q);
return NULL;
} else {
+ ast_log(LOG_WARNING, "Static queue '%s' already exists. Not loading from realtime\n", q->name);
ao2_unlock(q);
return q;
}
@@ -1924,6 +1922,7 @@
manager_event(EVENT_FLAG_AGENT, "AgentCalled",
"Queue: %s\r\n"
"AgentCalled: %s\r\n"
+ "AgentName: %s\r\n"
"ChannelCalling: %s\r\n"
"DestinationChannel: %s\r\n"
"CallerIDNum: %s\r\n"
@@ -1932,7 +1931,7 @@
"Extension: %s\r\n"
"Priority: %d\r\n"
"%s",
- qe->parent->name, tmp->interface, qe->chan->name, tmp->chan->name,
+ qe->parent->name, tmp->interface, tmp->member->membername, qe->chan->name, tmp->chan->name,
tmp->chan->cid.cid_num ? tmp->chan->cid.cid_num : "unknown",
tmp->chan->cid.cid_name ? tmp->chan->cid.cid_name : "unknown",
qe->chan->context, qe->chan->exten, qe->chan->priority,
@@ -3264,7 +3263,7 @@
dump_queue_members(q);
if(mem->realtime)
- update_realtime_member_field(mem, queuename, "paused", paused ? "1" : "0");
+ update_realtime_member_field(mem, q->name, "paused", paused ? "1" : "0");
ast_queue_log(q->name, "NONE", mem->membername, (paused ? "PAUSE" : "UNPAUSE"), "%s", S_OR(reason, ""));
@@ -4084,8 +4083,10 @@
/* Mark all queues as dead for the moment */
queue_iter = ao2_iterator_init(queues, F_AO2I_DONTLOCK);
while ((q = ao2_iterator_next(&queue_iter))) {
- if(!q->realtime)
+ if(!q->realtime) {
q->dead = 1;
+ q->found = 0;
+ }
queue_unref(q);
}
@@ -4121,6 +4122,13 @@
if (q) {
if (!new)
ao2_lock(q);
+ /* Check if a queue with this name already exists */
+ if (q->found) {
+ ast_log(LOG_WARNING, "Queue '%s' already defined! Skipping!\n", cat);
+ if(!new)
+ ast_mutex_unlock(&q->lock);
+ continue;
+ }
/* Re-initialize the queue, and clear statistics */
init_queue(q);
if (!queue_keep_stats)
@@ -4483,6 +4491,7 @@
if (ast_strlen_zero(memberfilter) || !strcmp(mem->interface, memberfilter)) {
astman_append(s, "Event: QueueMember\r\n"
"Queue: %s\r\n"
+ "Name: %s\r\n"
"Location: %s\r\n"
"Membership: %s\r\n"
"Penalty: %d\r\n"
@@ -4492,7 +4501,7 @@
"Paused: %d\r\n"
"%s"
"\r\n",
- q->name, mem->interface, mem->dynamic ? "dynamic" : "static",
+ q->name, mem->membername, mem->interface, mem->dynamic ? "dynamic" : "static",
mem->penalty, mem->calls, (int)mem->lastcall, mem->status, mem->paused, idText);
}
ao2_ref(mem, -1);
@@ -4815,6 +4824,76 @@
return NULL;
}
+static char *complete_queue_pause_member(const char *line, const char *word, int pos, int state)
+{
+ /* 0 - queue; 1 - pause; 2 - member; 3 - <interface>; 4 - queue; 5 - <queue>; 6 - reason; 7 - <reason> */
+ switch (pos) {
+ case 3: /* Don't attempt to complete name of interface (infinite possibilities) */
+ return NULL;
+ case 4: /* only one possible match, "queue" */
+ return state == 0 ? ast_strdup("queue") : NULL;
+ case 5: /* <queue> */
+ return complete_queue(line, word, pos, state);
+ case 6: /* "reason" */
+ return state == 0 ? ast_strdup("reason") : NULL;
+ case 7: /* Can't autocomplete a reason, since it's 100% customizeable */
+ return NULL;
+ default:
+ return NULL;
+ }
+}
+
+static char *handle_queue_pause_member(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+ char *queuename, *interface, *reason;
+ int paused;
+
+ switch (cmd) {
+ case CLI_INIT:
+ e->command = "queue {pause|unpause} member";
+ e->usage =
+ "Usage: queue {pause|unpause} member <member> [queue <queue> [reason <reason>]]\n"
+ " Pause or unpause a queue member. Not specifying a particular queue\n"
+ " will pause or unpause a member across all queues to which the member\n"
+ " belongs.\n";
+ return NULL;
+ case CLI_GENERATE:
+ return complete_queue_pause_member(a->line, a-> word, a->pos, a->n);
+ }
+
+ if (a->argc < 4 || a->argc == 5 || a->argc == 7 || a->argc > 8) {
+ return CLI_SHOWUSAGE;
+ } else if (a->argc >= 5 && strcmp(a->argv[4], "queue")) {
+ return CLI_SHOWUSAGE;
+ } else if (a->argc == 8 && strcmp(a->argv[6], "reason")) {
+ return CLI_SHOWUSAGE;
+ }
+
+
+ interface = a->argv[3];
+ queuename = a->argc >= 6 ? a->argv[5] : NULL;
+ reason = a->argc == 8 ? a->argv[7] : NULL;
+ paused = !strcasecmp(a->argv[1], "pause");
+
+ if(set_member_paused(queuename, interface, reason, paused) == RESULT_SUCCESS) {
+ ast_cli(a->fd, "%spaused interface '%s'", paused ? "" : "un", interface);
+ if(!ast_strlen_zero(queuename))
+ ast_cli(a->fd, " in queue '%s'", queuename);
+ if(!ast_strlen_zero(reason))
+ ast_cli(a->fd, " for reason '%s'", reason);
+ ast_cli(a->fd, "\n");
+ return CLI_SUCCESS;
+ } else {
+ ast_cli(a->fd, "Unable to %spause interface '%s'", paused ? "" : "un", interface);
+ if(!ast_strlen_zero(queuename))
+ ast_cli(a->fd, " in queue '%s'", queuename);
+ if(!ast_strlen_zero(reason))
+ ast_cli(a->fd, " for reason '%s'", reason);
+ ast_cli(a->fd, "\n");
+ return CLI_FAILURE;
+ }
+}
+
static const char queue_show_usage[] =
"Usage: queue show\n"
" Provides summary information on a specified queue.\n";
@@ -4824,6 +4903,12 @@
static const char qrm_cmd_usage[] =
"Usage: queue remove member <channel> from <queue>\n";
+
+static const char qpm_cmd_usage[] =
+"Usage: queue pause member <channel> in <queue> reason <reason>\n";
+
+static const char qum_cmd_usage[] =
+"Usage: queue unpause member <channel> in <queue> reason <reason>\n";
static struct ast_cli_entry cli_queue[] = {
{ { "queue", "show", NULL },
@@ -4837,6 +4922,8 @@
{ { "queue", "remove", "member", NULL },
handle_queue_remove_member, "Removes a channel from a specified queue",
qrm_cmd_usage, complete_queue_remove_member, NULL },
+
+ NEW_CLI(handle_queue_pause_member, "Pause or unpause a queue member"),
};
static int unload_module(void)
Modified: team/mmichelson/queue_refcount_trunk/apps/app_sms.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount_trunk/apps/app_sms.c?view=diff&rev=82461&r1=82460&r2=82461
==============================================================================
--- team/mmichelson/queue_refcount_trunk/apps/app_sms.c (original)
+++ team/mmichelson/queue_refcount_trunk/apps/app_sms.c Fri Sep 14 16:49:53 2007
@@ -202,7 +202,7 @@
char queue[30]; /*!< queue name */
char oa[20]; /*!< originating address */
char da[20]; /*!< destination address */
- time_t scts; /*!< time stamp, UTC */
+ struct timeval scts; /*!< time stamp, UTC */
unsigned char pid; /*!< protocol ID */
unsigned char dcs; /*!< data coding scheme */
short mr; /*!< message reference - actually a byte, but use -1 for not set */
@@ -766,7 +766,7 @@
h->rx = h->udl = *h->oa = *h->da = h->pid = h->srr = h->udhi = h->rp = h->vp = h->udhl = 0;
h->mr = -1;
h->dcs = 0xF1; /* normal messages class 1 */
- h->scts = time(NULL);
+ h->scts = ast_tvnow();
s = fopen(fn, "r");
if (s) {
if (unlink(fn)) { /* concurrent access, we lost */
@@ -825,7 +825,7 @@
M,
S;
if (sscanf (p, "%d-%d-%dT%d:%d:%d", &Y, &m, &d, &H, &M, &S) == 6) {
- struct tm t;
+ struct ast_tm t = { 0, };
t.tm_year = Y - 1900;
t.tm_mon = m - 1;
t.tm_mday = d;
@@ -833,8 +833,8 @@
t.tm_min = M;
t.tm_sec = S;
t.tm_isdst = -1;
- h->scts = mktime(&t);
- if (h->scts == (time_t) - 1)
+ h->scts = ast_mktime(&t, NULL);
+ if (h->scts.tv_sec == 0)
ast_log(LOG_WARNING, "Bad date/timein %s: %s", fn, p);
}
} else
@@ -925,7 +925,7 @@
snprintf(fn, sizeof(fn), "%s/sms/%s", ast_config_AST_SPOOL_DIR, h->smsc ? h->rx ? "morx" : "mttx" : h->rx ? "mtrx" : "motx");
ast_mkdir(fn, 0777); /* ensure it exists */
ast_copy_string(fn2, fn, sizeof(fn2));
- snprintf(fn2 + strlen(fn2), sizeof(fn2) - strlen(fn2), "/%s.%s-%d", h->queue, isodate(h->scts, buf, sizeof(buf)), seq++);
+ snprintf(fn2 + strlen(fn2), sizeof(fn2) - strlen(fn2), "/%s.%s-%d", h->queue, isodate(h->scts.tv_sec, buf, sizeof(buf)), seq++);
snprintf(fn + strlen(fn), sizeof(fn) - strlen(fn), "/.%s", fn2 + strlen(fn) + 1);
o = fopen(fn, "w");
if (o == NULL)
@@ -982,9 +982,9 @@
}
}
}
- if (h->scts) {
+ if (h->scts.tv_sec) {
char buf[30];
- fprintf(o, "scts=%s\n", isodate(h->scts, buf, sizeof(buf)));
+ fprintf(o, "scts=%s\n", isodate(h->scts.tv_sec, buf, sizeof(buf)));
}
if (h->pid)
fprintf(o, "pid=%d\n", h->pid);
@@ -1027,7 +1027,7 @@
h->udhi = ((h->imsg[2] & 0x40) ? 1 : 0);
h->rp = ((h->imsg[2] & 0x80) ? 1 : 0);
ast_copy_string(h->oa, h->cli, sizeof(h->oa));
- h->scts = time(NULL);
+ h->scts = ast_tvnow();
h->mr = h->imsg[p++];
p += unpackaddress(h->da, h->imsg + p);
h->pid = h->imsg[p++];
@@ -1065,7 +1065,7 @@
p += unpackaddress(h->oa, h->imsg + p);
h->pid = h->imsg[p++];
h->dcs = h->imsg[p++];
- h->scts = unpackdate(h->imsg + p);
+ h->scts.tv_sec = unpackdate(h->imsg + p);
p += 7;
p += unpacksms(h->dcs, h->imsg + p, h->udh, &h->udhl, h->ud, &h->udl, h->udhi);
h->rx = 1; /* received message */
@@ -1116,7 +1116,7 @@
static void sms_compose2(sms_t *h, int more)
{
struct ast_tm tm;
- struct timeval tv = { h->scts, 0 };
+ struct timeval tv = h->scts;
char stm[9];
h->omsg[0] = 0x00; /* set later... */
@@ -1171,7 +1171,7 @@
/* ast_verb(3, "SMS-P2 Frame: %s\n", sms_hexdump(h->imsg, sz, debug_buf)); */
/* Parse message body (called payload) */
- tv.tv_sec = h->scts = time(NULL);
+ tv = h->scts = ast_tvnow();
for (f = 4; f < sz; ) {
msg = h->imsg[f++];
msgsz = h->imsg[f++];
@@ -1186,7 +1186,7 @@
h->udl = msgsz;
break;
case 0x14: /* Date SCTS */
- tv.tv_sec = h->scts = time(NULL);
+ tv = h->scts = ast_tvnow();
ast_localtime(&tv, &tm, NULL);
tm.tm_mon = ( (h->imsg[f] * 10) + h->imsg[f + 1] ) - 1;
tm.tm_mday = ( (h->imsg[f + 2] * 10) + h->imsg[f + 3] );
@@ -1302,7 +1302,7 @@
p += packaddress(h->omsg + p, h->oa);
h->omsg[p++] = h->pid;
h->omsg[p++] = h->dcs;
- packdate(h->omsg + p, h->scts);
+ packdate(h->omsg + p, h->scts.tv_sec);
p += 7;
p += packsms(h->dcs, h->omsg + p, h->udhl, h->udh, h->udl, h->ud);
} else { /* submit */
@@ -1823,7 +1823,7 @@
/* submitting a message, not taking call. */
/* deprecated, use smsq instead */
- h.scts = time(NULL);
+ h.scts = ast_tvnow();
if (ast_strlen_zero(sms_args.addr) || strlen(sms_args.addr) >= sizeof(h.oa)) {
ast_log(LOG_ERROR, "Address too long %s\n", sms_args.addr);
goto done;
Modified: team/mmichelson/queue_refcount_trunk/build_tools/menuselect-deps.in
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount_trunk/build_tools/menuselect-deps.in?view=diff&rev=82461&r1=82460&r2=82461
==============================================================================
--- team/mmichelson/queue_refcount_trunk/build_tools/menuselect-deps.in (original)
+++ team/mmichelson/queue_refcount_trunk/build_tools/menuselect-deps.in Fri Sep 14 16:49:53 2007
@@ -29,6 +29,7 @@
SSL=@PBX_OPENSSL@
CRYPTO=@PBX_CRYPTO@
TONEZONE=@PBX_TONEZONE@
+USB=@PBX_USB@
UNIXODBC=@PBX_UNIXODBC@
VORBIS=@PBX_VORBIS@
VPBAPI=@PBX_VPB@
Modified: team/mmichelson/queue_refcount_trunk/cdr/cdr_csv.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount_trunk/cdr/cdr_csv.c?view=diff&rev=82461&r1=82460&r2=82461
==============================================================================
--- team/mmichelson/queue_refcount_trunk/cdr/cdr_csv.c (original)
+++ team/mmichelson/queue_refcount_trunk/cdr/cdr_csv.c Fri Sep 14 16:49:53 2007
@@ -48,6 +48,7 @@
#include "asterisk/options.h"
#include "asterisk/logger.h"
#include "asterisk/utils.h"
+#include "asterisk/lock.h"
#define CSV_LOG_DIR "/cdr-csv"
#define CSV_MASTER "/Master.csv"
@@ -92,8 +93,8 @@
static char *name = "csv";
-static FILE *mf = NULL;
-
+AST_MUTEX_DEFINE_STATIC(mf_lock);
+AST_MUTEX_DEFINE_STATIC(acf_lock);
static int load_config(int reload)
{
@@ -263,18 +264,26 @@
return -1;
}
snprintf(tmp, sizeof(tmp), "%s/%s/%s.csv", (char *)ast_config_AST_LOG_DIR,CSV_LOG_DIR, acc);
+
+ ast_mutex_lock(&acf_lock);
f = fopen(tmp, "a");
- if (!f)
- return -1;
+ if (!f) {
+ ast_mutex_unlock(&acf_lock);
+ ast_log(LOG_ERROR, "Unable to open file %s : %s\n", tmp, strerror(errno));
+ return -1;
+ }
fputs(s, f);
fflush(f);
fclose(f);
+ ast_mutex_unlock(&acf_lock);
+
return 0;
}
static int csv_log(struct ast_cdr *cdr)
{
+ FILE *mf = NULL;
/* Make sure we have a big enough buf */
char buf[1024];
char csvmaster[PATH_MAX];
@@ -288,16 +297,19 @@
/* because of the absolutely unconditional need for the
highest reliability possible in writing billing records,
we open write and close the log file each time */
+ ast_mutex_lock(&mf_lock);
mf = fopen(csvmaster, "a");
- if (!mf) {
- ast_log(LOG_ERROR, "Unable to re-open master file %s : %s\n", csvmaster, strerror(errno));
- }
if (mf) {
fputs(buf, mf);
fflush(mf); /* be particularly anal here */
fclose(mf);
mf = NULL;
- }
+ ast_mutex_unlock(&mf_lock);
+ } else {
+ ast_mutex_unlock(&mf_lock);
+ ast_log(LOG_ERROR, "Unable to re-open master file %s : %s\n", csvmaster, strerror(errno));
+ }
+
if (!ast_strlen_zero(cdr->accountcode)) {
if (writefile(buf, cdr->accountcode))
ast_log(LOG_WARNING, "Unable to write CSV record to account file '%s' : %s\n", cdr->accountcode, strerror(errno));
@@ -308,8 +320,6 @@
static int unload_module(void)
{
- if (mf)
- fclose(mf);
ast_cdr_unregister(name);
return 0;
}
@@ -324,8 +334,6 @@
res = ast_cdr_register(name, ast_module_info->description, csv_log);
if (res) {
ast_log(LOG_ERROR, "Unable to register CSV CDR handling\n");
- if (mf)
- fclose(mf);
}
return res;
}
Modified: team/mmichelson/queue_refcount_trunk/channels/chan_gtalk.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount_trunk/channels/chan_gtalk.c?view=diff&rev=82461&r1=82460&r2=82461
==============================================================================
--- team/mmichelson/queue_refcount_trunk/channels/chan_gtalk.c (original)
+++ team/mmichelson/queue_refcount_trunk/channels/chan_gtalk.c Fri Sep 14 16:49:53 2007
@@ -649,12 +649,12 @@
static int gtalk_handle_dtmf(struct gtalk *client, ikspak *pak)
{
struct gtalk_pvt *tmp;
- iks *dtmfnode = NULL;
+ iks *dtmfnode = NULL, *dtmfchild = NULL;
char *dtmf;
char *from;
/* Make sure our new call doesn't exist yet */
for (tmp = client->p; tmp; tmp = tmp->next) {
- if (iks_find_with_attrib(pak->x, "session", "id", tmp->sid))
+ if (iks_find_with_attrib(pak->x, "session", "id", tmp->sid) || iks_find_with_attrib(pak->x, "gtalk", "sid", tmp->sid))
break;
}
from = iks_find_attrib(pak->x, "to");
@@ -688,6 +688,22 @@
ast_verbose("GOOGLE! DTMF-relay event received: %c\n", f.subclass);
}
}
+ } else if ((dtmfnode = iks_find_with_attrib(pak->x, "gtalk", "action", "session-info"))) {
+ if((dtmfchild = iks_find(dtmfnode, "dtmf"))) {
+ if((dtmf = iks_find_attrib(dtmfchild, "code"))) {
+ if(iks_find_with_attrib(dtmfnode, "dtmf", "action", "button-up")) {
+ struct ast_frame f = {AST_FRAME_DTMF_END, };
+ f.subclass = dtmf[0];
+ ast_queue_frame(tmp->owner, &f);
+ ast_verbose("GOOGLE! DTMF-relay event received: %c\n", f.subclass);
+ } else if(iks_find_with_attrib(dtmfnode, "dtmf", "action", "button-down")) {
+ struct ast_frame f = {AST_FRAME_DTMF_BEGIN, };
+ f.subclass = dtmf[0];
+ ast_queue_frame(tmp->owner, &f);
+ ast_verbose("GOOGLE! DTMF-relay event received: %c\n", f.subclass);
+ }
+ }
+ }
}
gtalk_response(client, from, pak, NULL, NULL);
return 1;
@@ -697,7 +713,6 @@
gtalk_response(client, from, pak, NULL, NULL);
return 1;
}
-
static int gtalk_hangup_farend(struct gtalk *client, ikspak *pak)
{
@@ -1438,7 +1453,7 @@
iks_insert_attrib(iq, "id", client->connection->mid);
ast_aji_increment_mid(client->connection->mid);
iks_insert_attrib(gtalk, "xmlns", "http://jabber.org/protocol/gtalk");
- iks_insert_attrib(gtalk, "action", "content-info");
+ iks_insert_attrib(gtalk, "action", "session-info");
iks_insert_attrib(gtalk, "initiator", p->initiator ? p->us: p->them);
iks_insert_attrib(gtalk, "sid", p->sid);
iks_insert_attrib(dtmf, "xmlns", "http://jabber.org/protocol/gtalk/info/dtmf");
@@ -1447,9 +1462,9 @@
iks_insert_node(gtalk, dtmf);
ast_mutex_lock(&p->lock);
- if (ast->dtmff.frametype == AST_FRAME_DTMF_BEGIN) {
+ if (ast->dtmff.frametype == AST_FRAME_DTMF_BEGIN || duration == 0) {
iks_insert_attrib(dtmf, "action", "button-down");
- } else if (ast->dtmff.frametype == AST_FRAME_DTMF_END) {
+ } else if (ast->dtmff.frametype == AST_FRAME_DTMF_END || duration != 0) {
iks_insert_attrib(dtmf, "action", "button-up");
}
iks_send(client->connection->p, iq);
@@ -1640,7 +1655,7 @@
gtalk_is_answered(client, pak);
} else if (iks_find_with_attrib(pak->x, "session", "type", "transport-accept")) {
gtalk_is_accepted(client, pak);
- } else if (iks_find_with_attrib(pak->x, "session", "type", "content-info")) {
+ } else if (iks_find_with_attrib(pak->x, "session", "type", "content-info") || iks_find_with_attrib(pak->x, "gtalk", "action", "session-info")) {
gtalk_handle_dtmf(client, pak);
} else if (iks_find_with_attrib(pak->x, "session", "type", "terminate")) {
gtalk_hangup_farend(client, pak);
@@ -1736,10 +1751,11 @@
else if (!strcasecmp(var->name, "connection")) {
if ((client = ast_aji_get_client(var->value))) {
member->connection = client;
- iks_filter_add_rule(client->f, gtalk_parser, member, IKS_RULE_TYPE,
- IKS_PAK_IQ, IKS_RULE_FROM_PARTIAL, member->user,
- IKS_RULE_NS, "http://www.google.com/session",
- IKS_RULE_DONE);
+ iks_filter_add_rule(client->f, gtalk_parser, member,
+ IKS_RULE_TYPE, IKS_PAK_IQ,
+ IKS_RULE_FROM_PARTIAL, member->user,
+ IKS_RULE_NS, "http://www.google.com/session",
+ IKS_RULE_DONE);
} else {
ast_log(LOG_ERROR, "connection referenced not found!\n");
@@ -1852,8 +1868,8 @@
ASTOBJ_WRLOCK(iterator);
ASTOBJ_WRLOCK(member);
member->connection = iterator;
- iks_filter_add_rule(iterator->f, gtalk_parser, member, IKS_RULE_TYPE, IKS_PAK_IQ, IKS_RULE_NS,
- "http://www.google.com/session", IKS_RULE_DONE);
+ iks_filter_add_rule(iterator->f, gtalk_parser, member, IKS_RULE_TYPE, IKS_PAK_IQ, IKS_RULE_NS, "http://www.google.com/session", IKS_RULE_DONE);
+ iks_filter_add_rule(iterator->f, gtalk_parser, member, IKS_RULE_TYPE, IKS_PAK_IQ, IKS_RULE_NS, "http://jabber.org/protocol/gtalk", IKS_RULE_DONE);
ASTOBJ_UNLOCK(member);
ASTOBJ_CONTAINER_LINK(>alk_list, member);
ASTOBJ_UNLOCK(iterator);
Modified: team/mmichelson/queue_refcount_trunk/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount_trunk/channels/chan_iax2.c?view=diff&rev=82461&r1=82460&r2=82461
==============================================================================
--- team/mmichelson/queue_refcount_trunk/channels/chan_iax2.c (original)
+++ team/mmichelson/queue_refcount_trunk/channels/chan_iax2.c Fri Sep 14 16:49:53 2007
@@ -10007,7 +10007,7 @@
} else if (cfg == CONFIG_STATUS_FILEUNCHANGED) {
ucfg = ast_config_load("users.conf", config_flags);
if (ucfg == CONFIG_STATUS_FILEUNCHANGED)
- return 1;
+ return 0;
/* Otherwise we need to reread both files */
ast_clear_flag(&config_flags, CONFIG_FLAG_FILEUNCHANGED);
cfg = ast_config_load(config_file, config_flags);
@@ -10365,7 +10365,7 @@
}
ast_config_destroy(cfg);
set_timing();
- return capability;
+ return 1;
}
static int reload_config(void)
@@ -10373,7 +10373,7 @@
char *config = "iax.conf";
struct iax2_registry *reg;
- if (set_config(config, 1) == 1) {
+ if (set_config(config, 1) > 0) {
prune_peers();
prune_users();
trunk_timed = trunk_untimed = 0;
Modified: team/mmichelson/queue_refcount_trunk/channels/chan_jingle.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount_trunk/channels/chan_jingle.c?view=diff&rev=82461&r1=82460&r2=82461
==============================================================================
--- team/mmichelson/queue_refcount_trunk/channels/chan_jingle.c (original)
+++ team/mmichelson/queue_refcount_trunk/channels/chan_jingle.c Fri Sep 14 16:49:53 2007
@@ -367,7 +367,7 @@
iks_insert_attrib(iq, "id", client->connection->mid);
ast_aji_increment_mid(client->connection->mid);
- iks_insert_attrib(jingle, "xmlns", "http://www.google.com/session");
+ iks_insert_attrib(jingle, "xmlns", GOOGLE_NS);
iks_insert_attrib(jingle, "type", JINGLE_ACCEPT);
iks_insert_attrib(jingle, "initiator",
p->initiator ? client->connection->jid->full : p->from);
@@ -513,11 +513,11 @@
static int jingle_handle_dtmf(struct jingle *client, ikspak *pak)
{
struct jingle_pvt *tmp;
- iks *dtmfnode = NULL;
+ iks *dtmfnode = NULL, *dtmfchild = NULL;
char *dtmf;
/* Make sure our new call doesn't exist yet */
for (tmp = client->p; tmp; tmp = tmp->next) {
- if (iks_find_with_attrib(pak->x, GOOGLE_NODE, GOOGLE_SID, tmp->sid))
+ if (iks_find_with_attrib(pak->x, GOOGLE_NODE, GOOGLE_SID, tmp->sid) || iks_find_with_attrib(pak->x, JINGLE_NODE, JINGLE_SID, tmp->sid))
break;
}
@@ -525,7 +525,7 @@
if(iks_find_with_attrib(pak->x, "dtmf-method", "method", "rtp")) {
jingle_response(client,pak,
"feature-not-implemented xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'",
- "unsupported-dtmf-method xmlns='http://jabber.org/protocol/jingle/info/dtmf#errors'");
+ "unsupported-dtmf-method xmlns='http://www.xmpp.org/extensions/xep-0181.html#ns-errors'");
return -1;
}
if ((dtmfnode = iks_find(pak->x, "dtmf"))) {
@@ -545,6 +545,22 @@
f.subclass = dtmf[0];
ast_queue_frame(tmp->owner, &f);
ast_verbose("JINGLE! DTMF-relay event received: %c\n", f.subclass);
+ }
+ }
+ } else if ((dtmfnode = iks_find_with_attrib(pak->x, JINGLE_NODE, "action", "session-info"))) {
+ if((dtmfchild = iks_find(dtmfnode, "dtmf"))) {
+ if((dtmf = iks_find_attrib(dtmfchild, "code"))) {
+ if(iks_find_with_attrib(dtmfnode, "dtmf", "action", "button-up")) {
+ struct ast_frame f = {AST_FRAME_DTMF_END, };
+ f.subclass = dtmf[0];
+ ast_queue_frame(tmp->owner, &f);
+ ast_verbose("JINGLE! DTMF-relay event received: %c\n", f.subclass);
+ } else if(iks_find_with_attrib(dtmfnode, "dtmf", "action", "button-down")) {
+ struct ast_frame f = {AST_FRAME_DTMF_BEGIN, };
+ f.subclass = dtmf[0];
+ ast_queue_frame(tmp->owner, &f);
+ ast_verbose("JINGLE! DTMF-relay event received: %c\n", f.subclass);
+ }
}
}
}
@@ -861,7 +877,7 @@
iks_insert_attrib(session, "id", p->sid);
iks_insert_attrib(session, "initiator",
p->initiator ? client->connection->jid->full : p->from);
- iks_insert_attrib(session, "xmlns", "http://www.google.com/session");
+ iks_insert_attrib(session, "xmlns", GOOGLE_NS);
iks_insert_node(request, session);
iks_send(client->connection->p, request);
iks_delete(session);
@@ -1220,19 +1236,19 @@
iks_insert_attrib(iq, "from", client->connection->jid->full);
iks_insert_attrib(iq, "id", client->connection->mid);
ast_aji_increment_mid(client->connection->mid);
- iks_insert_attrib(jingle, "xmlns", "http://jabber.org/protocol/jingle");
- iks_insert_attrib(jingle, "action", "content-info");
+ iks_insert_attrib(jingle, "xmlns", JINGLE_NS);
+ iks_insert_attrib(jingle, "action", "session-info");
iks_insert_attrib(jingle, "initiator", p->initiator ? client->connection->jid->full : p->from);
iks_insert_attrib(jingle, "sid", p->sid);
- iks_insert_attrib(dtmf, "xmlns", "http://jabber.org/protocol/jingle/info/dtmf");
+ iks_insert_attrib(dtmf, "xmlns", JINGLE_DTMF_NS);
iks_insert_attrib(dtmf, "code", buffer);
iks_insert_node(iq, jingle);
iks_insert_node(jingle, dtmf);
ast_mutex_lock(&p->lock);
- if (ast->dtmff.frametype == AST_FRAME_DTMF_BEGIN) {
+ if (ast->dtmff.frametype == AST_FRAME_DTMF_BEGIN || duration == 0) {
iks_insert_attrib(dtmf, "action", "button-down");
- } else if (ast->dtmff.frametype == AST_FRAME_DTMF_END) {
+ } else if (ast->dtmff.frametype == AST_FRAME_DTMF_END || duration != 0) {
iks_insert_attrib(dtmf, "action", "button-up");
}
iks_send(client->connection->p, iq);
@@ -1279,7 +1295,7 @@
iks_insert_attrib(session, "type", "initiate");
iks_insert_attrib(session, "id", p->sid);
iks_insert_attrib(session, "initiator", client->jid->full);
- iks_insert_attrib(session, "xmlns", "http://www.google.com/session");
+ iks_insert_attrib(session, "xmlns", GOOGLE_NS);
iks_insert_attrib(desc, "xmlns", "http://www.google.com/session/phone");
payload_pcmu = iks_new("payload-type");
iks_insert_attrib(payload_pcmu, "id", "0");
@@ -1442,7 +1458,7 @@
ast_debug(3, "Candidate Added!\n");
} else if (iks_find_with_attrib(pak->x, GOOGLE_NODE, "type", GOOGLE_ACCEPT)) {
jingle_is_answered(client, pak);
- } else if (iks_find_with_attrib(pak->x, GOOGLE_NODE, "type", "content-info")) {
+ } else if (iks_find_with_attrib(pak->x, GOOGLE_NODE, "type", "session-info") || iks_find_with_attrib(pak->x, JINGLE_NODE, "action", "session-info")) {
jingle_handle_dtmf(client, pak);
} else if (iks_find_with_attrib(pak->x, GOOGLE_NODE, "type", "terminate")) {
jingle_hangup_farend(client, pak);
@@ -1537,10 +1553,11 @@
else if (!strcasecmp(var->name, "connection")) {
if ((client = ast_aji_get_client(var->value))) {
member->connection = client;
- iks_filter_add_rule(client->f, jingle_parser, member, IKS_RULE_TYPE,
- IKS_PAK_IQ, IKS_RULE_FROM_PARTIAL, member->user,
- IKS_RULE_NS, "http://jabber.org/protocol/jingle",
- IKS_RULE_DONE);
+ iks_filter_add_rule(client->f, jingle_parser, member,
+ IKS_RULE_TYPE, IKS_PAK_IQ,
+ IKS_RULE_FROM_PARTIAL, member->user,
+ IKS_RULE_NS, JINGLE_NS,
+ IKS_RULE_DONE);
} else {
ast_log(LOG_ERROR, "connection referenced not found!\n");
return 0;
@@ -1645,8 +1662,8 @@
ASTOBJ_WRLOCK(iterator);
ASTOBJ_WRLOCK(member);
member->connection = iterator;
- iks_filter_add_rule(iterator->f, jingle_parser, member, IKS_RULE_TYPE, IKS_PAK_IQ, IKS_RULE_NS,
- "http://jabber.org/protocol/jingle", IKS_RULE_DONE);
+ iks_filter_add_rule(iterator->f, jingle_parser, member, IKS_RULE_TYPE, IKS_PAK_IQ, IKS_RULE_NS, JINGLE_NS, IKS_RULE_DONE);
+ iks_filter_add_rule(iterator->f, jingle_parser, member, IKS_RULE_TYPE, IKS_PAK_IQ, IKS_RULE_NS, JINGLE_DTMF_NS, IKS_RULE_DONE);
ASTOBJ_UNLOCK(member);
ASTOBJ_CONTAINER_LINK(&jingles, member);
ASTOBJ_UNLOCK(iterator);
Modified: team/mmichelson/queue_refcount_trunk/channels/chan_skinny.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue_refcount_trunk/channels/chan_skinny.c?view=diff&rev=82461&r1=82460&r2=82461
==============================================================================
--- team/mmichelson/queue_refcount_trunk/channels/chan_skinny.c (original)
+++ team/mmichelson/queue_refcount_trunk/channels/chan_skinny.c Fri Sep 14 16:49:53 2007
@@ -964,6 +964,7 @@
static char regexten[AST_MAX_EXTENSION];
static int amaflags = 0;
static int callnums = 1;
+static int canreinvite = 0;
#define SKINNY_DEVICE_UNKNOWN -1
#define SKINNY_DEVICE_NONE 0
@@ -1151,6 +1152,7 @@
int immediate;
int hookstate;
int nat;
+ int canreinvite;
struct ast_codec_pref prefs;
struct skinny_subchannel *sub;
@@ -1250,7 +1252,7 @@
.fixup = skinny_fixup,
.send_digit_begin = skinny_senddigit_begin,
.send_digit_end = skinny_senddigit_end,
-/* .bridge = ast_rtp_bridge, */
+ .bridge = ast_rtp_bridge,
};
static int skinny_extensionstate_cb(char *context, char* exten, int state, void *data);
@@ -2150,24 +2152,107 @@
static enum ast_rtp_get_result skinny_get_rtp_peer(struct ast_channel *c, struct ast_rtp **rtp)
{
struct skinny_subchannel *sub = NULL;
-
- if (!(sub = c->tech_pvt) || !(sub->rtp))
+ struct skinny_line *l;
+ enum ast_rtp_get_result res = AST_RTP_TRY_NATIVE;
+
+ if (skinnydebug)
+ ast_verbose("skinny_get_rtp_peer() Channel = %s\n", c->name);
+
+
+ if (!(sub = c->tech_pvt))
return AST_RTP_GET_FAILED;
+ ast_mutex_lock(&sub->lock);
+
+ if (!(sub->rtp)){
+ ast_mutex_unlock(&sub->lock);
+ return AST_RTP_GET_FAILED;
+ }
+
*rtp = sub->rtp;
- return AST_RTP_TRY_NATIVE;
+ l = sub->parent;
+
+ if (!l->canreinvite || l->nat){
+ res = AST_RTP_TRY_PARTIAL;
+ if (skinnydebug)
+ ast_verbose("skinny_get_rtp_peer() Using AST_RTP_TRY_PARTIAL \n");
+ }
+
+ ast_mutex_unlock(&sub->lock);
+
+ return res;
+
}
static int skinny_set_rtp_peer(struct ast_channel *c, struct ast_rtp *rtp, struct ast_rtp *vrtp, struct ast_rtp *trtp, int codecs, int nat_active)
{
struct skinny_subchannel *sub;
+ struct skinny_line *l;
+ struct skinny_device *d;
+ struct skinnysession *s;
+ struct ast_format_list fmt;
[... 4931 lines stripped ...]
More information about the asterisk-commits
mailing list