Asterisk portion of the T309 patch. (#7271)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@37226 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.4
Matthew Fredrickson 20 years ago
parent 21486272e8
commit de03118578

@ -3637,20 +3637,23 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
break; break;
case ZT_EVENT_ALARM: case ZT_EVENT_ALARM:
#ifdef HAVE_PRI #ifdef HAVE_PRI
if (p->call) { if (!p->pri || !p->pri->pri || (pri_get_timer(p->pri->pri, PRI_TIMER_T309) < 0)) {
if (p->pri && p->pri->pri) { /* T309 is not enabled : hangup calls when alarm occurs */
if (!pri_grab(p, p->pri)) { if (p->call) {
pri_hangup(p->pri->pri, p->call, -1); if (p->pri && p->pri->pri) {
pri_destroycall(p->pri->pri, p->call); if (!pri_grab(p, p->pri)) {
p->call = NULL; pri_hangup(p->pri->pri, p->call, -1);
pri_rel(p->pri); pri_destroycall(p->pri->pri, p->call);
p->call = NULL;
pri_rel(p->pri);
} else
ast_log(LOG_WARNING, "Failed to grab PRI!\n");
} else } else
ast_log(LOG_WARNING, "Failed to grab PRI!\n"); ast_log(LOG_WARNING, "The PRI Call has not been destroyed\n");
} else }
ast_log(LOG_WARNING, "The PRI Call have not been destroyed\n"); if (p->owner)
p->owner->_softhangup |= AST_SOFTHANGUP_DEV;
} }
if (p->owner)
p->owner->_softhangup |= AST_SOFTHANGUP_DEV;
if (p->bearer) if (p->bearer)
p->bearer->inalarm = 1; p->bearer->inalarm = 1;
else else
@ -3662,7 +3665,13 @@ static struct ast_frame *zt_handle_event(struct ast_channel *ast)
"Alarm: %s\r\n" "Alarm: %s\r\n"
"Channel: %d\r\n", "Channel: %d\r\n",
alarm2str(res), p->channel); alarm2str(res), p->channel);
/* fall through intentionally */ #ifdef HAVE_LIBPRI
if (!p->pri || !p->pri->pri || pri_get_timer(p->pri->pri, PRI_TIMER_T309) < 0) {
/* fall through intentionally */
} else {
break;
}
#endif
case ZT_EVENT_ONHOOK: case ZT_EVENT_ONHOOK:
if (p->radio) { if (p->radio) {
p->subs[index].f.frametype = AST_FRAME_CONTROL; p->subs[index].f.frametype = AST_FRAME_CONTROL;
@ -8366,18 +8375,21 @@ static void *pri_dchannel(void *vpri)
for (i = 0; i < pri->numchans; i++) { for (i = 0; i < pri->numchans; i++) {
struct zt_pvt *p = pri->pvts[i]; struct zt_pvt *p = pri->pvts[i];
if (p) { if (p) {
if (p->call) { if (!p->pri || !p->pri->pri || pri_get_timer(p->pri->pri, PRI_TIMER_T309) < 0) {
if (p->pri && p->pri->pri) { /* T309 is not enabled : hangup calls when alarm occurs */
pri_hangup(p->pri->pri, p->call, -1); if (p->call) {
pri_destroycall(p->pri->pri, p->call); if (p->pri && p->pri->pri) {
p->call = NULL; pri_hangup(p->pri->pri, p->call, -1);
} else pri_destroycall(p->pri->pri, p->call);
ast_log(LOG_WARNING, "The PRI Call have not been destroyed\n"); p->call = NULL;
} else
ast_log(LOG_WARNING, "The PRI Call have not been destroyed\n");
}
if (p->realcall) {
pri_hangup_all(p->realcall, pri);
} else if (p->owner)
p->owner->_softhangup |= AST_SOFTHANGUP_DEV;
} }
if (p->realcall) {
pri_hangup_all(p->realcall, pri);
} else if (p->owner)
p->owner->_softhangup |= AST_SOFTHANGUP_DEV;
p->inalarm = 1; p->inalarm = 1;
} }
} }
@ -10218,12 +10230,11 @@ static int setup_zap(int reload)
cfg = ast_config_load(config); cfg = ast_config_load(config);
/* We *must* have a config file otherwise stop immediately */ /* Error if we have no config file */
if (!cfg) { if (!cfg) {
ast_log(LOG_ERROR, "Unable to load config %s\n", config); ast_log(LOG_ERROR, "Unable to load config %s\n", config);
return 0; return 0;
} }
/* It's a little silly to lock it, but we mind as well just to be sure */ /* It's a little silly to lock it, but we mind as well just to be sure */
ast_mutex_lock(&iflock); ast_mutex_lock(&iflock);

@ -131,6 +131,16 @@ switchtype=national
; ISDN Timers ; ISDN Timers
; All of the ISDN timers and counters that are used are configurable. Specify ; All of the ISDN timers and counters that are used are configurable. Specify
; the timer name, and its value (in ms for timers). ; the timer name, and its value (in ms for timers).
; K: Layer 2 max number of outstanding unacknowledged I frames (default 7)
; N200: Layer 2 max number of retransmissions of a frame (default 3)
; T200: Layer 2 max time before retransmission of a frame (default 1000 ms)
; T203: Layer 2 max time without frames being exchanged (default 10000 ms)
; T305: Wait for DISCONNECT acknowledge (default 30000 ms)
; T308: Wait for RELEASE acknowledge (default 4000 ms)
; T309: Maintain active calls on Layer 2 disconnection (default -1, Asterisk clears calls)
; EuroISDN: 6000 to 12000 ms, according to (N200 + 1) × T200 + 2s
; May vary in other ISDN standards (Q.931 1993 : 90000 ms)
; T313: Wait for CONNECT acknowledge, CPE side only (default 3000 ms)
; ;
; pritimer => t200,1000 ; pritimer => t200,1000
; pritimer => t313,4000 ; pritimer => t313,4000

Loading…
Cancel
Save