[Asterisk-code-review] main/pbx.c: Fixed to call the ast_softhangup() (...asterisk[13])

sungtae kim asteriskteam at digium.com
Wed May 8 17:03:16 CDT 2019


sungtae kim has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/11368


Change subject: main/pbx.c: Fixed to call the ast_softhangup()
......................................................................

main/pbx.c: Fixed to call the ast_softhangup()

If the channel moved to the normal dialplan from the stasis() application,
it doesn't create a SoftChannelRequest(AMI)/ChannelHangupRequest(ARI) events
for Hangup() application or when the Dialplan is over.
Fixed it to call the those events create handler properly.

ASTERISK-28336

Change-Id: I6652359e42bb9fe3f2c44c03df4365c183baf73d
---
M res/ari/resource_channels.c
M res/res_stasis.c
2 files changed, 8 insertions(+), 7 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/68/11368/1

diff --git a/res/ari/resource_channels.c b/res/ari/resource_channels.c
index bdb3534..5a55450 100644
--- a/res/ari/resource_channels.c
+++ b/res/ari/resource_channels.c
@@ -885,11 +885,17 @@
 
 	if (!ast_strlen_zero(origination->appdata)) {
 		struct ast_app *app = pbx_findapp("Stasis");
+		int ret;
 
 		if (app) {
 			ast_verb(4, "Launching Stasis(%s) on %s\n", origination->appdata,
 				ast_channel_name(ast_dial_answered(dial)));
-			pbx_exec(ast_dial_answered(dial), app, origination->appdata);
+			ret = pbx_exec(ast_dial_answered(dial), app, origination->appdata);
+			if (!ret) {
+				/* The channel was already hungup in the Stasis().
+				 * So we steal the answered channel so don't make hangup again. */
+				ast_dial_answered_steal(dial);
+			}
 		} else {
 			ast_log(LOG_WARNING, "No such application 'Stasis'\n");
 		}
diff --git a/res/res_stasis.c b/res/res_stasis.c
index 114a43f..5118bc4 100644
--- a/res/res_stasis.c
+++ b/res/res_stasis.c
@@ -1593,12 +1593,7 @@
 		ast_channel_unlock(chan);
 
 		if (!chan_hungup) {
-			struct ast_pbx_args pbx_args;
-
-			memset(&pbx_args, 0, sizeof(pbx_args));
-			pbx_args.no_hangup_chan = 1;
-
-			res = ast_pbx_run_args(chan, &pbx_args);
+			res = ast_pbx_run_args(chan, NULL);
 		}
 	}
 

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/11368
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Change-Id: I6652359e42bb9fe3f2c44c03df4365c183baf73d
Gerrit-Change-Number: 11368
Gerrit-PatchSet: 1
Gerrit-Owner: sungtae kim <pchero21 at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190508/86389d12/attachment-0001.html>


More information about the asterisk-code-review mailing list