[asterisk-dev] Arbitrary hangup handlers [patch]

Tilghman Lesher tlesher at digium.com
Thu Sep 16 12:06:26 CDT 2010


On Thursday 16 September 2010 10:25:00 Benny Amorsen wrote:
> Mark Murawski <markm at intellasoft.net> writes:
> > I still don't know what the appropriate differentiation is for functions
> > and applications.  The nice thing about functions is you get a return
> > value.  With applications you have to set a channel variable with the
> > contained result.  Say if a hangup handler failed to add because the
> > dialplan didn't exist, it might be nice to check the return code.
>
> IMHO, Error handling in Asterisk dial plan isn't realistic in practice.
> If you are only returning 0 or an error value, then don't bother.
>
> Otherwise you end up with
>
> SET(error=ADDHANDLER(hangup,callqueueHangupHandler))
>
> Obviously I don't speak for the actual developers, just as a random
> Asterisk user.

Please note that this is the -dev list and thus is the place where developers
can discuss such things.

> Besides, your proposed syntax did not provide a return value either:
> > Set(CHANNEL(addhanguphandler)="callqueueHangupHandler,s,1");
> > Set(CHANNEL(addhanguphandler)="someotherHangupHandler,s,1");
> > Set(CHANNEL(addhanguphandler)="yetanotherHangupHandler,s,1");
>
> Instead you set a magic variable CHANNEL(addhanguphandler). Are you
> meant to be able to query that variable afterwards? What would that
> return?
>
> You can also add a function like SET(handler=HANDLER(hangup) which would
> return the last handler which was added. Then you could check that to
> see if your handler was added correctly -- except someone else might
> have added yet another handler, and then your dial plan will get
> confused.

This has already been discussed in another thread of his original post, from
yesterday.  If you have an issue with that proposed syntax, please reply to my
post on the matter.

-- 
Tilghman Lesher
Digium, Inc. | Senior Software Developer
twitter: Corydon76 | IRC: Corydon76-dig (Freenode)
Check us out at: www.digium.com & www.asterisk.org



More information about the asterisk-dev mailing list