Re: [asterisk-users] Reuse h extension?

2012-09-30 Thread Stefan at WPF
Thank you all guys, should be enough to get me doing this :-)

2012/9/29 Matthew Jordan mjor...@digium.com



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

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

[asterisk-users] Reuse h extension?

2012-09-29 Thread Stefan at WPF
I have 2 contexts, however both have the same h extension.
Currently I am doing copypaste 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!
--
_
-- 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

Re: [asterisk-users] Reuse h extension?

2012-09-29 Thread Logan Bibby
I have a status context with a hangup extension. All my h calls go
there.

- Logan
On Sep 29, 2012 4:32 AM, Stefan at WPF stefan.at@googlemail.com
wrote:

 I have 2 contexts, however both have the same h extension.
 Currently I am doing copypaste 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!

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

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

Re: [asterisk-users] Reuse h extension?

2012-09-29 Thread Stefan at WPF
How do you redirect all h calls to your status context? Thanks :-)

2012/9/29 Logan Bibby lo...@keobi.com

 I have a status context with a hangup extension. All my h calls go
 there.

 - Logan
 On Sep 29, 2012 4:32 AM, Stefan at WPF stefan.at@googlemail.com
 wrote:

 I have 2 contexts, however both have the same h extension.
 Currently I am doing copypaste 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!

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


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

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

Re: [asterisk-users] Reuse h extension?

2012-09-29 Thread Logan Bibby
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
On Sep 29, 2012 4:36 AM, Stefan at WPF stefan.at@googlemail.com
wrote:

 How do you redirect all h calls to your status context? Thanks :-)

 2012/9/29 Logan Bibby lo...@keobi.com

 I have a status context with a hangup extension. All my h calls go
 there.

 - Logan
 On Sep 29, 2012 4:32 AM, Stefan at WPF stefan.at@googlemail.com
 wrote:

 I have 2 contexts, however both have the same h extension.
 Currently I am doing copypaste 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!

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


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



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

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

Re: [asterisk-users] Reuse h extension?

2012-09-29 Thread Stefan at WPF
Thanks Logan. Can you send an extract of your extensions.conf, how you do
that?

2012/9/29 Logan Bibby lo...@keobi.com

 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
 On Sep 29, 2012 4:36 AM, Stefan at WPF stefan.at@googlemail.com
 wrote:

 How do you redirect all h calls to your status context? Thanks :-)

 2012/9/29 Logan Bibby lo...@keobi.com

 I have a status context with a hangup extension. All my h calls go
 there.

 - Logan
 On Sep 29, 2012 4:32 AM, Stefan at WPF stefan.at@googlemail.com
 wrote:

 I have 2 contexts, however both have the same h extension.
 Currently I am doing copypaste 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!

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


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



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


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

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

Re: [asterisk-users] Reuse h extension?

2012-09-29 Thread Johan Wilfer
2012-09-29 11:32, Stefan at WPF skrev:
 I have 2 contexts, however both have the same h extension.
 Currently I am doing copypaste 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!
 

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)


-- 
Johan Wilfer

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


Re: [asterisk-users] Reuse h extension?

2012-09-29 Thread Logan Bibby
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
On Sep 29, 2012 6:08 AM, Stefan at WPF stefan.at@googlemail.com
wrote:

 Thanks Logan. Can you send an extract of your extensions.conf, how you do
 that?

 2012/9/29 Logan Bibby lo...@keobi.com

 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
 On Sep 29, 2012 4:36 AM, Stefan at WPF stefan.at@googlemail.com
 wrote:

 How do you redirect all h calls to your status context? Thanks :-)

 2012/9/29 Logan Bibby lo...@keobi.com

 I have a status context with a hangup extension. All my h calls go
 there.

 - Logan
 On Sep 29, 2012 4:32 AM, Stefan at WPF stefan.at@googlemail.com
 wrote:

 I have 2 contexts, however both have the same h extension.
 Currently I am doing copypaste 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!

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


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



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


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



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

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

Re: [asterisk-users] Reuse h extension?

2012-09-29 Thread Steve Edwards

On Sat, 29 Sep 2012, Stefan at WPF wrote:


I have 2 contexts, however both have the same h extension.
Currently I am doing copypaste 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?


; 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()

--
Thanks in advance,
-
Steve Edwards   sedwa...@sedwards.com  Voice: +1-760-468-3867 PST
Newline  Fax: +1-760-731-3000

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