by the flag.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@45295
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
/*------Request handling functions */
static int handle_request(struct sip_pvt *p, struct sip_request *req, struct sockaddr_in *sin, int *recount, int *nounlock);
static int handle_request_invite(struct sip_pvt *p, struct sip_request *req, int debug, int seqno, struct sockaddr_in *sin, int *recount, char *e);
/*------Request handling functions */
static int handle_request(struct sip_pvt *p, struct sip_request *req, struct sockaddr_in *sin, int *recount, int *nounlock);
static int handle_request_invite(struct sip_pvt *p, struct sip_request *req, int debug, int seqno, struct sockaddr_in *sin, int *recount, char *e);
-static int handle_request_refer(struct sip_pvt *p, struct sip_request *req, int debug, int ignore, int seqno, int *nounlock);
+static int handle_request_refer(struct sip_pvt *p, struct sip_request *req, int debug, int seqno, int *nounlock);
static int handle_request_bye(struct sip_pvt *p, struct sip_request *req);
static int handle_request_register(struct sip_pvt *p, struct sip_request *req, struct sockaddr_in *sin, char *e);
static int handle_request_cancel(struct sip_pvt *p, struct sip_request *req);
static int handle_request_bye(struct sip_pvt *p, struct sip_request *req);
static int handle_request_register(struct sip_pvt *p, struct sip_request *req, struct sockaddr_in *sin, char *e);
static int handle_request_cancel(struct sip_pvt *p, struct sip_request *req);
/*------Response handling functions */
static void handle_response_invite(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int seqno);
static void handle_response_refer(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int seqno);
/*------Response handling functions */
static void handle_response_invite(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int seqno);
static void handle_response_refer(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int seqno);
-static int handle_response_register(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int ignore, int seqno);
-static void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int ignore, int seqno);
+static int handle_response_register(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int seqno);
+static void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int seqno);
/*----- RTP interface functions */
static int sip_set_rtp_peer(struct ast_channel *chan, struct ast_rtp *rtp, struct ast_rtp *vrtp, int codecs, int nat_active);
/*----- RTP interface functions */
static int sip_set_rtp_peer(struct ast_channel *chan, struct ast_rtp *rtp, struct ast_rtp *vrtp, int codecs, int nat_active);
}
/*! \brief Handle responses on REGISTER to services */
}
/*! \brief Handle responses on REGISTER to services */
-static int handle_response_register(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int ignore, int seqno)
+static int handle_response_register(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int seqno)
{
int expires, expires_ms;
struct sip_registry *r;
{
int expires, expires_ms;
struct sip_registry *r;
/*! \brief Handle SIP response in dialogue */
/* XXX only called by handle_request */
/*! \brief Handle SIP response in dialogue */
/* XXX only called by handle_request */
-static void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int ignore, int seqno)
+static void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int seqno)
{
struct ast_channel *owner;
int sipmethod;
{
struct ast_channel *owner;
int sipmethod;
ast_set_flag(&p->flags[0], SIP_NEEDDESTROY);
}
} else if (sipmethod == SIP_REGISTER)
ast_set_flag(&p->flags[0], SIP_NEEDDESTROY);
}
} else if (sipmethod == SIP_REGISTER)
- res = handle_response_register(p, resp, rest, req, ignore, seqno);
+ res = handle_response_register(p, resp, rest, req, seqno);
else if (sipmethod == SIP_BYE) /* Ok, we're ready to go */
ast_set_flag(&p->flags[0], SIP_NEEDDESTROY);
break;
else if (sipmethod == SIP_BYE) /* Ok, we're ready to go */
ast_set_flag(&p->flags[0], SIP_NEEDDESTROY);
break;
else if (sipmethod == SIP_REFER)
handle_response_refer(p, resp, rest, req, seqno);
else if (p->registry && sipmethod == SIP_REGISTER)
else if (sipmethod == SIP_REFER)
handle_response_refer(p, resp, rest, req, seqno);
else if (p->registry && sipmethod == SIP_REGISTER)
- res = handle_response_register(p, resp, rest, req, ignore, seqno);
+ res = handle_response_register(p, resp, rest, req, seqno);
else {
ast_log(LOG_WARNING, "Got authentication request (401) on unknown %s to '%s'\n", sip_methods[sipmethod].text, get_header(req, "To"));
ast_set_flag(&p->flags[0], SIP_NEEDDESTROY);
else {
ast_log(LOG_WARNING, "Got authentication request (401) on unknown %s to '%s'\n", sip_methods[sipmethod].text, get_header(req, "To"));
ast_set_flag(&p->flags[0], SIP_NEEDDESTROY);
if (sipmethod == SIP_INVITE)
handle_response_invite(p, resp, rest, req, seqno);
else if (p->registry && sipmethod == SIP_REGISTER)
if (sipmethod == SIP_INVITE)
handle_response_invite(p, resp, rest, req, seqno);
else if (p->registry && sipmethod == SIP_REGISTER)
- res = handle_response_register(p, resp, rest, req, ignore, seqno);
+ res = handle_response_register(p, resp, rest, req, seqno);
else {
ast_log(LOG_WARNING, "Forbidden - maybe wrong password on authentication for %s\n", msg);
ast_set_flag(&p->flags[0], SIP_NEEDDESTROY);
else {
ast_log(LOG_WARNING, "Forbidden - maybe wrong password on authentication for %s\n", msg);
ast_set_flag(&p->flags[0], SIP_NEEDDESTROY);
break;
case 404: /* Not found */
if (p->registry && sipmethod == SIP_REGISTER)
break;
case 404: /* Not found */
if (p->registry && sipmethod == SIP_REGISTER)
- res = handle_response_register(p, resp, rest, req, ignore, seqno);
+ res = handle_response_register(p, resp, rest, req, seqno);
else if (sipmethod == SIP_INVITE)
handle_response_invite(p, resp, rest, req, seqno);
else if (owner)
else if (sipmethod == SIP_INVITE)
handle_response_invite(p, resp, rest, req, seqno);
else if (owner)
else if (sipmethod == SIP_REFER)
handle_response_refer(p, resp, rest, req, seqno);
else if (p->registry && sipmethod == SIP_REGISTER)
else if (sipmethod == SIP_REFER)
handle_response_refer(p, resp, rest, req, seqno);
else if (p->registry && sipmethod == SIP_REGISTER)
- res = handle_response_register(p, resp, rest, req, ignore, seqno);
+ res = handle_response_register(p, resp, rest, req, seqno);
else if (sipmethod == SIP_BYE) {
if (ast_strlen_zero(p->authname))
ast_log(LOG_WARNING, "Asked to authenticate %s, to %s:%d but we have no matching peer!\n",
else if (sipmethod == SIP_BYE) {
if (ast_strlen_zero(p->authname))
ast_log(LOG_WARNING, "Asked to authenticate %s, to %s:%d but we have no matching peer!\n",
ast_log(LOG_DEBUG, "SIP transfer: Invite Replace incoming channel should replace and hang up channel %s (one call leg)\n", replacecall->name);
}
ast_log(LOG_DEBUG, "SIP transfer: Invite Replace incoming channel should replace and hang up channel %s (one call leg)\n", replacecall->name);
}
+ if (ast_test_flag(req, SIP_PKT_IGNORE)) {
ast_log(LOG_NOTICE, "Ignoring this INVITE with replaces in a stupid way.\n");
/* We should answer something here. If we are here, the
call we are replacing exists, so an accepted
ast_log(LOG_NOTICE, "Ignoring this INVITE with replaces in a stupid way.\n");
/* We should answer something here. If we are here, the
call we are replacing exists, so an accepted
We can't destroy dialogs, since we want the call to continue.
*/
We can't destroy dialogs, since we want the call to continue.
*/
-static int handle_request_refer(struct sip_pvt *p, struct sip_request *req, int debug, int ignore, int seqno, int *nounlock)
+static int handle_request_refer(struct sip_pvt *p, struct sip_request *req, int debug, int seqno, int *nounlock)
{
struct sip_dual current; /* Chan1: Call between asterisk and transferer */
/* Chan2: Call between asterisk and transferee */
{
struct sip_dual current; /* Chan1: Call between asterisk and transferer */
/* Chan2: Call between asterisk and transferee */
- if(!ignore && ast_test_flag(&p->flags[0], SIP_GOTREFER)) {
+ if(!ast_test_flag(req, SIP_PKT_IGNORE) && ast_test_flag(&p->flags[0], SIP_GOTREFER)) {
/* Already have a pending REFER */
transmit_response(p, "491 Request pending", req);
append_history(p, "Xfer", "Refer failed. Request pending.");
/* Already have a pending REFER */
transmit_response(p, "491 Request pending", req);
append_history(p, "Xfer", "Refer failed. Request pending.");
/* Is this a repeat of a current request? Ignore it */
/* Don't know what else to do right now. */
/* Is this a repeat of a current request? Ignore it */
/* Don't know what else to do right now. */
+ if (ast_test_flag(req, SIP_PKT_IGNORE))
return res;
/* If this is a blind transfer, we have the following
return res;
/* If this is a blind transfer, we have the following
const char *useragent;
int seqno;
int len;
const char *useragent;
int seqno;
int len;
int respid;
int res = 0;
int debug = sip_debug_test_pvt(p);
int respid;
int res = 0;
int debug = sip_debug_test_pvt(p);
} else if (p->ocseq && (p->ocseq != seqno)) {
/* ignore means "don't do anything with it" but still have to
respond appropriately */
} else if (p->ocseq && (p->ocseq != seqno)) {
/* ignore means "don't do anything with it" but still have to
respond appropriately */
ast_set_flag(req, SIP_PKT_IGNORE);
ast_set_flag(req, SIP_PKT_IGNORE_RESP);
append_history(p, "Ignore", "Ignoring this retransmit\n");
ast_set_flag(req, SIP_PKT_IGNORE);
ast_set_flag(req, SIP_PKT_IGNORE_RESP);
append_history(p, "Ignore", "Ignoring this retransmit\n");
/* More SIP ridiculousness, we have to ignore bogus contacts in 100 etc responses */
if ((respid == 200) || ((respid >= 300) && (respid <= 399)))
extract_uri(p, req);
/* More SIP ridiculousness, we have to ignore bogus contacts in 100 etc responses */
if ((respid == 200) || ((respid >= 300) && (respid <= 399)))
extract_uri(p, req);
- handle_response(p, respid, e + len, req, ignore, seqno);
+ handle_response(p, respid, e + len, req, seqno);
/* ignore means "don't do anything with it" but still have to
respond appropriately. We do this if we receive a repeat of
the last sequence number */
/* ignore means "don't do anything with it" but still have to
respond appropriately. We do this if we receive a repeat of
the last sequence number */
ast_set_flag(req, SIP_PKT_IGNORE);
ast_set_flag(req, SIP_PKT_IGNORE_REQ);
if (option_debug > 2)
ast_set_flag(req, SIP_PKT_IGNORE);
ast_set_flag(req, SIP_PKT_IGNORE_REQ);
if (option_debug > 2)
res = handle_request_invite(p, req, debug, seqno, sin, recount, e);
break;
case SIP_REFER:
res = handle_request_invite(p, req, debug, seqno, sin, recount, e);
break;
case SIP_REFER:
- res = handle_request_refer(p, req, debug, ignore, seqno, nounlock);
+ res = handle_request_refer(p, req, debug, seqno, nounlock);
break;
case SIP_CANCEL:
res = handle_request_cancel(p, req);
break;
case SIP_CANCEL:
res = handle_request_cancel(p, req);
case SIP_INFO:
if (ast_test_flag(req, SIP_PKT_DEBUG))
ast_verbose("Receiving INFO!\n");
case SIP_INFO:
if (ast_test_flag(req, SIP_PKT_DEBUG))
ast_verbose("Receiving INFO!\n");
+ if (!ast_test_flag(req, SIP_PKT_IGNORE))
handle_request_info(p, req);
else /* if ignoring, transmit response */
transmit_response(p, "200 OK", req);
handle_request_info(p, req);
else /* if ignoring, transmit response */
transmit_response(p, "200 OK", req);