[asterisk-commits] branch kpfleming/vldtmf r8957 - in
/team/kpfleming/vldtmf: ./ channels/ inclu...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Tue Jan 31 14:21:06 MST 2006
Author: kpfleming
Date: Mon Jan 30 19:36:57 2006
New Revision: 8957
URL: http://svn.digium.com/view/asterisk?rev=8957&view=rev
Log:
convert frame queues in channel structure to proper type
initialize channel frame queues on channel allocation
Modified:
team/kpfleming/vldtmf/.cleancount
team/kpfleming/vldtmf/channel.c
team/kpfleming/vldtmf/channels/chan_local.c
team/kpfleming/vldtmf/include/asterisk/channel.h
Modified: team/kpfleming/vldtmf/.cleancount
URL: http://svn.digium.com/view/asterisk/team/kpfleming/vldtmf/.cleancount?rev=8957&r1=8956&r2=8957&view=diff
==============================================================================
--- team/kpfleming/vldtmf/.cleancount (original)
+++ team/kpfleming/vldtmf/.cleancount Mon Jan 30 19:36:57 2006
@@ -1,1 +1,1 @@
-9
+10
Modified: team/kpfleming/vldtmf/channel.c
URL: http://svn.digium.com/view/asterisk/team/kpfleming/vldtmf/channel.c?rev=8957&r1=8956&r2=8957&view=diff
==============================================================================
--- team/kpfleming/vldtmf/channel.c (original)
+++ team/kpfleming/vldtmf/channel.c Mon Jan 30 19:36:57 2006
@@ -656,6 +656,8 @@
headp = &tmp->varshead;
ast_mutex_init(&tmp->lock);
AST_LIST_HEAD_INIT_NOLOCK(headp);
+ AST_LIST_HEAD_INIT_NOLOCK(&tmp->readq);
+ AST_LIST_HEAD_INIT_NOLOCK(&tmp->dtmfq);
strcpy(tmp->context, "default");
ast_copy_string(tmp->language, defaultlanguage, sizeof(tmp->language));
strcpy(tmp->exten, "s");
@@ -686,7 +688,7 @@
ast_mutex_lock(&chan->lock);
- AST_LIST_TRAVERSE(chan->readq, cur, next) {
+ AST_LIST_TRAVERSE(&chan->readq, cur, next) {
if ((cur->frametype == AST_FRAME_CONTROL) && (cur->subclass == AST_CONTROL_HANGUP)) {
/* Don't bother actually queueing anything after a hangup */
ast_frfree(f);
@@ -709,7 +711,7 @@
}
}
- AST_LIST_INSERT_TAIL(chan->readq, f, next);
+ AST_LIST_INSERT_TAIL(&chan->readq, f, next);
if (chan->alertpipe[1] > -1) {
if (write(chan->alertpipe[1], &blah, sizeof(blah)) != sizeof(blah))
@@ -978,7 +980,7 @@
if ((fd = chan->timingfd) > -1)
close(fd);
- while ((f = AST_LIST_REMOVE_HEAD(chan->readq, next)))
+ while ((f = AST_LIST_REMOVE_HEAD(&chan->readq, next)))
ast_frfree(f);
/* loop over the variables list, freeing all data and deleting list items */
@@ -1767,9 +1769,9 @@
}
prestate = chan->_state;
- if (!ast_test_flag(chan, AST_FLAG_DEFER_DTMF) && AST_LIST_FIRST(chan->dtmfq)) {
+ if (!ast_test_flag(chan, AST_FLAG_DEFER_DTMF) && AST_LIST_FIRST(&chan->dtmfq)) {
/* We have DTMF that has been deferred. Return it now */
- f = AST_LIST_REMOVE_HEAD(chan->dtmfq, next);
+ f = AST_LIST_REMOVE_HEAD(&chan->dtmfq, next);
ast_mutex_unlock(&chan->lock);
return f;
}
@@ -1793,7 +1795,7 @@
#if 0
ast_log(LOG_NOTICE, "Oooh, there's a PING!\n");
#endif
- if (AST_LIST_FIRST(chan->readq) && AST_LIST_NEXT(AST_LIST_FIRST(chan->readq), next)) {
+ if (AST_LIST_FIRST(&chan->readq) && AST_LIST_NEXT(AST_LIST_FIRST(&chan->readq), next)) {
/* Acknowledge PONG unless we need it again */
#if 0
ast_log(LOG_NOTICE, "Sending a PONG!\n");
@@ -1837,8 +1839,8 @@
}
/* Check for pending read queue */
- if (AST_LIST_FIRST(chan->readq)) {
- f = AST_LIST_REMOVE_HEAD(chan->readq, next);
+ if (AST_LIST_FIRST(&chan->readq)) {
+ f = AST_LIST_REMOVE_HEAD(&chan->readq, next);
/* Interpret hangup and return NULL */
if ((f->frametype == AST_FRAME_CONTROL) && (f->subclass == AST_CONTROL_HANGUP)) {
ast_frfree(f);
@@ -1870,7 +1872,7 @@
the channel driver and f would be only a single frame)
*/
if (AST_LIST_NEXT(f, next)) {
- AST_LIST_HEAD_SET_NOLOCK(chan->readq, AST_LIST_NEXT(f, next));
+ AST_LIST_HEAD_SET_NOLOCK(&chan->readq, AST_LIST_NEXT(f, next));
AST_LIST_NEXT(f, next) = NULL;
}
@@ -1888,7 +1890,7 @@
break;
case AST_FRAME_DTMF_BEGIN:
if (ast_test_flag(chan, AST_FLAG_DEFER_DTMF)) {
- AST_LIST_INSERT_TAIL(chan->dtmfq, ast_frdup(f), next);
+ AST_LIST_INSERT_TAIL(&chan->dtmfq, ast_frdup(f), next);
f = &null_frame;
} else {
ast_log(LOG_DTMF, "DTMF begin '%c' received on %s\n", f->subclass, chan->name);
@@ -1907,20 +1909,20 @@
dtmf->subclass = f->subclass;
if (ast_test_flag(chan, AST_FLAG_DEFER_DTMF)) {
- AST_LIST_INSERT_TAIL(chan->dtmfq, dtmf, next);
- AST_LIST_INSERT_TAIL(chan->dtmfq, ast_frdup(f), next);
+ AST_LIST_INSERT_TAIL(&chan->dtmfq, dtmf, next);
+ AST_LIST_INSERT_TAIL(&chan->dtmfq, ast_frdup(f), next);
f = &null_frame;
break;
}
ast_log(LOG_DTMF, "DTMF end '%c' received on %s\n", f->subclass, chan->name);
- AST_LIST_INSERT_HEAD(chan->readq, f, next);
+ AST_LIST_INSERT_HEAD(&chan->readq, f, next);
f = dtmf;
}
/* fallthrough */
case AST_FRAME_DTMF:
if (ast_test_flag(chan, AST_FLAG_DEFER_DTMF)) {
- AST_LIST_INSERT_TAIL(chan->dtmfq, ast_frdup(f), next);
+ AST_LIST_INSERT_TAIL(&chan->dtmfq, ast_frdup(f), next);
f = &null_frame;
} else {
ast_log(LOG_DTMF, "DTMF '%c' received on %s\n", f->subclass, chan->name);
@@ -2971,9 +2973,9 @@
clone->tech_pvt = t_pvt;
/* Swap the readq's */
- cur = AST_LIST_FIRST(original->readq);
- AST_LIST_HEAD_SET_NOLOCK(original->readq, AST_LIST_FIRST(clone->readq));
- AST_LIST_HEAD_SET_NOLOCK(clone->readq, cur);
+ cur = AST_LIST_FIRST(&original->readq);
+ AST_LIST_HEAD_SET_NOLOCK(&original->readq, AST_LIST_FIRST(&clone->readq));
+ AST_LIST_HEAD_SET_NOLOCK(&clone->readq, cur);
/* Swap the alertpipes */
for (i = 0; i < 2; i++) {
@@ -2994,16 +2996,16 @@
* how many we're going to need... */
x = 0;
if (original->alertpipe[1] > -1) {
- AST_LIST_TRAVERSE(clone->readq, cur, next)
+ AST_LIST_TRAVERSE(&clone->readq, cur, next)
x++;
}
/* If we had any, prepend them to the ones already in the queue, and
* load up the alertpipe */
- if (AST_LIST_FIRST(clone->readq)) {
- AST_LIST_INSERT_TAIL(clone->readq, AST_LIST_FIRST(original->readq), next);
- AST_LIST_HEAD_SET_NOLOCK(original->readq, AST_LIST_FIRST(clone->readq));
- AST_LIST_HEAD_SET_NOLOCK(clone->readq, NULL);
+ if (AST_LIST_FIRST(&clone->readq)) {
+ AST_LIST_INSERT_TAIL(&clone->readq, AST_LIST_FIRST(&original->readq), next);
+ AST_LIST_HEAD_SET_NOLOCK(&original->readq, AST_LIST_FIRST(&clone->readq));
+ AST_LIST_HEAD_SET_NOLOCK(&clone->readq, NULL);
for (i = 0; i < x; i++)
write(original->alertpipe[1], &x, sizeof(x));
}
Modified: team/kpfleming/vldtmf/channels/chan_local.c
URL: http://svn.digium.com/view/asterisk/team/kpfleming/vldtmf/channels/chan_local.c?rev=8957&r1=8956&r2=8957&view=diff
==============================================================================
--- team/kpfleming/vldtmf/channels/chan_local.c (original)
+++ team/kpfleming/vldtmf/channels/chan_local.c Mon Jan 30 19:36:57 2006
@@ -188,7 +188,8 @@
return;
if (!p->chan || !p->owner)
return;
- if (isoutbound&& p->chan->_bridge /* Not ast_bridged_channel! Only go one step! */ && !p->owner->readq) {
+ if (isoutbound && p->chan->_bridge /* Not ast_bridged_channel! Only go one step! */ &&
+ !AST_LIST_FIRST(&p->owner->readq)) {
/* Masquerade bridged channel into owner */
/* Lock everything we need, one by one, and give up if
we can't get everything. Remember, we'll get another
@@ -205,7 +206,8 @@
ast_mutex_unlock(&(p->chan->_bridge)->lock);
}
}
- } else if (!isoutbound && p->owner && p->owner->_bridge && p->chan && !p->chan->readq) {
+ } else if (!isoutbound && p->owner && p->owner->_bridge && p->chan &&
+ !AST_LIST_FIRST(&p->chan->readq)) {
/* Masquerade bridged channel into chan */
if (!ast_mutex_trylock(&(p->owner->_bridge)->lock)) {
if (!p->owner->_bridge->_softhangup) {
Modified: team/kpfleming/vldtmf/include/asterisk/channel.h
URL: http://svn.digium.com/view/asterisk/team/kpfleming/vldtmf/include/asterisk/channel.h?rev=8957&r1=8956&r2=8957&view=diff
==============================================================================
--- team/kpfleming/vldtmf/include/asterisk/channel.h (original)
+++ team/kpfleming/vldtmf/include/asterisk/channel.h Mon Jan 30 19:36:57 2006
@@ -364,7 +364,7 @@
/* Current extension priority */
int priority;
/*! Deferred DTMF frames */
- struct ast_frame_list *dtmfq;
+ struct ast_frame_list dtmfq;
/*! DTMF frame */
struct ast_frame dtmff;
@@ -414,7 +414,7 @@
/*! ISDN Transfer Capbility - AST_FLAG_DIGITAL is not enough */
unsigned short transfercapability;
- struct ast_frame_list *readq;
+ struct ast_frame_list readq;
int alertpipe[2];
/*! Write translation path */
More information about the asterisk-commits
mailing list