<p>Joshua Colp <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/6732">View Change</a></p><div style="white-space:pre-wrap">Approvals:
George Joseph: Looks good to me, but someone else must approve
Joshua Colp: Looks good to me, but someone else must approve; Approved for Submit
Richard Mudgett: Looks good to me, approved
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">app_originate: Set ORIGINATE_STATUS correctly on failure<br><br>We were ignoring the return value from ast_pbx_outgoing_exten() and<br>ast_pbx_outgoing_app() which could fail before setting the reason code.<br>This resulted in failures being reported as success.<br><br>ASTERISK-25266 #close<br>Reported by: Allen Ford<br><br>Change-Id: Idf16237b7e41b527d2c69c865829128686beeb3b<br>---<br>M apps/app_originate.c<br>1 file changed, 23 insertions(+), 9 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/apps/app_originate.c b/apps/app_originate.c<br>index 8edccc7..30fa565 100644<br>--- a/apps/app_originate.c<br>+++ b/apps/app_originate.c<br>@@ -155,6 +155,7 @@<br> char *parse;<br> char *chantech, *chandata;<br> int res = -1;<br>+ int continue_in_dialplan = 0;<br> int outgoing_status = 0;<br> unsigned int timeout = 30;<br> static const char default_exten[] = "s";<br>@@ -223,6 +224,12 @@<br> predial_callee = opt_args[OPT_ARG_PREDIAL_CALLEE];<br> }<br> <br>+ if (strcasecmp(args.type, "exten") && strcasecmp(args.type, "app")) {<br>+ ast_log(LOG_ERROR, "Incorrect type, it should be 'exten' or 'app': %s\n",<br>+ args.type);<br>+ goto return_cleanup;<br>+ }<br>+<br> if (!strcasecmp(args.type, "exten")) {<br> int priority = 1; /* Initialized in case priority not specified */<br> const char *exten = args.arg2;<br>@@ -241,25 +248,32 @@<br> ast_debug(1, "Originating call to '%s/%s' and connecting them to extension %s,%s,%d\n",<br> chantech, chandata, args.arg1, exten, priority);<br> <br>- ast_pbx_outgoing_exten_predial(chantech, cap_slin, chandata,<br>+ res = ast_pbx_outgoing_exten_predial(chantech, cap_slin, chandata,<br> timeout * 1000, args.arg1, exten, priority, &outgoing_status,<br> AST_OUTGOING_WAIT, NULL, NULL, NULL, NULL, NULL, 0, NULL,<br> predial_callee);<br>- } else if (!strcasecmp(args.type, "app")) {<br>+ } else {<br> ast_debug(1, "Originating call to '%s/%s' and connecting them to %s(%s)\n",<br> chantech, chandata, args.arg1, S_OR(args.arg2, ""));<br> <br>- ast_pbx_outgoing_app_predial(chantech, cap_slin, chandata,<br>+ res = ast_pbx_outgoing_app_predial(chantech, cap_slin, chandata,<br> timeout * 1000, args.arg1, args.arg2, &outgoing_status,<br> AST_OUTGOING_WAIT, NULL, NULL, NULL, NULL, NULL, NULL,<br> predial_callee);<br>- } else {<br>- ast_log(LOG_ERROR, "Incorrect type, it should be 'exten' or 'app': %s\n",<br>- args.type);<br>- goto return_cleanup;<br> }<br> <br>- res = 0;<br>+ /*<br>+ * Getting here means that we have passed the various validation checks and<br>+ * have at least attempted the dial. If we have a reason (outgoing_status),<br>+ * we clear our error indicator so that we ultimately report the right thing<br>+ * to the caller.<br>+ */<br>+ if (res && outgoing_status) {<br>+ res = 0;<br>+ }<br>+<br>+ /* We need to exit cleanly if we've gotten this far */<br>+ continue_in_dialplan = 1;<br> <br> return_cleanup:<br> if (res) {<br>@@ -292,7 +306,7 @@<br> ao2_cleanup(cap_slin);<br> ast_autoservice_stop(chan);<br> <br>- return res;<br>+ return continue_in_dialplan ? 0 : -1;<br> }<br> <br> static int unload_module(void)<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/6732">change 6732</a>. To unsubscribe, 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/6732"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: Idf16237b7e41b527d2c69c865829128686beeb3b </div>
<div style="display:none"> Gerrit-Change-Number: 6732 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Sean Bright <sean.bright@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Richard Mudgett <rmudgett@digium.com> </div>