<p>Dmitriy Serov has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/10445">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_pjsip_outbound_registration: Adding Cause field value to AMI event Registry<br><br>Often there are problems with outbound registration.<br>By tracking the AMI Registry event, I want to know the textual cause of<br>registration problems that the server often reports.<br>Cause field of AMI event is the most appropriate way to get this information.<br><br>ASTERISK-28092 #close<br>Reported-by: Dmitriy Serov<br><br>Change-Id: I52d5176d9449d657ad3d33c1437f800c6318dc7b<br>---<br>M res/res_pjsip_outbound_registration.c<br>1 file changed, 14 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/45/10445/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/res/res_pjsip_outbound_registration.c b/res/res_pjsip_outbound_registration.c</span><br><span>index b5c42f1..5c22fd7 100644</span><br><span>--- a/res/res_pjsip_outbound_registration.c</span><br><span>+++ b/res/res_pjsip_outbound_registration.c</span><br><span>@@ -892,6 +892,7 @@</span><br><span> pjsip_regc_info info;</span><br><span> char server_uri[PJSIP_MAX_URL_SIZE];</span><br><span> char client_uri[PJSIP_MAX_URL_SIZE];</span><br><span style="color: hsl(120, 100%, 40%);">+ const char *reason = NULL;</span><br><span> </span><br><span> if (response->client_state->status == SIP_REGISTRATION_STOPPED) {</span><br><span> ao2_ref(response, -1);</span><br><span>@@ -1011,8 +1012,20 @@</span><br><span> }</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ if (response->rdata) {</span><br><span style="color: hsl(120, 100%, 40%);">+ static const pj_str_t str_reason = { "Reason", 6 };</span><br><span style="color: hsl(120, 100%, 40%);">+ pjsip_generic_string_hdr *reason_hdr;</span><br><span style="color: hsl(120, 100%, 40%);">+ pj_str_t reason_value;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ reason_hdr = pjsip_msg_find_hdr_by_name(response->rdata->msg_info.msg, &str_reason, NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (reason_hdr) {</span><br><span style="color: hsl(120, 100%, 40%);">+ pj_strdup_with_null(response->rdata->tp_info.pool, &reason_value, &reason_hdr->hvalue);</span><br><span style="color: hsl(120, 100%, 40%);">+ reason = pj_strbuf(&reason_value);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> ast_system_publish_registry("PJSIP", client_uri, server_uri,</span><br><span style="color: hsl(0, 100%, 40%);">- sip_outbound_registration_status_str(response->client_state->status), NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+ sip_outbound_registration_status_str(response->client_state->status), reason);</span><br><span> </span><br><span> if (response->client_state->destroy) {</span><br><span> /* We have a pending deferred destruction to complete now. */</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/10445">change 10445</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/10445"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 15 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I52d5176d9449d657ad3d33c1437f800c6318dc7b </div>
<div style="display:none"> Gerrit-Change-Number: 10445 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Dmitriy Serov <serov.d.p@gmail.com> </div>