[Asterisk-Users] Dial Tone

Gavin Hamill
2005-04-27T04:27:28Z

On Wednesday 27 April 2005 12:12, Henry Jensen wrote:
> Hi,
>
> User wants to call the number 12345
>
> 1. User picks up the hook
> 2. User dials 0 -> hears dial tone
> 3. User dials 1 -> dial tone stops
> 4. User dials 2345 -> phone 12345 is ringing

We're using chan_capi and had this same problem... The following really
hacky
solution works OK with Asterisk 1.0.7, but not with CVS - I don't know why
:)

[default]
exten => _120.,1,Goto(s,1) ; fax extensions are 1201 -> 1208

exten => s,1,NoOp( incoming call from ISDN )
exten => s,2,Answer
exten => s,3,PlayTones(dial)            ; Give the caller a familiar noise.
exten => s,4,DigitTimeout(0.1)
exten => s,5,WaitExten(0.1)

; next section captures the next digit and stops the dialtone
exten => _X,1,NoOp( Got a digit! It was ${EXTEN})
exten => _X,2,StopPlaytones()
exten => _X,3,SetVar(Predigits=${EXTEN})         ; Put that digit aside for
use later...
exten => _X,4,Goto(s-gathermoredigits,1)

exten => s-gathermoredigits,1,NoOp( Now looking for the rest of the number)
exten => s-gathermoredigits,2,DigitTimeout,3
exten => s-gathermoredigits,3,WaitExten(8)      ; and give the caller 8
seconds overall to do their thing

; log + dial the composite number of Predigits + the remainder
exten => _X.,1,NoOp(${TIMESTAMP} ok, now we're going to dial
${Predigits}${EXTEN})
exten => _X.,2,Goto(outbound,${Predigits}${EXTEN},1)

exten => t,1,Goto(#,1)                  ; If they take too long, give up
exten => i,1,Playback(invalid)          ; "That's not valid, try
again"

The [outbound] context is jsut full of the normal exten =>
_01.,1,Dial(blaaah)
call routing

If someone has a better way of doing this, I'd be interested to hear it!

Cheers,
Gavin.