dect
/
asterisk
Archived
13
0
Fork 0

The dialing flag was mistakingly removed from sig_pri.

This readds the proper setting of the flag and is really a continuation of
r205731. The flag was being set properly in sig_analog, but use of the 
newly added set_dialing callback allowed for some simplification in
chan_dahdi.

(closes issue #15486)
Reported by: rmudgett


git-svn-id: http://svn.digium.com/svn/asterisk/trunk@206767 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
jpeeler 2009-07-15 22:02:55 +00:00
parent a39d5b4aa2
commit 97097c07d2
5 changed files with 43 additions and 23 deletions

View File

@ -2033,6 +2033,12 @@ static void my_set_cadence(void *pvt, int *cidrings, struct ast_channel *ast)
}
}
static void my_set_dialing(void *pvt, int flag)
{
struct dahdi_pvt *p = pvt;
p->dialing = flag;
}
static void my_increase_ss_count(void)
{
ast_mutex_lock(&ss_thread_lock);
@ -2567,6 +2573,7 @@ static struct sig_pri_callback dahdi_pri_callbacks =
.unlock_private = my_unlock_private,
.new_ast_channel = my_new_pri_ast_channel,
.fixup_chans = my_pri_fixup_chans,
.set_dialing = my_set_dialing,
};
#endif /* HAVE_PRI */
@ -2687,6 +2694,7 @@ static struct analog_callback dahdi_analog_callbacks =
.get_sigpvt_bridged_channel = my_get_sigpvt_bridged_channel,
.get_sub_fd = my_get_sub_fd,
.set_cadence = my_set_cadence,
.set_dialing = my_set_dialing,
};
static struct dahdi_pvt *round_robin[32];
@ -7565,9 +7573,7 @@ static struct ast_frame *dahdi_read(struct ast_channel *ast)
#if 0
ast_debug(1, "Read %d of voice on %s\n", p->subs[idx].f.datalen, ast->name);
#endif
{
struct analog_pvt *ap = p->sig_pvt;
if ((analog_lib_handles(p->sig ,p->radio, p->oprmode) && ap->dialing) || p->dialing || p->radio || /* Transmitting something */
if (p->dialing || p->radio || /* Transmitting something */
(idx && (ast->_state != AST_STATE_UP)) || /* Three-way or callwait that isn't up */
((idx == SUB_CALLWAIT) && !p->subs[SUB_CALLWAIT].inthreeway) /* Inactive and non-confed call-wait */
) {
@ -7581,7 +7587,6 @@ static struct ast_frame *dahdi_read(struct ast_channel *ast)
p->subs[idx].f.data.ptr = NULL;
p->subs[idx].f.datalen= 0;
}
}
if (p->dsp && (!p->ignoredtmf || p->callwaitcas || p->busydetect || p->callprogress || p->waitingfordt.tv_sec) && !idx) {
/* Perform busy detection etc on the dahdi line */
int mute;
@ -7724,14 +7729,6 @@ static int dahdi_write(struct ast_channel *ast, struct ast_frame *frame)
ast_log(LOG_WARNING, "Cannot handle frames in %d format\n", frame->subclass);
return -1;
}
if (analog_lib_handles(p->sig, p->radio, p->oprmode)) {
struct analog_pvt *ap = p->sig_pvt;
if (ap->dialing) {
ast_debug(1, "Dropping frame since I'm still dialing on %s...\n",ast->name);
return 0;
}
}
if (p->dialing) {
ast_debug(1, "Dropping frame since I'm still dialing on %s...\n",ast->name);
return 0;

View File

@ -695,6 +695,14 @@ static void analog_set_cadence(struct analog_pvt *p, struct ast_channel *chan)
}
}
static void analog_set_dialing(struct analog_pvt *p, int flag)
{
p->dialing = flag;
if (p->calls->set_dialing) {
return p->calls->set_dialing(p->chan_pvt, flag);
}
}
int analog_call(struct analog_pvt *p, struct ast_channel *ast, char *rdest, int timeout)
{
int res, index,mysig;
@ -730,7 +738,7 @@ int analog_call(struct analog_pvt *p, struct ast_channel *ast, char *rdest, int
/* Normal ring, on hook */
/* Don't send audio while on hook, until the call is answered */
p->dialing = 1;
analog_set_dialing(p, 1);
analog_set_cadence(p, ast); /* and set p->cidrings */
/* nick@dccinc.com 4/3/03 mods to allow for deferred dialing */
@ -753,7 +761,7 @@ int analog_call(struct analog_pvt *p, struct ast_channel *ast, char *rdest, int
ast_log(LOG_WARNING, "Unable to ring phone: %s\n", strerror(errno));
return -1;
}
p->dialing = 1;
analog_set_dialing(p, 1);
} else {
if (ast->connected.id.number)
ast_copy_string(p->callwait_num, ast->connected.id.number, sizeof(p->callwait_num));
@ -912,7 +920,7 @@ int analog_call(struct analog_pvt *p, struct ast_channel *ast, char *rdest, int
}
} else
ast_debug(1, "Deferring dialing...\n");
p->dialing = 1;
analog_set_dialing(p, 1);
if (ast_strlen_zero(c))
p->dialednone = 1;
ast_setstate(ast, AST_STATE_DIALING);
@ -1091,7 +1099,7 @@ int analog_hangup(struct analog_pvt *p, struct ast_channel *ast)
p->callwaitcas = 0;
p->callwaiting = p->permcallwaiting;
p->hidecallerid = p->permhidecallerid;
p->dialing = 0;
analog_set_dialing(p, 0);
analog_update_conf(p);
analog_all_subchannels_hungup(p);
}
@ -1145,7 +1153,7 @@ int analog_answer(struct analog_pvt *p, struct ast_channel *ast)
}
res = analog_off_hook(p);
analog_play_tone(p, index, -1);
p->dialing = 0;
analog_set_dialing(p, 0);
if ((index == ANALOG_SUB_REAL) && p->subs[ANALOG_SUB_THREEWAY].inthreeway) {
if (oldstate == AST_STATE_RINGING) {
ast_debug(1, "Finally swapping real and threeway\n");
@ -2166,7 +2174,7 @@ static struct ast_frame *__analog_handle_event(struct analog_pvt *p, struct ast_
analog_dial_digits(p, ANALOG_SUB_REAL, &p->dop);
p->echobreak = 0;
} else {
p->dialing = 0;
analog_set_dialing(p, 0);
if ((mysig == ANALOG_SIG_E911) || (mysig == ANALOG_SIG_FGC_CAMA) || (mysig == ANALOG_SIG_FGC_CAMAMF)) {
/* if thru with dialing after offhook */
if (ast->_state == AST_STATE_DIALING_OFFHOOK) {
@ -2220,7 +2228,7 @@ static struct ast_frame *__analog_handle_event(struct analog_pvt *p, struct ast_
p->owner = NULL;
/* Don't start streaming audio yet if the incoming call isn't up yet */
if (p->subs[ANALOG_SUB_REAL].owner->_state != AST_STATE_UP)
p->dialing = 1;
analog_set_dialing(p, 1);
analog_ring(p);
} else if (p->subs[ANALOG_SUB_THREEWAY].owner) {
unsigned int mssinceflash;
@ -2332,7 +2340,7 @@ static struct ast_frame *__analog_handle_event(struct analog_pvt *p, struct ast_
ast_log(LOG_WARNING, "Dialing failed on channel %d: %s\n", p->channel, strerror(saveerr));
return NULL;
}
p->dialing = 1;
analog_set_dialing(p, 1);
return &p->subs[index].f;
}
switch (p->sig) {
@ -2349,7 +2357,7 @@ static struct ast_frame *__analog_handle_event(struct analog_pvt *p, struct ast_
/* Make sure it stops ringing */
analog_off_hook(p);
ast_debug(1, "channel %d answered\n", p->channel);
p->dialing = 0;
analog_set_dialing(p, 0);
p->callwaitcas = 0;
if (!ast_strlen_zero(p->dop.dialstr)) {
/* nick@dccinc.com 4/3/03 - fxo should be able to do deferred dialing */
@ -2362,7 +2370,7 @@ static struct ast_frame *__analog_handle_event(struct analog_pvt *p, struct ast_
ast_debug(1, "Sent FXO deferred digit string: %s\n", p->dop.dialstr);
p->subs[index].f.frametype = AST_FRAME_NULL;
p->subs[index].f.subclass = 0;
p->dialing = 1;
analog_set_dialing(p, 1);
}
p->dop.dialstr[0] = '\0';
ast_setstate(ast, AST_STATE_DIALING);
@ -2886,7 +2894,7 @@ struct ast_frame *analog_exception(struct analog_pvt *p, struct ast_channel *ast
analog_off_hook(p);
if (p->owner && (p->owner->_state == AST_STATE_RINGING)) {
ast_queue_control(p->subs[ANALOG_SUB_REAL].owner, AST_CONTROL_ANSWER);
p->dialing = 0;
analog_set_dialing(p, 0);
}
break;
case ANALOG_EVENT_HOOKCOMPLETE:

View File

@ -192,6 +192,7 @@ struct analog_callback {
void * (* const get_sigpvt_bridged_channel)(struct ast_channel *chan);
int (* const get_sub_fd)(void *pvt, enum analog_sub sub);
void (* const set_cadence)(void *pvt, int *cidrings, struct ast_channel *chan);
void (* const set_dialing)(void *pvt, int flag);
};

View File

@ -94,6 +94,12 @@ static void sig_pri_handle_dchan_exception(struct sig_pri_pri *pri, int index)
pri->calls->handle_dchan_exception(pri, index);
}
static void sig_pri_set_dialing(struct sig_pri_chan *p, int flag)
{
if (p->calls->set_dialing)
p->calls->set_dialing(p, flag);
}
static void sig_pri_unlock_private(struct sig_pri_chan *p)
{
if (p->calls->unlock_private)
@ -1325,6 +1331,7 @@ static void *pri_dchannel(void *vpri)
pri_queue_frame(pri->pvts[chanpos], &f, pri);
}
pri->pvts[chanpos]->progress = 1;
sig_pri_set_dialing(pri->pvts[chanpos], 0);
sig_pri_unlock_private(pri->pvts[chanpos]);
}
}
@ -1349,6 +1356,7 @@ static void *pri_dchannel(void *vpri)
pri_queue_frame(pri->pvts[chanpos], &f, pri);
}
pri->pvts[chanpos]->proceeding = 1;
sig_pri_set_dialing(pri->pvts[chanpos], 0);
sig_pri_unlock_private(pri->pvts[chanpos]);
}
}
@ -1388,6 +1396,7 @@ static void *pri_dchannel(void *vpri)
sig_pri_lock_private(pri->pvts[chanpos]);
pri_queue_control(pri->pvts[chanpos], AST_CONTROL_ANSWER, pri);
/* Enable echo cancellation if it's not on already */
sig_pri_set_dialing(pri->pvts[chanpos], 0);
sig_pri_set_echocanceller(pri->pvts[chanpos], 1);
#ifdef SUPPORT_USERUSER
@ -1698,6 +1707,7 @@ int sig_pri_hangup(struct sig_pri_chan *p, struct ast_channel *ast)
p->setup_ack = 0;
p->rdnis[0] = '\0';
p->exten[0] = '\0';
sig_pri_set_dialing(p, 0);
if (!p->call) {
res = 0;
@ -2016,6 +2026,7 @@ int sig_pri_call(struct sig_pri_chan *p, struct ast_channel *ast, char *rdest, i
}
pri_sr_free(sr);
ast_setstate(ast, AST_STATE_DIALING);
sig_pri_set_dialing(p, 1);
pri_rel(p->pri);
return 0;
}
@ -2077,6 +2088,7 @@ int sig_pri_indicate(struct sig_pri_chan *p, struct ast_channel *chan, int condi
}
}
p->proceeding = 1;
sig_pri_set_dialing(p, 0);
}
/* don't continue in ast_indicate */
res = 0;
@ -2158,6 +2170,7 @@ int sig_pri_answer(struct sig_pri_chan *p, struct ast_channel *ast)
/* Send a pri acknowledge */
if (!pri_grab(p, p->pri)) {
p->proceeding = 1;
sig_pri_set_dialing(p, 0);
res = pri_answer(p->pri->pri, p->call, 0, !p->digital);
pri_rel(p->pri);
} else {

View File

@ -70,6 +70,7 @@ struct sig_pri_callback {
/* Note: Called with PRI lock held */
void (* const handle_dchan_exception)(struct sig_pri_pri *pri, int index);
void (* const set_dialing)(void *pvt, int flag);
};
#define NUM_DCHANS 4 /*!< No more than 4 d-channels */