freetdm: ISDN - ftdm_complete_state is not called in state_advance if a new state is set
This commit is contained in:
parent
faf1ec091a
commit
c5dd481fbd
|
@ -603,6 +603,7 @@ static ftdm_status_t ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdm
|
||||||
ftdm_sigmsg_t sigev;
|
ftdm_sigmsg_t sigev;
|
||||||
ftdm_channel_state_t initial_state;
|
ftdm_channel_state_t initial_state;
|
||||||
sngisdn_chan_data_t *sngisdn_info = ftdmchan->call_data;
|
sngisdn_chan_data_t *sngisdn_info = ftdmchan->call_data;
|
||||||
|
uint8_t state_change = 0;
|
||||||
|
|
||||||
memset(&sigev, 0, sizeof(sigev));
|
memset(&sigev, 0, sizeof(sigev));
|
||||||
|
|
||||||
|
@ -673,6 +674,7 @@ static ftdm_status_t ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdm
|
||||||
sngisdn_send_signal(sngisdn_info, FTDM_SIGEVENT_PROCEED);
|
sngisdn_send_signal(sngisdn_info, FTDM_SIGEVENT_PROCEED);
|
||||||
|
|
||||||
if (sngisdn_test_flag(sngisdn_info, FLAG_MEDIA_READY)) {
|
if (sngisdn_test_flag(sngisdn_info, FLAG_MEDIA_READY)) {
|
||||||
|
state_change++;
|
||||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA);
|
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -693,6 +695,7 @@ static ftdm_status_t ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdm
|
||||||
sngisdn_send_signal(sngisdn_info, FTDM_SIGEVENT_RINGING);
|
sngisdn_send_signal(sngisdn_info, FTDM_SIGEVENT_RINGING);
|
||||||
|
|
||||||
if (sngisdn_test_flag(sngisdn_info, FLAG_MEDIA_READY)) {
|
if (sngisdn_test_flag(sngisdn_info, FLAG_MEDIA_READY)) {
|
||||||
|
state_change++;
|
||||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA);
|
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_PROGRESS_MEDIA);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -752,6 +755,7 @@ static ftdm_status_t ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdm
|
||||||
/* Send a release complete */
|
/* Send a release complete */
|
||||||
sngisdn_snd_release(ftdmchan, 0);
|
sngisdn_snd_release(ftdmchan, 0);
|
||||||
/*now go to the HANGUP complete state*/
|
/*now go to the HANGUP complete state*/
|
||||||
|
state_change++;
|
||||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE);
|
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -811,6 +815,7 @@ static ftdm_status_t ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdm
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* now go to the HANGUP complete state */
|
/* now go to the HANGUP complete state */
|
||||||
|
state_change++;
|
||||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE);
|
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -819,6 +824,7 @@ static ftdm_status_t ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdm
|
||||||
if (sngisdn_test_flag(sngisdn_info, FLAG_REMOTE_ABORT) ||
|
if (sngisdn_test_flag(sngisdn_info, FLAG_REMOTE_ABORT) ||
|
||||||
sngisdn_test_flag(sngisdn_info, FLAG_LOCAL_ABORT)) {
|
sngisdn_test_flag(sngisdn_info, FLAG_LOCAL_ABORT)) {
|
||||||
/* If the remote side aborted, we will not get anymore message for this call */
|
/* If the remote side aborted, we will not get anymore message for this call */
|
||||||
|
state_change++;
|
||||||
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
|
||||||
} else {
|
} else {
|
||||||
/* waiting on remote confirmation before moving to down */
|
/* waiting on remote confirmation before moving to down */
|
||||||
|
@ -873,8 +879,10 @@ static ftdm_status_t ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdm
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Acknowledge the state change */
|
if (!state_change) {
|
||||||
ftdm_channel_complete_state(ftdmchan);
|
/* Acknowledge the state change */
|
||||||
|
ftdm_channel_complete_state(ftdmchan);
|
||||||
|
}
|
||||||
|
|
||||||
/* If sngisdn_info->variables is not NULL, it means did not send any
|
/* If sngisdn_info->variables is not NULL, it means did not send any
|
||||||
* sigevent to the user, therefore we have to free that hashtable */
|
* sigevent to the user, therefore we have to free that hashtable */
|
||||||
|
|
Loading…
Reference in New Issue