summaryrefslogtreecommitdiff
path: root/channels/chan_dahdi.c
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2012-04-18 16:41:17 +0000
committerRichard Mudgett <rmudgett@digium.com>2012-04-18 16:41:17 +0000
commitc7cb03a975bbaad41ed9ed07b3f5c68433f65900 (patch)
treec0f1d043618815ea5744e39ea8bc9eacfd23a2da /channels/chan_dahdi.c
parent7b5eb159e9ad35b0488da542148bcff4d1b26433 (diff)
Add ability to ignore layer 1 alarms for BRI PTMP lines.
Several telcos bring the BRI PTMP layer 1 down when the line is idle. When layer 1 goes down, Asterisk cannot make outgoing calls. Incoming calls could fail as well because the alarm processing is handled by a different code path than the Q.931 messages. * Add the layer1_presence configuration option to ignore layer 1 alarms when the telco brings layer 1 down. This option can be configured by span while the similar DAHDI driver teignorered=1 option is system wide. This option unlike layer2_persistence does not require libpri v1.4.13 or newer. Related to JIRA AST-598 JIRA ABE-2845 ........ Merged revisions 362428 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 362429 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@362430 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_dahdi.c')
-rw-r--r--channels/chan_dahdi.c45
1 files changed, 42 insertions, 3 deletions
diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index 86a5f41b6..55a0b721d 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -3140,8 +3140,19 @@ static void my_handle_dchan_exception(struct sig_pri_span *pri, int index)
int x;
ioctl(pri->fds[index], DAHDI_GETEVENT, &x);
- if (x) {
- ast_log(LOG_NOTICE, "PRI got event: %s (%d) on D-channel of span %d\n", event2str(x), x, pri->span);
+ switch (x) {
+ case DAHDI_EVENT_NONE:
+ break;
+ case DAHDI_EVENT_ALARM:
+ case DAHDI_EVENT_NOALARM:
+ if (sig_pri_is_alarm_ignored(pri)) {
+ break;
+ }
+ /* Fall through */
+ default:
+ ast_log(LOG_NOTICE, "PRI got event: %s (%d) on D-channel of span %d\n",
+ event2str(x), x, pri->span);
+ break;
}
/* Keep track of alarm state */
switch (x) {
@@ -3831,6 +3842,12 @@ static void dahdi_queue_frame(struct dahdi_pvt *p, struct ast_frame *f)
static void handle_clear_alarms(struct dahdi_pvt *p)
{
+#if defined(HAVE_PRI)
+ if (dahdi_sig_pri_lib_handles(p->sig) && sig_pri_is_alarm_ignored(p->pri)) {
+ return;
+ }
+#endif /* defined(HAVE_PRI) */
+
if (report_alarms & REPORT_CHANNEL_ALARMS) {
ast_log(LOG_NOTICE, "Alarm cleared on channel %d\n", p->channel);
manager_event(EVENT_FLAG_SYSTEM, "AlarmClear", "Channel: %d\r\n", p->channel);
@@ -7901,8 +7918,15 @@ static void dahdi_handle_dtmf(struct ast_channel *ast, int idx, struct ast_frame
static void handle_alarms(struct dahdi_pvt *p, int alms)
{
- const char *alarm_str = alarm2str(alms);
+ const char *alarm_str;
+
+#if defined(HAVE_PRI)
+ if (dahdi_sig_pri_lib_handles(p->sig) && sig_pri_is_alarm_ignored(p->pri)) {
+ return;
+ }
+#endif /* defined(HAVE_PRI) */
+ alarm_str = alarm2str(alms);
if (report_alarms & REPORT_CHANNEL_ALARMS) {
ast_log(LOG_WARNING, "Detected alarm on channel %d: %s\n", p->channel, alarm_str);
manager_event(EVENT_FLAG_SYSTEM, "Alarm",
@@ -12696,6 +12720,12 @@ static struct dahdi_pvt *mkintf(int channel, const struct dahdi_chan_conf *conf,
pris[span].pri.aoc_passthrough_flag = conf->pri.pri.aoc_passthrough_flag;
pris[span].pri.aoce_delayhangup = conf->pri.pri.aoce_delayhangup;
#endif /* defined(HAVE_PRI_AOC_EVENTS) */
+ if (chan_sig == SIG_BRI_PTMP) {
+ pris[span].pri.layer1_ignored = conf->pri.pri.layer1_ignored;
+ } else {
+ /* Option does not apply to this line type. */
+ pris[span].pri.layer1_ignored = 0;
+ }
pris[span].pri.append_msn_to_user_tag = conf->pri.pri.append_msn_to_user_tag;
ast_copy_string(pris[span].pri.initial_user_tag, conf->chan.cid_tag, sizeof(pris[span].pri.initial_user_tag));
ast_copy_string(pris[span].pri.msn_list, conf->pri.pri.msn_list, sizeof(pris[span].pri.msn_list));
@@ -17966,6 +17996,15 @@ static int process_dahdi(struct dahdi_chan_conf *confp, const char *cat, struct
} else if (!strcasecmp(v->name, "datetime_send")) {
confp->pri.pri.datetime_send = dahdi_datetime_send_option(v->value);
#endif /* defined(HAVE_PRI_DATETIME_SEND) */
+ } else if (!strcasecmp(v->name, "layer1_presence")) {
+ if (!strcasecmp(v->value, "required")) {
+ confp->pri.pri.layer1_ignored = 0;
+ } else if (!strcasecmp(v->value, "ignore")) {
+ confp->pri.pri.layer1_ignored = 1;
+ } else {
+ /* Default */
+ confp->pri.pri.layer1_ignored = 0;
+ }
#if defined(HAVE_PRI_L2_PERSISTENCE)
} else if (!strcasecmp(v->name, "layer2_persistence")) {
if (!strcasecmp(v->value, "keep_up")) {