<p>Friendly Automation <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/13693">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Joshua Colp: Looks good to me, but someone else must approve
Kevin Harwell: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved
Friendly Automation: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_pjsip_messaging: Ensure MESSAGE_SEND_STATUS is set properly<br><br>We need to wait for the message sending callback to finish to know if<br>we succeeded or failed.<br><br>ASTERISK-25421 #close<br>Reported by: Dmitriy Serov<br><br>Change-Id: I22b954398821d2caf4c6fe58f0607c8cfa378059<br>---<br>M res/res_pjsip_messaging.c<br>1 file changed, 10 insertions(+), 6 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/res/res_pjsip_messaging.c b/res/res_pjsip_messaging.c</span><br><span>index 930cf84..72b7d17 100644</span><br><span>--- a/res/res_pjsip_messaging.c</span><br><span>+++ b/res/res_pjsip_messaging.c</span><br><span>@@ -637,7 +637,7 @@</span><br><span> </span><br><span> static int msg_send(void *data)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">- RAII_VAR(struct msg_data *, mdata, data, ao2_cleanup);</span><br><span style="color: hsl(120, 100%, 40%);">+ struct msg_data *mdata = data; /* The caller holds a reference */</span><br><span> </span><br><span> const struct ast_sip_body body = {</span><br><span> .type = "text",</span><br><span>@@ -681,24 +681,28 @@</span><br><span> return -1;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- return PJ_SUCCESS;</span><br><span style="color: hsl(120, 100%, 40%);">+ return 0;</span><br><span> }</span><br><span> </span><br><span> static int sip_msg_send(const struct ast_msg *msg, const char *to, const char *from)</span><br><span> {</span><br><span> struct msg_data *mdata;</span><br><span style="color: hsl(120, 100%, 40%);">+ int res;</span><br><span> </span><br><span> if (ast_strlen_zero(to)) {</span><br><span> ast_log(LOG_ERROR, "SIP MESSAGE - a 'To' URI must be specified\n");</span><br><span> return -1;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (!(mdata = msg_data_create(msg, to, from)) ||</span><br><span style="color: hsl(0, 100%, 40%);">- ast_sip_push_task(message_serializer, msg_send, mdata)) {</span><br><span style="color: hsl(0, 100%, 40%);">- ao2_cleanup(mdata);</span><br><span style="color: hsl(120, 100%, 40%);">+ mdata = msg_data_create(msg, to, from);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!mdata) {</span><br><span> return -1;</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">- return 0;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ res = ast_sip_push_task_wait_serializer(message_serializer, msg_send, mdata);</span><br><span style="color: hsl(120, 100%, 40%);">+ ao2_ref(mdata, -1);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ return res;</span><br><span> }</span><br><span> </span><br><span> static const struct ast_msg_tech msg_tech = {</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/13693">change 13693</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/+/13693"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 16 </div>
<div style="display:none"> Gerrit-Change-Id: I22b954398821d2caf4c6fe58f0607c8cfa378059 </div>
<div style="display:none"> Gerrit-Change-Number: 13693 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Sean Bright <sean.bright@gmail.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: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>