[asterisk-commits] rmudgett: trunk r221701 - in /trunk: ./ channels/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Oct 1 14:49:01 CDT 2009
Author: rmudgett
Date: Thu Oct 1 14:48:58 2009
New Revision: 221701
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=221701
Log:
Prevent deadlock if chan_dahdi attempts to change PRI channel names.
The PRI channels can no longer change the channel name if a different B
channel is selected during call negotiation. To prevent using the channel
name to infer what B channel a call is using and to avoid name collisions,
the channel name format is changed.
The new channel naming for PRI channels is:
DAHDI/ISDN-<span>-<sequence-number>
Modified:
trunk/CHANGES
trunk/channels/chan_dahdi.c
trunk/channels/sig_pri.h
Modified: trunk/CHANGES
URL: http://svnview.digium.com/svn/asterisk/trunk/CHANGES?view=diff&rev=221701&r1=221700&r2=221701
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Thu Oct 1 14:48:58 2009
@@ -205,6 +205,12 @@
LibPRI).
* Added the ability to ignore calls that are not in a Multiple Subscriber
Number (MSN) list for PTMP CPE interfaces.
+ * The PRI channels can no longer change the channel name if a different B
+ channel is selected during call negotiation. To prevent using the channel
+ name to infer what B channel a call is using and to avoid name collisions,
+ the channel name format is changed.
+ The new channel naming for PRI channels is:
+ DAHDI/ISDN-<span>-<sequence-number>
Asterisk Manager Interface
--------------------------
Modified: trunk/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_dahdi.c?view=diff&rev=221701&r1=221700&r2=221701
==============================================================================
--- trunk/channels/chan_dahdi.c (original)
+++ trunk/channels/chan_dahdi.c Thu Oct 1 14:48:58 2009
@@ -2588,17 +2588,10 @@
{
struct dahdi_pvt *old_chan = chan_old;
struct dahdi_pvt *new_chan = chan_new;
- struct sig_pri_chan *pchan = new_chan->sig_pvt;
- struct sig_pri_pri *pri = pchan->pri;
new_chan->owner = old_chan->owner;
old_chan->owner = NULL;
if (new_chan->owner) {
- char newname[AST_CHANNEL_NAME];
-
- snprintf(newname, sizeof(newname), "DAHDI/%d:%d-%d", pri->trunkgroup, new_chan->channel, 1);
- ast_change_name(new_chan->owner, newname);
-
new_chan->owner->tech_pvt = new_chan;
new_chan->owner->fds[0] = new_chan->subs[SUB_REAL].dfd;
new_chan->subs[SUB_REAL].owner = old_chan->subs[SUB_REAL].owner;
@@ -8200,23 +8193,36 @@
struct ast_str *chan_name;
struct ast_variable *v;
struct dahdi_params ps;
+
if (i->subs[idx].owner) {
ast_log(LOG_WARNING, "Channel %d already has a %s call\n", i->channel,subnames[idx]);
return NULL;
}
- y = 1;
+
+ /* Create the new channel name tail. */
chan_name = ast_str_alloca(32);
- do {
- if (i->channel == CHAN_PSEUDO)
- ast_str_set(&chan_name, 0, "pseudo-%ld", ast_random());
- else
+ if (i->channel == CHAN_PSEUDO) {
+ ast_str_set(&chan_name, 0, "pseudo-%ld", ast_random());
+#if defined(HAVE_PRI)
+ } else if (i->pri) {
+ ast_mutex_lock(&i->pri->lock);
+ ast_str_set(&chan_name, 0, "ISDN-%d-%d", i->pri->span, ++i->pri->new_chan_seq);
+ ast_mutex_unlock(&i->pri->lock);
+#endif /* defined(HAVE_PRI) */
+ } else {
+ y = 1;
+ do {
ast_str_set(&chan_name, 0, "%d-%d", i->channel, y);
- for (x = 0; x < 3; x++) {
- if ((idx != x) && i->subs[x].owner && !strcasecmp(ast_str_buffer(chan_name), i->subs[x].owner->name + 6))
- break;
- }
- y++;
- } while (x < 3);
+ for (x = 0; x < 3; ++x) {
+ if (i->subs[x].owner && !strcasecmp(ast_str_buffer(chan_name),
+ i->subs[x].owner->name + 6)) {
+ break;
+ }
+ }
+ ++y;
+ } while (x < 3);
+ }
+
tmp = ast_channel_alloc(0, state, i->cid_num, i->cid_name, i->accountcode, i->exten, i->context, linkedid, i->amaflags, "DAHDI/%s", ast_str_buffer(chan_name));
if (!tmp)
return NULL;
Modified: trunk/channels/sig_pri.h
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/sig_pri.h?view=diff&rev=221701&r1=221700&r2=221701
==============================================================================
--- trunk/channels/sig_pri.h (original)
+++ trunk/channels/sig_pri.h Thu Oct 1 14:48:58 2009
@@ -211,6 +211,7 @@
int resetting; /*!< true if span is being reset/restarted */
int resetpos; /*!< current position during a reset (-1 if not started) */
int sig; /*!< ISDN signalling type (SIG_PRI, SIG_BRI, SIG_BRI_PTMP, etc...) */
+ int new_chan_seq; /*!< New struct ast_channel sequence number */
/* Everything after here is internally set */
struct pri *dchans[NUM_DCHANS]; /*!< Actual d-channels */
More information about the asterisk-commits
mailing list