summaryrefslogtreecommitdiff
path: root/res/res_pjsip
diff options
context:
space:
mode:
Diffstat (limited to 'res/res_pjsip')
-rw-r--r--res/res_pjsip/pjsip_configuration.c10
-rw-r--r--res/res_pjsip/pjsip_distributor.c28
2 files changed, 26 insertions, 12 deletions
diff --git a/res/res_pjsip/pjsip_configuration.c b/res/res_pjsip/pjsip_configuration.c
index 2e0df75e3..368f0d8a2 100644
--- a/res/res_pjsip/pjsip_configuration.c
+++ b/res/res_pjsip/pjsip_configuration.c
@@ -131,7 +131,7 @@ static int persistent_endpoint_update_state(void *obj, void *arg, int flags)
}
}
- ast_verb(1, "Endpoint %s is now Reachable\n", ast_endpoint_get_resource(endpoint));
+ ast_verb(2, "Endpoint %s is now Reachable\n", ast_endpoint_get_resource(endpoint));
} else {
ast_endpoint_set_state(endpoint, AST_ENDPOINT_OFFLINE);
blob = ast_json_pack("{s: s}", "peer_status", "Unreachable");
@@ -144,7 +144,7 @@ static int persistent_endpoint_update_state(void *obj, void *arg, int flags)
}
}
- ast_verb(1, "Endpoint %s is now Unreachable\n", ast_endpoint_get_resource(endpoint));
+ ast_verb(2, "Endpoint %s is now Unreachable\n", ast_endpoint_get_resource(endpoint));
}
ast_free(regcontext);
@@ -176,7 +176,7 @@ static void persistent_endpoint_contact_created_observer(const void *object)
}
contact_status->status = CREATED;
- ast_verb(1, "Contact %s/%s has been created\n",contact->aor, contact->uri);
+ ast_verb(2, "Contact %s/%s has been created\n",contact->aor, contact->uri);
ao2_callback(persistent_endpoints, OBJ_NODATA, persistent_endpoint_update_state, contact_status);
ao2_cleanup(contact_status);
@@ -195,7 +195,7 @@ static void persistent_endpoint_contact_deleted_observer(const void *object)
return;
}
- ast_verb(1, "Contact %s/%s has been deleted\n", contact->aor, contact->uri);
+ ast_verb(2, "Contact %s/%s has been deleted\n", contact->aor, contact->uri);
ast_statsd_log_string_va("PJSIP.contacts.states.%s", AST_STATSD_GAUGE,
"-1", 1.0, ast_sip_get_contact_status_label(contact_status->status));
ast_statsd_log_string_va("PJSIP.contacts.states.%s", AST_STATSD_GAUGE,
@@ -223,7 +223,7 @@ static void persistent_endpoint_contact_status_observer(const void *object)
}
if (contact_status->status != contact_status->last_status) {
- ast_verb(1, "Contact %s/%s is now %s. RTT: %.3f msec\n", contact_status->aor, contact_status->uri,
+ ast_verb(3, "Contact %s/%s is now %s. RTT: %.3f msec\n", contact_status->aor, contact_status->uri,
ast_sip_get_contact_status_label(contact_status->status),
contact_status->rtt / 1000.0);
diff --git a/res/res_pjsip/pjsip_distributor.c b/res/res_pjsip/pjsip_distributor.c
index d902ed456..0d3df06f0 100644
--- a/res/res_pjsip/pjsip_distributor.c
+++ b/res/res_pjsip/pjsip_distributor.c
@@ -231,20 +231,34 @@ static pjsip_dialog *find_dialog(pjsip_rx_data *rdata)
if (rdata->msg_info.msg->type == PJSIP_RESPONSE_MSG ||
pjsip_method_cmp(&rdata->msg_info.msg->line.req.method, &pjsip_cancel_method) ||
rdata->msg_info.to->tag.slen != 0) {
- return pjsip_ua_find_dialog(&rdata->msg_info.cid->id, local_tag,
+ dlg = pjsip_ua_find_dialog(&rdata->msg_info.cid->id, local_tag,
remote_tag, PJ_TRUE);
+ if (dlg) {
+ return dlg;
+ }
}
- /* Incoming CANCEL without a to-tag can't use same method for finding the
- * dialog. Instead, we have to find the matching INVITE transaction and
- * then get the dialog from the transaction
+ /*
+ * There may still be a matching dialog if this is
+ * 1) an incoming CANCEL request without a to-tag
+ * 2) an incoming response to a dialog-creating request.
*/
- pjsip_tsx_create_key(rdata->tp_info.pool, &tsx_key, PJSIP_ROLE_UAS,
- pjsip_get_invite_method(), rdata);
+ if (rdata->msg_info.msg->type == PJSIP_REQUEST_MSG) {
+ /* CANCEL requests will need to match the INVITE we initially received. Any
+ * other request type will either have been matched already or is not in
+ * dialog
+ */
+ pjsip_tsx_create_key(rdata->tp_info.pool, &tsx_key, PJSIP_ROLE_UAS,
+ pjsip_get_invite_method(), rdata);
+ } else {
+ pjsip_tsx_create_key(rdata->tp_info.pool, &tsx_key, PJSIP_ROLE_UAC,
+ &rdata->msg_info.cseq->method, rdata);
+ }
tsx = pjsip_tsx_layer_find_tsx(&tsx_key, PJ_TRUE);
if (!tsx) {
- ast_log(LOG_ERROR, "Could not find matching INVITE transaction for CANCEL request\n");
+ ast_debug(3, "Could not find matching transaction for %s\n",
+ pjsip_rx_data_get_info(rdata));
return NULL;
}