mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-19 19:52:48 +00:00
Cleanup sip_destination
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@749 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -1716,7 +1716,7 @@ static void add_route(struct sip_request *req, struct sip_route *route)
|
|||||||
|
|
||||||
static void set_destination(struct sip_pvt *p, char *uri)
|
static void set_destination(struct sip_pvt *p, char *uri)
|
||||||
{
|
{
|
||||||
char *h, *maddr, hostname[256];
|
char *h, *maddr, hostname[256] = "";
|
||||||
int port, hn;
|
int port, hn;
|
||||||
struct hostent *hp;
|
struct hostent *hp;
|
||||||
|
|
||||||
@@ -1733,7 +1733,6 @@ static void set_destination(struct sip_pvt *p, char *uri)
|
|||||||
}
|
}
|
||||||
++h;
|
++h;
|
||||||
hn = strcspn(h, ":;>");
|
hn = strcspn(h, ":;>");
|
||||||
hostname[255] = '\0';
|
|
||||||
strncpy(hostname, h, (hn>255)?255:hn);
|
strncpy(hostname, h, (hn>255)?255:hn);
|
||||||
h+=hn;
|
h+=hn;
|
||||||
/* Is "port" present? if not default to 5060 */
|
/* Is "port" present? if not default to 5060 */
|
||||||
@@ -1755,7 +1754,7 @@ static void set_destination(struct sip_pvt *p, char *uri)
|
|||||||
|
|
||||||
hp = gethostbyname(hostname);
|
hp = gethostbyname(hostname);
|
||||||
if (hp == NULL) {
|
if (hp == NULL) {
|
||||||
ast_log(LOG_WARNING, "Can't find address for host '%s'\n", h);
|
ast_log(LOG_WARNING, "Can't find address for host '%s'\n", hostname);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
p->sa.sin_family = AF_INET;
|
p->sa.sin_family = AF_INET;
|
||||||
|
Reference in New Issue
Block a user