]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
This change adds a SIP peer configuration feature to allow the peer's
authorBrent Eagles <beagles@digium.com>
Thu, 13 Dec 2012 15:22:27 +0000 (15:22 +0000)
committerBrent Eagles <beagles@digium.com>
Thu, 13 Dec 2012 15:22:27 +0000 (15:22 +0000)
configured codecs to take precedence on an outgoing call.

This change introduces a new peer configuration property named
'ignore_requested_pref' that causes the requested codec to be ignored when
determining the preferred codec for an outgoing call leg. The consequence is
that Asterisk's usual efforts to prefer avoiding transcoding can be overridden
on a peer-by-peer basis where appropriate.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@377971 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c
channels/sip/include/sip.h
configs/sip.conf.sample

index 9d5d638ad75907eefc83d250808c31f3482701c4..22a3457675a1fb5979efa1704eb13c78f56a7859 100644 (file)
@@ -13167,10 +13167,11 @@ static enum sip_result add_sdp(struct sip_request *resp, struct sip_pvt *p, int
                   - Then other codecs in capabilities, including video
                */
 
-               /* Prefer the audio codec we were requested to use, first, no matter what
-                  Note that p->prefcodec can include video codecs, so mask them out
-               */
-               if (ast_format_cap_has_joint(tmpcap, p->prefcaps)) {
+
+               /* Unless otherwise configured, the prefcaps is added before the peer's
+                * configured codecs.
+                */
+               if (!ast_test_flag(&p->flags[2], SIP_PAGE3_IGNORE_PREFCAPS) && ast_format_cap_has_joint(tmpcap, p->prefcaps)) {
                        ast_format_cap_iter_start(p->prefcaps);
                        while (!(ast_format_cap_iter_next(p->prefcaps, &tmp_fmt))) {
                                if (AST_FORMAT_GET_TYPE(tmp_fmt.id) != AST_FORMAT_TYPE_AUDIO) {
@@ -30766,6 +30767,8 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str
                                ast_set2_flag(&peer->flags[2], ast_true(v->value), SIP_PAGE3_USE_AVPF);
                        } else if (!strcasecmp(v->name, "icesupport")) {
                                ast_set2_flag(&peer->flags[2], ast_true(v->value), SIP_PAGE3_ICE_SUPPORT);
+                       } else if (!strcasecmp(v->name, "ignore_requested_pref")) {
+                               ast_set2_flag(&peer->flags[2], ast_true(v->value), SIP_PAGE3_IGNORE_PREFCAPS);
                        } else {
                                ast_rtp_dtls_cfg_parse(&peer->dtls_cfg, v->name, v->value);
                        }
index 7f907c6e5ed805741d3693dd3199417bcda48221..9a818553b48b6287092dcb615ec0c9131d045fb5 100644 (file)
 #define SIP_PAGE3_DIRECT_MEDIA_OUTGOING  (1 << 4)  /*!< DP: Only send direct media reinvites on outgoing calls */
 #define SIP_PAGE3_USE_AVPF               (1 << 5)  /*!< DGP: Support a minimal AVPF-compatible profile */
 #define SIP_PAGE3_ICE_SUPPORT            (1 << 6)  /*!< DGP: Enable ICE support */
+#define SIP_PAGE3_IGNORE_PREFCAPS        (1 << 7)  /*!< DP: Ignore prefcaps when setting up an outgoing call leg */
 
 #define SIP_PAGE3_FLAGS_TO_COPY \
        (SIP_PAGE3_SNOM_AOC | SIP_PAGE3_SRTP_TAG_32 | SIP_PAGE3_NAT_AUTO_RPORT | SIP_PAGE3_NAT_AUTO_COMEDIA | \
-        SIP_PAGE3_DIRECT_MEDIA_OUTGOING | SIP_PAGE3_USE_AVPF | SIP_PAGE3_ICE_SUPPORT)
+        SIP_PAGE3_DIRECT_MEDIA_OUTGOING | SIP_PAGE3_USE_AVPF | SIP_PAGE3_ICE_SUPPORT | SIP_PAGE3_IGNORE_PREFCAPS )
 
 #define CHECK_AUTH_BUF_INITLEN   256
 
index bbd2af8df4e128ff5dc59553cbfa20d3f7455a07..90b8abe5f1e4ec58e8cbe97d79a347c575b96cfc 100644 (file)
@@ -1259,6 +1259,8 @@ srvlookup=yes                   ; Enable DNS SRV lookups on outbound calls
 ; dtlscafile
 ; dtlscapath
 ; dtlssetup
+; ignore_requested_pref ; Ignore the requested codec and determine the preferred codec
+;                                              ; from the peer's configuration.
 ;
 
 ;------------------------------------------------------------------------------