[svn-commits] branch oej/t38passthrough r12499 -
/team/oej/t38passthrough/channels/chan_sip.c
svn-commits at lists.digium.com
svn-commits at lists.digium.com
Sat Mar 11 03:48:06 MST 2006
Author: oej
Date: Sat Mar 11 04:48:04 2006
New Revision: 12499
URL: http://svn.digium.com/view/asterisk?rev=12499&view=rev
Log:
- More work on per user/peer T38 support configuration...
Modified:
team/oej/t38passthrough/channels/chan_sip.c
Modified: team/oej/t38passthrough/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/t38passthrough/channels/chan_sip.c?rev=12499&r1=12498&r2=12499&view=diff
==============================================================================
--- team/oej/t38passthrough/channels/chan_sip.c (original)
+++ team/oej/t38passthrough/channels/chan_sip.c Sat Mar 11 04:48:04 2006
@@ -539,6 +539,7 @@
};
struct t38properties {
+ struct ast_flags t38support; /*!< Flag for udptl, rtp or tcp support for this session */
int capability; /*!< Our T38 capability */
int peercapability; /*!< Peers T38 capability */
int jointcapability; /*!< Supported T38 capability at both ends */
@@ -651,9 +652,11 @@
#define SIP_PAGE2_DEBUG_CONSOLE (1 << 6)
#define SIP_PAGE2_DYNAMIC (1 << 7) /*!< Dynamic Peers register with Asterisk */
#define SIP_PAGE2_SELFDESTRUCT (1 << 8) /*!< Automatic peers need to destruct themselves */
-#define SIP_PAGE2_T38SUPPORT_UDPTL (1 << 15) /*!< T38 Fax Passthrough Support */
-#define SIP_PAGE2_T38SUPPORT_RTP (1 << 16) /*!< T38 Fax Passthrough Support */
-#define SIP_PAGE2_T38SUPPORT_TCP (1 << 16) /*!< T38 Fax Passthrough Support */
+/* GAP for other patches in the bug tracker */
+#define SIP_PAGE2_T38SUPPORT (3 << 15) /*!< T38 Fax Passthrough Support */
+#define SIP_PAGE2_T38SUPPORT_UDPTL (0 << 15) /*!< 15: T38 Fax Passthrough Support */
+#define SIP_PAGE2_T38SUPPORT_RTP (1 << 15) /*!< 16: T38 Fax Passthrough Support */
+#define SIP_PAGE2_T38SUPPORT_TCP (2 << 15) /*!< 17: T38 Fax Passthrough Support */
#define SIP_PAGE2_FLAGS_TO_COPY \
(SIP_PAGE2_T38SUPPORT_RTP | SIP_PAGE2_T38SUPPORT_UDPTL | SIP_PAGE2_T38SUPPORT_TCP)
@@ -1996,19 +1999,26 @@
r->capability = peer->capability;
r->prefs = peer->prefs;
#if defined(T38_SUPPORT)
- r->t38.capability = global_t38_capability;
- if (r->udptl) {
- if (ast_udptl_get_error_correction_scheme(r->udptl) == UDPTL_ERROR_CORRECTION_FEC )
- r->t38.capability |= T38FAX_UDP_EC_FEC;
- else if (ast_udptl_get_error_correction_scheme(r->udptl) == UDPTL_ERROR_CORRECTION_REDUNDANCY )
- r->t38.capability |= T38FAX_UDP_EC_REDUNDANCY;
- else if (ast_udptl_get_error_correction_scheme(r->udptl) == UDPTL_ERROR_CORRECTION_NONE )
- r->t38.capability |= T38FAX_UDP_EC_NONE;
- r->t38.capability |= T38FAX_RATE_MANAGEMENT_TRANSFERED_TCF;
- if (option_debug > 1)
- ast_log(LOG_DEBUG,"Our T38 capability (%d)\n", r->t38.capability);
- }
- r->t38.jointcapability = r->t38.capability;
+ if (ast_test_flag(&peer->flags_page2, SIP_PAGE2_T38SUPPORT)) {
+ ast_copy_flags(&r->t38.t38support, &peer->flags_page2, SIP_PAGE2_T38SUPPORT);
+ r->t38.capability = global_t38_capability;
+ if (r->udptl) {
+ if (ast_udptl_get_error_correction_scheme(r->udptl) == UDPTL_ERROR_CORRECTION_FEC )
+ r->t38.capability |= T38FAX_UDP_EC_FEC;
+ else if (ast_udptl_get_error_correction_scheme(r->udptl) == UDPTL_ERROR_CORRECTION_REDUNDANCY )
+ r->t38.capability |= T38FAX_UDP_EC_REDUNDANCY;
+ else if (ast_udptl_get_error_correction_scheme(r->udptl) == UDPTL_ERROR_CORRECTION_NONE )
+ r->t38.capability |= T38FAX_UDP_EC_NONE;
+ r->t38.capability |= T38FAX_RATE_MANAGEMENT_TRANSFERED_TCF;
+ if (option_debug > 1)
+ ast_log(LOG_DEBUG,"Our T38 capability (%d)\n", r->t38.capability);
+ }
+ r->t38.jointcapability = r->t38.capability;
+ } else {
+ /* Destroy udptl stream handle since it's no longer needed */
+ if (r->udptl)
+ ast_udptl_destroy(r->udptl);
+ }
#endif
if (r->rtp) {
if (option_debug)
@@ -2993,10 +3003,11 @@
t38 support is enabled - not good, but working.
XXX: It would be better to have user/peer configuration flag for t38support. :XXX
*/
-static int sip_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo,struct ast_channel **rc, int timeoutms) {
-
+static int sip_bridge(struct ast_channel *c0, struct ast_channel *c1, int flags, struct ast_frame **fo, struct ast_channel **rc, int timeoutms) {
+
+ /* OEJ: We need to check for peer support here */
if (!global_t38udptl_support) {
- return ast_rtp_bridge(c0,c1,flags,fo,rc,timeoutms);
+ return ast_rtp_bridge(c0, c1, flags, fo, rc, timeoutms);
} else {
ast_log(LOG_NOTICE, "T38 UDPTL support enabled, native RTP bridging disabled\n");
return AST_BRIDGE_FAILED_NOWARN;
@@ -4931,23 +4942,19 @@
p->sessionversion++;
/* Our T.38 end is */
- if (p->udptl)
- ast_udptl_get_us(p->udptl, &udptlsin);
+ ast_udptl_get_us(p->udptl, &udptlsin);
/* Determine T.38 UDPTL destination */
- if (p->udptl) {
- if (p->udptlredirip.sin_addr.s_addr) {
- udptldest.sin_port = p->udptlredirip.sin_port;
- udptldest.sin_addr = p->udptlredirip.sin_addr;
- } else {
- udptldest.sin_addr = p->ourip;
- udptldest.sin_port = udptlsin.sin_port;
- }
+ if (p->udptlredirip.sin_addr.s_addr) {
+ udptldest.sin_port = p->udptlredirip.sin_port;
+ udptldest.sin_addr = p->udptlredirip.sin_addr;
+ } else {
+ udptldest.sin_addr = p->ourip;
+ udptldest.sin_port = udptlsin.sin_port;
}
if (debug) {
- if (p->udptl && debug)
- ast_log(LOG_DEBUG, "T.38 UDPTL is at %s port %d\n", ast_inet_ntoa(iabuf, sizeof(iabuf), p->ourip), ntohs(udptlsin.sin_port));
+ ast_log(LOG_DEBUG, "T.38 UDPTL is at %s port %d\n", ast_inet_ntoa(iabuf, sizeof(iabuf), p->ourip), ntohs(udptlsin.sin_port));
}
/* We break with the "recommendation" and send our IP, in order that our
@@ -12793,6 +12800,15 @@
oldha = user->ha;
user->ha = NULL;
ast_copy_flags(user, &global_flags, SIP_FLAGS_TO_COPY);
+
+#ifdef T38_SUPPORT
+ if(global_t38udptl_support)
+ ast_set_flag(&user->flags_page2, SIP_PAGE2_T38SUPPORT_UDPTL);
+ if(global_t38rtp_support)
+ ast_set_flag(&user->flags_page2, SIP_PAGE2_T38SUPPORT_RTP);
+ if(global_t38tcp_support)
+ ast_set_flag(&user->flags_page2, SIP_PAGE2_T38SUPPORT_TCP);
+#endif
user->capability = global_capability;
user->prefs = default_prefs;
/* set default context */
@@ -12899,6 +12915,15 @@
peer->pickupgroup = 0;
peer->maxms = default_qualify;
peer->prefs = default_prefs;
+#ifdef T38_SUPPORT
+ /* This needs to move completely into flags... */
+ if(global_t38udptl_support)
+ ast_set_flag(&peer->flags_page2, SIP_PAGE2_T38SUPPORT_UDPTL);
+ if(global_t38rtp_support)
+ ast_set_flag(&peer->flags_page2, SIP_PAGE2_T38SUPPORT_RTP);
+ if(global_t38tcp_support)
+ ast_set_flag(&peer->flags_page2, SIP_PAGE2_T38SUPPORT_TCP);
+#endif
}
/*! \brief Create temporary peer (used in autocreatepeer mode) */
More information about the svn-commits
mailing list