diff 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
line wrap: on
line diff
--- a/mgw/gsm2pstn.c	Wed Oct 12 18:08:34 2022 -0800
+++ b/mgw/gsm2pstn.c	Sat Nov 19 22:57:59 2022 -0800
@@ -15,6 +15,7 @@
 #include <syslog.h>
 #include <unistd.h>
 #include <gsm.h>	/* libgsm dependency */
+#include <gsm_fr_preproc.h>
 #include "../include/tmgw_ctrl.h"
 #include "../include/tmgw_const.h"
 #include "struct.h"
@@ -133,6 +134,8 @@
 	}
 	switch (ep->gsm_payload_msg_type) {
 	case GSM_TCHF_FRAME:
+		gsmfr_preproc_good_frame(ep->gsm_decoder_extra_state,
+					 pkt.payload);
 		gsm_decode(ep->gsm_decoder_state, pkt.payload, pcm_samples);
 		break;
 	}
@@ -156,6 +159,12 @@
 		ep->gsm_decoder_state = gsm_create();
 		if (!ep->gsm_decoder_state)
 			return TMGW_RESP_ERR_RSRC;
+		ep->gsm_decoder_extra_state = gsmfr_preproc_create();
+		if (!ep->gsm_decoder_extra_state) {
+			free(ep->gsm_decoder_state);
+			ep->gsm_decoder_state = 0;
+			return TMGW_RESP_ERR_RSRC;
+		}
 		break;
 	}
 	select_handlers[ep->rtp_gsm.rtp_fd] = gsm2pstn_rtp_in;