[asterisk-users] start n run an agi script on hangup
Steve Edwards
asterisk.org at sedwards.com
Sat Jun 14 03:00:54 CDT 2008
On Fri, 13 Jun 2008, Benjamin Jacob wrote:
> I think, you can use the 'h' extension to invoke scripts (DeadAGI to be
> more precise) on hungup channels. use something like this :
>
> exten => _X., 1, NoOp(got a call)
> exten => _X., n, Dial(<somexten>}
> ....
>
> exten => h, 1, DeadAGI(hangupScript.sh)
Just to clarify...
You don't need the "h" extension to invoke deadagi(). You need the "h"
extension to "catch" the channel hangup.
You may have several contexts in your dialplan where you want to catch a
channel hangup. If the code you want to execute in each context is the
same, you could "catch" the channel hangup and go to a common context to
finish the call. For example:
[example-1]
.
.
.
exten = h,1, verbose(1,Hangup detected)
exten = h,n, goto(finish-call,s,1)
[example-2]
.
.
.
exten = h,1, verbose(1,Hangup detected)
exten = h,n, goto(finish-call,s,1)
finish-call]
exten = s,1, verbose(1,Finishing call)
exten = s,n, deadagi(cleanup-database)
Note that deadagi() is invoked from "s," not "h."
Personally, I would use the "h" extension in finish-call so that it is
obvious that we think we are processing a hung up channel -- but it is not
a requirement.
You could clean this example up a bit with a template:
[h](!)
exten = h,1, verbose(1,Hangup detected)
exten = h,n, goto(finish-call,h,1)
[example-1](h)
.
.
.
[example-2](h)
.
.
.
finish-call]
exten = h,1, verbose(1,Finishing call)
exten = h,n, deadagi(cleanup-database)
Thanks in advance,
------------------------------------------------------------------------
Steve Edwards sedwards at sedwards.com Voice: +1-760-468-3867 PST
Newline Fax: +1-760-731-3000
More information about the asterisk-users
mailing list