[asterisk-commits] dhubbard: branch dhubbard/pinecowbell r166901 - /team/dhubbard/pinecowbell/ch...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Dec 29 22:45:22 CST 2008
Author: dhubbard
Date: Mon Dec 29 22:45:21 2008
New Revision: 166901
URL: http://svn.digium.com/view/asterisk?view=rev&rev=166901
Log:
remove non-persistent service state entries from the database in destroy_all_channels
Modified:
team/dhubbard/pinecowbell/channels/chan_dahdi.c
Modified: team/dhubbard/pinecowbell/channels/chan_dahdi.c
URL: http://svn.digium.com/view/asterisk/team/dhubbard/pinecowbell/channels/chan_dahdi.c?view=diff&rev=166901&r1=166900&r2=166901
==============================================================================
--- team/dhubbard/pinecowbell/channels/chan_dahdi.c (original)
+++ team/dhubbard/pinecowbell/channels/chan_dahdi.c Mon Dec 29 22:45:21 2008
@@ -263,12 +263,12 @@
#define SRVST_DBKEY "service-state"
/*! \brief The out-of-service SERVICE state */
#define SRVST_TYPE_OOS "O"
-/*! \brief SRVST_NOREASON is used to indicate a channel being out-of-service
- * The SRVST_NOREASON is mostly used maintain backwards compatibility but also may
+/*! \brief SRVST_INITIALIZED is used to indicate a channel being out-of-service
+ * The SRVST_INITIALIZED is mostly used maintain backwards compatibility but also may
* mean that the channel has not yet received a RESTART message. If a channel is
* out-of-service with this reason a RESTART message will result in the channel
* being put into service. */
-#define SRVST_NOREASON 0
+#define SRVST_INITIALIZED 0
/*! \brief SRVST_NEAREND is used to indicate that the near end was put out-of-service */
#define SRVST_NEAREND (1 << 0)
/*! \brief SRVST_FAREND is used to indicate that the far end was taken out-of-service */
@@ -2977,6 +2977,21 @@
pl = p;
p = p->next;
x = pl->channel;
+#ifdef HAVE_PRI_SERVICE_MESSAGES
+ {
+ char db_chan_name[20], db_answer[5], state;
+ int why = -1;
+
+ snprintf(db_chan_name, sizeof(db_chan_name), "%s/%d", dahdi_db, x);
+ if (!ast_db_get(db_chan_name, SRVST_DBKEY, db_answer, sizeof(db_answer))) {
+ sscanf(db_answer, "%c:%d", &state, &why);
+ }
+ if (!why) {
+ /* SRVST persistence is not required */
+ ast_db_del(db_chan_name, SRVST_DBKEY);
+ }
+ }
+#endif
/* Free associated memory */
if (pl)
destroy_dahdi_pvt(&pl);
@@ -9011,12 +9026,11 @@
tmp->inservice = 0;
#ifdef HAVE_PRI_SERVICE_MESSAGES
if (chan_sig == SIG_PRI) {
- char db_chan_name[20];
- char db_answer[5];
+ char db_chan_name[20], 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);
+ snprintf(db_answer, sizeof(db_answer), "%s:%d", SRVST_TYPE_OOS, SRVST_INITIALIZED);
ast_db_put(db_chan_name, SRVST_DBKEY, db_answer);
}
}
@@ -9112,9 +9126,7 @@
/* Trust PRI */
if (p->pri) {
#ifdef HAVE_PRI_SERVICE_MESSAGES
- char db_chan_name[20];
- char db_answer[5];
- char state;
+ char db_chan_name[20], db_answer[5], state;
int why = 0;
snprintf(db_chan_name, sizeof(db_chan_name), "%s/%d", dahdi_db, p->channel);
@@ -10961,9 +10973,7 @@
PRI_SPAN(e->restart.channel), PRI_CHANNEL(e->restart.channel), pri->span);
else {
#ifdef HAVE_PRI_SERVICE_MESSAGES
- char db_chan_name[20];
- char db_answer[5];
- char state;
+ char db_chan_name[20], db_answer[5], state;
int why;
int skipit = 0;
@@ -11075,11 +11085,8 @@
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[20];
- char db_answer[5];
- char state;
- int ch;
- int why = -1;
+ char db_chan_name[20], db_answer[5], state;
+ int ch, why = -1;
ast_mutex_lock(&pri->pvts[chanpos]->lock);
ch = pri->pvts[chanpos]->channel;
@@ -12084,8 +12091,7 @@
int interfaceid = 0;
char *c;
char state;
- char db_answer[5];
- char db_chan_name[20];
+ char db_chan_name[20], db_answer[5];
struct dahdi_pvt *start, *tmp = NULL;
struct dahdi_pri *pri = NULL;
ast_mutex_t *lock;
More information about the asterisk-commits
mailing list