diff options
-rw-r--r-- | channels/chan_dahdi.c | 35 | ||||
-rw-r--r-- | channels/sig_pri.c | 30 |
2 files changed, 34 insertions, 31 deletions
diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c index e6e83ed31..f5491cd43 100644 --- a/channels/chan_dahdi.c +++ b/channels/chan_dahdi.c @@ -2565,30 +2565,31 @@ static int my_on_hook(void *pvt) } #if defined(HAVE_PRI) -static void my_pri_fixup_chans(void *old_chan, void *new_chan) +static void my_pri_fixup_chans(void *chan_old, void *chan_new) { - struct dahdi_pvt *old = old_chan; - struct dahdi_pvt *new = new_chan; - struct sig_pri_chan *pchan = new->sig_pvt; + 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->owner = old->owner; - old->owner = NULL; - if (new->owner) { + 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->channel, 1); - ast_change_name(new->owner, newname); - new->owner->tech_pvt = new; - new->owner->fds[0] = new->subs[SUB_REAL].dfd; - new->subs[SUB_REAL].owner = old->subs[SUB_REAL].owner; - old->subs[SUB_REAL].owner = NULL; + 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; + old_chan->subs[SUB_REAL].owner = NULL; } /* Copy any DSP that may be present */ - new->dsp = old->dsp; - new->dsp_features = old->dsp_features; - old->dsp = NULL; - old->dsp_features = 0; + new_chan->dsp = old_chan->dsp; + new_chan->dsp_features = old_chan->dsp_features; + old_chan->dsp = NULL; + old_chan->dsp_features = 0; } static int sig_pri_tone_to_dahditone(enum sig_pri_tone tone) diff --git a/channels/sig_pri.c b/channels/sig_pri.c index 7dcbd6793..47884fbaf 100644 --- a/channels/sig_pri.c +++ b/channels/sig_pri.c @@ -524,10 +524,10 @@ static int sig_pri_set_echocanceller(struct sig_pri_chan *p, int enable) return -1; } -static void sig_pri_fixup_chans(struct sig_pri_chan *old, struct sig_pri_chan *new) +static void sig_pri_fixup_chans(struct sig_pri_chan *old_chan, struct sig_pri_chan *new_chan) { - if (old->calls->fixup_chans) - old->calls->fixup_chans(old->chan_pvt, new->chan_pvt); + if (old_chan->calls->fixup_chans) + old_chan->calls->fixup_chans(old_chan->chan_pvt, new_chan->chan_pvt); } static int sig_pri_play_tone(struct sig_pri_chan *p, enum sig_pri_tone tone) @@ -664,10 +664,10 @@ static int pri_find_principle(struct sig_pri_pri *pri, int channel) int x; int span = PRI_SPAN(channel); int principle = -1; - int explicit = PRI_EXPLICIT(channel); + int explicit_ds1 = PRI_EXPLICIT(channel); channel = PRI_CHANNEL(channel); - if (!explicit) { + if (!explicit_ds1) { int index = pri_active_dchan_index(pri); if (index == -1) return -1; @@ -687,6 +687,7 @@ static int pri_find_principle(struct sig_pri_pri *pri, int channel) static int pri_fixup_principle(struct sig_pri_pri *pri, int principle, q931_call *c) { int x; + if (!c) { if (principle < 0) return -1; @@ -704,23 +705,24 @@ static int pri_fixup_principle(struct sig_pri_pri *pri, int principle, q931_call if (pri->pvts[x]->call == c) { /* Found our call */ if (principle != x) { - struct sig_pri_chan *new = pri->pvts[principle], *old = pri->pvts[x]; + struct sig_pri_chan *new_chan = pri->pvts[principle]; + struct sig_pri_chan *old_chan = pri->pvts[x]; ast_verb(3, "Moving call from channel %d to channel %d\n", - old->channel, new->channel); - if (new->owner) { + old_chan->channel, new_chan->channel); + if (new_chan->owner) { ast_log(LOG_WARNING, "Can't fix up channel from %d to %d because %d is already in use\n", - old->channel, new->channel, new->channel); + old_chan->channel, new_chan->channel, new_chan->channel); return -1; } - sig_pri_fixup_chans(old, new); + sig_pri_fixup_chans(old_chan, new_chan); /* Fix it all up now */ - new->owner = old->owner; - old->owner = NULL; + new_chan->owner = old_chan->owner; + old_chan->owner = NULL; - new->call = old->call; - old->call = NULL; + new_chan->call = old_chan->call; + old_chan->call = NULL; } return principle; |