Fixed hookflash issues

- Ignore hookflash when there is no connected call and no call on hold.
- No timeout when retrieving call.
- Release not connected call that is active.
This commit is contained in:
Andreas Eversberg 2023-02-22 19:36:21 +01:00
parent 39e66c6e31
commit e802b9c67e
1 changed files with 21 additions and 3 deletions

View File

@ -1411,17 +1411,34 @@ static void swap_active_hold(pstn_t *pstn)
/* process hookflash from various events: short hangup, off-hook-pulse, pulse digit 1 ... */
static void hookflash(pstn_t *pstn)
{
/* hookflash: no connected call, no call on hold */
if (pstn->call[PSTN_CALL_ACTIVE]->state != CALL_STATE_ACTIVE
&& !pstn->call[PSTN_CALL_HOLD]->cc_callref) {
PDEBUG(DTEL, DEBUG_INFO, "There is an active call that is not connected, but no call on hold, ignoring hookflash.\n");
return;
}
/* stop timer */
timer_off(pstn);
/* stop tone (CW tone) */
tone_off(pstn);
/* clear dialing */
pstn->dialing[0] = '\0';
/* release incomplete call, if any */
if (pstn->call[PSTN_CALL_ACTIVE]->state != CALL_STATE_ACTIVE) {
PDEBUG(DTEL, DEBUG_INFO, "There is an active call that is not connected, release it.\n");
/* release active call that is not connectd */
release_call(pstn, PSTN_CALL_ACTIVE, OSMO_CC_ISDN_CAUSE_NORM_CALL_CLEAR);
}
/* if call on hold, swap calls */
if (pstn->call[PSTN_CALL_HOLD]->cc_callref) {
PDEBUG(DTEL, DEBUG_INFO, "There is a call on hold, so swap both calls.\n");
/* swap ACTIVE call and call on HOLD */
swap_active_hold(pstn);
/* send notify to call on hold */
notify_ind(pstn->call[PSTN_CALL_HOLD], OSMO_CC_NOTIFY_REMOTE_HOLD);
if (pstn->call[PSTN_CALL_HOLD]->cc_callref) {
/* send notify to call on hold */
notify_ind(pstn->call[PSTN_CALL_HOLD], OSMO_CC_NOTIFY_REMOTE_HOLD);
}
/* if waiting call, answer it */
if (pstn->call[PSTN_CALL_ACTIVE]->state != CALL_STATE_ACTIVE
&& pstn->call[PSTN_CALL_ACTIVE]->state != CALL_STATE_HOLD) {
@ -1430,7 +1447,8 @@ static void hookflash(pstn_t *pstn)
}
/* change state */
pstn_call_state(pstn->call[PSTN_CALL_ACTIVE], CALL_STATE_ACTIVE);
pstn_call_state(pstn->call[PSTN_CALL_HOLD], CALL_STATE_HOLD);
if (pstn->call[PSTN_CALL_HOLD]->cc_callref)
pstn_call_state(pstn->call[PSTN_CALL_HOLD], CALL_STATE_HOLD);
/* send notify to active call */
notify_ind(pstn->call[PSTN_CALL_ACTIVE], OSMO_CC_NOTIFY_REMOTE_RETRIEVAL);
return;