[asterisk-commits] wdoekes: trunk r375110 - /trunk/channels/chan_sip.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Oct 16 16:38:07 CDT 2012
Author: wdoekes
Date: Tue Oct 16 16:38:00 2012
New Revision: 375110
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=375110
Log:
Don't do SIP contact/route DNS if we're not using the result.
In many cases (for peers behind NAT or for TCP sockets) we do not need
to look up any hostname in the Contact (or Route) when sending an
in-dialog request. This should reduce netsock2.c: getaddrinfo errors in
certain scenarios.
Review: https://reviewboard.asterisk.org/r/2156
Modified:
trunk/channels/chan_sip.c
Modified: trunk/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_sip.c?view=diff&rev=375110&r1=375109&r2=375110
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Tue Oct 16 16:38:00 2012
@@ -11811,7 +11811,16 @@
if (p->route &&
!(sipmethod == SIP_CANCEL ||
(sipmethod == SIP_ACK && (p->invitestate == INV_COMPLETED || p->invitestate == INV_CANCELLED)))) {
- set_destination(p, p->route->hop);
+ if (p->socket.type != SIP_TRANSPORT_UDP && p->socket.tcptls_session) {
+ /* For TCP/TLS sockets that are connected we won't need
+ * to do any hostname/IP lookups */
+ } else if (ast_test_flag(&p->flags[0], SIP_NAT_FORCE_RPORT)) {
+ /* For NATed traffic, we ignore the contact/route and
+ * simply send to the received-from address. No need
+ * for lookups. */
+ } else {
+ set_destination(p, p->route->hop);
+ }
add_route(req, is_strict ? p->route->next : p->route);
}
add_max_forwards(p, req);
More information about the asterisk-commits
mailing list