<p>George Joseph <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/15539">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Sean Bright: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved; Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_pjsip_registrar: Include source IP and port in log messages.<br><br>When registering it can be useful to see the source IP address and<br>port in cases where multiple devices are using the same endpoint<br>or when anonymous is in use.<br><br>ASTERISK-29325<br><br>Change-Id: Ie178a6f55f53f8473035854c411bc3d056e0a2e0<br>---<br>M res/res_pjsip_registrar.c<br>1 file changed, 13 insertions(+), 8 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/res/res_pjsip_registrar.c b/res/res_pjsip_registrar.c</span><br><span>index 44b59c1..c4c091f 100644</span><br><span>--- a/res/res_pjsip_registrar.c</span><br><span>+++ b/res/res_pjsip_registrar.c</span><br><span>@@ -682,8 +682,9 @@</span><br><span> if (contact_count > aor->max_contacts) {</span><br><span> /* Enforce the maximum number of contacts */</span><br><span> ast_sip_report_failed_acl(endpoint, rdata, "registrar_attempt_exceeds_maximum_configured_contacts");</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING, "Registration attempt from endpoint '%s' to AOR '%s' will exceed max contacts of %u\n",</span><br><span style="color: hsl(0, 100%, 40%);">- ast_sorcery_object_get_id(endpoint), aor_name, aor->max_contacts);</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_log(LOG_WARNING, "Registration attempt from endpoint '%s' (%s:%d) to AOR '%s' will exceed max contacts of %u\n",</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_sorcery_object_get_id(endpoint), rdata->pkt_info.src_name, rdata->pkt_info.src_port,</span><br><span style="color: hsl(120, 100%, 40%);">+ aor_name, aor->max_contacts);</span><br><span> response->code = 403;</span><br><span> pjsip_endpt_release_pool(ast_sip_get_pjsip_endpoint(), details.pool);</span><br><span> ao2_cleanup(existing_contacts);</span><br><span>@@ -1077,8 +1078,9 @@</span><br><span> /* The provided AOR name was not found (be it within the configuration or sorcery itself) */</span><br><span> pjsip_endpt_respond_stateless(ast_sip_get_pjsip_endpoint(), rdata, 404, NULL, NULL, NULL);</span><br><span> ast_sip_report_req_no_support(endpoint, rdata, "registrar_requested_aor_not_found");</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING, "AOR '%s' not found for endpoint '%s'\n",</span><br><span style="color: hsl(0, 100%, 40%);">- aor_name ?: "", ast_sorcery_object_get_id(endpoint));</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_log(LOG_WARNING, "AOR '%s' not found for endpoint '%s' (%s:%d)\n",</span><br><span style="color: hsl(120, 100%, 40%);">+ aor_name ?: "", ast_sorcery_object_get_id(endpoint),</span><br><span style="color: hsl(120, 100%, 40%);">+ rdata->pkt_info.src_name, rdata->pkt_info.src_port);</span><br><span> }</span><br><span> ast_free(aor_name);</span><br><span> return aor;</span><br><span>@@ -1099,14 +1101,16 @@</span><br><span> /* Short circuit early if the endpoint has no AORs configured on it, which means no registration possible */</span><br><span> pjsip_endpt_respond_stateless(ast_sip_get_pjsip_endpoint(), rdata, 403, NULL, NULL, NULL);</span><br><span> ast_sip_report_failed_acl(endpoint, rdata, "registrar_attempt_without_configured_aors");</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING, "Endpoint '%s' has no configured AORs\n", ast_sorcery_object_get_id(endpoint));</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_log(LOG_WARNING, "Endpoint '%s' (%s:%d) has no configured AORs\n", ast_sorcery_object_get_id(endpoint),</span><br><span style="color: hsl(120, 100%, 40%);">+ rdata->pkt_info.src_name, rdata->pkt_info.src_port);</span><br><span> return PJ_TRUE;</span><br><span> }</span><br><span> </span><br><span> if (!PJSIP_URI_SCHEME_IS_SIP(rdata->msg_info.to->uri) && !PJSIP_URI_SCHEME_IS_SIPS(rdata->msg_info.to->uri)) {</span><br><span> pjsip_endpt_respond_stateless(ast_sip_get_pjsip_endpoint(), rdata, 416, NULL, NULL, NULL);</span><br><span> ast_sip_report_failed_acl(endpoint, rdata, "registrar_invalid_uri_in_to_received");</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING, "Endpoint '%s' attempted to register to an AOR with a non-SIP URI\n", ast_sorcery_object_get_id(endpoint));</span><br><span style="color: hsl(120, 100%, 40%);">+ 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),</span><br><span style="color: hsl(120, 100%, 40%);">+ rdata->pkt_info.src_name, rdata->pkt_info.src_port);</span><br><span> return PJ_TRUE;</span><br><span> }</span><br><span> </span><br><span>@@ -1122,8 +1126,9 @@</span><br><span> /* Registration is not permitted for this AOR */</span><br><span> pjsip_endpt_respond_stateless(ast_sip_get_pjsip_endpoint(), rdata, 403, NULL, NULL, NULL);</span><br><span> ast_sip_report_req_no_support(endpoint, rdata, "registrar_attempt_without_registration_permitted");</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING, "AOR '%s' has no configured max_contacts. Endpoint '%s' unable to register\n",</span><br><span style="color: hsl(0, 100%, 40%);">- aor_name, ast_sorcery_object_get_id(endpoint));</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_log(LOG_WARNING, "AOR '%s' has no configured max_contacts. Endpoint '%s' (%s:%d) unable to register\n",</span><br><span style="color: hsl(120, 100%, 40%);">+ aor_name, ast_sorcery_object_get_id(endpoint),</span><br><span style="color: hsl(120, 100%, 40%);">+ rdata->pkt_info.src_name, rdata->pkt_info.src_port);</span><br><span> } else {</span><br><span> register_aor(rdata, endpoint, aor, aor_name);</span><br><span> }</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/15539">change 15539</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/c/asterisk/+/15539"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 18 </div>
<div style="display:none"> Gerrit-Change-Id: Ie178a6f55f53f8473035854c411bc3d056e0a2e0 </div>
<div style="display:none"> Gerrit-Change-Number: 15539 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Sean Bright <sean.bright@gmail.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>