GSM now receives tones during bridge
If a bridge is enabled, tones (e.g. hangup tone) will have priority over the bridge. The bridge will continue to forward audio, after tone is removed. (e.g after beeing on hold music)
This commit is contained in:
parent
1e778230b9
commit
57defecea8
8
gsm.cpp
8
gsm.cpp
|
@ -236,6 +236,14 @@ void Pgsm::frame_receive(void *arg)
|
|||
|
||||
/* send traffic to gsm */
|
||||
int Pgsm::bridge_rx(unsigned char *data, int len)
|
||||
{
|
||||
if (p_tone_name[0])
|
||||
return -EINVAL;
|
||||
|
||||
return audio_send(data, len);
|
||||
}
|
||||
|
||||
int Pgsm::audio_send(unsigned char *data, int len)
|
||||
{
|
||||
unsigned char frame[33];
|
||||
|
||||
|
|
1
gsm.h
1
gsm.h
|
@ -60,6 +60,7 @@ class Pgsm : public Port
|
|||
|
||||
void frame_send(void *_frame);
|
||||
void frame_receive(void *_frame);
|
||||
int audio_send(unsigned char *data, int len);
|
||||
int bridge_rx(unsigned char *data, int len);
|
||||
|
||||
int hunt_bchannel(void);
|
||||
|
|
|
@ -414,13 +414,13 @@ int message_bsc(struct lcr_gsm *lcr_gsm, int msg_type, void *arg)
|
|||
} else
|
||||
pgsm_bs->frame_receive(arg);
|
||||
/* if we do not bridge we need to inject audio, if available */
|
||||
if (!pgsm_bs->p_bridge) {
|
||||
if (!pgsm_bs->p_bridge || pgsm_bs->p_tone_name[0]) {
|
||||
unsigned char data[160];
|
||||
int i;
|
||||
|
||||
i = pgsm_bs->read_audio(data, 160);
|
||||
if (i)
|
||||
pgsm_bs->bridge_rx(data, i);
|
||||
pgsm_bs->audio_send(data, i);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue