forked from Mirrors/freeswitch
FS-5148 gsmopen: wait for the first audio write() before giving the AT command that moves the audio path to the audio tty (eg: don't accumulate noise by not sending frames on the open tty)
This commit is contained in:
parent
172df304cc
commit
4a3d1a074f
|
@ -455,6 +455,7 @@ struct private_object {
|
|||
|
||||
char buffer2[320];
|
||||
int buffer2_full;
|
||||
int serialPort_serial_audio_opened;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -2202,7 +2202,7 @@ int gsmopen_serial_answer_AT(private_t *tech_pvt)
|
|||
return -1;
|
||||
}
|
||||
}
|
||||
res = gsmopen_serial_write_AT_expect(tech_pvt, "AT^DDSETEX=2", tech_pvt->at_dial_expect);
|
||||
//res = gsmopen_serial_write_AT_expect(tech_pvt, "AT^DDSETEX=2", tech_pvt->at_dial_expect);
|
||||
DEBUGA_GSMOPEN("AT: call answered\n", GSMOPEN_P_LOG);
|
||||
return 0;
|
||||
}
|
||||
|
@ -2286,7 +2286,7 @@ int gsmopen_serial_call_AT(private_t *tech_pvt, char *dstr)
|
|||
ERRORA("dial command failed, dial string was: %s\n", GSMOPEN_P_LOG, at_command);
|
||||
return -1;
|
||||
}
|
||||
res = gsmopen_serial_write_AT_expect(tech_pvt, "AT^DDSETEX=2", tech_pvt->at_dial_expect);
|
||||
//res = gsmopen_serial_write_AT_expect(tech_pvt, "AT^DDSETEX=2", tech_pvt->at_dial_expect);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -3007,6 +3007,8 @@ int gsmopen_serial_init_audio_port(private_t *tech_pvt, int controldevice_audio_
|
|||
|
||||
if (tech_pvt->serialPort_serial_audio->Open(devname, 115200, "8N1", ctb::SerialPort::NoFlowControl) >= 0) {
|
||||
DEBUGA_GSMOPEN("port %s, SUCCESS open\n", GSMOPEN_P_LOG, tech_pvt->controldevice_audio_name);
|
||||
tech_pvt->serialPort_serial_audio_opened =1;
|
||||
gsmopen_serial_write_AT_expect(tech_pvt, "AT^DDSETEX=2", tech_pvt->at_dial_expect);
|
||||
} else {
|
||||
#ifdef WIN32
|
||||
LPVOID msg;
|
||||
|
@ -3054,6 +3056,7 @@ int serial_audio_shutdown(private_t *tech_pvt)
|
|||
|
||||
res = tech_pvt->serialPort_serial_audio->Close();
|
||||
DEBUGA_GSMOPEN("serial_audio_shutdown res=%d (controldev_audio_fd is %d)\n", GSMOPEN_P_LOG, res, tech_pvt->controldev_audio_fd);
|
||||
tech_pvt->serialPort_serial_audio_opened =0;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
|
|
@ -208,6 +208,7 @@ switch_status_t gsmopen_tech_init(private_t *tech_pvt, switch_core_session_t *se
|
|||
dtmf_rx_init(&tech_pvt->dtmf_state, NULL, NULL);
|
||||
dtmf_rx_parms(&tech_pvt->dtmf_state, 0, 10, 10, -99);
|
||||
|
||||
/*
|
||||
if (tech_pvt->no_sound == 0) {
|
||||
if (serial_audio_init(tech_pvt)) {
|
||||
ERRORA("serial_audio_init failed\n", GSMOPEN_P_LOG);
|
||||
|
@ -215,6 +216,7 @@ switch_status_t gsmopen_tech_init(private_t *tech_pvt, switch_core_session_t *se
|
|||
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
if (switch_core_timer_init(&tech_pvt->timer_read, "soft", 20, tech_pvt->read_codec.implementation->samples_per_packet, gsmopen_module_pool) !=
|
||||
SWITCH_STATUS_SUCCESS) {
|
||||
|
@ -805,6 +807,9 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc
|
|||
|
||||
gsmopen_sound_boost(frame->data, frame->samples, tech_pvt->playback_boost);
|
||||
if (!tech_pvt->no_sound) {
|
||||
if (!tech_pvt->serialPort_serial_audio_opened) {
|
||||
serial_audio_init(tech_pvt);
|
||||
}
|
||||
sent = tech_pvt->serialPort_serial_audio->Write((char *) frame->data, (int) (frame->datalen));
|
||||
|
||||
if (sent && sent != frame->datalen && sent != -1) {
|
||||
|
|
Loading…
Reference in New Issue