[asterisk-commits] jpeeler: trunk r206767 - /trunk/channels/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Jul 15 17:03:00 CDT 2009
Author: jpeeler
Date: Wed Jul 15 17:02:55 2009
New Revision: 206767
URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=206767
Log:
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
Modified:
trunk/channels/chan_dahdi.c
trunk/channels/sig_analog.c
trunk/channels/sig_analog.h
trunk/channels/sig_pri.c
trunk/channels/sig_pri.h
Modified: trunk/channels/chan_dahdi.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/channels/chan_dahdi.c?view=diff&rev=206767&r1=206766&r2=206767
==============================================================================
--- trunk/channels/chan_dahdi.c (original)
+++ trunk/channels/chan_dahdi.c Wed Jul 15 17:02:55 2009
@@ -2033,6 +2033,12 @@
}
}
+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 @@
.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 @@
.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 @@
#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 */
) {
@@ -7580,7 +7586,6 @@
p->subs[idx].f.offset = 0;
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 */
@@ -7723,14 +7728,6 @@
(frame->subclass != AST_FORMAT_ALAW)) {
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);
Modified: trunk/channels/sig_analog.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/channels/sig_analog.c?view=diff&rev=206767&r1=206766&r2=206767
==============================================================================
--- trunk/channels/sig_analog.c (original)
+++ trunk/channels/sig_analog.c Wed Jul 15 17:02:55 2009
@@ -695,6 +695,14 @@
}
}
+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 @@
/* 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 at dccinc.com 4/3/03 mods to allow for deferred dialing */
@@ -753,7 +761,7 @@
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 @@
}
} 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 @@
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 @@
}
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 @@
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 @@
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 @@
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 @@
/* 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 at dccinc.com 4/3/03 - fxo should be able to do deferred dialing */
@@ -2362,7 +2370,7 @@
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 @@
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:
Modified: trunk/channels/sig_analog.h
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/channels/sig_analog.h?view=diff&rev=206767&r1=206766&r2=206767
==============================================================================
--- trunk/channels/sig_analog.h (original)
+++ trunk/channels/sig_analog.h Wed Jul 15 17:02:55 2009
@@ -192,6 +192,7 @@
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);
};
Modified: trunk/channels/sig_pri.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/channels/sig_pri.c?view=diff&rev=206767&r1=206766&r2=206767
==============================================================================
--- trunk/channels/sig_pri.c (original)
+++ trunk/channels/sig_pri.c Wed Jul 15 17:02:55 2009
@@ -92,6 +92,12 @@
{
if (pri->calls->handle_dchan_exception)
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)
@@ -1325,6 +1331,7 @@
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 @@
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 @@
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 @@
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 @@
}
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 @@
}
}
p->proceeding = 1;
+ sig_pri_set_dialing(p, 0);
}
/* don't continue in ast_indicate */
res = 0;
@@ -2158,6 +2170,7 @@
/* 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 {
Modified: trunk/channels/sig_pri.h
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/channels/sig_pri.h?view=diff&rev=206767&r1=206766&r2=206767
==============================================================================
--- trunk/channels/sig_pri.h (original)
+++ trunk/channels/sig_pri.h Wed Jul 15 17:02:55 2009
@@ -70,6 +70,7 @@
/* 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 */
More information about the asterisk-commits
mailing list