[asterisk-commits] dvossel: branch 1.8 r280552 - in /branches/1.8: ./ channels/chan_sip.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Jul 29 15:43:52 CDT 2010
Author: dvossel
Date: Thu Jul 29 15:43:47 2010
New Revision: 280552
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=280552
Log:
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:
branches/1.8/ (props changed)
branches/1.8/channels/chan_sip.c
Propchange: branches/1.8/
------------------------------------------------------------------------------
--- branch-1.6.2-merged (original)
+++ branch-1.6.2-merged Thu Jul 29 15:43:47 2010
@@ -1,1 +1,1 @@
-/branches/1.6.2:1-279056,279207,279501,279561,279597,279609,279657,279784,279849,279946,280089,280160,280193,280229,280231,280306,280345,280449
+/branches/1.6.2:1-279056,279207,279501,279561,279597,279609,279657,279784,279849,279946,280089,280160,280193,280229,280231,280306,280345,280449,280551
Modified: branches/1.8/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/channels/chan_sip.c?view=diff&rev=280552&r1=280551&r2=280552
==============================================================================
--- branches/1.8/channels/chan_sip.c (original)
+++ branches/1.8/channels/chan_sip.c Thu Jul 29 15:43:47 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;
@@ -11384,7 +11413,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);
@@ -12118,7 +12147,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) {
@@ -25930,7 +25959,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