[asterisk-commits] file: trunk r51560 - in /trunk: ./ channels/ configs/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Jan 22 20:15:05 MST 2007


Author: file
Date: Mon Jan 22 21:15:04 2007
New Revision: 51560

URL: http://svn.digium.com/view/asterisk?view=rev&rev=51560
Log:
Add SRV Lookup support on outbound calls to chan_iax2. It's listed in the RFC so we might want to support it and please don't hurt me Marko ... (issue #7812 reported by drorlb)

Modified:
    trunk/CHANGES
    trunk/channels/chan_iax2.c
    trunk/configs/iax.conf.sample

Modified: trunk/CHANGES
URL: http://svn.digium.com/view/asterisk/trunk/CHANGES?view=diff&rev=51560&r1=51559&r2=51560
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Mon Jan 22 21:15:04 2007
@@ -64,6 +64,7 @@
   * Added G729 passthrough support to chan_phone for Sigma Designs boards.
   * Added the parkedcalltransfers option to features.conf
   * Added 's' option to Page application.
+  * Added the srvlookup option to iax.conf
 
 SIP changes
 -----------

Modified: trunk/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_iax2.c?view=diff&rev=51560&r1=51559&r2=51560
==============================================================================
--- trunk/channels/chan_iax2.c (original)
+++ trunk/channels/chan_iax2.c Mon Jan 22 21:15:04 2007
@@ -179,6 +179,8 @@
 
 static int min_reg_expire;
 static int max_reg_expire;
+
+static int srvlookup = 0;
 
 static int timingfd = -1;				/* Timing file descriptor */
 
@@ -2674,8 +2676,6 @@
 
 static int create_addr(const char *peername, struct sockaddr_in *sin, struct create_addr_info *cai)
 {
-	struct ast_hostent ahp;
-	struct hostent *hp;
 	struct iax2_peer *peer;
 
 	ast_clear_flag(cai, IAX_SENDANI | IAX_TRUNK);
@@ -2685,18 +2685,14 @@
 
 	if (!(peer = find_peer(peername, 1))) {
 		cai->found = 0;
-
-		hp = ast_gethostbyname(peername, &ahp);
-		if (hp) {
-			memcpy(&sin->sin_addr, hp->h_addr, sizeof(sin->sin_addr));
-			sin->sin_port = htons(IAX_DEFAULT_PORTNO);
-			/* use global iax prefs for unknown peer/user */
-			ast_codec_pref_convert(&prefs, cai->prefs, sizeof(cai->prefs), 1);
-			return 0;
-		} else {
+		if (ast_get_ip_or_srv(sin, peername, srvlookup ? "_iax._udp" : NULL)) {
 			ast_log(LOG_WARNING, "No such host: %s\n", peername);
 			return -1;
 		}
+		sin->sin_port = htons(IAX_DEFAULT_PORTNO);
+		/* use global iax prefs for unknown peer/user */
+		ast_codec_pref_convert(&prefs, cai->prefs, sizeof(cai->prefs), 1);
+		return 0;
 	}
 
 	cai->found = 1;
@@ -8968,6 +8964,8 @@
 
 	maxauthreq = 3;
 
+	srvlookup = 0;
+
 	v = ast_variable_browse(cfg, "general");
 
 	/* Seed initial tos value */
@@ -9171,6 +9169,8 @@
 				maxauthreq = 0;
 		} else if (!strcasecmp(v->name, "adsi")) {
 			adsi = ast_true(v->value);
+		} else if (!strcasecmp(v->name, "srvlookup")) {
+			srvlookup = ast_true(v->value);
 		} /*else if (strcasecmp(v->name,"type")) */
 		/*	ast_log(LOG_WARNING, "Ignoring %s\n", v->name); */
 		v = v->next;

Modified: trunk/configs/iax.conf.sample
URL: http://svn.digium.com/view/asterisk/trunk/configs/iax.conf.sample?view=diff&rev=51560&r1=51559&r2=51560
==============================================================================
--- trunk/configs/iax.conf.sample (original)
+++ trunk/configs/iax.conf.sample Mon Jan 22 21:15:04 2007
@@ -50,6 +50,10 @@
 ; (or may have) ADSI compatible CPE equipment
 ;
 ;adsi=no
+;
+; Perform an SRV lookup on outbound calls
+;
+;srvlookup=yes
 ;
 ; You may specify a default account for Call Detail Records in addition
 ; to specifying on a per-user basis



More information about the asterisk-commits mailing list