comparison mgw/gsm2pstn.c @ 168:8c28426abef0

mgw: start using the new libgsmfrp dependency
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 19 Nov 2022 22:57:59 -0800
parents f062c32a5116
children 648a64b2e16b
comparison
equal deleted inserted replaced
167:2ebad02adbe5 168:8c28426abef0
13 #include <string.h> 13 #include <string.h>
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 "../include/tmgw_ctrl.h" 19 #include "../include/tmgw_ctrl.h"
19 #include "../include/tmgw_const.h" 20 #include "../include/tmgw_const.h"
20 #include "struct.h" 21 #include "struct.h"
21 #include "select.h" 22 #include "select.h"
22 #include "int_defs.h" 23 #include "int_defs.h"
131 else 132 else
132 m_out = 1; 133 m_out = 1;
133 } 134 }
134 switch (ep->gsm_payload_msg_type) { 135 switch (ep->gsm_payload_msg_type) {
135 case GSM_TCHF_FRAME: 136 case GSM_TCHF_FRAME:
137 gsmfr_preproc_good_frame(ep->gsm_decoder_extra_state,
138 pkt.payload);
136 gsm_decode(ep->gsm_decoder_state, pkt.payload, pcm_samples); 139 gsm_decode(ep->gsm_decoder_state, pkt.payload, pcm_samples);
137 break; 140 break;
138 } 141 }
139 pkt.m_pt = ep->pstn_payload_type; 142 pkt.m_pt = ep->pstn_payload_type;
140 if (m_out) 143 if (m_out)
154 switch (ep->gsm_payload_msg_type) { 157 switch (ep->gsm_payload_msg_type) {
155 case GSM_TCHF_FRAME: 158 case GSM_TCHF_FRAME:
156 ep->gsm_decoder_state = gsm_create(); 159 ep->gsm_decoder_state = gsm_create();
157 if (!ep->gsm_decoder_state) 160 if (!ep->gsm_decoder_state)
158 return TMGW_RESP_ERR_RSRC; 161 return TMGW_RESP_ERR_RSRC;
162 ep->gsm_decoder_extra_state = gsmfr_preproc_create();
163 if (!ep->gsm_decoder_extra_state) {
164 free(ep->gsm_decoder_state);
165 ep->gsm_decoder_state = 0;
166 return TMGW_RESP_ERR_RSRC;
167 }
159 break; 168 break;
160 } 169 }
161 select_handlers[ep->rtp_gsm.rtp_fd] = gsm2pstn_rtp_in; 170 select_handlers[ep->rtp_gsm.rtp_fd] = gsm2pstn_rtp_in;
162 return TMGW_RESP_OK; 171 return TMGW_RESP_OK;
163 } 172 }