freetdm: ss7 - update to support CCR

This commit is contained in:
Konrad Hammel 2010-10-28 17:09:51 -04:00
parent 5fe38d5f88
commit 6f2ccbae21
2 changed files with 30 additions and 13 deletions

View File

@ -598,7 +598,7 @@ ftdm_status_t handle_rel_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ
/* this is a remote hangup request */
sngss7_set_flag(sngss7_info, FLAG_REMOTE_REL);
ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_LOOP, NULL);
/* move the state of the channel to CANCEL to end the call */
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_TERMINATING);
@ -613,7 +613,7 @@ ftdm_status_t handle_rel_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ
if (siRelEvnt->causeDgn.causeVal.pres) {
ftdmchan->caller_data.hangup_cause = siRelEvnt->causeDgn.causeVal.val;
} else {
SS7_ERROR("REL does not have a cause code!\n");
SS7_ERROR("REL does not have a cause ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_LOOP, NULL);code!\n");
ftdmchan->caller_data.hangup_cause = 0;
}
@ -625,6 +625,23 @@ ftdm_status_t handle_rel_ind(uint32_t suInstId, uint32_t spInstId, uint32_t circ
break;
/**************************************************************************/
case FTDM_CHANNEL_STATE_IN_LOOP:
/* inform the core to unloop the channel*/
ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_LOOP, NULL);
/* since we need to acknowledge the hang up set the flag for remote release */
sngss7_set_flag(sngss7_info, FLAG_REMOTE_REL);
/* go to hangup complete to send the RLC */
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE);
/* save the call info for the RLC */
sngss7_info->suInstId = get_unique_id();
sngss7_info->spInstId = spInstId;
break;
/**************************************************************************/
default:
/* throw the reset flag */
@ -1293,15 +1310,6 @@ ftdm_status_t handle_cot_start(uint32_t suInstId, uint32_t spInstId, uint32_t ci
/* switch to the IN_LOOP state */
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_IN_LOOP);
/* store the sngss7 ids */
if (suInstId == 0) {
sngss7_info->suInstId = get_unique_id();
} else {
sngss7_info->suInstId = suInstId;
}
sngss7_info->spInstId = spInstId;
sngss7_info->globalFlg = globalFlg;
/* unlock the channel again before we exit */
ftdm_mutex_unlock(ftdmchan->mutex);
@ -1662,7 +1670,7 @@ ftdm_status_t handle_rsc_rsp(uint32_t suInstId, uint32_t spInstId, uint32_t circ
sngss7_set_flag(sngss7_info, FLAG_RESET_TX_RSP);
/* go to DOWN */
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
/*ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN);*/
break;
/**********************************************************************/

View File

@ -93,7 +93,8 @@ ftdm_state_map_t sangoma_ss7_state_map = {
ZSM_UNACCEPTABLE,
{FTDM_CHANNEL_STATE_IN_LOOP, FTDM_END},
{FTDM_CHANNEL_STATE_SUSPENDED, FTDM_CHANNEL_STATE_RESTART,
FTDM_CHANNEL_STATE_COLLECT, FTDM_CHANNEL_STATE_DOWN, FTDM_END}
FTDM_CHANNEL_STATE_COLLECT, FTDM_CHANNEL_STATE_DOWN,
FTDM_CHANNEL_STATE_HANGUP_COMPLETE, FTDM_END}
},
{
ZSD_INBOUND,
@ -970,6 +971,14 @@ void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
ftdm_set_state_locked (ftdmchan, ftdmchan->last_state);
break;
/******************************************************************/
case (FTDM_CHANNEL_STATE_IN_LOOP):
/* we screwed up in a COT/CCR, remove the loop */
ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_LOOP, NULL);
/* go to down */
ftdm_set_state_locked(ftdmchan, FTDM_CHANNEL_STATE_DOWN);
break;
/******************************************************************/
default:
/* KONRAD: find out what the cause code should be */
ftdmchan->caller_data.hangup_cause = 41;