Changes from chan_dahdi that did not make it into sig_pri.

*  Moved SUPPORT_USERUSER to sig_pri.c
*  Fix PRI_DEADLOCK_AVOIDANCE parameter.
*  Whitespace changes.
*  Added missing unlock in pri_dchannel():PRI_EVENT_RING case.
*  Balanced curly braces.
*  ast_debug/ast_log changes from chan_dahdi.
*  sig_pri_indicate() should default to return -1 if the indication is not
handled.


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@210154 65c4cc65-6c06-0410-ace0-fbb531ad65f3
certified/1.8.6
Richard Mudgett 16 years ago
parent 95d037edad
commit 070de85e56

@ -272,9 +272,6 @@ static struct ast_jb_conf default_jbconf =
};
static struct ast_jb_conf global_jbconf;
/* define this to send PRI user-user information elements */
#undef SUPPORT_USERUSER
/*!
* \note Define ZHONE_HACK to cause us to go off hook and then back on hook when
* the user hangs up to reset the state machine so ring works properly.
@ -2219,7 +2216,7 @@ static int dahdi_setlaw(int dfd, int law)
}
#endif
#ifdef HAVE_PRI
#if defined(HAVE_PRI)
static struct ast_channel *my_new_pri_ast_channel(void *pvt, int state, int startpbx, enum sig_pri_law law, int transfercapability, char *exten, const struct ast_channel *requestor)
{
struct dahdi_pvt *p = pvt;
@ -2250,7 +2247,7 @@ static struct ast_channel *my_new_pri_ast_channel(void *pvt, int state, int star
}
return dahdi_new(p, state, startpbx, SUB_REAL, newlaw, transfercapability, requestor ? requestor->linkedid : "");
}
#endif
#endif /* defined(HAVE_PRI) */
static int unalloc_sub(struct dahdi_pvt *p, int x);
@ -2499,7 +2496,7 @@ static int my_on_hook(void *pvt)
return dahdi_set_hook(p->subs[ANALOG_SUB_REAL].dfd, DAHDI_ONHOOK);
}
#ifdef HAVE_PRI
#if defined(HAVE_PRI)
static void my_pri_fixup_chans(void *old_chan, void *new_chan)
{
struct dahdi_pvt *old = old_chan;
@ -2582,7 +2579,7 @@ static struct sig_pri_callback dahdi_pri_callbacks =
.fixup_chans = my_pri_fixup_chans,
.set_dialing = my_set_dialing,
};
#endif /* HAVE_PRI */
#endif /* defined(HAVE_PRI) */
/*!
* \brief Send MWI state change
@ -4340,7 +4337,8 @@ static int dahdi_call(struct ast_channel *ast, char *rdest, int timeout)
ast_mutex_unlock(&p->lock);
return -1;
}
#ifdef HAVE_SS7
#if defined(HAVE_SS7)
if (p->ss7) {
char ss7_called_nai;
int called_nai_strip;
@ -4477,7 +4475,8 @@ static int dahdi_call(struct ast_channel *ast, char *rdest, int timeout)
ast_setstate(ast, AST_STATE_DIALING);
ss7_rel(p->ss7);
}
#endif /* HAVE_SS7 */
#endif /* defined(HAVE_SS7) */
#ifdef HAVE_OPENR2
if (p->mfcr2) {
openr2_calling_party_category_t chancat;
@ -7780,6 +7779,7 @@ static int dahdi_indicate(struct ast_channel *chan, int condition, const void *d
int res=-1;
int idx;
int func = DAHDI_FLASH;
ast_mutex_lock(&p->lock);
idx = dahdi_get_index(chan, p, 0);
ast_debug(1, "Requested indication %d on channel %s\n", condition, chan->name);

@ -48,6 +48,9 @@
#include "sig_pri.h"
/* define this to send PRI user-user information elements */
#undef SUPPORT_USERUSER
static int pri_matchdigittimeout = 3000;
static int pri_gendigittimeout = 8000;
@ -62,7 +65,7 @@ static int pri_gendigittimeout = 8000;
#define DCHAN_AVAILABLE (DCHAN_NOTINALARM | DCHAN_UP)
#define PRI_DEADLOCK_AVOIDANCE(lock) \
#define PRI_DEADLOCK_AVOIDANCE(p) \
do { \
sig_pri_unlock_private(p); \
usleep(1); \
@ -533,8 +536,9 @@ static void *pri_ss_thread(void *data)
int len;
int timeout;
/* in the bizarre case where the channel has become a zombie before we
even get started here, abort safely
/*
* In the bizarre case where the channel has become a zombie before we
* even get started here, abort safely.
*/
if (!p) {
ast_log(LOG_WARNING, "Channel became a zombie before simple switch could be started (%s)\n", chan->name);
@ -1056,6 +1060,7 @@ static void *pri_dchannel(void *vpri)
if (pri->pvts[chanpos]->call == e->ring.call) {
ast_log(LOG_WARNING, "Duplicate setup requested on channel %d/%d already in use on span %d\n",
PRI_SPAN(e->ring.channel), PRI_CHANNEL(e->ring.channel), pri->span);
sig_pri_unlock_private(pri->pvts[chanpos]);
break;
} else {
/* This is where we handle initial glare */
@ -1270,12 +1275,6 @@ static void *pri_dchannel(void *vpri)
sig_pri_set_echocanceller(pri->pvts[chanpos], 1);
pri_queue_control(pri->pvts[chanpos], AST_CONTROL_RINGING, pri);
pri->pvts[chanpos]->alerting = 1;
#ifdef PRI_PROGRESS_MASK
if (e->ringing.progressmask & PRI_PROG_INBAND_AVAILABLE) {
#else
if (e->ringing.progress == 8) {
#endif
}
#ifdef SUPPORT_USERUSER
if (!ast_strlen_zero(e->ringing.useruserinfo)) {
@ -1294,11 +1293,13 @@ static void *pri_dchannel(void *vpri)
/* Get chan value if e->e is not PRI_EVNT_RINGING */
chanpos = pri_find_principle(pri, e->proceeding.channel);
if (chanpos > -1) {
if ((!pri->pvts[chanpos]->progress)
#ifdef PRI_PROGRESS_MASK
if ((!pri->pvts[chanpos]->progress) || (e->proceeding.progressmask & PRI_PROG_INBAND_AVAILABLE)) {
|| (e->proceeding.progressmask & PRI_PROG_INBAND_AVAILABLE)
#else
if ((!pri->pvts[chanpos]->progress) || (e->proceeding.progress == 8)) {
|| (e->proceeding.progress == 8)
#endif
) {
struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_PROGRESS, };
if (e->proceeding.cause > -1) {
@ -1316,14 +1317,16 @@ static void *pri_dchannel(void *vpri)
}
sig_pri_lock_private(pri->pvts[chanpos]);
ast_log(LOG_DEBUG, "Queuing frame from PRI_EVENT_PROGRESS on channel %d/%d span %d\n",
ast_debug(1, "Queuing frame from PRI_EVENT_PROGRESS on channel %d/%d span %d\n",
pri->pvts[chanpos]->logicalspan, pri->pvts[chanpos]->prioffset,pri->span);
pri_queue_frame(pri->pvts[chanpos], &f, pri);
if (
#ifdef PRI_PROGRESS_MASK
if (e->proceeding.progressmask & PRI_PROG_INBAND_AVAILABLE) {
e->proceeding.progressmask & PRI_PROG_INBAND_AVAILABLE
#else
if (e->proceeding.progress == 8) {
e->proceeding.progress == 8
#endif
) {
/* Bring voice path up */
f.subclass = AST_CONTROL_PROGRESS;
pri_queue_frame(pri->pvts[chanpos], &f, pri);
@ -1341,14 +1344,16 @@ static void *pri_dchannel(void *vpri)
struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_PROCEEDING, };
sig_pri_lock_private(pri->pvts[chanpos]);
ast_log(LOG_DEBUG, "Queuing frame from PRI_EVENT_PROCEEDING on channel %d/%d span %d\n",
ast_debug(1, "Queuing frame from PRI_EVENT_PROCEEDING on channel %d/%d span %d\n",
pri->pvts[chanpos]->logicalspan, pri->pvts[chanpos]->prioffset,pri->span);
pri_queue_frame(pri->pvts[chanpos], &f, pri);
if (
#ifdef PRI_PROGRESS_MASK
if (e->proceeding.progressmask & PRI_PROG_INBAND_AVAILABLE) {
e->proceeding.progressmask & PRI_PROG_INBAND_AVAILABLE
#else
if (e->proceeding.progress == 8) {
e->proceeding.progress == 8
#endif
) {
/* Bring voice path up */
f.subclass = AST_CONTROL_PROGRESS;
pri_queue_frame(pri->pvts[chanpos], &f, pri);
@ -1442,6 +1447,7 @@ static void *pri_dchannel(void *vpri)
break;
default:
ast_softhangup_nolock(pri->pvts[chanpos]->owner, AST_SOFTHANGUP_DEV);
break;
}
}
}
@ -1508,6 +1514,7 @@ static void *pri_dchannel(void *vpri)
break;
default:
ast_softhangup_nolock(pri->pvts[chanpos]->owner, AST_SOFTHANGUP_DEV);
break;
}
}
ast_verb(3, "Channel %d/%d, span %d got hangup request, cause %d\n", PRI_SPAN(e->hangup.channel), PRI_CHANNEL(e->hangup.channel), pri->span, e->hangup.cause);
@ -1581,7 +1588,7 @@ static void *pri_dchannel(void *vpri)
if (pri->pvts[x] && pri->pvts[x]->resetting) {
chanpos = x;
sig_pri_lock_private(pri->pvts[chanpos]);
ast_log(LOG_DEBUG, "Assuming restart ack is really for channel %d/%d span %d\n", pri->pvts[chanpos]->logicalspan,
ast_debug(1, "Assuming restart ack is really for channel %d/%d span %d\n", pri->pvts[chanpos]->logicalspan,
pri->pvts[chanpos]->prioffset, pri->span);
if (pri->pvts[chanpos]->owner) {
ast_log(LOG_WARNING, "Got restart ack on channel %d/%d with owner on span %d\n", pri->pvts[chanpos]->logicalspan,
@ -1630,7 +1637,7 @@ static void *pri_dchannel(void *vpri)
pri->pvts[chanpos]->setup_ack = 1;
/* Send any queued digits */
for (x = 0;x < strlen(pri->pvts[chanpos]->dialdest); x++) {
ast_log(LOG_DEBUG, "Sending pending digit '%c'\n", pri->pvts[chanpos]->dialdest[x]);
ast_debug(1, "Sending pending digit '%c'\n", pri->pvts[chanpos]->dialdest[x]);
pri_information(pri->pri, pri->pvts[chanpos]->call,
pri->pvts[chanpos]->dialdest[x]);
}
@ -1646,6 +1653,7 @@ static void *pri_dchannel(void *vpri)
PRI_SPAN(e->notify.channel), PRI_CHANNEL(e->notify.channel), pri->span);
} else {
struct ast_frame f = { AST_FRAME_CONTROL, };
sig_pri_lock_private(pri->pvts[chanpos]);
switch (e->notify.info) {
case PRI_NOTIFY_REMOTE_HOLD:
@ -1661,7 +1669,7 @@ static void *pri_dchannel(void *vpri)
}
break;
default:
ast_log(LOG_DEBUG, "Event: %d\n", e->e);
ast_debug(1, "Event: %d\n", e->e);
}
}
ast_mutex_unlock(&pri->lock);
@ -1795,7 +1803,6 @@ int sig_pri_call(struct sig_pri_chan *p, struct ast_channel *ast, char *rdest, i
l = NULL;
n = NULL;
if (!p->hidecallerid) {
l = ast->connected.id.number;
if (!p->hidecalleridname) {
@ -1803,7 +1810,6 @@ int sig_pri_call(struct sig_pri_chan *p, struct ast_channel *ast, char *rdest, i
}
}
if (strlen(c) < p->stripmsd) {
ast_log(LOG_WARNING, "Number '%s' is shorter than stripmsd (%d)\n", c, p->stripmsd);
return -1;
@ -2032,7 +2038,7 @@ int sig_pri_call(struct sig_pri_chan *p, struct ast_channel *ast, char *rdest, i
int sig_pri_indicate(struct sig_pri_chan *p, struct ast_channel *chan, int condition, const void *data, size_t datalen)
{
int res = 0;
int res = -1;
switch (condition) {
case AST_CONTROL_BUSY:
@ -2093,12 +2099,16 @@ int sig_pri_indicate(struct sig_pri_chan *p, struct ast_channel *chan, int condi
res = 0;
break;
case AST_CONTROL_PROGRESS:
ast_log(LOG_DEBUG,"Received AST_CONTROL_PROGRESS on %s\n",chan->name);
ast_debug(1,"Received AST_CONTROL_PROGRESS on %s\n",chan->name);
p->digital = 0; /* Digital-only calls isn't allowing any inband progress messages */
if (!p->progress && p->pri && !p->outgoing) {
if (p->pri->pri) {
if (!pri_grab(p, p->pri)) {
#ifdef HAVE_PRI_PROG_W_CAUSE
pri_progress_with_cause(p->pri->pri,p->call, PVT_TO_CHANNEL(p), 1, -1); /* no cause at all */
#else
pri_progress(p->pri->pri,p->call, PVT_TO_CHANNEL(p), 1);
#endif
pri_rel(p->pri);
} else {
ast_log(LOG_WARNING, "Unable to grab PRI on span %d\n", p->pri->span);
@ -2260,6 +2270,7 @@ int sig_pri_start_pri(struct sig_pri_pri *pri)
pri_set_service_message_support(pri->dchans[i], 1);
}
#endif
break;
}
/* Force overlap dial if we're doing GR-303! */

Loading…
Cancel
Save