struct stfu_instance *i;
i = malloc(sizeof(*i));
- assert(i != NULL);
+ if (!i) {
+ return NULL;
+ }
memset(i, 0, sizeof(*i));
stfu_n_init_aqueue(&i->a_queue, qlen);
stfu_n_init_aqueue(&i->b_queue, qlen);
switch_byte_t decoded[SWITCH_RECOMMENDED_BUFFER_SIZE];
uint32_t rate = read_codec->implementation->actual_samples_per_second;
uint32_t dlen = sizeof(decoded);
- switch_status_t status;
+ switch_status_t tstatus;
switch_byte_t *sendbuf = NULL;
uint32_t sendlen = 0;
status = SWITCH_STATUS_SUCCESS;
} else {
if (switch_test_flag(conninfo, SUF_NATIVE)) {
- status = SWITCH_STATUS_NOOP;
+ tstatus = SWITCH_STATUS_NOOP;
} else {
- status = switch_core_codec_decode(
+ tstatus = switch_core_codec_decode(
read_codec,
&conninfo->read_codec,
read_frame->data,
read_codec->implementation->actual_samples_per_second,
decoded, &dlen, &rate, &flags);
}
- switch (status) {
+ switch (tstatus) {
case SWITCH_STATUS_NOOP:
case SWITCH_STATUS_BREAK:
sendbuf = read_frame->data;
sendlen = read_frame->datalen;
- status = SWITCH_STATUS_SUCCESS;
+ tstatus = SWITCH_STATUS_SUCCESS;
break;
case SWITCH_STATUS_SUCCESS:
sendbuf = decoded;
sendlen = dlen;
- status = SWITCH_STATUS_SUCCESS;
+ tstatus = SWITCH_STATUS_SUCCESS;
break;
default:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Codec Error\n");
}
}
- if (status == SWITCH_STATUS_SUCCESS) {
+ if (tstatus == SWITCH_STATUS_SUCCESS) {
len = sendlen;
if (switch_socket_sendto(conninfo->socket, conninfo->remote_addr, 0, (void *)sendbuf, &len) != SWITCH_STATUS_SUCCESS) {
switch_ivr_deactivate_unicast(session);
/* read from the channel while we wait if the audio is up on it */
if (session && (ringback_data || !switch_channel_test_flag(caller_channel, CF_BYPASS_MEDIA)) &&
(switch_channel_test_flag(caller_channel, CF_ANSWERED) || switch_channel_test_flag(caller_channel, CF_EARLY_MEDIA))) {
- switch_status_t status = switch_core_session_read_frame(session, &read_frame, 1000, 0);
+ switch_status_t tstatus = switch_core_session_read_frame(session, &read_frame, 1000, 0);
- if (!SWITCH_READ_ACCEPTABLE(status)) {
+ if (!SWITCH_READ_ACCEPTABLE(tstatus)) {
break;
}
}
} else { /* time off the channel (if you must) */
switch_frame_t *read_frame;
- switch_status_t status;
+ switch_status_t tstatus;
while (switch_channel_ready(channel) && switch_channel_test_flag(channel, CF_HOLD)) {
switch_yield(10000);
}
- status = switch_core_session_read_frame(session, &read_frame, -1, 0);
+ tstatus = switch_core_session_read_frame(session, &read_frame, -1, 0);
- if (!SWITCH_READ_ACCEPTABLE(status)) {
+ if (!SWITCH_READ_ACCEPTABLE(tstatus)) {
break;
}
}
} else {
switch_frame_t *read_frame;
- switch_status_t status = switch_core_session_read_frame(session, &read_frame, -1, 0);
+ switch_status_t tstatus = switch_core_session_read_frame(session, &read_frame, -1, 0);
while (switch_channel_ready(channel) && switch_channel_test_flag(channel, CF_HOLD)) {
switch_yield(10000);
}
- if (!SWITCH_READ_ACCEPTABLE(status)) {
+ if (!SWITCH_READ_ACCEPTABLE(tstatus)) {
break;
}
}
} else { /* time off the channel (if you must) */
switch_frame_t *read_frame;
- switch_status_t status = switch_core_session_read_frame(session, &read_frame, -1, 0);
+ switch_status_t tstatus = switch_core_session_read_frame(session, &read_frame, -1, 0);
while (switch_channel_ready(channel) && switch_channel_test_flag(channel, CF_HOLD)) {
switch_yield(10000);
}
- if (!SWITCH_READ_ACCEPTABLE(status)) {
+ if (!SWITCH_READ_ACCEPTABLE(tstatus)) {
break;
}