[Asterisk-cvs] asterisk/channels chan_iax2.c,1.153,1.154
markster at lists.digium.com
markster at lists.digium.com
Tue Jun 15 10:11:25 CDT 2004
Update of /usr/cvsroot/asterisk/channels
In directory mongoose.digium.com:/tmp/cvs-serv10183/channels
Modified Files:
chan_iax2.c
Log Message:
When dialing outbound, if we match a peer name, use it (who really cares?) (bug #1850)
Index: chan_iax2.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_iax2.c,v
retrieving revision 1.153
retrieving revision 1.154
diff -u -d -r1.153 -r1.154
--- chan_iax2.c 14 Jun 2004 03:12:46 -0000 1.153
+++ chan_iax2.c 15 Jun 2004 15:16:16 -0000 1.154
@@ -1954,7 +1954,7 @@
}
#endif /* MYSQL_FRIENDS */
-static int create_addr(struct sockaddr_in *sin, int *capability, int *sendani, int *maxtime, char *peer, char *context, int *trunk, int *notransfer, char *secret, int seclen)
+static int create_addr(struct sockaddr_in *sin, int *capability, int *sendani, int *maxtime, char *peer, char *context, int *trunk, int *notransfer, char *secret, int seclen, int *ofound)
{
struct ast_hostent ahp; struct hostent *hp;
struct iax2_peer *p;
@@ -2010,6 +2010,8 @@
p = NULL;
}
}
+ if (ofound)
+ *ofound = found;
if (!p && !found) {
hp = ast_gethostbyname(peer, &ahp);
if (hp) {
@@ -2117,7 +2119,7 @@
strsep(&stringp, ":");
portno = strsep(&stringp, ":");
}
- if (create_addr(&sin, NULL, NULL, NULL, hname, context, NULL, NULL, storedsecret, sizeof(storedsecret) - 1)) {
+ if (create_addr(&sin, NULL, NULL, NULL, hname, context, NULL, NULL, storedsecret, sizeof(storedsecret) - 1, NULL)) {
ast_log(LOG_WARNING, "No address associated with '%s'\n", hname);
return -1;
}
@@ -5689,6 +5691,7 @@
int res;
int sendani;
int maxtime;
+ int found = 0;
int fmt, native;
struct sockaddr_in sin;
char s[256];
@@ -5720,7 +5723,7 @@
}
/* Populate our address from the given */
- if (create_addr(&sin, &capability, &sendani, &maxtime, hostname, NULL, &trunk, ¬ransfer, NULL, 0)) {
+ if (create_addr(&sin, &capability, &sendani, &maxtime, hostname, NULL, &trunk, ¬ransfer, NULL, 0, &found)) {
return NULL;
}
if (portno) {
@@ -5740,6 +5743,8 @@
iaxs[callno]->sendani = sendani;
iaxs[callno]->maxtime = maxtime;
iaxs[callno]->notransfer = notransfer;
+ if (found)
+ strncpy(iaxs[callno]->host, hostname, sizeof(iaxs[callno]->host) - 1);
c = ast_iax2_new(callno, AST_STATE_DOWN, capability);
ast_mutex_unlock(&iaxsl[callno]);
if (c) {
@@ -6483,7 +6488,7 @@
host = st;
}
/* Populate our address from the given */
- if (create_addr(&sin, NULL, NULL, NULL, host, NULL, NULL, NULL, NULL, 0)) {
+ if (create_addr(&sin, NULL, NULL, NULL, host, NULL, NULL, NULL, NULL, 0, NULL)) {
return -1;
}
ast_log(LOG_DEBUG, "host: %s, user: %s, password: %s, context: %s\n", host, username, password, context);
More information about the svn-commits
mailing list