res_pjsip_registrar: Include source IP and port in log messages.
When registering it can be useful to see the source IP address and port in cases where multiple devices are using the same endpoint or when anonymous is in use. ASTERISK-29325 Change-Id: Ie178a6f55f53f8473035854c411bc3d056e0a2e0
This commit is contained in:
parent
682f7d9437
commit
5f1c21e4ca
|
@ -682,8 +682,9 @@ static void register_aor_core(pjsip_rx_data *rdata,
|
|||
if (contact_count > aor->max_contacts) {
|
||||
/* Enforce the maximum number of contacts */
|
||||
ast_sip_report_failed_acl(endpoint, rdata, "registrar_attempt_exceeds_maximum_configured_contacts");
|
||||
ast_log(LOG_WARNING, "Registration attempt from endpoint '%s' to AOR '%s' will exceed max contacts of %u\n",
|
||||
ast_sorcery_object_get_id(endpoint), aor_name, aor->max_contacts);
|
||||
ast_log(LOG_WARNING, "Registration attempt from endpoint '%s' (%s:%d) to AOR '%s' will exceed max contacts of %u\n",
|
||||
ast_sorcery_object_get_id(endpoint), rdata->pkt_info.src_name, rdata->pkt_info.src_port,
|
||||
aor_name, aor->max_contacts);
|
||||
response->code = 403;
|
||||
pjsip_endpt_release_pool(ast_sip_get_pjsip_endpoint(), details.pool);
|
||||
ao2_cleanup(existing_contacts);
|
||||
|
@ -1077,8 +1078,9 @@ static struct ast_sip_aor *find_registrar_aor(struct pjsip_rx_data *rdata, struc
|
|||
/* The provided AOR name was not found (be it within the configuration or sorcery itself) */
|
||||
pjsip_endpt_respond_stateless(ast_sip_get_pjsip_endpoint(), rdata, 404, NULL, NULL, NULL);
|
||||
ast_sip_report_req_no_support(endpoint, rdata, "registrar_requested_aor_not_found");
|
||||
ast_log(LOG_WARNING, "AOR '%s' not found for endpoint '%s'\n",
|
||||
aor_name ?: "", ast_sorcery_object_get_id(endpoint));
|
||||
ast_log(LOG_WARNING, "AOR '%s' not found for endpoint '%s' (%s:%d)\n",
|
||||
aor_name ?: "", ast_sorcery_object_get_id(endpoint),
|
||||
rdata->pkt_info.src_name, rdata->pkt_info.src_port);
|
||||
}
|
||||
ast_free(aor_name);
|
||||
return aor;
|
||||
|
@ -1099,14 +1101,16 @@ static pj_bool_t registrar_on_rx_request(struct pjsip_rx_data *rdata)
|
|||
/* Short circuit early if the endpoint has no AORs configured on it, which means no registration possible */
|
||||
pjsip_endpt_respond_stateless(ast_sip_get_pjsip_endpoint(), rdata, 403, NULL, NULL, NULL);
|
||||
ast_sip_report_failed_acl(endpoint, rdata, "registrar_attempt_without_configured_aors");
|
||||
ast_log(LOG_WARNING, "Endpoint '%s' has no configured AORs\n", ast_sorcery_object_get_id(endpoint));
|
||||
ast_log(LOG_WARNING, "Endpoint '%s' (%s:%d) has no configured AORs\n", ast_sorcery_object_get_id(endpoint),
|
||||
rdata->pkt_info.src_name, rdata->pkt_info.src_port);
|
||||
return PJ_TRUE;
|
||||
}
|
||||
|
||||
if (!PJSIP_URI_SCHEME_IS_SIP(rdata->msg_info.to->uri) && !PJSIP_URI_SCHEME_IS_SIPS(rdata->msg_info.to->uri)) {
|
||||
pjsip_endpt_respond_stateless(ast_sip_get_pjsip_endpoint(), rdata, 416, NULL, NULL, NULL);
|
||||
ast_sip_report_failed_acl(endpoint, rdata, "registrar_invalid_uri_in_to_received");
|
||||
ast_log(LOG_WARNING, "Endpoint '%s' attempted to register to an AOR with a non-SIP URI\n", ast_sorcery_object_get_id(endpoint));
|
||||
ast_log(LOG_WARNING, "Endpoint '%s' (%s:%d) attempted to register to an AOR with a non-SIP URI\n", ast_sorcery_object_get_id(endpoint),
|
||||
rdata->pkt_info.src_name, rdata->pkt_info.src_port);
|
||||
return PJ_TRUE;
|
||||
}
|
||||
|
||||
|
@ -1122,8 +1126,9 @@ static pj_bool_t registrar_on_rx_request(struct pjsip_rx_data *rdata)
|
|||
/* Registration is not permitted for this AOR */
|
||||
pjsip_endpt_respond_stateless(ast_sip_get_pjsip_endpoint(), rdata, 403, NULL, NULL, NULL);
|
||||
ast_sip_report_req_no_support(endpoint, rdata, "registrar_attempt_without_registration_permitted");
|
||||
ast_log(LOG_WARNING, "AOR '%s' has no configured max_contacts. Endpoint '%s' unable to register\n",
|
||||
aor_name, ast_sorcery_object_get_id(endpoint));
|
||||
ast_log(LOG_WARNING, "AOR '%s' has no configured max_contacts. Endpoint '%s' (%s:%d) unable to register\n",
|
||||
aor_name, ast_sorcery_object_get_id(endpoint),
|
||||
rdata->pkt_info.src_name, rdata->pkt_info.src_port);
|
||||
} else {
|
||||
register_aor(rdata, endpoint, aor, aor_name);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue