aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_dahdi.c
diff options
context:
space:
mode:
Diffstat (limited to 'channels/chan_dahdi.c')
-rw-r--r--channels/chan_dahdi.c83
1 files changed, 54 insertions, 29 deletions
diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index 131279ea0..321be6625 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -38,12 +38,12 @@
*/
/*** MODULEINFO
- <use>res_smdi</use>
+ <use type="module">res_smdi</use>
<depend>dahdi</depend>
<depend>tonezone</depend>
- <use>pri</use>
- <use>ss7</use>
- <use>openr2</use>
+ <use type="external">pri</use>
+ <use type="external">ss7</use>
+ <use type="external">openr2</use>
***/
#include "asterisk.h"
@@ -9491,6 +9491,8 @@ static struct ast_channel *dahdi_new(struct dahdi_pvt *i, int state, int startpb
int features;
struct ast_str *chan_name;
struct ast_variable *v;
+ char *dashptr;
+ char device_name[AST_CHANNEL_NAME];
if (i->subs[idx].owner) {
ast_log(LOG_WARNING, "Channel %d already has a %s call\n", i->channel,subnames[idx]);
@@ -9672,7 +9674,13 @@ static struct ast_channel *dahdi_new(struct dahdi_pvt *i, int state, int startpb
/* Configure the new channel jb */
ast_jb_configure(tmp, &global_jbconf);
- ast_devstate_changed_literal(ast_state_chan2dev(state), tmp->name);
+ /* Set initial device state */
+ ast_copy_string(device_name, tmp->name, sizeof(device_name));
+ dashptr = strrchr(device_name, '-');
+ if (dashptr) {
+ *dashptr = '\0';
+ }
+ ast_devstate_changed_literal(AST_DEVICE_UNKNOWN, device_name);
for (v = i->vars ; v ; v = v->next)
pbx_builtin_setvar_helper(tmp, v->name, v->value);
@@ -13933,17 +13941,22 @@ static void *mfcr2_monitor(void *data)
#endif
static void dahdi_pri_message(struct pri *pri, char *s)
{
- int x, y;
- int dchan = -1, span = -1, dchancount = 0;
+ int x;
+ int y;
+ int dchan = -1;
+ int span = -1;
+ int dchancount = 0;
if (pri) {
for (x = 0; x < NUM_SPANS; x++) {
for (y = 0; y < SIG_PRI_NUM_DCHANS; y++) {
- if (pris[x].pri.dchans[y])
+ if (pris[x].pri.dchans[y]) {
dchancount++;
+ }
- if (pris[x].pri.dchans[y] == pri)
+ if (pris[x].pri.dchans[y] == pri) {
dchan = y;
+ }
}
if (dchan >= 0) {
span = x;
@@ -13951,14 +13964,18 @@ static void dahdi_pri_message(struct pri *pri, char *s)
}
dchancount = 0;
}
- if (dchancount > 1 && (span > -1))
- ast_verbose("[Span %d D-Channel %d]%s", span, dchan, s);
- else if (span > -1)
- ast_verbose("%d %s", span+1, s);
- else
- ast_verbose("%s", s);
- } else
- ast_verbose("%s", s);
+ if (-1 < span) {
+ if (1 < dchancount) {
+ ast_verbose("[PRI Span: %d D-Channel: %d] %s", span + 1, dchan, s);
+ } else {
+ ast_verbose("PRI Span: %d %s", span + 1, s);
+ }
+ } else {
+ ast_verbose("PRI Span: ? %s", s);
+ }
+ } else {
+ ast_verbose("PRI Span: ? %s", s);
+ }
ast_mutex_lock(&pridebugfdlock);
@@ -13975,18 +13992,22 @@ static void dahdi_pri_message(struct pri *pri, char *s)
#if defined(HAVE_PRI)
static void dahdi_pri_error(struct pri *pri, char *s)
{
- int x, y;
- int dchan = -1, span = -1;
+ int x;
+ int y;
+ int dchan = -1;
+ int span = -1;
int dchancount = 0;
if (pri) {
for (x = 0; x < NUM_SPANS; x++) {
for (y = 0; y < SIG_PRI_NUM_DCHANS; y++) {
- if (pris[x].pri.dchans[y])
+ if (pris[x].pri.dchans[y]) {
dchancount++;
+ }
- if (pris[x].pri.dchans[y] == pri)
+ if (pris[x].pri.dchans[y] == pri) {
dchan = y;
+ }
}
if (dchan >= 0) {
span = x;
@@ -13994,14 +14015,18 @@ static void dahdi_pri_error(struct pri *pri, char *s)
}
dchancount = 0;
}
- if ((dchancount > 1) && (span > -1))
- ast_log(LOG_ERROR, "[Span %d D-Channel %d] PRI: %s", span, dchan, s);
- else if (span > -1)
- ast_log(LOG_ERROR, "%d %s", span+1, s);
- else
- ast_log(LOG_ERROR, "%s", s);
- } else
- ast_log(LOG_ERROR, "%s", s);
+ if (-1 < span) {
+ if (1 < dchancount) {
+ ast_log(LOG_ERROR, "[PRI Span: %d D-Channel: %d] %s", span + 1, dchan, s);
+ } else {
+ ast_log(LOG_ERROR, "PRI Span: %d %s", span + 1, s);
+ }
+ } else {
+ ast_log(LOG_ERROR, "PRI Span: ? %s", s);
+ }
+ } else {
+ ast_log(LOG_ERROR, "PRI Span: ? %s", s);
+ }
ast_mutex_lock(&pridebugfdlock);