IVR using digits from previous IVR

Hi all,
I’m building a new system using FreePBX core 15.0.9.12 on Debian 9.
IVR module is on version 15.0.14.

I’ve read the recent changes in behavior using Read instead of WaitExten, not sure if this is related and I couldn’t find reference of others with this problem. I have 2 IVRs in my system. The first is for language choice (options 1 and 2), then the main IVR for routing. Options are 1, 2 and 3 for now. The problem is whatever I enter on the 2nd IVR will be read as my result from the 1st + from the 2nd. Example, if I press 1 for language, that works, sets the language, then goes to the next IVR. If I enter 1 there, it times out after 10 seconds and says the entry is invalid. I can see that FreePBX reads it as 11. Then on the retry, I enter 1 again and it works. Seems like digits is not properly reset after the 1st one.
Example output below. I first thought DTMF might be funky and reading the “1” twice on the 2nd IVR, but it’s 100% reproducible on my system and if I enter “2” then “1” I will see DIGITS=21 on the 2nd IVR. Always.

Any input? Can anyone reproduce?

-- Executing [[email protected]:1] Set("SIP/TwilioIn3-00000036", "__DIRECTION=INBOUND") in new stack
-- Executing [[email protected]:2] Gosub("SIP/TwilioIn3-00000036", "sub-record-check,s,1(in,+18332271313,
yes)") in new stack
-- Executing [[email protected]:1] GotoIf("SIP/TwilioIn3-00000036", "0?initialized") in new stack
-- Executing [[email protected]:2] Set("SIP/TwilioIn3-00000036", "__REC_STATUS=INITIALIZED") in new stack
-- Executing [[email protected]:3] Set("SIP/TwilioIn3-00000036", "NOW=1554995502") in new stack
-- Executing [[email protected]:4] Set("SIP/TwilioIn3-00000036", "__DAY=11") in new stack
-- Executing [[email protected]:5] Set("SIP/TwilioIn3-00000036", "__MONTH=04") in new stack
-- Executing [[email protected]:6] Set("SIP/TwilioIn3-00000036", "__YEAR=2019") in new stack
-- Executing [[email protected]:7] Set("SIP/TwilioIn3-00000036", "__TIMESTR=20190411-151142") in new stack
-- Executing [[email protected]:8] Set("SIP/TwilioIn3-00000036", "__FROMEXTEN=unknown") in new stack
-- Executing [[email protected]:9] Set("SIP/TwilioIn3-00000036", "__MON_FMT=wav") in new stack
-- Executing [[email protected]:10] NoOp("SIP/TwilioIn3-00000036", "Recordings initialized") in new stack
-- Executing [[email protected]:11] ExecIf("SIP/TwilioIn3-00000036", "0?Set(ARG3=dontcare)") in new stack
-- Executing [[email protected]:12] Set("SIP/TwilioIn3-00000036", "REC_POLICY_MODE_SAVE=") in new stack
-- Executing [[email protected]:13] ExecIf("SIP/TwilioIn3-00000036", "0?Set(REC_STATUS=NO)") in new stack
-- Executing [[email protected]:14] GotoIf("SIP/TwilioIn3-00000036", "2?checkaction") in new stack
-- Goto (sub-record-check,s,17)
-- Executing [[email protected]:17] GotoIf("SIP/TwilioIn3-00000036", "1?sub-record-check,in,1") in new stack
-- Goto (sub-record-check,in,1)
-- Executing [[email protected]:1] NoOp("SIP/TwilioIn3-00000036", "Inbound Recording Check to +18332271313") 
in new stack
-- Executing [[email protected]:2] Set("SIP/TwilioIn3-00000036", "FROMEXTEN=unknown") in new stack
-- Executing [[email protected]:3] ExecIf("SIP/TwilioIn3-00000036", "12?Set(FROMEXTEN=+15142677694)") in new 
stack
-- Executing [[email protected]:4] Gosub("SIP/TwilioIn3-00000036", "recordcheck,1(yes,in,+18332271313)") in n
ew stack
-- Executing [[email protected]:1] NoOp("SIP/TwilioIn3-00000036", "Starting recording check against 
yes") in new stack
-- Executing [[email protected]:2] Goto("SIP/TwilioIn3-00000036", "yes") in new stack
-- Goto (sub-record-check,recordcheck,9)
-- Executing [[email protected]:9] ExecIf("SIP/TwilioIn3-00000036", "0?Return()") in new stack
-- Executing [[email protected]:10] Set("SIP/TwilioIn3-00000036", "__REC_POLICY_MODE=YES") in new st
ack
-- Executing [[email protected]:11] Goto("SIP/TwilioIn3-00000036", "startrec") in new stack
-- Goto (sub-record-check,recordcheck,16)
-- Executing [[email protected]:16] NoOp("SIP/TwilioIn3-00000036", "Starting recording: in, +1833227
1313") in new stack
-- Executing [[email protected]:17] Set("SIP/TwilioIn3-00000036", "__CALLFILENAME=in-+18332271313-+1
5142677694-20190411-151142-1554995502.54") in new stack
-- Executing [[email protected]:18] MixMonitor("SIP/TwilioIn3-00000036", "2019/04/11/in-+18332271313
-+15142677694-20190411-151142-1554995502.54.wav,abi(LOCAL_MIXMON_ID),") in new stack
-- Executing [[email protected]-record-check:19] Set("SIP/TwilioIn3-00000036", "__MIXMON_ID=0x7fa6500034a0") in n
ew stack
-- Executing [[email protected]:20] Set("SIP/TwilioIn3-00000036", "__RECORD_ID=SIP/TwilioIn3-0000003
6") in new stack
-- Executing [[email protected]:21] Set("SIP/TwilioIn3-00000036", "__REC_STATUS=RECORDING") in new s
tack
-- Executing [[email protected]:22] Set("SIP/TwilioIn3-00000036", "CDR(recordingfile)=in-+1833227131
3-+15142677694-20190411-151142-1554995502.54.wav") in new stack
-- Executing [[email protected]:23] Return("SIP/TwilioIn3-00000036", "") in new stack
-- Executing [[email protected]:5] Return("SIP/TwilioIn3-00000036", "") in new stack
-- Executing [[email protected]:3] Set("SIP/TwilioIn3-00000036", "CHANNEL(tonezone)=us") in new stack
-- Executing [[email protected]:4] Set("SIP/TwilioIn3-00000036", "__FROM_DID=+18332271313") in new stack
-- Executing [[email protected]:5] Set("SIP/TwilioIn3-00000036", "returnhere=1") in new stack
-- Executing [[email protected]:6] Gosub("SIP/TwilioIn3-00000036", "app-blacklist-check,s,1()") in new st
ack
-- Executing [[email protected]:1] GotoIf("SIP/TwilioIn3-00000036", "0?blacklisted") in new stack
-- Executing [[email protected]:2] Set("SIP/TwilioIn3-00000036", "CALLED_BLACKLIST=1") in new stack
-- Executing [[email protected]:3] Return("SIP/TwilioIn3-00000036", "") in new stack
-- Executing [[email protected]:7] Set("SIP/TwilioIn3-00000036", "CDR(did)=+18332271313") in new stack
-- Executing [[email protected]:8] GotoIf("SIP/TwilioIn3-00000036", "0?") in new stack
-- Executing [[email protected]:9] ExecIf("SIP/TwilioIn3-00000036", "1 ?Set(CALLERID(name)=+15142677694)"
) in new stack
-- Executing [[email protected]:10] Set("SIP/TwilioIn3-00000036", "__MOHCLASS=") in new stack
-- Executing [[email protected]:11] Set("SIP/TwilioIn3-00000036", "__REVERSAL_REJECT=FALSE") in new stack
-- Executing [[email protected]:12] GotoIf("SIP/TwilioIn3-00000036", "1?post-reverse-charge") in new stac
k
-- Goto (from-trunk,+18332271313,14)
-- Executing [[email protected]:14] NoOp("SIP/TwilioIn3-00000036", "") in new stack
-- Executing [[email protected]:15] Set("SIP/TwilioIn3-00000036", "__CALLINGNAMEPRES_SV=allowed_not_scree
ned") in new stack
-- Executing [[email protected]:16] Set("SIP/TwilioIn3-00000036", "__CALLINGNUMPRES_SV=allowed_not_screen
ed") in new stack
-- Executing [[email protected]:17] Set("SIP/TwilioIn3-00000036", "CALLERID(name-pres)=allowed_not_screen
ed") in new stack
-- Executing [[email protected]:18] Set("SIP/TwilioIn3-00000036", "CALLERID(num-pres)=allowed_not_screene
d") in new stack
-- Executing [[email protected]:19] NoOp("SIP/TwilioIn3-00000036", "CallerID Entry Point") in new stack
-- Executing [[email protected]:20] Goto("SIP/TwilioIn3-00000036", "ivr-2,s,1") in new stack
-- Goto (ivr-2,s,1)
-- Executing [[email protected]:1] Set("SIP/TwilioIn3-00000036", "INVALID_LOOPCOUNT=0") in new stack
-- Executing [[email protected]:2] Set("SIP/TwilioIn3-00000036", "_IVR_CONTEXT_ivr-2=") in new stack
-- Executing [[email protected]:3] Set("SIP/TwilioIn3-00000036", "_IVR_CONTEXT=ivr-2") in new stack
-- Executing [[email protected]:4] Set("SIP/TwilioIn3-00000036", "__IVR_RETVM=") in new stack
-- Executing [[email protected]:5] GotoIf("SIP/TwilioIn3-00000036", "0?skip") in new stack
-- Executing [[email protected]:6] Answer("SIP/TwilioIn3-00000036", "") in new stack
== Begin MixMonitor Recording SIP/TwilioIn3-00000036
-- Executing [[email protected]:7] Set("SIP/TwilioIn3-00000036", "IVR_MSG=custom/lang-pick") in new stack
-- Executing [[email protected]:8] Set("SIP/TwilioIn3-00000036", "DIGITS=") in new stack
-- Executing [[email protected]:9] Set("SIP/TwilioIn3-00000036", "NODEFOUND=0") in new stack
-- Executing [[email protected]:10] Set("SIP/TwilioIn3-00000036", "LOCALEXT=0") in new stack
-- Executing [[email protected]:11] Set("SIP/TwilioIn3-00000036", "DIREXT=0") in new stack
-- Executing [[email protected]:12] ExecIf("SIP/TwilioIn3-00000036", "0?Set(DIGITS=)") in new stack
-- Executing [[email protected]:13] While("SIP/TwilioIn3-00000036", "1 ") in new stack
-- Executing [[email protected]:14] Read("SIP/TwilioIn3-00000036", "IVREXT,custom/lang-pick,1,,0,10") in new stack
-- Accepting a maximum of 1 digits.
-- <SIP/TwilioIn3-00000036> Playing 'custom/lang-pick.ulaw' (language 'fr')
-- User entered '1'
-- Executing [[email protected]:15] Set("SIP/TwilioIn3-00000036", "IVR_MSG=") in new stack
-- Executing [[email protected]:16] GotoIf("SIP/TwilioIn3-00000036", "0?t,1") in new stack
-- Executing [[email protected]:17] NoOp("SIP/TwilioIn3-00000036", "") in new stack
-- Executing [[email protected]:18] GotoIf("SIP/TwilioIn3-00000036", "0?beforewhile:nodedial") in new stack
-- Goto (ivr-2,s,21)
-- Executing [[email protected]:21] Goto("SIP/TwilioIn3-00000036", "1,1") in new stack
-- Goto (ivr-2,1,1)
-- Executing [[email protected]:1] Set("SIP/TwilioIn3-00000036", "__ivrreturn=0") in new stack
-- Executing [[email protected]:2] Goto("SIP/TwilioIn3-00000036", "app-languages,1,1") in new stack
-- Goto (app-languages,1,1)
-- Executing [[email protected]:1] NoOp("SIP/TwilioIn3-00000036", "Changing Channel to language: fr (FR)") in new stack
-- Executing [[email protected]:2] Set("SIP/TwilioIn3-00000036", "CHANNEL(language)=fr") in new stack
-- Executing [[email protected]:3] Goto("SIP/TwilioIn3-00000036", "timeconditions,1,1") in new stack
-- Goto (timeconditions,1,1)
-- Executing [[email protected]:1] Set("SIP/TwilioIn3-00000036", "DB(TC/1/INUSESTATE)=INUSE") in new stack
-- Executing [[email protected]:2] Set("SIP/TwilioIn3-00000036", "DB(TC/1/NOT_INUSESTATE)=NOT_INUSE") in new stack
-- Executing [[email protected]:3] NoOp("SIP/TwilioIn3-00000036", "TIMENOW: 15:11,Thu,11,Apr") in new stack
-- Executing [[email protected]:4] NoOp("SIP/TwilioIn3-00000036", "TIMEMATCHED: TRUE") in new stack
-- Executing [[email protected]:5] GotoIfTime("SIP/TwilioIn3-00000036", "08:00-17:00,mon-fri,*,*?truestate") in new stack
-- Goto (timeconditions,1,14)
-- Executing [[email protected]:14] GotoIf("SIP/TwilioIn3-00000036", "0?falsegoto") in new stack
-- Executing [[email protected]:15] ExecIf("SIP/TwilioIn3-00000036", "0?Set(DB(TC/1)=)") in new stack
-- Executing [[email protected]:16] Set("SIP/TwilioIn3-00000036", "DEVICE_STATE(Custom:TC1)=NOT_INUSE") in new stack
-- Executing [[email protected]:17] ExecIf("SIP/TwilioIn3-00000036", "0?Set(DEVICE_STATE(Custom:TCSTICKY)=INUSE)") in new stack
-- Executing [[email protected]:18] GotoIf("SIP/TwilioIn3-00000036", "1?ivr-1,s,1") in new stack
-- Goto (ivr-1,s,1)
-- Executing [[email protected]:1] Set("SIP/TwilioIn3-00000036", "TIMEOUT_LOOPCOUNT=0") in new stack
-- Executing [[email protected]:2] Set("SIP/TwilioIn3-00000036", "INVALID_LOOPCOUNT=0") in new stack
-- Executing [[email protected]:3] Set("SIP/TwilioIn3-00000036", "_IVR_CONTEXT_ivr-1=ivr-2") in new stack
-- Executing [[email protected]:4] Set("SIP/TwilioIn3-00000036", "_IVR_CONTEXT=ivr-1") in new stack
-- Executing [[email protected]:5] Set("SIP/TwilioIn3-00000036", "__IVR_RETVM=") in new stack
-- Executing [[email protected]:6] GotoIf("SIP/TwilioIn3-00000036", "1?skip") in new stack
-- Goto (ivr-1,s,8)
-- Executing [[email protected]:8] Set("SIP/TwilioIn3-00000036", "IVR_MSG=custom/main-ivr") in new stack
-- Executing [[email protected]:9] Set("SIP/TwilioIn3-00000036", "DIGITS=") in new stack
-- Executing [[email protected]:10] Set("SIP/TwilioIn3-00000036", "NODEFOUND=0") in new stack
-- Executing [[email protected]:11] Set("SIP/TwilioIn3-00000036", "LOCALEXT=0") in new stack
-- Executing [[email protected]:12] Set("SIP/TwilioIn3-00000036", "DIREXT=0") in new stack
-- Executing [[email protected]:13] ExecIf("SIP/TwilioIn3-00000036", "1?Set(DIGITS=1)") in new stack
-- Executing [[email protected]:14] While("SIP/TwilioIn3-00000036", "1 ") in new stack
-- Executing [[email protected]:15] Read("SIP/TwilioIn3-00000036", "IVREXT,custom/main-ivr,1,,0,10") in new stack
-- Accepting a maximum of 1 digits.
-- <SIP/TwilioIn3-00000036> Playing 'custom/main-ivr.ulaw' (language 'fr')
-- User entered '1'
-- Executing [[email protected]:16] Set("SIP/TwilioIn3-00000036", "IVR_MSG=") in new stack
-- Executing [[email protected]:17] GotoIf("SIP/TwilioIn3-00000036", "0?t,1") in new stack
-- Executing [[email protected]:18] NoOp("SIP/TwilioIn3-00000036", "") in new stack
-- Executing [[email protected]:19] GotoIf("SIP/TwilioIn3-00000036", "1?beforewhile:nodedial") in new stack
-- Goto (ivr-1,s,13)
-- Executing [[email protected]:13] ExecIf("SIP/TwilioIn3-00000036", "1?**Set(DIGITS=11)**") in new stack
-- Executing [[email protected]:14] While("SIP/TwilioIn3-00000036", "1 ") in new stack
-- Executing [[email protected]:15] Read("SIP/TwilioIn3-00000036", "IVREXT,,1,,0,10") in new stack
-- Accepting a maximum of 1 digits.
-- User entered nothing.
-- Executing [[email protected]:16] Set("SIP/TwilioIn3-00000036", "IVR_MSG=") in new stack
-- Executing [[email protected]:17] GotoIf("SIP/TwilioIn3-00000036", "1?t,1") in new stack
-- Goto (ivr-1,t,1)
-- Executing [[email protected]:1] Set("SIP/TwilioIn3-00000036", "TIMEOUT_LOOPCOUNT=1") in new stack
-- Executing [[email protected]:2] GotoIf("SIP/TwilioIn3-00000036", "0?final") in new stack
-- Executing [[email protected]:3] Set("SIP/TwilioIn3-00000036", "IVR_MSG=no-valid-responce-pls-try-again&custom/main-ivr
") in new stack
-- Executing [[email protected]:4] Goto("SIP/TwilioIn3-00000036", "s,start") in new stack
-- Goto (ivr-1,s,9)
-- Executing [[email protected]:9] Set("SIP/TwilioIn3-00000036", "DIGITS=") in new stack
-- Executing [[email protected]:10] Set("SIP/TwilioIn3-00000036", "NODEFOUND=0") in new stack
-- Executing [[email protected]:11] Set("SIP/TwilioIn3-00000036", "LOCALEXT=0") in new stack
-- Executing [[email protected]:12] Set("SIP/TwilioIn3-00000036", "DIREXT=0") in new stack
-- Executing [[email protected]:13] ExecIf("SIP/TwilioIn3-00000036", "0?Set(DIGITS=)") in new stack
-- Executing [[email protected]:14] While("SIP/TwilioIn3-00000036", "1 ") in new stack
-- Executing [[email protected]:15] Read("SIP/TwilioIn3-00000036", "IVREXT,no-valid-responce-pls-try-again&custom/main-iv
r,1,,0,10") in new stack
-- Accepting a maximum of 1 digits.
-- <SIP/TwilioIn3-00000036> Playing 'no-valid-responce-pls-try-again.ulaw' (language 'fr')
-- <SIP/TwilioIn3-00000036> Playing 'custom/main-ivr.ulaw' (language 'fr')
-- User entered '1'
-- Executing [[email protected]:16] Set("SIP/TwilioIn3-00000036", "IVR_MSG=") in new stack
-- Executing [[email protected]:17] GotoIf("SIP/TwilioIn3-00000036", "0?t,1") in new stack
-- Executing [[email protected]:18] NoOp("SIP/TwilioIn3-00000036", "") in new stack
-- Executing [[email protected]:19] GotoIf("SIP/TwilioIn3-00000036", "0?beforewhile:nodedial") in new stack
-- Goto (ivr-1,s,22)
-- Executing [[email protected]:22] Goto("SIP/TwilioIn3-00000036", "1,1") in new stack
-- Goto (ivr-1,1,1)
-- Executing [[email protected]:1] Set("SIP/TwilioIn3-00000036", "__ivrreturn=0") in new stack
-- Executing [[email protected]:2] Goto("SIP/TwilioIn3-00000036", "app-announcement-1,s,1") in new stack
-- Goto (app-announcement-1,s,1)
-- Executing [[email protected]:1] GotoIf("SIP/TwilioIn3-00000036", "1?begin") in new stack
-- Goto (app-announcement-1,s,4)
-- Executing [[email protected]:4] NoOp("SIP/TwilioIn3-00000036", "Playing announcement Recording warning to
support") in new stack
-- Executing [[email protected]:5] Playback("SIP/TwilioIn3-00000036", "custom/recording-warning,noanswer") i
n new stack
-- <SIP/TwilioIn3-00000036> Playing 'custom/recording-warning.ulaw' (language 'fr')
== MixMonitor close filestream (mixed)
== End MixMonitor Recording SIP/TwilioIn3-00000036

I can reproduce this.
I am trying to do the same as you,

IVR1: 1,2,3 (choose language)
IVR2: 1,2,3

Basically I want to enter “1” to chose language and immediately “1” for the next IVR. But instead it reads it as I pressed “11”.

Why isnt it clearing the digits when you enter a new IVR?

Hi all,
barhom thanks for confirming you’re affected as well. I looked at the source and fixed it on my end by adding a line to reset IVREXT on start. I created a pull request here:


Sorry if not allowed or encouraged, and it might not follow best practices and not thoroughly tested. Works for me though.

1 Like

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