mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-20 12:20:12 +00:00
Add SRV code to SIP, cleanup ENUM and make IAX2 do the right thing on dials
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1085 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
2
Makefile
2
Makefile
@@ -112,7 +112,7 @@ OBJS=io.o sched.o logger.o frame.o loader.o config.o channel.o \
|
|||||||
ulaw.o alaw.o callerid.o fskmodem.o image.o app.o \
|
ulaw.o alaw.o callerid.o fskmodem.o image.o app.o \
|
||||||
cdr.o tdd.o acl.o rtp.o manager.o asterisk.o ast_expr.o \
|
cdr.o tdd.o acl.o rtp.o manager.o asterisk.o ast_expr.o \
|
||||||
dsp.o chanvars.o indications.o autoservice.o db.o privacy.o \
|
dsp.o chanvars.o indications.o autoservice.o db.o privacy.o \
|
||||||
astmm.o enum.o
|
astmm.o enum.o srv.o
|
||||||
CC=gcc
|
CC=gcc
|
||||||
INSTALL=install
|
INSTALL=install
|
||||||
|
|
||||||
|
@@ -3019,7 +3019,7 @@ static int complete_dpreply(struct chan_iax2_pvt *pvt, struct iax_ies *ies)
|
|||||||
if (dp->flags & CACHE_FLAG_PENDING) {
|
if (dp->flags & CACHE_FLAG_PENDING) {
|
||||||
dp->flags &= ~CACHE_FLAG_PENDING;
|
dp->flags &= ~CACHE_FLAG_PENDING;
|
||||||
dp->flags |= status;
|
dp->flags |= status;
|
||||||
dp->flags |= CACHE_FLAG_MATCHMORE;
|
dp->flags |= matchmore;
|
||||||
}
|
}
|
||||||
/* Wake up waiters */
|
/* Wake up waiters */
|
||||||
for (x=0;x<sizeof(dp->waiters) / sizeof(dp->waiters[0]); x++)
|
for (x=0;x<sizeof(dp->waiters) / sizeof(dp->waiters[0]); x++)
|
||||||
|
@@ -36,6 +36,7 @@
|
|||||||
#include <asterisk/dsp.h>
|
#include <asterisk/dsp.h>
|
||||||
#include <asterisk/parking.h>
|
#include <asterisk/parking.h>
|
||||||
#include <asterisk/acl.h>
|
#include <asterisk/acl.h>
|
||||||
|
#include <asterisk/srv.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <net/if.h>
|
#include <net/if.h>
|
||||||
@@ -94,6 +95,8 @@ static char fromdomain[AST_MAX_EXTENSION] = "";
|
|||||||
|
|
||||||
static char notifymime[AST_MAX_EXTENSION] = "application/simple-message-summary";
|
static char notifymime[AST_MAX_EXTENSION] = "application/simple-message-summary";
|
||||||
|
|
||||||
|
static int srvlookup = 0;
|
||||||
|
|
||||||
static int usecnt =0;
|
static int usecnt =0;
|
||||||
static pthread_mutex_t usecnt_lock = AST_MUTEX_INITIALIZER;
|
static pthread_mutex_t usecnt_lock = AST_MUTEX_INITIALIZER;
|
||||||
|
|
||||||
@@ -595,6 +598,8 @@ static int create_addr(struct sip_pvt *r, char *peer)
|
|||||||
struct sip_peer *p;
|
struct sip_peer *p;
|
||||||
int found=0;
|
int found=0;
|
||||||
char *port;
|
char *port;
|
||||||
|
int portno;
|
||||||
|
char host[256], *hostn;
|
||||||
|
|
||||||
r->sa.sin_family = AF_INET;
|
r->sa.sin_family = AF_INET;
|
||||||
ast_pthread_mutex_lock(&peerl.lock);
|
ast_pthread_mutex_lock(&peerl.lock);
|
||||||
@@ -656,15 +661,27 @@ static int create_addr(struct sip_pvt *r, char *peer)
|
|||||||
*port='\0';
|
*port='\0';
|
||||||
port++;
|
port++;
|
||||||
}
|
}
|
||||||
hp = gethostbyname(peer);
|
hostn = peer;
|
||||||
|
if (port)
|
||||||
|
portno = atoi(port);
|
||||||
|
else
|
||||||
|
portno = DEFAULT_SIP_PORT;
|
||||||
|
if (srvlookup) {
|
||||||
|
char service[256];
|
||||||
|
int tportno;
|
||||||
|
int ret;
|
||||||
|
snprintf(service, sizeof(service), "_sip._udp.%s", peer);
|
||||||
|
ret = ast_get_srv(NULL, host, sizeof(host), &tportno, service);
|
||||||
|
if (ret > 0) {
|
||||||
|
hostn = host;
|
||||||
|
portno = tportno;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
hp = gethostbyname(hostn);
|
||||||
if (hp) {
|
if (hp) {
|
||||||
strncpy(r->tohost, peer, sizeof(r->tohost) - 1);
|
strncpy(r->tohost, peer, sizeof(r->tohost) - 1);
|
||||||
memcpy(&r->sa.sin_addr, hp->h_addr, sizeof(r->sa.sin_addr));
|
memcpy(&r->sa.sin_addr, hp->h_addr, sizeof(r->sa.sin_addr));
|
||||||
if (port) {
|
r->sa.sin_port = htons(portno);
|
||||||
r->sa.sin_port = htons(atoi(port));
|
|
||||||
} else {
|
|
||||||
r->sa.sin_port = htons(DEFAULT_SIP_PORT);
|
|
||||||
}
|
|
||||||
memcpy(&r->recv, &r->sa, sizeof(r->recv));
|
memcpy(&r->recv, &r->sa, sizeof(r->recv));
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
@@ -5216,6 +5233,8 @@ static int reload_config(void)
|
|||||||
strncpy(fromdomain, v->value, sizeof(fromdomain)-1);
|
strncpy(fromdomain, v->value, sizeof(fromdomain)-1);
|
||||||
} else if (!strcasecmp(v->name, "nat")) {
|
} else if (!strcasecmp(v->name, "nat")) {
|
||||||
globalnat = ast_true(v->value);
|
globalnat = ast_true(v->value);
|
||||||
|
} else if (!strcasecmp(v->name, "srvlookup")) {
|
||||||
|
srvlookup = ast_true(v->value);
|
||||||
} else if (!strcasecmp(v->name, "canreinvite")) {
|
} else if (!strcasecmp(v->name, "canreinvite")) {
|
||||||
if (!strcasecmp(v->value, "update"))
|
if (!strcasecmp(v->value, "update"))
|
||||||
globalcanreinvite = REINVITE_UPDATE;
|
globalcanreinvite = REINVITE_UPDATE;
|
||||||
|
@@ -5,6 +5,7 @@
|
|||||||
port = 5060 ; Port to bind to
|
port = 5060 ; Port to bind to
|
||||||
bindaddr = 0.0.0.0 ; Address to bind to
|
bindaddr = 0.0.0.0 ; Address to bind to
|
||||||
context = default ; Default for incoming calls
|
context = default ; Default for incoming calls
|
||||||
|
;srvlookup = yes ; Enable SRV lookups on outbound calls
|
||||||
;tos=lowdelay
|
;tos=lowdelay
|
||||||
;tos=184
|
;tos=184
|
||||||
;maxexpirey=3600 ; Max length of incoming registration we allow
|
;maxexpirey=3600 ; Max length of incoming registration we allow
|
||||||
|
5
enum.c
5
enum.c
@@ -234,15 +234,12 @@ static int parse_answer(unsigned char *dst, int dstlen, unsigned char *tech, int
|
|||||||
printf("Looking for %d/%d\n", C_IN, T_NAPTR);
|
printf("Looking for %d/%d\n", C_IN, T_NAPTR);
|
||||||
#endif
|
#endif
|
||||||
for (x=0;x<ntohs(h->ancount);x++) {
|
for (x=0;x<ntohs(h->ancount);x++) {
|
||||||
if ((res = skip_name(answer, len) < 0)) {
|
if ((res = skip_name(answer, len)) < 0) {
|
||||||
ast_log(LOG_WARNING, "Failed to skip name :(\n");
|
ast_log(LOG_WARNING, "Failed to skip name :(\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
answer += res;
|
answer += res;
|
||||||
len -= res;
|
len -= res;
|
||||||
/* XXX Why am I adding 2 here? XXX */
|
|
||||||
answer += 2;
|
|
||||||
len -= 2;
|
|
||||||
ans = (struct dn_answer *)answer;
|
ans = (struct dn_answer *)answer;
|
||||||
answer += sizeof(struct dn_answer);
|
answer += sizeof(struct dn_answer);
|
||||||
len -= sizeof(struct dn_answer);
|
len -= sizeof(struct dn_answer);
|
||||||
|
Reference in New Issue
Block a user