Native SIP CCSS sends bad CC cancel SUBSCRIBE message.

The SUBSCRIBE message used to cancel a CC request has incorrect To/From
SIP headers.  They are reversed and the dialog tags are the same when they
should not be.  If pedantic mode was disabled, then the cancel would have
succeeded despite the incorrect message.

* The SIP_OUTGOING flag was not set correctly for the dialog and I had to
move some CC subscribe handling code as a result.

* Initialized the dialog subscribed type to CALL_COMPLETION earlier.  If a
CC request SUBSCRIBE message comes in and the CC instance is not found,
the 404 response was duplicated.

JIRA AST-568
JIRA SWP-3493


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@320883 65c4cc65-6c06-0410-ace0-fbb531ad65f3
certified/1.8.6
Richard Mudgett 14 years ago
parent 59a41188a8
commit b6ed006d32

@ -1910,6 +1910,7 @@ static int sip_cc_monitor_request_cc(struct ast_cc_monitor *monitor, int *availa
ast_get_ccnr_available_timer(monitor->interface->config_params); ast_get_ccnr_available_timer(monitor->interface->config_params);
sip_pvt_lock(monitor_instance->subscription_pvt); sip_pvt_lock(monitor_instance->subscription_pvt);
ast_set_flag(&monitor_instance->subscription_pvt->flags[0], SIP_OUTGOING);
create_addr(monitor_instance->subscription_pvt, monitor_instance->peername, 0, 1, NULL); create_addr(monitor_instance->subscription_pvt, monitor_instance->peername, 0, 1, NULL);
ast_sip_ouraddrfor(&monitor_instance->subscription_pvt->sa, &monitor_instance->subscription_pvt->ourip, monitor_instance->subscription_pvt); ast_sip_ouraddrfor(&monitor_instance->subscription_pvt->sa, &monitor_instance->subscription_pvt->ourip, monitor_instance->subscription_pvt);
monitor_instance->subscription_pvt->subscribed = CALL_COMPLETION; monitor_instance->subscription_pvt->subscribed = CALL_COMPLETION;
@ -19685,6 +19686,27 @@ static void handle_response_notify(struct sip_pvt *p, int resp, const char *rest
/* \brief Handle SIP response in SUBSCRIBE transaction */ /* \brief Handle SIP response in SUBSCRIBE transaction */
static void handle_response_subscribe(struct sip_pvt *p, int resp, const char *rest, struct sip_request *req, int seqno) static void handle_response_subscribe(struct sip_pvt *p, int resp, const char *rest, struct sip_request *req, int seqno)
{ {
if (p->subscribed == CALL_COMPLETION) {
struct sip_monitor_instance *monitor_instance;
if (resp < 300) {
return;
}
/* Final failure response received. */
monitor_instance = ao2_callback(sip_monitor_instances, 0,
find_sip_monitor_instance_by_subscription_pvt, p);
if (monitor_instance) {
ast_cc_monitor_failed(monitor_instance->core_id,
monitor_instance->device_name,
"Received error response to our SUBSCRIBE");
}
return;
}
if (p->subscribed != MWI_NOTIFICATION) {
return;
}
if (!p->mwi) { if (!p->mwi) {
return; return;
} }
@ -20414,16 +20436,6 @@ static void handle_response(struct sip_pvt *p, int resp, const char *rest, struc
ast_string_field_set(p, theirtag, tag); ast_string_field_set(p, theirtag, tag);
} }
if (sipmethod == SIP_SUBSCRIBE && resp >= 400) {
struct sip_monitor_instance *monitor_instance = ao2_callback(sip_monitor_instances,
0, find_sip_monitor_instance_by_subscription_pvt, p);
if (monitor_instance) {
ast_cc_monitor_failed(monitor_instance->core_id, monitor_instance->device_name,
"Received error response to our SUBSCRIBE");
return;
}
}
switch(resp) { switch(resp) {
case 200: case 200:
if (sipmethod == SIP_INVITE) { if (sipmethod == SIP_INVITE) {
@ -23570,6 +23582,8 @@ static int handle_cc_subscribe(struct sip_pvt *p, struct sip_request *req)
*param_separator = '\0'; *param_separator = '\0';
} }
p->subscribed = CALL_COMPLETION;
if (!(agent = find_sip_cc_agent_by_subscribe_uri(uri))) { if (!(agent = find_sip_cc_agent_by_subscribe_uri(uri))) {
if (!expires) { if (!expires) {
/* Typically, if a 0 Expires reaches us and we can't find /* Typically, if a 0 Expires reaches us and we can't find
@ -23601,7 +23615,6 @@ static int handle_cc_subscribe(struct sip_pvt *p, struct sip_request *req)
agent_pvt->subscribe_pvt = dialog_ref(p, "SIP CC agent gains reference to subscription dialog"); agent_pvt->subscribe_pvt = dialog_ref(p, "SIP CC agent gains reference to subscription dialog");
ast_cc_agent_accept_request(agent->core_id, "SIP caller %s has requested CC via SUBSCRIBE", ast_cc_agent_accept_request(agent->core_id, "SIP caller %s has requested CC via SUBSCRIBE",
agent->device_name); agent->device_name);
p->subscribed = CALL_COMPLETION;
/* We don't send a response here. That is done in the agent's ack callback or in the /* We don't send a response here. That is done in the agent's ack callback or in the
* agent destructor, should a failure occur before we have responded * agent destructor, should a failure occur before we have responded

Loading…
Cancel
Save