mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-15 16:39:14 +00:00
freetdm: handle loop requests
This commit is contained in:
parent
edb2d58285
commit
632e89f5f9
@ -1088,6 +1088,7 @@ static void handle_call_loop_start(ftdm_span_t *span, sangomabc_connection_t *mc
|
|||||||
ftdm_channel_done(ftdmchan);
|
ftdm_channel_done(ftdmchan);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
ftdm_log(FTDM_LOG_DEBUG, "%d:%d starting loop\n", ftdmchan->span_id, ftdmchan->chan_id);
|
||||||
ftdm_channel_command(ftdmchan, FTDM_COMMAND_ENABLE_LOOP, NULL);
|
ftdm_channel_command(ftdmchan, FTDM_COMMAND_ENABLE_LOOP, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1100,13 +1101,16 @@ static void handle_call_loop_stop(ftdm_span_t *span, sangomabc_connection_t *mco
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (ftdmchan->state != FTDM_CHANNEL_STATE_IN_LOOP) {
|
if (ftdmchan->state != FTDM_CHANNEL_STATE_IN_LOOP) {
|
||||||
ftdm_log(FTDM_LOG_ERROR, "Got stop loop request in a channel that is not in loop, ignoring ...\n");
|
ftdm_log(FTDM_LOG_WARNING, "Got stop loop request in a channel that is not in loop, ignoring ...\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_LOOP, NULL);
|
ftdm_channel_command(ftdmchan, FTDM_COMMAND_DISABLE_LOOP, NULL);
|
||||||
/* even when we did not sent a msg we set this flag to avoid sending call stop in the DOWN state handler */
|
/* even when we did not sent a msg we set this flag to avoid sending call stop in the DOWN state handler */
|
||||||
ftdm_set_flag(ftdmchan, SFLAG_SENT_FINAL_MSG);
|
ftdm_set_flag(ftdmchan, SFLAG_SENT_FINAL_MSG);
|
||||||
ftdm_set_state_r(ftdmchan, FTDM_CHANNEL_STATE_DOWN, res);
|
ftdm_set_state_r(ftdmchan, FTDM_CHANNEL_STATE_DOWN, res);
|
||||||
|
if (res != FTDM_SUCCESS) {
|
||||||
|
ftdm_log(FTDM_LOG_CRIT, "yay, could not set the state of the channel from IN_LOOP to DOWN\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1355,6 +1359,9 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan)
|
|||||||
int call_stopped_ack_sent = 0;
|
int call_stopped_ack_sent = 0;
|
||||||
ftdm_sangoma_boost_data_t *sangoma_boost_data = ftdmchan->span->signal_data;
|
ftdm_sangoma_boost_data_t *sangoma_boost_data = ftdmchan->span->signal_data;
|
||||||
|
|
||||||
|
if (ftdmchan->last_state == FTDM_CHANNEL_STATE_IN_LOOP) {
|
||||||
|
ftdm_log(FTDM_LOG_DEBUG, "%d:%d terminating loop\n", ftdmchan->span_id, ftdmchan->chan_id);
|
||||||
|
} else {
|
||||||
release_request_id_span_chan(ftdmchan->physical_span_id, ftdmchan->physical_chan_id);
|
release_request_id_span_chan(ftdmchan->physical_span_id, ftdmchan->physical_chan_id);
|
||||||
|
|
||||||
if (!ftdm_test_sflag(ftdmchan, SFLAG_SENT_FINAL_MSG)) {
|
if (!ftdm_test_sflag(ftdmchan, SFLAG_SENT_FINAL_MSG)) {
|
||||||
@ -1379,9 +1386,10 @@ static __inline__ void state_advance(ftdm_channel_t *ftdmchan)
|
|||||||
call_stopped_ack_sent = 1;
|
call_stopped_ack_sent = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ftdmchan->sflags = 0;
|
ftdmchan->sflags = 0;
|
||||||
memset(ftdmchan->call_data, 0, sizeof(sangoma_boost_call_t));
|
memset(ftdmchan->call_data, 0, sizeof(sangoma_boost_call_t));
|
||||||
|
|
||||||
if (sangoma_boost_data->sigmod && call_stopped_ack_sent) {
|
if (sangoma_boost_data->sigmod && call_stopped_ack_sent) {
|
||||||
/* we dont want to call ftdm_channel_done just yet until call released is received */
|
/* we dont want to call ftdm_channel_done just yet until call released is received */
|
||||||
ftdm_log(FTDM_LOG_DEBUG, "Waiting for call release confirmation before declaring chan %d:%d as available \n",
|
ftdm_log(FTDM_LOG_DEBUG, "Waiting for call release confirmation before declaring chan %d:%d as available \n",
|
||||||
|
@ -625,6 +625,7 @@ static FIO_COMMAND_FUNCTION(wanpipe_command)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
case FTDM_COMMAND_DISABLE_LOOP:
|
case FTDM_COMMAND_DISABLE_LOOP:
|
||||||
{
|
{
|
||||||
#ifdef WP_API_FEATURE_LOOP
|
#ifdef WP_API_FEATURE_LOOP
|
||||||
@ -635,6 +636,7 @@ static FIO_COMMAND_FUNCTION(wanpipe_command)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
case FTDM_COMMAND_SET_INTERVAL:
|
case FTDM_COMMAND_SET_INTERVAL:
|
||||||
{
|
{
|
||||||
err=sangoma_tdm_set_usr_period(ftdmchan->sockfd, &tdm_api, FTDM_COMMAND_OBJ_INT);
|
err=sangoma_tdm_set_usr_period(ftdmchan->sockfd, &tdm_api, FTDM_COMMAND_OBJ_INT);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user