Enter Customer ID before going to destination

I want to have inbound callers enter their customer ID before they get access to a queue for our tech support team. I don’t need to validate the number they enter (customer ID) against a database (would be nice however). I just need to check that it is a 6 digit number before their call goes through to the techs. This would stop clients who are using a demo instead of paid from bugging the techs after hours.

Can anyone point me to an example or sample of how to do this?

aterisk 1.6.2.15
dahdi 2.4.0
Ubuntu server 10.4.1

Hi there.

Something like this:

exten => s,1,Wait(1)
exten => s,n,Read(custno,,6,3,10)
exten => s,n,Gotoif($[ “${LEN(${custno})}” = “6”]?s,20
exten => s,n,Noop(Not 6 digits)
exten => s,n,Hangup()
exten => s,20,Noop(6 digits enteret, forwarding to techs)

More info about the read command here: voip-info.org/wiki/view/Asterisk+cmd+Read

Part of it is working but not the counting.

Here is what I have in extensions_custom.conf.
[custom-digits]
exten => s,1,Wait(1)
exten => s,n,Read(custno,kentucky,6,3,10)
exten => s,n,Gotoif($[ “${LEN(${custno})}” = “6”]?s,20
exten => s,n,Noop(Not 6 digits)
exten => s,n,Hangup()
exten => s,20,Noop(6 digits entered, forwarding to techs)

in FreePBX I have a custom destination set to custom-digits,s,1

  • That destination is an option on an ivr.
  • The prompt works
  • It gets the 6 digit number
  • It says it’s not 6 digits and therefore goes to the wrong branch/line

Also I am not sure what to put under “forwarding to techs”. They are static members of a queue with number 6600
exten => s,n,Dial(SIP/6600)??

CLI OUTPUT

-- Starting simple switch on 'DAHDI/1-1'
-- Executing [s@from-zaptel:1] NoOp("DAHDI/1-1", "Entering from-zaptel with DID == ") in new stack
-- Executing [s@from-zaptel:2] Ringing("DAHDI/1-1", "") in new stack
-- Executing [s@from-zaptel:3] Set("DAHDI/1-1", "DID=s") in new stack
-- Executing [s@from-zaptel:4] NoOp("DAHDI/1-1", "DID is now s") in new stack
-- Executing [s@from-zaptel:5] GotoIf("DAHDI/1-1", "1?zapok:notzap") in new stack
-- Goto (from-zaptel,s,8)
-- Executing [s@from-zaptel:8] NoOp("DAHDI/1-1", "Is a Zaptel Channel") in new stack
-- Executing [s@from-zaptel:9] Set("DAHDI/1-1", "CHAN=1-1") in new stack
-- Executing [s@from-zaptel:10] Set("DAHDI/1-1", "CHAN=1") in new stack
-- Executing [s@from-zaptel:11] Macro("DAHDI/1-1", "from-zaptel-1,s,1") in new stack
-- Executing [s@macro-from-zaptel-1:1] NoOp("DAHDI/1-1", "Entering macro-from-zaptel-1 with DID = s and setting to: 15136861881") in new stack
-- Executing [s@macro-from-zaptel-1:2] Set("DAHDI/1-1", "__FROM_DID=15136861881") in new stack
-- Executing [s@macro-from-zaptel-1:3] Goto("DAHDI/1-1", "from-trunk,15136861881,1") in new stack
-- Goto (from-trunk,15136861881,1)

== Channel ‘DAHDI/1-1’ jumping out of macro ‘from-zaptel-1’
– Executing [15136861881@from-trunk:1] Set(“DAHDI/1-1”, “__FROM_DID=15136861881”) in new stack
– Executing [15136861881@from-trunk:2] Gosub(“DAHDI/1-1”, “app-blacklist-check,s,1”) in new stack
– Executing [s@app-blacklist-check:1] GotoIf(“DAHDI/1-1”, “0?blacklisted”) in new stack
– Executing [s@app-blacklist-check:2] Set(“DAHDI/1-1”, “CALLED_BLACKLIST=1”) in new stack
– Executing [s@app-blacklist-check:3] Return(“DAHDI/1-1”, “”) in new stack
– Executing [15136861881@from-trunk:3] ExecIf(“DAHDI/1-1”, “1 ?Set(CALLERID(name)=)”) in new stack
– Executing [15136861881@from-trunk:4] Set(“DAHDI/1-1”, “__CALLINGPRES_SV=allowed_not_screened”) in new stack
– Executing [15136861881@from-trunk:5] Set(“DAHDI/1-1”, “CALLERPRES()=allowed_not_screened”) in new stack
– Executing [15136861881@from-trunk:6] Goto(“DAHDI/1-1”, “ivr-2,s,1”) in new stack
– Goto (ivr-2,s,1)
– Executing [s@ivr-2:1] Set(“DAHDI/1-1”, “MSG=custom/sixdigit”) in new stack
– Executing [s@ivr-2:2] Set(“DAHDI/1-1”, “LOOPCOUNT=0”) in new stack
– Executing [s@ivr-2:3] Set(“DAHDI/1-1”, “__DIR-CONTEXT=default”) in new stack
– Executing [s@ivr-2:4] Set(“DAHDI/1-1”, “_IVR_CONTEXT_ivr-2=”) in new stack
– Executing [s@ivr-2:5] Set(“DAHDI/1-1”, “_IVR_CONTEXT=ivr-2”) in new stack
– Executing [s@ivr-2:6] GotoIf(“DAHDI/1-1”, “0?begin”) in new stack
– Executing [s@ivr-2:7] Answer(“DAHDI/1-1”, “”) in new stack
– Executing [s@ivr-2:8] Wait(“DAHDI/1-1”, “1”) in new stack
– Executing [s@ivr-2:9] Set(“DAHDI/1-1”, “TIMEOUT(digit)=3”) in new stack
– Digit timeout set to 3.000
– Executing [s@ivr-2:10] Set(“DAHDI/1-1”, “TIMEOUT(response)=10”) in new stack
– Response timeout set to 10.000
– Executing [s@ivr-2:11] Set(“DAHDI/1-1”, “__IVR_RETVM=”) in new stack
– Executing [s@ivr-2:12] ExecIf(“DAHDI/1-1”, “1?Background(custom/sixdigit)”) in new stack
– <DAHDI/1-1> Playing ‘custom/sixdigit.slin’ (language ‘en’)
– Executing [1@ivr-2:1] NoOp(“DAHDI/1-1”, "Deleting: ") in new stack
– Executing [1@ivr-2:2] Set(“DAHDI/1-1”, “__NODEST=”) in new stack
– Executing [1@ivr-2:3] Goto(“DAHDI/1-1”, “custom-digits,s,1”) in new stack
– Goto (custom-digits,s,1)
– Executing [s@custom-digits:1] Wait(“DAHDI/1-1”, “1”) in new stack
– Executing [s@custom-digits:2] Read(“DAHDI/1-1”, “custno,kentucky,6,3,10”) in new stack
– Accepting a maximum of 6 digits.
– <DAHDI/1-1> Playing ‘kentucky.gsm’ (language ‘en’)
– User entered ‘123456’
– Executing [s@custom-digits:3] GotoIf(“DAHDI/1-1”, “0”) in new stack
– Executing [s@custom-digits:4] NoOp(“DAHDI/1-1”, “Not 6 digits”) in new stack
– Executing [s@custom-digits:5] Hangup(“DAHDI/1-1”, “”) in new stack
== Spawn extension (custom-digits, s, 5) exited non-zero on ‘DAHDI/1-1’
– Hungup 'DAHDI/1-1’
ecophone-one*CLI>

If the queue is 6600, then you can use this(max wait time of 240 seconds):

exten => s,n,Queue(6600,240)

ref: voip-info.org/wiki/view/Asterisk+cmd+Queue