<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jul 18, 2017 at 6:49 PM, John Kiniston <span dir="ltr"><<a href="mailto:johnkiniston@gmail.com" target="_blank">johnkiniston@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>I'm messing around with pre-dialer handlers today and running into a wall.<br></div><div><br>Dial has the U option where I can execute a Gosub when the channels bridge and there I can set the variable GOSUB_RESULT to BUSY to make Dial act like the channel I called was Busy.<br></div></div></blockquote><div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><br></div><div>I want to do something similar with a Pre-Dial handler but don't see a way I can Set a variable or return a value that will cause Dial to act like the channel I called was Busy?<br></div><div><br>Use case:<br>Endpoint 100 calls Extension 101<br><br></div><div>Extension 101 has a Pre-Dial Handler that checks how many calls Endpoint 101 has in progress and if it's greater than X returns a Busy.<br></div><div><br></div><div>Dial acts like it got a Busy back from the Endpoint, Sets DIALSTATUS and continues through it's dial-plan.<br><br></div><div>I've tried using the BUSY() Application inside my Pre-Dial handler.<br></div><div>I've tried sending BUSY back as a Value with Return() to be picked up in GOSUB_RETVAL<br></div><div>I've tried setting DIALSTATUS to BUSY.<br><br></div><div>Am I trying to use the wrong tool for the Job here?<br></div></div></blockquote><div><br></div><div>Why don't you do the how many calls the endpoint has check before Dial()?<br>You can use the LOCK/UNLOCK functions as shown in [1] on the calling channel pre-dial<br>routine to prevent reentrancy issues while doing the check.  The called channel pre-dial<br>routine is only to setup the channels you have decided to dial.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><br></div><div>Related, Why can we have multiple Hangup handlers but not Pre-Dial handlers?<span class="gmail-HOEnZb"><font color="#888888"><br></font></span></div></div></blockquote><div><br><div>* There is only one dial to execute the called channel pre-dial handler while there are many opportunities to specify hangup handlers.<br></div>* How do you think you could associate different pre-dial handlers to different called channels? <br><br></div><div>Richard<br></div><br><div>[1] <a href="http://blogs.asterisk.org/2017/03/29/dialplan-handler-routines-allow-customization/">http://blogs.asterisk.org/2017/03/29/dialplan-handler-routines-allow-customization/</a><br></div></div><br></div></div>