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 \
dsp.o chanvars.o indications.o autoservice.o db.o privacy.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 \
dsp.o chanvars.o indications.o autoservice.o db.o privacy.o \
if (dp->flags & CACHE_FLAG_PENDING) {
dp->flags &= ~CACHE_FLAG_PENDING;
dp->flags |= status;
if (dp->flags & CACHE_FLAG_PENDING) {
dp->flags &= ~CACHE_FLAG_PENDING;
dp->flags |= status;
- dp->flags |= CACHE_FLAG_MATCHMORE;
+ dp->flags |= matchmore;
}
/* Wake up waiters */
for (x=0;x<sizeof(dp->waiters) / sizeof(dp->waiters[0]); x++)
}
/* Wake up waiters */
for (x=0;x<sizeof(dp->waiters) / sizeof(dp->waiters[0]); x++)
#include <asterisk/dsp.h>
#include <asterisk/parking.h>
#include <asterisk/acl.h>
#include <asterisk/dsp.h>
#include <asterisk/parking.h>
#include <asterisk/acl.h>
+#include <asterisk/srv.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>
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 pthread_mutex_t usecnt_lock = AST_MUTEX_INITIALIZER;
static int usecnt =0;
static pthread_mutex_t usecnt_lock = AST_MUTEX_INITIALIZER;
struct sip_peer *p;
int found=0;
char *port;
struct sip_peer *p;
int found=0;
char *port;
+ int portno;
+ char host[256], *hostn;
r->sa.sin_family = AF_INET;
ast_pthread_mutex_lock(&peerl.lock);
r->sa.sin_family = AF_INET;
ast_pthread_mutex_lock(&peerl.lock);
- 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) {
strncpy(r->tohost, peer, sizeof(r->tohost) - 1);
memcpy(&r->sa.sin_addr, hp->h_addr, sizeof(r->sa.sin_addr));
if (hp) {
strncpy(r->tohost, peer, sizeof(r->tohost) - 1);
memcpy(&r->sa.sin_addr, hp->h_addr, sizeof(r->sa.sin_addr));
- if (port) {
- r->sa.sin_port = htons(atoi(port));
- } else {
- r->sa.sin_port = htons(DEFAULT_SIP_PORT);
- }
+ r->sa.sin_port = htons(portno);
memcpy(&r->recv, &r->sa, sizeof(r->recv));
return 0;
} else {
memcpy(&r->recv, &r->sa, sizeof(r->recv));
return 0;
} else {
strncpy(fromdomain, v->value, sizeof(fromdomain)-1);
} else if (!strcasecmp(v->name, "nat")) {
globalnat = ast_true(v->value);
strncpy(fromdomain, v->value, sizeof(fromdomain)-1);
} else if (!strcasecmp(v->name, "nat")) {
globalnat = ast_true(v->value);
+ } else if (!strcasecmp(v->name, "srvlookup")) {
+ srvlookup = ast_true(v->value);
} else if (!strcasecmp(v->name, "canreinvite")) {
if (!strcasecmp(v->value, "update"))
globalcanreinvite = REINVITE_UPDATE;
} else if (!strcasecmp(v->name, "canreinvite")) {
if (!strcasecmp(v->value, "update"))
globalcanreinvite = REINVITE_UPDATE;
port = 5060 ; Port to bind to
bindaddr = 0.0.0.0 ; Address to bind to
context = default ; Default for incoming calls
port = 5060 ; Port to bind to
bindaddr = 0.0.0.0 ; Address to bind to
context = default ; Default for incoming calls
+;srvlookup = yes ; Enable SRV lookups on outbound calls
;tos=lowdelay
;tos=184
;maxexpirey=3600 ; Max length of incoming registration we allow
;tos=lowdelay
;tos=184
;maxexpirey=3600 ; Max length of incoming registration we allow
printf("Looking for %d/%d\n", C_IN, T_NAPTR);
#endif
for (x=0;x<ntohs(h->ancount);x++) {
printf("Looking for %d/%d\n", C_IN, T_NAPTR);
#endif
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");
return -1;
}
answer += res;
len -= res;
ast_log(LOG_WARNING, "Failed to skip name :(\n");
return -1;
}
answer += res;
len -= res;
- /* XXX Why am I adding 2 here? XXX */
- answer += 2;
- len -= 2;
ans = (struct dn_answer *)answer;
answer += sizeof(struct dn_answer);
len -= sizeof(struct dn_answer);
ans = (struct dn_answer *)answer;
answer += sizeof(struct dn_answer);
len -= sizeof(struct dn_answer);