In case of INFO_IND(DISC) in stay-online mode, wait a little bit
for further infos like CCBS retain info before sending HANGUP to Asterisk.
This commit is contained in:
parent
a13961713d
commit
892b24eb2a
27
chan_capi.c
27
chan_capi.c
|
@ -805,6 +805,7 @@ static void interface_cleanup(struct capi_pvt *i)
|
|||
i->cause = 0;
|
||||
|
||||
i->whentohangup = 0;
|
||||
i->whentoqueuehangup = 0;
|
||||
|
||||
i->FaxState &= ~CAPI_FAX_STATE_MASK;
|
||||
|
||||
|
@ -2480,7 +2481,7 @@ static void capidev_handle_did_digits(_cmsg *CMSG, unsigned int PLCI, unsigned i
|
|||
/*
|
||||
* send control according to cause code
|
||||
*/
|
||||
static void queue_cause_control(struct capi_pvt *i, int control)
|
||||
void queue_cause_control(struct capi_pvt *i, int control)
|
||||
{
|
||||
struct ast_frame fr = { AST_FRAME_CONTROL, AST_CONTROL_HANGUP, };
|
||||
|
||||
|
@ -2518,10 +2519,17 @@ static void capidev_handle_info_disconnect(_cmsg *CMSG, unsigned int PLCI, unsig
|
|||
if ((i->doB3 != CAPI_B3_ALWAYS) && (i->outgoing == 1)) {
|
||||
cc_verbose(4, 1, VERBOSE_PREFIX_3 "%s: Disconnect case 1\n",
|
||||
i->vname);
|
||||
if (i->state == CAPI_STATE_CONNECTED)
|
||||
if (i->state == CAPI_STATE_CONNECTED) {
|
||||
queue_cause_control(i, 0);
|
||||
else
|
||||
queue_cause_control(i, 1);
|
||||
} else {
|
||||
if ((i->isdnstate & CAPI_ISDN_STATE_STAYONLINE)) {
|
||||
cc_verbose(3, 1, VERBOSE_PREFIX_2 "%s: stay-online hangup frame queued.\n",
|
||||
i->vname);
|
||||
i->whentoqueuehangup = time(NULL) + 1;
|
||||
} else {
|
||||
queue_cause_control(i, 1);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -4722,12 +4730,21 @@ static void capidev_run_secondly(time_t now)
|
|||
/* check for channels to hangup (timeout) */
|
||||
cc_mutex_lock(&iflock);
|
||||
for (i = iflist; i; i = i->next) {
|
||||
if ((i->used) && (i->whentohangup) && (i->whentohangup < now)) {
|
||||
if (i->used == NULL) {
|
||||
continue;
|
||||
}
|
||||
if ((i->whentohangup) && (i->whentohangup < now)) {
|
||||
cc_verbose(3, 1, VERBOSE_PREFIX_2 "%s: stay-online timeout, hanging up.\n",
|
||||
i->vname);
|
||||
i->whentohangup = 0;
|
||||
capi_disconnect(i);
|
||||
}
|
||||
if ((i->whentoqueuehangup) && (i->whentoqueuehangup < now)) {
|
||||
cc_verbose(3, 1, VERBOSE_PREFIX_2 "%s: stay-online queue-hangup.\n",
|
||||
i->vname);
|
||||
queue_cause_control(i, 1);
|
||||
i->whentoqueuehangup = 0;
|
||||
}
|
||||
}
|
||||
cc_mutex_unlock(&iflock);
|
||||
}
|
||||
|
|
|
@ -408,7 +408,9 @@ struct capi_pvt {
|
|||
unsigned int reason;
|
||||
unsigned int reasonb3;
|
||||
|
||||
/* deferred tasks */
|
||||
time_t whentohangup;
|
||||
time_t whentoqueuehangup;
|
||||
|
||||
/* RTP */
|
||||
struct ast_rtp *rtp;
|
||||
|
@ -560,5 +562,6 @@ struct cc_capi_controller {
|
|||
extern unsigned capi_ApplID;
|
||||
extern struct capi_pvt *iflist;
|
||||
extern void cc_start_b3(struct capi_pvt *i);
|
||||
extern void queue_cause_control(struct capi_pvt *i, int control);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -108,6 +108,12 @@ static void new_ccbsnr_id(char type, unsigned int plci,
|
|||
cc_verbose(1, 1, VERBOSE_PREFIX_3
|
||||
"%s: PLCI=%#x CCBS/CCNR new id=0x%04x handle=%d\n",
|
||||
i->vname, plci, id, ccbsnr->handle);
|
||||
|
||||
/* if the hangup frame was deferred, it can be done now and here */
|
||||
if (i->whentoqueuehangup) {
|
||||
i->whentoqueuehangup = 0;
|
||||
queue_cause_control(i, 1);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue