mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-02 20:08:17 +00:00
Merged revisions 221697 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ........ r221697 | dvossel | 2009-10-01 14:33:33 -0500 (Thu, 01 Oct 2009) | 9 lines outbound tls connections were not defaulting to port 5061 (closes issue #15854) Reported by: dvossel Patches: sip_port_config_trunk.diff uploaded by dvossel (license 671) Tested by: dvossel ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.1@221702 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -22105,6 +22105,7 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str
|
||||
struct ast_ha *oldha = NULL;
|
||||
int found = 0;
|
||||
int firstpass = 1;
|
||||
uint16_t port = 0;
|
||||
int format = 0; /* Ama flags */
|
||||
time_t regseconds = 0;
|
||||
struct ast_flags peerflags[2] = {{(0)}};
|
||||
@@ -22267,17 +22268,15 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str
|
||||
/* Initialize stuff if this is a new peer, or if it used to
|
||||
* not be dynamic before the reload. */
|
||||
memset(&peer->addr.sin_addr, 0, 4);
|
||||
if (peer->addr.sin_port) {
|
||||
/* If we've already got a port, make it the default rather than absolute */
|
||||
peer->defaddr.sin_port = peer->addr.sin_port;
|
||||
peer->addr.sin_port = 0;
|
||||
}
|
||||
peer->addr.sin_port = 0;
|
||||
}
|
||||
peer->host_dynamic = TRUE;
|
||||
} else {
|
||||
/* Non-dynamic. Make sure we become that way if we're not */
|
||||
AST_SCHED_DEL_UNREF(sched, peer->expire,
|
||||
unref_peer(peer, "removing register expire ref"));
|
||||
/* the port will either be set to a default value or a config specified value once all option parsing is complete */
|
||||
peer->addr.sin_port = 0;
|
||||
peer->host_dynamic = FALSE;
|
||||
srvlookup = v->value;
|
||||
if (global_dynamic_exclude_static) {
|
||||
@@ -22307,10 +22306,8 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str
|
||||
}
|
||||
} else if (!strcasecmp(v->name, "port")) {
|
||||
peer->portinuri = 1;
|
||||
if (!realtime && peer->host_dynamic) {
|
||||
peer->defaddr.sin_port = htons(atoi(v->value));
|
||||
} else {
|
||||
peer->addr.sin_port = htons(atoi(v->value));
|
||||
if (!(port = port_str2int(v->value, 0))) {
|
||||
ast_log(LOG_WARNING, "Invalid peer port configuration at line %d : %s\n", v->lineno, v->value);
|
||||
}
|
||||
} else if (!strcasecmp(v->name, "callingpres")) {
|
||||
peer->callingpres = ast_parse_caller_presentation(v->value);
|
||||
@@ -22521,6 +22518,12 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str
|
||||
set_socket_transport(&peer->socket, peer->default_outbound_transport);
|
||||
}
|
||||
|
||||
if (port && !realtime && peer->host_dynamic) {
|
||||
peer->defaddr.sin_port = htons(port);
|
||||
} else if (port) {
|
||||
peer->addr.sin_port = htons(port);
|
||||
}
|
||||
|
||||
if (ast_str_strlen(fullcontact)) {
|
||||
ast_copy_string(peer->fullcontact, fullcontact->str, sizeof(peer->fullcontact));
|
||||
peer->rt_fromcontact = TRUE;
|
||||
@@ -22561,7 +22564,9 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str
|
||||
if (!peer->addr.sin_port) {
|
||||
peer->addr.sin_port = htons(((peer->socket.type & SIP_TRANSPORT_TLS) ? STANDARD_TLS_PORT : STANDARD_SIP_PORT));
|
||||
}
|
||||
|
||||
if (!peer->defaddr.sin_port) {
|
||||
peer->defaddr.sin_port = htons(((peer->socket.type & SIP_TRANSPORT_TLS) ? STANDARD_TLS_PORT : STANDARD_SIP_PORT));
|
||||
}
|
||||
if (!peer->socket.port) {
|
||||
peer->socket.port = htons(((peer->socket.type & SIP_TRANSPORT_TLS) ? STANDARD_TLS_PORT : STANDARD_SIP_PORT));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user