[asterisk-dev] Arbitrary hangup handlers [patch]

Tilghman Lesher tlesher at digium.com
Mon Sep 13 23:08:08 CDT 2010


On Monday 13 September 2010 15:55:50 Mark Murawski wrote:
> I've just finished writing a hangup handler module. And associated
> helper function ast_pbx_exten_parse(), which I think is needed to
> separate the functionality of parsing a gosub target from actually going
> to the target.  It's been malloc debugged and valgrind debugged.
>
> Overview of module:
> I find the 'h' extensions to be limited, cumbersome, and error prone
> when writing very complex dialplan, especially when using lots of gotos
> and gosubs.  Say you have a main dialplan entry point context called
> callqueue.  If at any point after callqueue runs, you want to run a
> hangup handler specific for the callqueue dialplan, you have to put an
> 'h' extension in every single context you plan to possibly jump to after
> entering callqueue.  This solves that problem, and gives the added
> benefit of cascading hangup handlers.

I'd like to see mechanisms both for adding and removing handlers, especially
if you're going to have multiple handlers, in no particular order (or reverse
order, if this is a stack).  We absolutely need to define what particular
order each will run, if we have multiple, and reverse order is likely the most
practical.

Perhaps, on the order of:
Set(CHANNEL(hanguphandler,add)=somesubroutine,h,1)
Set(CHANNEL(hanguphandler,remove)=somesubroutine,h,1)
and one that pops the last off and adds a new one in a single step:
Set(CHANNEL(hanguphandler,replace)=nextcheckpoint,h,1)

-- 
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