Custom extension with Asterisk that "Answers" then "Beeps"

2.2k views Asked by At

I'm trying to solve a very painful problem that impedes on my world utilizing my amazing powers as a programmer... (my front gate makes my friends call my cell phone, then I have to press "9" and it lets them in)...

So, my amazing powers have gotten me very far, except this last part I can't get (perhaps due to lack of sleep).

I've got every thing worked out so far: The call-box now dials my Google Voice account, which forwards it to my virtual machine on my laptop running the latest 'trixbox' (Asterisk), which will receives the call via Gizmo5/SIP junk.

What I need now is to have the phone call answered, and then "press" the number "9"... wait about 5 seconds, then hang-up.

I'm sure it's as easy as putting this code somewhere in a config file:

exten => 1234,1,Answer
exten => 1234,n,Press("the flippin 9 key")
exten => 1234,n,Wait(5)
exten => 1234,n,Hangup

But I don't know:

1) Is this possible (pretty sure it is) 2) What file do I edit? 3) Do I need to make an extension first? 4) Is that code in my example above anywhere close? 5) What do I actually need to do!

I greatly appreciate any help on this one.

1

There are 1 answers

2
payne On BEST ANSWER

You're close, try:

exten => 1234,1,Answer
exten => 1234,2,Wait(2)      ; Safety time
exten => 1234,3,SendDTMF(9)
exten => 1234,4,Wait(5)
exten => 1234,5,Hangup

This tells Asterisk how to handle a call coming in for 1234

In a "standard" Asterisk installation, this goes in extensions.conf and 1234 should be whatever extension/number the incoming call is coming in on.

extensions.conf has different sections, which can vary based on distribution and local setup, but it's usually best to put this in the [default] section.