----- Original Message ----- > From: "Steve Edwards" <asterisk....@sedwards.com> > To: "Asterisk Users Mailing List - Non-Commercial Discussion" > <asterisk-users@lists.digium.com> > Sent: Saturday, September 29, 2012 10:44:25 AM > Subject: Re: [asterisk-users] Reuse h extension? > > On Sat, 29 Sep 2012, Stefan at WPF wrote: > > > I have 2 contexts, however both have the same h extension. > > Currently I am doing copy&paste for the h extension - is there a > > better way? > > Can I somehow reference a h extension, so I have to create/modify > > it only once?
In addition to Steve's approach using templates, in Asterisk 11, you'll be able to use hangup handlers. These are subroutines that can be attached to a channel and are executed after the channel is hung up. [hangup_handler] exten => my_handler,1,NoOp() same => n,Verbose(Execute your normal 'h' extension logic here) same => n,Return() [context_1] exten => 123,1,NoOp() same => n,Set(CHANNEL(hangup_handler_push)=hangup_handler,my_handler,1) same => n,Verbose(do stuff) [context_2] exten => 123,1,NoOp() same => n,Set(CHANNEL(hangup_handler_push)=hangup_handler,my_handler,1) same => n,Verbose(do stuff) More on hangup handlers is available here: https://wiki.asterisk.org/wiki/display/AST/Hangup+Handlers -- Matthew Jordan Digium, Inc. | Engineering Manager 445 Jan Davis Drive NW - Huntsville, AL 35806 - USA Check us out at: http://digium.com & http://asterisk.org -- _____________________________________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users