[asterisk-commits] dvossel: trunk r280553 - in /trunk: ./ channels/chan_sip.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Jul 29 15:44:42 CDT 2010
Author: dvossel
Date: Thu Jul 29 15:44:37 2010
New Revision: 280553
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=280553
Log:
Merged revisions 280552 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8
................
r280552 | dvossel | 2010-07-29 15:43:47 -0500 (Thu, 29 Jul 2010) | 17 lines
Merged revisions 280551 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.6.2
........
r280551 | dvossel | 2010-07-29 15:42:29 -0500 (Thu, 29 Jul 2010) | 11 lines
fixes wrong SRV query for TLS connection
(closes issue #17612)
Reported by: marcelloceschia
Patches:
chan-sip_srvQuery.patch uploaded by marcelloceschia (license 1079)
chan-sip_Trunk_srvQuery.patch uploaded by st (license 907)
chan-sip_asterisk18b1_srvQuery.patch uploaded by marcelloceschia (license 1079)
Tested by: marcelloceschia, st, pabelanger
........
................
Modified:
trunk/ (props changed)
trunk/channels/chan_sip.c
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.
Modified: trunk/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_sip.c?view=diff&rev=280553&r1=280552&r2=280553
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Thu Jul 29 15:44:37 2010
@@ -3004,6 +3004,33 @@
return "UNKNOWN";
}
+/*! \brief Return protocol string for srv dns query */
+static inline const char *get_srv_protocol(enum sip_transport t)
+{
+ switch (t) {
+ case SIP_TRANSPORT_UDP:
+ return "udp";
+ case SIP_TRANSPORT_TLS:
+ case SIP_TRANSPORT_TCP:
+ return "tcp";
+ }
+
+ return "udp";
+}
+
+/*! \brief Return service string for srv dns query */
+static inline const char *get_srv_service(enum sip_transport t)
+{
+ switch (t) {
+ case SIP_TRANSPORT_TCP:
+ case SIP_TRANSPORT_UDP:
+ return "sip";
+ case SIP_TRANSPORT_TLS:
+ return "sips";
+ }
+ return "sip";
+}
+
/*! \brief Return transport of dialog.
\note this is based on a false assumption. We don't always use the
outbound proxy for all requests in a dialog. It depends on the
@@ -4971,7 +4998,9 @@
* an A record lookup should be used instead of SRV.
*/
if (!hostport.port && sip_cfg.srvlookup) {
- snprintf(service, sizeof(service), "_sip._%s.%s", get_transport(dialog->socket.type), peername);
+ snprintf(service, sizeof(service), "_%s._%s.%s",
+ get_srv_service(dialog->socket.type),
+ get_srv_protocol(dialog->socket.type), peername);
if ((srv_ret = ast_get_srv(NULL, host, sizeof(host), &tportno,
service)) > 0) {
hostn = host;
@@ -11385,7 +11414,7 @@
/* If we have no DNS manager let's do a lookup */
if (!mwi->dnsmgr) {
char transport[MAXHOSTNAMELEN];
- snprintf(transport, sizeof(transport), "_sip._%s", get_transport(mwi->transport));
+ snprintf(transport, sizeof(transport), "_%s._%s", get_srv_service(mwi->transport), get_srv_protocol(mwi->transport));
mwi->us.ss.ss_family = get_address_family_filter(&bindaddr); /* Filter address family */
ast_dnsmgr_lookup(mwi->hostname, &mwi->us, &mwi->dnsmgr, sip_cfg.srvlookup ? transport : NULL);
@@ -12119,7 +12148,7 @@
if (r->dnsmgr == NULL) {
char transport[MAXHOSTNAMELEN];
peer = find_peer(r->hostname, NULL, TRUE, FINDPEERS, FALSE, 0);
- snprintf(transport, sizeof(transport), "_sip._%s", get_transport(r->transport)); /* have to use static get_transport function */
+ snprintf(transport, sizeof(transport), "_%s._%s",get_srv_service(r->transport), get_srv_protocol(r->transport)); /* have to use static get_transport function */
r->us.ss.ss_family = get_address_family_filter(&bindaddr); /* Filter address family */
ast_dnsmgr_lookup(peer ? peer->tohost : r->hostname, &r->us, &r->dnsmgr, sip_cfg.srvlookup ? transport : NULL);
if (peer) {
@@ -25960,7 +25989,7 @@
*params++ = '\0';
}
- snprintf(transport, sizeof(transport), "_sip._%s", get_transport(peer->socket.type));
+ snprintf(transport, sizeof(transport), "_%s._%s", get_srv_service(peer->socket.type), get_srv_protocol(peer->socket.type));
peer->addr.ss.ss_family = get_address_family_filter(&bindaddr); /* Filter address family */
if (ast_dnsmgr_lookup(_srvlookup, &peer->addr, &peer->dnsmgr, sip_cfg.srvlookup && !peer->portinuri ? transport : NULL)) {
More information about the asterisk-commits
mailing list