From ceef936ea894781a14584efc9256856cca6d1c0f Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Wed, 19 Aug 2015 14:43:35 +0200 Subject: mgcp: Add transcoding from PCMU as well Use the existing ulaw encode/decode to support PCMU as well. The MERA VoIP switch has some severe issues with the GSM codec and it appears easier to enable transcoding for it. The mera switch doesn't appear to cope with codec change between a SIP 180 trying and the 200 ok connection result. Inserting the codec is touching too many places. Ideally we should have the transcoding function as pointer in the struct as well but the arguments differ.. so it is not a direct way forward. --- openbsc/src/libmgcp/mgcp_sdp.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'openbsc/src/libmgcp/mgcp_sdp.c') diff --git a/openbsc/src/libmgcp/mgcp_sdp.c b/openbsc/src/libmgcp/mgcp_sdp.c index aa4ef3054..b64894496 100644 --- a/openbsc/src/libmgcp/mgcp_sdp.c +++ b/openbsc/src/libmgcp/mgcp_sdp.c @@ -54,6 +54,7 @@ int mgcp_set_audio_info(void *ctx, struct mgcp_rtp_codec *codec, if (!audio_name) { switch (payload_type) { + case 0: audio_name = "PCMU/8000/1"; break; case 3: audio_name = "GSM/8000/1"; break; case 8: audio_name = "PCMA/8000/1"; break; case 18: audio_name = "G729/8000/1"; break; @@ -89,6 +90,8 @@ int mgcp_set_audio_info(void *ctx, struct mgcp_rtp_codec *codec, payload_type = 3; else if (!strcmp(audio_codec, "PCMA")) payload_type = 8; + else if (!strcmp(audio_codec, "PCMU")) + payload_type = 0; else if (!strcmp(audio_codec, "G729")) payload_type = 18; } @@ -109,6 +112,11 @@ void codecs_initialize(void *ctx, struct sdp_rtp_map *codecs, int used) for (i = 0; i < used; ++i) { switch (codecs[i].payload_type) { + case 0: + codecs[i].codec_name = "PCMU"; + codecs[i].rate = 8000; + codecs[i].channels = 1; + break; case 3: codecs[i].codec_name = "GSM"; codecs[i].rate = 8000; -- cgit v1.2.3