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:
parent
39e66c6e31
commit
e802b9c67e
|
@ -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 ... */
|
/* process hookflash from various events: short hangup, off-hook-pulse, pulse digit 1 ... */
|
||||||
static void hookflash(pstn_t *pstn)
|
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) */
|
/* stop tone (CW tone) */
|
||||||
tone_off(pstn);
|
tone_off(pstn);
|
||||||
/* clear dialing */
|
/* clear dialing */
|
||||||
pstn->dialing[0] = '\0';
|
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 call on hold, swap calls */
|
||||||
if (pstn->call[PSTN_CALL_HOLD]->cc_callref) {
|
if (pstn->call[PSTN_CALL_HOLD]->cc_callref) {
|
||||||
PDEBUG(DTEL, DEBUG_INFO, "There is a call on hold, so swap both calls.\n");
|
PDEBUG(DTEL, DEBUG_INFO, "There is a call on hold, so swap both calls.\n");
|
||||||
/* swap ACTIVE call and call on HOLD */
|
/* swap ACTIVE call and call on HOLD */
|
||||||
swap_active_hold(pstn);
|
swap_active_hold(pstn);
|
||||||
/* send notify to call on hold */
|
if (pstn->call[PSTN_CALL_HOLD]->cc_callref) {
|
||||||
notify_ind(pstn->call[PSTN_CALL_HOLD], OSMO_CC_NOTIFY_REMOTE_HOLD);
|
/* send notify to call on hold */
|
||||||
|
notify_ind(pstn->call[PSTN_CALL_HOLD], OSMO_CC_NOTIFY_REMOTE_HOLD);
|
||||||
|
}
|
||||||
/* if waiting call, answer it */
|
/* if waiting call, answer it */
|
||||||
if (pstn->call[PSTN_CALL_ACTIVE]->state != CALL_STATE_ACTIVE
|
if (pstn->call[PSTN_CALL_ACTIVE]->state != CALL_STATE_ACTIVE
|
||||||
&& pstn->call[PSTN_CALL_ACTIVE]->state != CALL_STATE_HOLD) {
|
&& pstn->call[PSTN_CALL_ACTIVE]->state != CALL_STATE_HOLD) {
|
||||||
|
@ -1430,7 +1447,8 @@ static void hookflash(pstn_t *pstn)
|
||||||
}
|
}
|
||||||
/* change state */
|
/* change state */
|
||||||
pstn_call_state(pstn->call[PSTN_CALL_ACTIVE], CALL_STATE_ACTIVE);
|
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 */
|
/* send notify to active call */
|
||||||
notify_ind(pstn->call[PSTN_CALL_ACTIVE], OSMO_CC_NOTIFY_REMOTE_RETRIEVAL);
|
notify_ind(pstn->call[PSTN_CALL_ACTIVE], OSMO_CC_NOTIFY_REMOTE_RETRIEVAL);
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue