mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-14 16:15:04 +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,33 +1359,37 @@ 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;
|
||||||
|
|
||||||
release_request_id_span_chan(ftdmchan->physical_span_id, ftdmchan->physical_chan_id);
|
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);
|
||||||
|
|
||||||
if (!ftdm_test_sflag(ftdmchan, SFLAG_SENT_FINAL_MSG)) {
|
if (!ftdm_test_sflag(ftdmchan, SFLAG_SENT_FINAL_MSG)) {
|
||||||
ftdm_set_sflag_locked(ftdmchan, SFLAG_SENT_FINAL_MSG);
|
ftdm_set_sflag_locked(ftdmchan, SFLAG_SENT_FINAL_MSG);
|
||||||
|
|
||||||
if (ftdmchan->call_data && CALL_DATA(ftdmchan)->last_event_id == SIGBOOST_EVENT_CALL_START_NACK) {
|
if (ftdmchan->call_data && CALL_DATA(ftdmchan)->last_event_id == SIGBOOST_EVENT_CALL_START_NACK) {
|
||||||
sangomabc_exec_command(mcon,
|
sangomabc_exec_command(mcon,
|
||||||
BOOST_SPAN(ftdmchan),
|
BOOST_SPAN(ftdmchan),
|
||||||
BOOST_CHAN(ftdmchan),
|
BOOST_CHAN(ftdmchan),
|
||||||
CALL_DATA(ftdmchan)->call_setup_id,
|
CALL_DATA(ftdmchan)->call_setup_id,
|
||||||
SIGBOOST_EVENT_CALL_START_NACK_ACK,
|
SIGBOOST_EVENT_CALL_START_NACK_ACK,
|
||||||
0, 0);
|
0, 0);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
/* we got a call stop msg, time to reply with call stopped ack */
|
/* we got a call stop msg, time to reply with call stopped ack */
|
||||||
sangomabc_exec_command(mcon,
|
sangomabc_exec_command(mcon,
|
||||||
BOOST_SPAN(ftdmchan),
|
BOOST_SPAN(ftdmchan),
|
||||||
BOOST_CHAN(ftdmchan),
|
BOOST_CHAN(ftdmchan),
|
||||||
0,
|
0,
|
||||||
SIGBOOST_EVENT_CALL_STOPPED_ACK,
|
SIGBOOST_EVENT_CALL_STOPPED_ACK,
|
||||||
0, 0);
|
0, 0);
|
||||||
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",
|
||||||
|
@ -601,7 +601,7 @@ static FIO_COMMAND_FUNCTION(wanpipe_command)
|
|||||||
{
|
{
|
||||||
err=sangoma_tdm_enable_hwec(ftdmchan->sockfd, &tdm_api);
|
err=sangoma_tdm_enable_hwec(ftdmchan->sockfd, &tdm_api);
|
||||||
if (err) {
|
if (err) {
|
||||||
snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "HWEC Enable Failed");
|
snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "HWEC Enable Failed");
|
||||||
return FTDM_FAIL;
|
return FTDM_FAIL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -610,7 +610,7 @@ static FIO_COMMAND_FUNCTION(wanpipe_command)
|
|||||||
{
|
{
|
||||||
err=sangoma_tdm_disable_hwec(ftdmchan->sockfd, &tdm_api);
|
err=sangoma_tdm_disable_hwec(ftdmchan->sockfd, &tdm_api);
|
||||||
if (err) {
|
if (err) {
|
||||||
snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "HWEC Disable Failed");
|
snprintf(ftdmchan->last_error, sizeof(ftdmchan->last_error), "HWEC Disable Failed");
|
||||||
return FTDM_FAIL;
|
return FTDM_FAIL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -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