--- chan_sip.c 2006-02-13 14:58:52.768542984 +0200 +++ chan_sip.c.geop 2006-02-23 15:34:55.723163288 +0200 @@ -4521,6 +4521,22 @@ respprep(&resp, p, msg, req); if (p->rtp) { ast_rtp_offered_from_local(p->rtp, 0); + +////////////////////////////////////////////////////////////////// + char *codec=pbx_builtin_getvar_helper(p->owner,"SIP_CODEC"); + if (codec) { + int fmt=ast_getformatbyname(codec); + if (fmt) { + ast_log(LOG_NOTICE, "Changing codec to '%s' for this call because of ${SIP_CODEC) variable\n",codec); + if (p->jointcapability & fmt) { + p->jointcapability &= fmt; + p->capability &= fmt; + } else + ast_log(LOG_NOTICE, "Ignoring ${SIP_CODEC} variable because it is not shared by both ends.\n"); + } else ast_log(LOG_NOTICE, "Ignoring ${SIP_CODEC} variable because of unrecognized/not configured codec (check allow/disallow in sip.conf): %s\n",codec); + } +///////////////////////////////////////////////////////////////// + add_sdp(&resp, p); } else { ast_log(LOG_ERROR, "Can't add SDP to response, since we have no RTP session allocated. Call-ID %s\n", p->callid);