--- chan_sip.c.buggy 2013-02-18 14:42:57.000000000 +0100 +++ chan_sip.c 2013-02-18 14:44:44.000000000 +0100 @@ -11881,7 +11881,7 @@ /* 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 (capability & p->prefcodec) { + if ((capability & p->prefcodec) & AST_FORMAT_AUDIO_MASK) { format_t codec = p->prefcodec & AST_FORMAT_AUDIO_MASK; add_codec_to_sdp(p, codec, &m_audio, &a_audio, debug, &min_audio_packet_size);