I need help with asterisk's dial plan. I want that every time I make a call, when the user picks up the phone, I want it to say a specific date, but I can't figure out which application in the dial plan can do that.
I am using SayUnixTime
but it only says the current time. I'd appreciate your help if you could help me out.
0
votes
2 Answers
0
votes
0
votes
[from-internal-custom]
exten => ***0005,1,Noop(---say money---)
same => n,answer()
same => n,wait(1)
same => n,Set(money=20.50)
same => n,gosub(saymoney,s,1(${money})
same => n,hangup()
exten => ***0004,1,NooP(-------------- saydate------------)
same => n,Answer()
same => n,wait(1)
same => n,set(date=03-31-2018)
same => n,gosub(saydate,s,1(${date}))
same => n,hangup()
[saydate]
exten => s,1,noop(----say date----)
same => n,set(fulldate=${ARG1})
same => n,set(month=${CUT(fulldate,-,1)})
same => n,set(date=${CUT(fulldate,-,2)})
same => n,set(year=${CUT(fulldate,-,3)})
same => n,Noop(Month = ${month} Date = ${date} Year = ${year})
same => n,gosub(months,s,1(${month}))
same => n,set(monthwav=${GOSUB_RETVAL})
same => n,Gosub(date,s,1(${date}))
same => n,Set(datewav=${GOSUB_RETVAL})
same => n,playback(${monthwav}&${datewav})
same => n,saynumber(${year})
same => n,return()
[months]
exten => s,1,Noop(------------- Get-Month-------------)
same => n,Set(mt=${MATH(${ARG1}-1,int)})
same => n,Set(monthwav=digits/mon-${mt})
same => n,return(${monthwav})
[date]
exten => s,1,Noop(SUB-----------Get-Date---------------)
same => n,set(d=${ARG1})
same => n,gotoif($[${d}>19]?Nums20-31
same => n,execif($[${d:0:1}=0]?set(d=${d:1:1}))
same => n(setordinal),set(date=digits/h-${d})
same => n,return(${date})
same => n(Nums20-31),Noop(----------Number 20 to 31 -------------)
same => n,gotoif($[${d:1:1}=0]?setordinal)
same => n,set(f=${ARG1:0:1}) ;get first digit
same => n,set(l=${ARG1:1:1}) ;get last digit
same => n,set(date=digits/${f}0&digits/h-${l}) ;put both wave files together
same => n(return),return(${date})
[saymoney]
exten => s,1,noop(SUB---------saying money------------)
same => n,set(money=${ARG1})
same => n,Set(dollars=${CUT(money,.,1)})
same => n,set(cents=${CUT(money,.,2)})
same => n,saynumber(${dollars})
same => n,playback(digits/dollars)
same => n,gotoif($["${cents}"=""]?return
same => n,gotoif($[${cents}=0]?return
same => n,playback(and)
same => n,saynumber(${cents})
same => n,execif($[${cents}=1]?playback(cent):playback(cents))
same => n(return),return()