[asterisk-commits] dhubbard: branch group/issue3450 r136717 - /team/group/issue3450/channels/
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Aug 7 18:03:23 CDT 2008
Author: dhubbard
Date: Thu Aug 7 18:03:22 2008
New Revision: 136717
URL: http://svn.digium.com/view/asterisk?view=rev&rev=136717
Log:
remove the changestatus field in the tech_pvt structure because we are obtaining that information from the
persistent state entry in AstDB. Shrink local buffers to a more efficient size. Fix a bug where the
available() function was using the terminated 'changestatus' contents instead of the AstDB. This work is for
mantis issue 3450.
Modified:
team/group/issue3450/channels/chan_dahdi.c
Modified: team/group/issue3450/channels/chan_dahdi.c
URL: http://svn.digium.com/view/asterisk/team/group/issue3450/channels/chan_dahdi.c?view=diff&rev=136717&r1=136716&r2=136717
==============================================================================
--- team/group/issue3450/channels/chan_dahdi.c (original)
+++ team/group/issue3450/channels/chan_dahdi.c Thu Aug 7 18:03:22 2008
@@ -600,7 +600,6 @@
unsigned int progress:1;
unsigned int resetting:1;
unsigned int setup_ack:1;
- unsigned int changestatus;
#endif
unsigned int use_smdi:1; /* Whether to use SMDI on this channel */
struct ast_smdi_interface *smdi_iface; /* The serial port to listen for SMDI data on */
@@ -8721,8 +8720,9 @@
tmp->inservice = 0;
#ifdef HAVE_PRI
if (chan_sig == SIG_PRI) {
- char db_chan_name[100];
- char db_answer[20];
+ char db_chan_name[20];
+ char db_answer[5];
+
snprintf(db_chan_name, sizeof(db_chan_name), "%s/%d", dahdi_db, tmp->channel);
if (ast_db_get(db_chan_name, SRVST_DBKEY, db_answer, sizeof(db_answer))) {
snprintf(db_answer, sizeof(db_answer), "%s:%d", SRVST_TYPE_OOS, SRVST_NOREASON_MMKAY);
@@ -8818,8 +8818,17 @@
#ifdef HAVE_PRI
/* Trust PRI */
if (p->pri) {
- if ((p->resetting || p->call) || (p->changestatus > 0)) {
- if (p->changestatus)
+ char db_chan_name[20];
+ char db_answer[5];
+ char state;
+ int why = 0;
+
+ snprintf(db_chan_name, sizeof(db_chan_name), "%s/%d", dahdi_db, p->channel);
+ if (!ast_db_get(db_chan_name, SRVST_DBKEY, db_answer, sizeof(db_answer))) {
+ sscanf(db_answer, "%c:%d", &state, &why);
+ }
+ if ((p->resetting || p->call) || (why)) {
+ if (why)
*reason = AST_CAUSE_REQUESTED_CHAN_UNAVAIL;
return 0;
} else
@@ -10619,8 +10628,8 @@
ast_log(LOG_WARNING, "Restart requested on odd/unavailable channel number %d/%d on span %d\n",
PRI_SPAN(e->restart.channel), PRI_CHANNEL(e->restart.channel), pri->span);
else {
- char db_chan_name[100];
- char db_answer[20];
+ char db_chan_name[20];
+ char db_answer[5];
char state;
int why;
int skipit = 0;
@@ -10729,14 +10738,13 @@
ast_log(LOG_WARNING, "Received service change status %d on unconfigured channel %d/%d span %d\n",
e->service_ack.changestatus, PRI_SPAN(e->service_ack.channel), PRI_CHANNEL(e->service_ack.channel), pri->span);
} else {
- char db_chan_name[100];
- char db_answer[20];
+ char db_chan_name[20];
+ char db_answer[5];
char state;
int ch;
int why = -1;
ast_mutex_lock(&pri->pvts[chanpos]->lock);
- pri->pvts[chanpos]->changestatus = e->service.changestatus;
ch = pri->pvts[chanpos]->channel;
ast_mutex_unlock(&pri->pvts[chanpos]->lock);
@@ -10746,7 +10754,7 @@
ast_db_del(db_chan_name, SRVST_DBKEY);
}
switch (e->service.changestatus) {
- case 0: /* enable */
+ case 0: /* in-service */
if (why > -1) {
if (why & SRVST_NEAREND) {
snprintf(db_answer, sizeof(db_answer), "%s:%d", SRVST_TYPE_OOS, SRVST_NEAREND);
@@ -10756,7 +10764,10 @@
} else
ast_log(LOG_WARNING, "Huh?? Channel '%s' wasn't listed in the persistent storage database\n", db_chan_name);
break;
- case 2: /* disable */
+ case 1: /* maintenance - no supported */
+ ast_log(LOG_WARNING, "channel '%d' received a SERVICE message with new state 'maintenance' - this is unsupported.\n", ch);
+ break;
+ case 2: /* out-of-service */
if (why == -1) {
why = SRVST_FAREND;
} else {
@@ -10778,9 +10789,6 @@
ast_log(LOG_WARNING, "Received service acknowledge change status %d on unconfigured channel %d/%d span %d\n",
e->service_ack.changestatus, PRI_SPAN(e->service_ack.channel), PRI_CHANNEL(e->service_ack.channel), pri->span);
} else {
- ast_mutex_lock(&pri->pvts[chanpos]->lock);
- pri->pvts[chanpos]->changestatus = e->service_ack.changestatus;
- ast_mutex_unlock(&pri->pvts[chanpos]->lock);
ast_log(LOG_WARNING, "Received service acknowledge change status %d on channel %d/%d span %d\n",
e->service_ack.changestatus, PRI_SPAN(e->service_ack.channel), PRI_CHANNEL(e->service_ack.channel), pri->span);
}
@@ -11742,8 +11750,8 @@
int trunkgroup;
struct dahdi_pri *pri=NULL;
int fd = a->fd;
- char db_chan_name[100];
- char db_answer[20];
+ char db_chan_name[20];
+ char db_answer[5];
char state;
int why;
@@ -12467,7 +12475,6 @@
#endif
#ifdef HAVE_PRI
if (tmp->pri) {
- ast_cli(a->fd, "Change Status: %d\n", tmp->changestatus);
ast_cli(a->fd, "PRI Flags: ");
if (tmp->resetting)
ast_cli(a->fd, "Resetting ");
@@ -13147,8 +13154,8 @@
p = iflist;
while (p) {
#ifdef HAVE_PRI
- char db_chan_name[100];
- char db_answer[20];
+ char db_chan_name[20];
+ char db_answer[5];
char state;
int why;
#endif
More information about the asterisk-commits
mailing list