Index: channels/chan_sip.c =================================================================== --- channels/chan_sip.c (Revision 242356) +++ channels/chan_sip.c (Arbeitskopie) @@ -1770,6 +1770,7 @@ unsigned int reqsipoptions; /*!< Required SIP options on the other end */ struct ast_codec_pref prefs; /*!< codec prefs */ format_t capability; /*!< Special capability (codec) */ + format_t dynamic_t38_capability; /*!< Switch T.38 on/off from dialplan */ format_t jointcapability; /*!< Supported capability at both ends (codecs) */ format_t peercapability; /*!< Supported peer capability */ format_t prefcodec; /*!< Preferred codec (outbound only) */ @@ -2490,6 +2491,7 @@ /*--- Codec handling / SDP */ static void try_suggested_sip_codec(struct sip_pvt *p); +static void dynamic_switch_t38(struct sip_pvt *p); static const char *get_sdp_iterate(int* start, struct sip_request *req, const char *name); static char get_sdp_line(int *start, int stop, struct sip_request *req, const char **value); static int find_sdp(struct sip_request *req); @@ -6492,6 +6494,25 @@ return; } +/*! \brief Set T.38 on/off from dialplan using the T.38_SWITCH channel variable */ +static void dynamic_switch_t38(struct sip_pvt *p) +{ + const char *t38_state; + + p->dynamic_t38_capability = 1; + t38_state = pbx_builtin_getvar_helper(p->owner, "T.38_SWITCH"); + + if (!t38_state) + return; + + if(strcmp(t38_state, "off") == 0) { + ast_log(LOG_NOTICE, "Changing T.38 state to '%s' for this call because of ${T.38_SWITCH} variable\n", t38_state); + p->dynamic_t38_capability = 0; + } + + return; +} + /*! \brief sip_answer: Answer SIP call , send 200 OK on Invite * Part of PBX interface */ static int sip_answer(struct ast_channel *ast) @@ -8484,8 +8505,8 @@ ast_log(LOG_DEBUG, "Processing session-level SDP %c=%s... %s\n", type, value, (processed == TRUE)? "OK." : "UNSUPPORTED."); } + dynamic_switch_t38(p); - /* Scan media stream (m=) specific parameters loop */ while (!ast_strlen_zero(nextm)) { int audio = FALSE; @@ -8565,7 +8586,7 @@ ast_rtp_codecs_payloads_set_m_type(&newtextrtp, NULL, codec); } /* Search for image media definition */ - } else if (p->udptl && ((sscanf(m, "image %30d udptl t38%n", &x, &len) == 1 && len > 0) || + } else if (p->dynamic_t38_capability != 0 && p->udptl && ((sscanf(m, "image %30d udptl t38%n", &x, &len) == 1 && len > 0) || (sscanf(m, "image %30d UDPTL t38%n", &x, &len) == 1 && len > 0) )) { image = TRUE; if (debug)