|
|
|
@ -4587,7 +4587,6 @@ static struct sip_peer *realtime_peer(const char *newpeername, struct ast_sockad
|
|
|
|
|
struct ast_config *peerlist = NULL;
|
|
|
|
|
char ipaddr[INET6_ADDRSTRLEN];
|
|
|
|
|
char portstring[6]; /*up to 5 digits plus null terminator*/
|
|
|
|
|
char *cat = NULL;
|
|
|
|
|
int realtimeregs = ast_check_realtime("sipregs");
|
|
|
|
|
|
|
|
|
|
/* First check on peer name */
|
|
|
|
@ -4659,7 +4658,6 @@ static struct sip_peer *realtime_peer(const char *newpeername, struct ast_sockad
|
|
|
|
|
}
|
|
|
|
|
} else { /*var wasn't found in the list of "hosts", so try "ipaddr"*/
|
|
|
|
|
peerlist = NULL;
|
|
|
|
|
cat = NULL;
|
|
|
|
|
peerlist = ast_load_realtime_multientry("sippeers", "ipaddr", ipaddr, SENTINEL);
|
|
|
|
|
if(peerlist) {
|
|
|
|
|
var = get_insecure_variable_from_config(peerlist);
|
|
|
|
@ -12734,7 +12732,6 @@ static int sip_reg_timeout(const void *data)
|
|
|
|
|
/* if we are here, our registration timed out, so we'll just do it over */
|
|
|
|
|
struct sip_registry *r = (struct sip_registry *)data; /* the ref count should have been bumped when the sched item was added */
|
|
|
|
|
struct sip_pvt *p;
|
|
|
|
|
int res;
|
|
|
|
|
|
|
|
|
|
/* if we couldn't get a reference to the registry object, punt */
|
|
|
|
|
if (!r) {
|
|
|
|
@ -12777,7 +12774,7 @@ static int sip_reg_timeout(const void *data)
|
|
|
|
|
r->regstate = REG_STATE_FAILED;
|
|
|
|
|
} else {
|
|
|
|
|
r->regstate = REG_STATE_UNREGISTERED;
|
|
|
|
|
res = transmit_register(r, SIP_REGISTER, NULL, NULL);
|
|
|
|
|
transmit_register(r, SIP_REGISTER, NULL, NULL);
|
|
|
|
|
ast_log(LOG_NOTICE, " -- Registration for '%s@%s' timed out, trying again (Attempt #%d)\n", r->username, r->hostname, r->regattempts);
|
|
|
|
|
}
|
|
|
|
|
manager_event(EVENT_FLAG_SYSTEM, "Registry", "ChannelType: SIP\r\nUsername: %s\r\nDomain: %s\r\nStatus: %s\r\n", r->username, r->hostname, regstate2str(r->regstate));
|
|
|
|
@ -13058,8 +13055,6 @@ static int transmit_refer(struct sip_pvt *p, const char *dest)
|
|
|
|
|
const char *of;
|
|
|
|
|
char *c;
|
|
|
|
|
char referto[256];
|
|
|
|
|
char *ttag, *ftag;
|
|
|
|
|
char *theirtag = ast_strdupa(p->theirtag);
|
|
|
|
|
int use_tls=FALSE;
|
|
|
|
|
|
|
|
|
|
if (sipdebug) {
|
|
|
|
@ -13069,12 +13064,8 @@ static int transmit_refer(struct sip_pvt *p, const char *dest)
|
|
|
|
|
/* Are we transfering an inbound or outbound call ? */
|
|
|
|
|
if (ast_test_flag(&p->flags[0], SIP_OUTGOING)) {
|
|
|
|
|
of = get_header(&p->initreq, "To");
|
|
|
|
|
ttag = theirtag;
|
|
|
|
|
ftag = p->tag;
|
|
|
|
|
} else {
|
|
|
|
|
of = get_header(&p->initreq, "From");
|
|
|
|
|
ftag = theirtag;
|
|
|
|
|
ttag = p->tag;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ast_copy_string(from, of, sizeof(from));
|
|
|
|
@ -20251,7 +20242,6 @@ static void handle_response(struct sip_pvt *p, int resp, const char *rest, struc
|
|
|
|
|
{
|
|
|
|
|
struct ast_channel *owner;
|
|
|
|
|
int sipmethod;
|
|
|
|
|
int res = 1;
|
|
|
|
|
const char *c = get_header(req, "Cseq");
|
|
|
|
|
/* GCC 4.2 complains if I try to cast c as a char * when passing it to ast_skip_nonblanks, so make a copy of it */
|
|
|
|
|
char *c_copy = ast_strdupa(c);
|
|
|
|
@ -20374,7 +20364,7 @@ static void handle_response(struct sip_pvt *p, int resp, const char *rest, struc
|
|
|
|
|
} else if (sipmethod == SIP_NOTIFY) {
|
|
|
|
|
handle_response_notify(p, resp, rest, req, seqno);
|
|
|
|
|
} else if (sipmethod == SIP_REGISTER) {
|
|
|
|
|
res = handle_response_register(p, resp, rest, req, seqno);
|
|
|
|
|
handle_response_register(p, resp, rest, req, seqno);
|
|
|
|
|
} else if (sipmethod == SIP_SUBSCRIBE) {
|
|
|
|
|
ast_set_flag(&p->flags[1], SIP_PAGE2_DIALOG_ESTABLISHED);
|
|
|
|
|
handle_response_subscribe(p, resp, rest, req, seqno);
|
|
|
|
@ -20392,7 +20382,7 @@ static void handle_response(struct sip_pvt *p, int resp, const char *rest, struc
|
|
|
|
|
else if (sipmethod == SIP_SUBSCRIBE)
|
|
|
|
|
handle_response_subscribe(p, resp, rest, req, seqno);
|
|
|
|
|
else if (p->registry && sipmethod == SIP_REGISTER)
|
|
|
|
|
res = handle_response_register(p, resp, rest, req, seqno);
|
|
|
|
|
handle_response_register(p, resp, rest, req, seqno);
|
|
|
|
|
else if (sipmethod == SIP_UPDATE) {
|
|
|
|
|
handle_response_update(p, resp, rest, req, seqno);
|
|
|
|
|
} else if (sipmethod == SIP_BYE) {
|
|
|
|
@ -20417,7 +20407,7 @@ static void handle_response(struct sip_pvt *p, int resp, const char *rest, struc
|
|
|
|
|
else if (sipmethod == SIP_SUBSCRIBE)
|
|
|
|
|
handle_response_subscribe(p, resp, rest, req, seqno);
|
|
|
|
|
else if (p->registry && sipmethod == SIP_REGISTER)
|
|
|
|
|
res = handle_response_register(p, resp, rest, req, seqno);
|
|
|
|
|
handle_response_register(p, resp, rest, req, seqno);
|
|
|
|
|
else {
|
|
|
|
|
ast_log(LOG_WARNING, "Forbidden - maybe wrong password on authentication for %s\n", msg);
|
|
|
|
|
pvt_set_needdestroy(p, "received 403 response");
|
|
|
|
@ -20425,7 +20415,7 @@ static void handle_response(struct sip_pvt *p, int resp, const char *rest, struc
|
|
|
|
|
break;
|
|
|
|
|
case 404: /* Not found */
|
|
|
|
|
if (p->registry && sipmethod == SIP_REGISTER)
|
|
|
|
|
res = handle_response_register(p, resp, rest, req, seqno);
|
|
|
|
|
handle_response_register(p, resp, rest, req, seqno);
|
|
|
|
|
else if (sipmethod == SIP_INVITE)
|
|
|
|
|
handle_response_invite(p, resp, rest, req, seqno);
|
|
|
|
|
else if (sipmethod == SIP_SUBSCRIBE)
|
|
|
|
@ -20435,13 +20425,13 @@ static void handle_response(struct sip_pvt *p, int resp, const char *rest, struc
|
|
|
|
|
break;
|
|
|
|
|
case 423: /* Interval too brief */
|
|
|
|
|
if (sipmethod == SIP_REGISTER)
|
|
|
|
|
res = handle_response_register(p, resp, rest, req, seqno);
|
|
|
|
|
handle_response_register(p, resp, rest, req, seqno);
|
|
|
|
|
break;
|
|
|
|
|
case 408: /* Request timeout - terminate dialog */
|
|
|
|
|
if (sipmethod == SIP_INVITE)
|
|
|
|
|
handle_response_invite(p, resp, rest, req, seqno);
|
|
|
|
|
else if (sipmethod == SIP_REGISTER)
|
|
|
|
|
res = handle_response_register(p, resp, rest, req, seqno);
|
|
|
|
|
handle_response_register(p, resp, rest, req, seqno);
|
|
|
|
|
else if (sipmethod == SIP_BYE) {
|
|
|
|
|
pvt_set_needdestroy(p, "received 408 response");
|
|
|
|
|
ast_debug(4, "Got timeout on bye. Thanks for the answer. Now, kill this call\n");
|
|
|
|
@ -21047,12 +21037,10 @@ static int handle_request_notify(struct sip_pvt *p, struct sip_request *req, str
|
|
|
|
|
/* Mostly created to return proper answers on notifications on outbound REFER's */
|
|
|
|
|
int res = 0;
|
|
|
|
|
const char *event = get_header(req, "Event");
|
|
|
|
|
char *eventid = NULL;
|
|
|
|
|
char *sep;
|
|
|
|
|
|
|
|
|
|
if( (sep = strchr(event, ';')) ) { /* XXX bug here - overwriting string ? */
|
|
|
|
|
*sep++ = '\0';
|
|
|
|
|
eventid = sep;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (sipdebug)
|
|
|
|
|