[Asterisk-code-review] stasis: Hangup channel for Local channel No such extension error (...asterisk[master])

Friendly Automation asteriskteam at digium.com
Wed May 8 12:22:46 CDT 2019


Friendly Automation has submitted this change and it was merged. ( https://gerrit.asterisk.org/c/asterisk/+/11356 )

Change subject: stasis: Hangup channel for Local channel No such extension error
......................................................................

stasis: Hangup channel for Local channel No such extension error

When we use early bridge with create and dial from stasis using Local channel
and the dialplan does not any entry the it is returned from core_local.c with
No such extension .

In such case asterisk locks up till the channel is not hangup with the error
Exceptionally long voice queue length

* Found that in such case app_control_dial fails on ast_call method and
  return -1
* Since it is called from stasis_app_send_command_async and return -1 does
  not cause resources to be freed and since no PBX exist it is not able to
  read from channel causing exceptionally long queue
* After putting this code found that the channel was releasing immediately
  and resources were freed.

ASTERISK-28399
Reported by: Abhay Gupta
Tested by: Abhay Gupta

Change-Id: I0a55c923fc6995559f808d63b9488762b4489318
---
M res/stasis/control.c
1 file changed, 11 insertions(+), 0 deletions(-)

Approvals:
  Benjamin Keith Ford: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved
  Friendly Automation: Approved for Submit



diff --git a/res/stasis/control.c b/res/stasis/control.c
index 6bac6e8..d3ea7d7 100644
--- a/res/stasis/control.c
+++ b/res/stasis/control.c
@@ -1634,6 +1634,17 @@
 	}
 
 	if (ast_call(chan, args->dialstring, 0)) {
+		/* If call fails normally this channel would then just be normally hung up and destroyed.
+		 * In this case though the channel is being handled by the ARI control thread and dial
+		 * bridge which needs to be notified that the channel should be hung up. To do this we
+		 * queue a soft hangup which will cause each to wake up, see that the channel has been
+		 * hung up, and then destroy it.
+		 */
+		int hangup_flag;
+		hangup_flag = ast_bridge_setup_after_goto(chan) ? AST_SOFTHANGUP_DEV : AST_SOFTHANGUP_ASYNCGOTO;
+		ast_channel_lock(chan);
+		ast_softhangup_nolock(chan, hangup_flag);
+		ast_channel_unlock(chan);
 		return -1;
 	}
 

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

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I0a55c923fc6995559f808d63b9488762b4489318
Gerrit-Change-Number: 11356
Gerrit-PatchSet: 1
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Abhay Gupta <abhay at avissol.com>
Gerrit-Reviewer: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190508/f380dcc6/attachment.html>


More information about the asterisk-code-review mailing list