[asterisk-users] Say duration of alaw file?

John Kiniston johnkiniston at gmail.com
Tue Oct 18 18:37:37 CDT 2016


This is the most compact I can make it just by tidying up your variables
and playbacks:

    same =>
n,Set(ARRAY(minSpeech,playFile)=minutes&and,/var/lib/asterisk/sounds/en/abandon-all-hope)
    same => n,Gosub(setup)
    same => n,set(playFile=/tmp/reno_project-system)
    same => n,Gosub(setup)
    same => n,Hangup(); tidy up

    same => n(setup),Set(totalTime=$[CEIL(${STAT(s,${playFile}.alaw)} /
8000)])
    same =>
n(play),ControlPlayback(${playFile},0,3,1,045679#*,,2,o(${CPLAYBACKOFFSET}))
    same => n,GosubIf($["${CPLAYBACKSTATUS}"="USERSTOPPED"]?pause)
    same => n,GoToIf($["${CPLAYBACKSTATUS}"="SUCCESS"]?done:play)

    same =>
n(pause),Set(ARRAY(totalMin,totalSec,pauseTime)=$[FLOOR(${totalTime} /
60)],$[REMAINDER(${totalTime},60)],$[{CEIL(${CPLAYBACKOFFSET})} / 1000])
    same => n,Set(pauseTime=${MATH(${pauseTime}+0,i)})
    same => n,Set(ARRAY(pauseMin,pauseSec)=$[FLOOR(${pauseTime} /
60)],$[REMAINDER(${pauseTime},60)])
    same => n,Playback(dictate/paused&digits/at)
    same => n,ExecIF($[${pauseTime} > 59
]?Playback(digits/${pauseMin}&${minSpeech}))
    same => n,SayNumber(${pauseSec})
    same => n,Playback(seconds&vm-duration)
    same => n,ExecIF($[${totalTime} > 59
]?Playback(digits/${totalMin}&${minSpeech}))
    same => n,SayNumber(${totalSec})
    same => n,Playback(seconds)
    same => n,Return() ; continue where we left
    same => n(done),Set(CPLAYBACKOFFSET=0)
    same => n,Return()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20161018/462d2ed8/attachment.html>


More information about the asterisk-users mailing list