FreeCalypso > hg > themwi-system-sw
comparison mgw/pstn2gsm.c @ 96:f24bbfd23c9d
mgw p2g: outgoing seq numbers, forwarding control
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sun, 25 Sep 2022 19:32:27 -0800 |
parents | f280328e7e2e |
children | 9aed16c30622 |
comparison
equal
deleted
inserted
replaced
95:f280328e7e2e | 96:f24bbfd23c9d |
---|---|
104 m_out = 0; | 104 m_out = 0; |
105 } else | 105 } else |
106 m_out = 1; | 106 m_out = 1; |
107 ep->p2g_state = 1; | 107 ep->p2g_state = 1; |
108 ep->p2g_ssrc = pkt.ssrc; | 108 ep->p2g_ssrc = pkt.ssrc; |
109 ep->p2g_last_ts = htonl(pkt.tstamp); | 109 ep->p2g_last_ts = ntohl(pkt.tstamp); |
110 ep->p2g_last_seq = htons(pkt.seq); | 110 ep->p2g_last_seq = ntohs(pkt.seq); |
111 /* actual transcoding and forwarding */ | 111 /* actual transcoding and forwarding */ |
112 if (!(ep->fwd_mode & TMGW_FWD_ENABLE_PSTN2GSM)) | |
113 return; | |
112 for (n = 0; n < SAMPLES_PER_FRAME; n++) | 114 for (n = 0; n < SAMPLES_PER_FRAME; n++) |
113 pcm_samples[n] = pcm_dec_table[pkt.payload[n]]; | 115 pcm_samples[n] = pcm_dec_table[pkt.payload[n]]; |
114 pkt.m_pt = ep->gsm_payload_type; | 116 pkt.m_pt = ep->gsm_payload_type; |
115 if (m_out) | 117 if (m_out) |
116 pkt.m_pt |= 0x80; | 118 pkt.m_pt |= 0x80; |
119 pkt.seq = htons(++ep->p2g_out_seq); | |
117 switch (ep->gsm_payload_msg_type) { | 120 switch (ep->gsm_payload_msg_type) { |
118 case GSM_TCHF_FRAME: | 121 case GSM_TCHF_FRAME: |
119 gsm_encode(ep->gsm_encoder_state, pcm_samples, pkt.payload); | 122 gsm_encode(ep->gsm_encoder_state, pcm_samples, pkt.payload); |
120 n = RTP_PACKET_SIZE_GSM_FR; | 123 n = RTP_PACKET_SIZE_GSM_FR; |
121 break; | 124 break; |