FreeCalypso > hg > themwi-system-sw
changeset 174:c985c33baeac
mgw: support EFR by way of libgsmefr
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 10 Jan 2023 17:56:22 -0800 |
parents | 36cce9b0bbe2 |
children | 623c64ae6102 |
files | mgw/Makefile mgw/gsm2pstn.c mgw/mdcx.c mgw/pstn2gsm.c |
diffstat | 4 files changed, 26 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mgw/Makefile Mon Nov 21 12:17:55 2022 -0800 +++ b/mgw/Makefile Tue Jan 10 17:56:22 2023 -0800 @@ -10,7 +10,7 @@ all: ${PROG} ${PROG}: ${OBJS} ${LIBS} - ${CC} ${CFLAGS} -o $@ ${OBJS} ${LIBS} -lgsmfrp -lgsm -lm + ${CC} ${CFLAGS} -o $@ ${OBJS} ${LIBS} -lgsmefr -lgsmfrp -lgsm -lm install: install -c -o bin -g bin -m 755 ${PROG} ${INSTBIN}
--- a/mgw/gsm2pstn.c Mon Nov 21 12:17:55 2022 -0800 +++ b/mgw/gsm2pstn.c Tue Jan 10 17:56:22 2023 -0800 @@ -16,6 +16,7 @@ #include <unistd.h> #include <gsm.h> /* libgsm dependency */ #include <gsm_fr_preproc.h> +#include <gsm_efr.h> #include "../include/tmgw_ctrl.h" #include "../include/tmgw_const.h" #include "struct.h" @@ -127,6 +128,14 @@ pkt.payload); gsm_decode(ep->gsm_decoder_state, pkt.payload, pcm_samples); break; + case GSM_TCHF_FRAME_EFR: + if (bfi) + EFR_decode_bfi_nodata(ep->gsm_decoder_state, taf, + pcm_samples); + else + EFR_decode_frame(ep->gsm_decoder_state, pkt.payload, + 0, 0, pcm_samples); + break; } if (ep->dtmf_sample_ptr) { bcopy(ep->dtmf_sample_ptr, pcm_samples, SAMPLES_PER_FRAME*2); @@ -162,6 +171,11 @@ return TMGW_RESP_ERR_RSRC; } break; + case GSM_TCHF_FRAME_EFR: + ep->gsm_decoder_state = EFR_decoder_create(); + if (!ep->gsm_decoder_state) + return TMGW_RESP_ERR_RSRC; + break; } select_handlers[ep->rtp_gsm.rtp_fd] = gsm2pstn_rtp_in; return TMGW_RESP_OK;
--- a/mgw/mdcx.c Mon Nov 21 12:17:55 2022 -0800 +++ b/mgw/mdcx.c Tue Jan 10 17:56:22 2023 -0800 @@ -50,8 +50,8 @@ return TMGW_RESP_ERR_PARAM; switch (req->gsm_payload_msg_type) { case GSM_TCHF_FRAME: + case GSM_TCHF_FRAME_EFR: break; - case GSM_TCHF_FRAME_EFR: case GSM_TCHH_FRAME: case GSM_TCH_FRAME_AMR: return TMGW_RESP_ERR_NOTSUP;
--- a/mgw/pstn2gsm.c Mon Nov 21 12:17:55 2022 -0800 +++ b/mgw/pstn2gsm.c Tue Jan 10 17:56:22 2023 -0800 @@ -15,6 +15,7 @@ #include <syslog.h> #include <unistd.h> #include <gsm.h> /* libgsm dependency */ +#include <gsm_efr.h> #include "../include/tmgw_ctrl.h" #include "../include/tmgw_const.h" #include "struct.h" @@ -128,6 +129,10 @@ case GSM_TCHF_FRAME: gsm_encode(ep->gsm_encoder_state, pcm_samples, pkt.payload); break; + case GSM_TCHF_FRAME_EFR: + EFR_encode_frame(ep->gsm_encoder_state, pcm_samples, + pkt.payload, (int *) 0, (int *) 0); + break; } addrlen = sizeof(struct sockaddr_in); sendto(ep->rtp_gsm.rtp_fd, &pkt, ep->gsm_rtp_pkt_size, 0, @@ -145,6 +150,11 @@ if (!ep->gsm_encoder_state) return TMGW_RESP_ERR_RSRC; break; + case GSM_TCHF_FRAME_EFR: + ep->gsm_encoder_state = EFR_encoder_create(0); + if (!ep->gsm_encoder_state) + return TMGW_RESP_ERR_RSRC; + break; } select_handlers[ep->rtp_pstn.rtp_fd] = pstn2gsm_rtp_in; return TMGW_RESP_OK;