Reuse H Extension?

Home » Asterisk Users » Reuse H Extension?
Asterisk Users 9 Comments

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?

Thanks for any hint!

9 thoughts on - Reuse H Extension?

  • I do. I call the Hangup application in priority 1 so I can send calls there without needing to call it. Then the h extension goes to status,hangup,2.

    – Logan

  • 2012-09-29 11:32, Stefan at WPF skrev:

    Have you tried goto? I have some extensions that are related and I use goto to the main context from the others.

    Goto(context,h,1)

  • I don’t have it readily available, but it would be something like this

    [status]
    exten => hangup,1,Hangup same => 2,NoOp(Hangup)
    ; do further processing here

    [default]
    exten => 1234,1,Answer
    ; other priorities same => Goto(status,hangup,1) ; < - actually hangs up the channel exten => h,1,Goto(status,hangup,2) ; <- processes a channel not hung up by the dialplan

  • ; templates
    [h](!)
    exten = h,1, verbose(1,[${EXTEN}@${CONTEXT}])
    exten = h,n, goto(settle-card,s,1)

    [i](!)
    exten = i,1, verbose(1,[${EXTEN}@${CONTEXT}])
    exten = i,n, goto(${CONTEXT},s,1)

    [s](!)
    exten = s,1, verbose(1,[${EXTEN}@${CONTEXT}])

    ; example1
    [example1](h,i,s)
    exten = s,2, blah-blah-blah()
    exten = s,n, hangup()

    ; example2
    [example2](h,i,s)
    exten = s,2, blah-blah-blah()
    exten = s,n, hangup()