Macro and running commands after call ends

Hi I would like to run a few commands after a macro is executed.

Currently I am use
exten => h
This works well but runs after every call not after the one macro I want it to.

How do I run a set of commands after executing a specific macro but not any other macro?

Thanks

Right now I can only imagine passing a variable(frommacro maybe?) and then use GotoIf/ExecIf in the exten h.

Thanks for the idea. This may answer my question.

I was thinking that I could have a separate exten => h for each context.

The way I have my contexts at present is as follows

[general]
static = yes

[global]

[default]
include => Extn1
include => Extn2
include => Extn3
exten => h,1,Verbose(4,################# H in default context #################)
exten => h,2,Hangup()
exten => t,1,Hangup()

[Extn1]
exten => 11,1,Dial(SIP/11)
exten => h,1,Verbose(4,################# H in extn1 context #################)
exten => h,2,Hangup()
exten => t,1,Hangup()

[Extn2]
exten => 22,1,Dial(SIP/22)
exten => h,1,Verbose(4,################# H in extn2 context #################)
exten => h,2,Hangup()
exten => t,1,Hangup()

[Extn3]
exten => 33,1,Dial(SIP/33)
exten => h,1,Verbose(4,################# H in extn3 context #################)
exten => h,2,Hangup()
exten => t,1,Hangup()

If I dial from extn 11 to 22 and hang up I will get the exten => h from default. OK that’s fare it is the default. So I will take that out
If perform the same test I then get the exten => h from Extn1 context. This looks better as I originated the call from that context. However if I take the exten => h statement from the Extn1 context and call from extn 11 to 33 I get the exten => h from context Extn2.

So it appears that the first exten => h found in the order of the include context is the first and only which is executed.

So my question is there a way each context can call each other but only execute the exten => h for the context called?

can you only have one exten => h extension in your dialplan?

Thanks

You might want to look into Hangup Handlers:

wiki.asterisk.org/wiki/display/ … p+Handlers

they’re part of Asterisk 11

Yes this works.

exten => h is still run if there is one in an available context but I can manage that.

I’m not sure I get the full idea of having multiple hangup_handlers that you can change and extract. Why not just have a variable you change?

Anyway thanks for the link.