aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-04-16 21:42:08 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-04-16 21:42:08 +0000
commit179e51c7a6aa7da7ca65c295785cc7b34cd19929 (patch)
treee18b1fa9f1d20d4a52c9e69052d1bc16178d4cee /channels
parenteebb9942125499e95ceb45f24e58fbf0bcce55a2 (diff)
Contribute SIP changes
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@859 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rwxr-xr-xchannels/chan_sip.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 89b5cf750..796903433 100755
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -576,6 +576,8 @@ static int create_addr(struct sip_pvt *r, char *peer)
struct hostent *hp;
struct sip_peer *p;
int found=0;
+ char *port;
+
r->sa.sin_family = AF_INET;
ast_pthread_mutex_lock(&peerl.lock);
p = peerl.peers;
@@ -625,10 +627,18 @@ static int create_addr(struct sip_pvt *r, char *peer)
}
ast_pthread_mutex_unlock(&peerl.lock);
if (!p && !found) {
+ if ((port=strchr(peer, ':'))) {
+ *port='\0';
+ port++;
+ }
hp = gethostbyname(peer);
if (hp) {
memcpy(&r->sa.sin_addr, hp->h_addr, sizeof(r->sa.sin_addr));
- r->sa.sin_port = htons(DEFAULT_SIP_PORT);
+ if (port) {
+ r->sa.sin_port = htons(atoi(port));
+ } else {
+ r->sa.sin_port = htons(DEFAULT_SIP_PORT);
+ }
memcpy(&r->recv, &r->sa, sizeof(r->recv));
return 0;
} else {