From: Joshua Colp Date: Tue, 8 Jan 2008 20:06:52 +0000 (+0000) Subject: Move common code for setting T38 capabilities and fix a bug with fax detection in... X-Git-Tag: 1.6.0-beta1~3^2~159 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=21fe29f8183b8b0c3c66bdeff54341d179a006a8;p=thirdparty%2Fasterisk.git Move common code for setting T38 capabilities and fix a bug with fax detection in the SIP RTP read callback. It's still sort of silly... but more on that later. (closes issue #11239) Reported by: dimas Patches: sipt38prop.patch uploaded by dimas (license 88) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@97154 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 8164603a96..f4de9e5945 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -3412,6 +3412,20 @@ static void do_setnat(struct sip_pvt *p, int natflags) } } +static void set_t38_capabilities(struct sip_pvt *p) +{ + p->t38.capability = global_t38_capability; + if (p->udptl) { + if (ast_udptl_get_error_correction_scheme(p->udptl) == UDPTL_ERROR_CORRECTION_FEC ) + p->t38.capability |= T38FAX_UDP_EC_FEC; + else if (ast_udptl_get_error_correction_scheme(p->udptl) == UDPTL_ERROR_CORRECTION_REDUNDANCY ) + p->t38.capability |= T38FAX_UDP_EC_REDUNDANCY; + else if (ast_udptl_get_error_correction_scheme(p->udptl) == UDPTL_ERROR_CORRECTION_NONE ) + p->t38.capability |= T38FAX_UDP_EC_NONE; + p->t38.capability |= T38FAX_RATE_MANAGEMENT_TRANSFERED_TCF; + } +} + /*! \brief Create address structure from peer reference. * This function copies data from peer to the dialog, so we don't have to look up the peer * again from memory or database during the life time of the dialog. @@ -3440,17 +3454,8 @@ static int create_addr_from_peer(struct sip_pvt *dialog, struct sip_peer *peer) } dialog->prefs = peer->prefs; if (ast_test_flag(&dialog->flags[1], SIP_PAGE2_T38SUPPORT)) { - dialog->t38.capability = global_t38_capability; - if (dialog->udptl) { - if (ast_udptl_get_error_correction_scheme(dialog->udptl) == UDPTL_ERROR_CORRECTION_FEC ) - dialog->t38.capability |= T38FAX_UDP_EC_FEC; - else if (ast_udptl_get_error_correction_scheme(dialog->udptl) == UDPTL_ERROR_CORRECTION_REDUNDANCY ) - dialog->t38.capability |= T38FAX_UDP_EC_REDUNDANCY; - else if (ast_udptl_get_error_correction_scheme(dialog->udptl) == UDPTL_ERROR_CORRECTION_NONE ) - dialog->t38.capability |= T38FAX_UDP_EC_NONE; - dialog->t38.capability |= T38FAX_RATE_MANAGEMENT_TRANSFERED_TCF; - ast_debug(2,"Our T38 capability (%d)\n", dialog->t38.capability); - } + ast_copy_flags(&dialog->t38.t38support, &peer->flags[1], SIP_PAGE2_T38SUPPORT); + set_t38_capabilities(dialog); dialog->t38.jointcapability = dialog->t38.capability; } else if (dialog->udptl) { ast_udptl_destroy(dialog->udptl); @@ -5272,14 +5277,8 @@ static struct sip_pvt *sip_alloc(ast_string_field callid, struct sockaddr_in *si (ast_test_flag(&p->flags[0], SIP_DTMF) == SIP_DTMF_AUTO)) p->noncodeccapability |= AST_RTP_DTMF; if (p->udptl) { - p->t38.capability = global_t38_capability; - if (ast_udptl_get_error_correction_scheme(p->udptl) == UDPTL_ERROR_CORRECTION_REDUNDANCY) - p->t38.capability |= T38FAX_UDP_EC_REDUNDANCY; - else if (ast_udptl_get_error_correction_scheme(p->udptl) == UDPTL_ERROR_CORRECTION_FEC) - p->t38.capability |= T38FAX_UDP_EC_FEC; - else if (ast_udptl_get_error_correction_scheme(p->udptl) == UDPTL_ERROR_CORRECTION_NONE) - p->t38.capability |= T38FAX_UDP_EC_NONE; - p->t38.capability |= T38FAX_RATE_MANAGEMENT_TRANSFERED_TCF; + ast_copy_flags(&p->t38.t38support, &p->flags[1], SIP_PAGE2_T38SUPPORT); + set_t38_capabilities(p); p->t38.jointcapability = p->t38.capability; } ast_string_field_set(p, context, default_context);