FreeCalypso > hg > themwi-system-sw
comparison mgw/gsm2pstn.c @ 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 | a6eb2de277f6 |
children | cf1ba5d65188 |
comparison
equal
deleted
inserted
replaced
173:36cce9b0bbe2 | 174:c985c33baeac |
---|---|
14 #include <strings.h> | 14 #include <strings.h> |
15 #include <syslog.h> | 15 #include <syslog.h> |
16 #include <unistd.h> | 16 #include <unistd.h> |
17 #include <gsm.h> /* libgsm dependency */ | 17 #include <gsm.h> /* libgsm dependency */ |
18 #include <gsm_fr_preproc.h> | 18 #include <gsm_fr_preproc.h> |
19 #include <gsm_efr.h> | |
19 #include "../include/tmgw_ctrl.h" | 20 #include "../include/tmgw_ctrl.h" |
20 #include "../include/tmgw_const.h" | 21 #include "../include/tmgw_const.h" |
21 #include "struct.h" | 22 #include "struct.h" |
22 #include "select.h" | 23 #include "select.h" |
23 #include "int_defs.h" | 24 #include "int_defs.h" |
125 else | 126 else |
126 gsmfr_preproc_good_frame(ep->gsm_decoder_extra_state, | 127 gsmfr_preproc_good_frame(ep->gsm_decoder_extra_state, |
127 pkt.payload); | 128 pkt.payload); |
128 gsm_decode(ep->gsm_decoder_state, pkt.payload, pcm_samples); | 129 gsm_decode(ep->gsm_decoder_state, pkt.payload, pcm_samples); |
129 break; | 130 break; |
131 case GSM_TCHF_FRAME_EFR: | |
132 if (bfi) | |
133 EFR_decode_bfi_nodata(ep->gsm_decoder_state, taf, | |
134 pcm_samples); | |
135 else | |
136 EFR_decode_frame(ep->gsm_decoder_state, pkt.payload, | |
137 0, 0, pcm_samples); | |
138 break; | |
130 } | 139 } |
131 if (ep->dtmf_sample_ptr) { | 140 if (ep->dtmf_sample_ptr) { |
132 bcopy(ep->dtmf_sample_ptr, pcm_samples, SAMPLES_PER_FRAME*2); | 141 bcopy(ep->dtmf_sample_ptr, pcm_samples, SAMPLES_PER_FRAME*2); |
133 ep->dtmf_sample_ptr += SAMPLES_PER_FRAME; | 142 ep->dtmf_sample_ptr += SAMPLES_PER_FRAME; |
134 ep->dtmf_frames_sent++; | 143 ep->dtmf_frames_sent++; |
160 free(ep->gsm_decoder_state); | 169 free(ep->gsm_decoder_state); |
161 ep->gsm_decoder_state = 0; | 170 ep->gsm_decoder_state = 0; |
162 return TMGW_RESP_ERR_RSRC; | 171 return TMGW_RESP_ERR_RSRC; |
163 } | 172 } |
164 break; | 173 break; |
174 case GSM_TCHF_FRAME_EFR: | |
175 ep->gsm_decoder_state = EFR_decoder_create(); | |
176 if (!ep->gsm_decoder_state) | |
177 return TMGW_RESP_ERR_RSRC; | |
178 break; | |
165 } | 179 } |
166 select_handlers[ep->rtp_gsm.rtp_fd] = gsm2pstn_rtp_in; | 180 select_handlers[ep->rtp_gsm.rtp_fd] = gsm2pstn_rtp_in; |
167 return TMGW_RESP_OK; | 181 return TMGW_RESP_OK; |
168 } | 182 } |