DTMF Detection Delay

Hello. In bellow IVR, If I press * button, then asterisk suddenly get it and response. But I press any number, it take about 6 second and give response. What is the issue? I need reduce this responding time not more than 2 second. How do it?

[English_lang_testing]
exten => s,1,NoOp(User Pressed 1 and go to English path)
   same => n,Background(software_en)
  
   same => n,Background(network_en)

   same => n,Background(sales_en)
 
   same => n,Background(hr_en)
  
   same => n,Background(finance_en)
   
   same => n,Background(again_en)

   same => n,Background(previous_en)   

   same => n,Background(exit_en)
   
   same => n,WaitExten(2)
   same => n,Set(tries=$[${tries} +2])
   same => n,GotoIf($[${tries}>=6]?Hangup,s,1)
   same => n,Playback(tryAgain_en)
   same => n,WaitExten(1)
   same => n,Goto(English_lang_testing,s,1)

exten => 1,1,NoOp(User Pressed 1, Goto Software Team)
   same => n,Verbose(1, User pressed 1)
   same => n,Set(QUEUE_ENTRY_TIME=${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M:%S)})
   same => n,System(mysql -u asterisk -p'asterisk' -D asterisk -e "INSERT INTO call_path (caller_id, path_A, path_B, queue_name, dield_number) VALUES ('${CALLERID(num)}', 'Eng_Lang_test','', 'software', '${DIALED_NUMBER}')")
   same => n,Queue(software,,,,30)
   ; Check the result of the queue attempt
   same => n,GotoIf($["${QUEUESTATUS}"="NONE"]?agent_busy,s,1)
   same => n,GotoIf($["${QUEUESTATUS}"="TIMEOUT"|"${QUEUESTATUS}"="FULL"|"${QUEUESTATUS}"="JOINEMPTY"|"${QUEUESTATUS}"="LEAVEEMPTY"|"${QUEUESTATUS}"="NOAGENTS"]?agent_busy,s,1)
   same => n,Set(WAITING_TIME=$[${EPOCH} - ${QUEUE_ENTRY_TIME}])
   same => n,Answer()
   same => n,Set(ANSWER_TIME=${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M:%S)})
   same => n,NoOp(Waiting time: ${STRFTIME(${DIFF(${ANSWER_TIME},${QUEUE_ENTRY_TIME})},,%H:%M:%S)})
   same => n,NoOp(Call duration: ${CDR(duration)})
   same => n,Hangup()

exten => 2,1,NoOp(User Pressed 2, Goto Network Team)
   same => n,Verbose(1, User pressed 2)
   same => n,Set(QUEUE_ENTRY_TIME=${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M:%S)})
   same => n,System(mysql -u asterisk -p'asterisk' -D asterisk -e "INSERT INTO call_path (caller_id, path_A, path_B, queue_name, dield_number) VALUES ('${CALLERID(num)}', 'Eng_Lang_test','', 'network', '${DIALED_NUMBER}')")
   same => n,Queue(software,,,,30)
   ; Check the result of the queue attempt
   same => n,GotoIf($["${QUEUESTATUS}"="NONE"]?agent_busy,s,1)
   same => n,GotoIf($["${QUEUESTATUS}"="TIMEOUT"|"${QUEUESTATUS}"="FULL"|"${QUEUESTATUS}"="JOINEMPTY"|"${QUEUESTATUS}"="LEAVEEMPTY"|"${QUEUESTATUS}"="NOAGENTS"]?agent_busy,s,1)
   same => n,Set(WAITING_TIME=$[${EPOCH} - ${QUEUE_ENTRY_TIME}])
   same => n,Answer()
   same => n,Set(ANSWER_TIME=${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M:%S)})
   same => n,NoOp(Waiting time: ${STRFTIME(${DIFF(${ANSWER_TIME},${QUEUE_ENTRY_TIME})},,%H:%M:%S)})
   same => n,NoOp(Call duration: ${CDR(duration)})
   same => n,Hangup()


exten => 3,1,NoOp(User Pressed 3, Goto Network Team)
   same => n,Verbose(1, User pressed 3)
   same => n,Set(QUEUE_ENTRY_TIME=${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M:%S)})
   same => n,System(mysql -u asterisk -p'asterisk' -D asterisk -e "INSERT INTO call_path (caller_id, path_A, path_B, queue_name, dield_number) VALUES ('${CALLERID(num)}', 'Eng_Lang_test','', 'network', '${DIALED_NUMBER}')")
   same => n,Queue(software,,,,30)
   ; Check the result of the queue attempt
   same => n,GotoIf($["${QUEUESTATUS}"="NONE"]?agent_busy,s,1)
   same => n,GotoIf($["${QUEUESTATUS}"="TIMEOUT"|"${QUEUESTATUS}"="FULL"|"${QUEUESTATUS}"="JOINEMPTY"|"${QUEUESTATUS}"="LEAVEEMPTY"|"${QUEUESTATUS}"="NOAGENTS"]?agent_busy,s,1)
   same => n,Set(WAITING_TIME=$[${EPOCH} - ${QUEUE_ENTRY_TIME}])
   same => n,Answer()
   same => n,Set(ANSWER_TIME=${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M:%S)})
   same => n,NoOp(Waiting time: ${STRFTIME(${DIFF(${ANSWER_TIME},${QUEUE_ENTRY_TIME})},,%H:%M:%S)})
   same => n,NoOp(Call duration: ${CDR(duration)})
   same => n,Hangup()

exten => 4,1,NoOp(User Pressed 4, Goto HR team Team)
   same => n,Verbose(1, User pressed 4)
   same => n,System(mysql -u asterisk -p'asterisk' -D asterisk -e "INSERT INTO call_path (caller_id, path_A, path_B, queue_name, dield_number) VALUES ('${CALLERID(num)}', 'Eng_Lang_test', '', 'software', '${DIALED_NUMBER}')")
   same => n,Queue(software,,,,60)
   same => n,Answer()
   same => n,Hangup()

exten => 5,1,NoOp(Incoming call for Extension ${EXTEN})
   same => n,Verbose(1, User pressed 5)
   same => n,GotoIf($["${DB(availability/${EXTEN})}" = "INUSE"]?dial:queue)
   same => n(dial),Dial(SIP/${EXTEN},20)
   same => n,Goto(end)
   same => n(queue),Queue(software,,,,30)
   same => n(end),Hangup()

exten => 6,1,NoOp(User Pressed 6, Wrong Input)
   same => n,Verbose(1, User pressed 6)
   same => n,Goto(English_lang_testing,s,1)

exten => 7,1,NoOp(User Pressed 7, Wrong Input)
   same => n,Verbose(1, User pressed 7)
   same => n,Set(tries=$[${tries} +1])
   same => n,GotoIf($[${tries}>=3]?Hangup)
   same => n,Playback(wrongInput_en)
   same => n,WaitExten(1)
   same => n,Goto(English_lang_testing,s,1)


exten => 8,1,NoOp(User Pressed 8, Wrong Input)
   same => n,Verbose(1, User pressed 8)
   same => n,Set(tries=$[${tries} +1])
   same => n,GotoIf($[${tries}>=3]?Hangup)
   same => n,Playback(wrongInput_en)
   same => n,WaitExten(1)
   same => n,Goto(English_lang_testing,s,1)

exten => 9,1,NoOp(User Pressed 9, Wrong Input)
   same => n,Verbose(1, User pressed 9)
   same => n,WaitExten(1)
   same => n,Goto(testing,s,1)

exten => 0,1,NoOp(User Pressed 0, Exit the menue)
   same => n,Verbose(1, User pressed 0)
   same => n,Goto(testing,s,1)

exten => _XX.,1,NoOp(User Pressed (${_XX}), Wrong Input)
   same => n,Verbose(1, User pressed 0)
   same => n,Set(tries=$[${tries} +1])
   same => n,GotoIf($[${tries}>=3]?Hangup)
   same => n,Playback(wrong_en)
   same => n,WaitExten(1)
   same => n,Goto(testing,s,1)

exten => *,1,NoOp(User Pressed *, Wrong Input)
   same => n,Verbose(1, User pressed *)
   same => n,Set(tries=$[${tries} +1])
   same => n,GotoIf($[${tries}>=3]?Hangup)
   ;same => n,Playback(wrongInput_en)
   same => n,WaitExten(1)
   same => n,Goto(English_lang_testing,s,1)


exten => _XX.,1,NoOp(User Pressed (${_XX}), Wrong Input)

There’s your problem. Asterisk has to wait for input to know whether the caller intends to type in more digits so that matches, or not. You can either remove that section or set the digit timeout[1] to a lower value - knowing that the caller will have to type in longer digits fairly quick.

[1] TIMEOUT - Asterisk Documentation

If _XX. is only there to catch invalid numbers, you could use the i extension, instead.

It worked. I add ‘same => n,Set(TIMEOUT(digit)=2)’ code part into extensions.conf .

[English_lang_testing]
exten => s,1,NoOp(User Pressed 1 and go to English path)
   same => n,Set(TIMEOUT(digit)=2) 
   same => n,Background(software_en)
  
   same => n,Background(network_en)

   same => n,Background(sales_en)
 
   same => n,Background(hr_en)
  
   same => n,Background(finance_en)
   
   same => n,Background(again_en)

   same => n,Background(previous_en)   

   same => n,Background(exit_en)
   
   same => n,WaitExten(2)
   same => n,Set(tries=$[${tries} +2])
   same => n,GotoIf($[${tries}>=6]?Hangup,s,1)
   same => n,Playback(tryAgain_en)
   same => n,WaitExten(1)
   same => n,Goto(English_lang_testing,s,1)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.