diff --git a/daemon/call_interfaces.c b/daemon/call_interfaces.c index f134ddaea..6e045180f 100644 --- a/daemon/call_interfaces.c +++ b/daemon/call_interfaces.c @@ -1060,6 +1060,10 @@ void call_ng_flags_flags(str *s, unsigned int idx, helper_arg arg) { case CSH_LOOKUP("allow transcoding"): out->allow_transcoding = true; break; + case CSH_LOOKUP("force-transcoding"): + case CSH_LOOKUP("force transcoding"): + out->force_transcoding = true; + break; case CSH_LOOKUP("always-transcode"): case CSH_LOOKUP("always transcode"):; static const str str_all = STR_CONST("all"); diff --git a/daemon/codec.c b/daemon/codec.c index 50d6a58ad..696fa6850 100644 --- a/daemon/codec.c +++ b/daemon/codec.c @@ -1175,6 +1175,11 @@ void __codec_handlers_update(struct call_media *receiver, struct call_media *sin // do we have to force everything through the transcoding engine even if codecs match? bool force_transcoding = do_pcm_dtmf_blocking || do_dtmf_blocking || use_audio_player; + if ( (a.flags && a.flags->force_transcoding) || ML_ISSET(other_monologue, FORCE_TRANSCODING)) { + ilogs(codec, LOG_DEBUG, "Flag force-transcoding exist"); + force_transcoding = true; + ML_SET(other_monologue, FORCE_TRANSCODING); + } for (__auto_type l = receiver->codecs.codec_prefs.head; l; ) { rtp_payload_type *pt = l->data; diff --git a/docs/ng_control_protocol.md b/docs/ng_control_protocol.md index b417be436..5a466ad5d 100644 --- a/docs/ng_control_protocol.md +++ b/docs/ng_control_protocol.md @@ -920,6 +920,12 @@ Spaces in each string may be replaced by hyphens. given, the answer will be accepted even if some codecs were rejected, and codecs will be transcoded as required. +* `force transcoding` + + This flag will force transcoding between channels. This provides a loss measurement + between the A-leg and B-leg. If this flag appears in the NG protocol, it will always be + transcoded (for example, between codecs G722 and G722). + * `always transcode` Legacy flag, synonymous to `codec-accept=all`. diff --git a/include/call.h b/include/call.h index 6e627883d..0cc6fad52 100644 --- a/include/call.h +++ b/include/call.h @@ -231,6 +231,7 @@ enum { #define ML_FLAG_SILENCE_MEDIA 0x01000000 #define ML_FLAG_MOH_SENDRECV 0x02000000 #define ML_FLAG_MOH_ZEROCONN 0x04000000 +#define ML_FLAG_FORCE_TRANSCODING 0x08000000 /* call_t */ #define CALL_FLAG_IPV4_OFFER 0x00010000 diff --git a/include/call_interfaces.h b/include/call_interfaces.h index e1c46935a..c14c18a44 100644 --- a/include/call_interfaces.h +++ b/include/call_interfaces.h @@ -219,6 +219,7 @@ RTPE_NG_FLAGS_STR_CASE_HT_PARAMS static_codecs:1, allow_no_codec_media:1, allow_transcoding:1, + force_transcoding:1, allow_asymmetric_codecs:1, early_media:1, accept_any:1, diff --git a/utils/rtpengine-ng-client b/utils/rtpengine-ng-client index 59a093770..1fb29a5c5 100755 --- a/utils/rtpengine-ng-client +++ b/utils/rtpengine-ng-client @@ -41,6 +41,7 @@ my @flags = qw( pierce-NAT SIP-source-address allow-transcoding + force-transcoding trickle-ICE reject-ICE egress