[asterisk-users] Say duration of alaw file?

John Kiniston johnkiniston at gmail.com
Tue Oct 18 11:56:16 CDT 2016


Alright... How about:

exten => 100,1,NoOP()
 same =>
n,Set(Duration=$[CEIL(${STAT(s,/var/lib/asterisk/moh/reno_project-system.alaw)}
/ 8000)])
 same =>      n,NoOP(Duration is $[FLOOR(${Duration} / 60)] Minutes,
$[REMAINDER(${Duration},60)] Seconds)
 same =>      n,Hangup()


On Tue, Oct 18, 2016 at 7:26 AM, Jonathan H <lardconcepts at gmail.com> wrote:

> I can get the size of a ulaw file using STAT.
> And I can get the duration in seconds by doing filesize/8000.
>
> Your tea-break challenge is to help me find the shortest most
> Asterisk-like way of saying:
>
> "The following file is [<n> minutes and] <s> seconds long".
>
> ...without referring to external applications!
>
> Yes, I'm aware of the math behind it, but I was hoping for a nice way
> than a load of MATH and GoToIf statements :)
>
> Thanks
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> Join the Asterisk Community at the 13th AstriCon, September 27-29, 2016
>       http://www.asterisk.org/community/astricon-user-conference
>
> New to Asterisk? Start here:
>       https://wiki.asterisk.org/wiki/display/AST/Getting+Started
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users
>



-- 
A human being should be able to change a diaper, plan an invasion, butcher
a hog, conn a ship, design a building, write a sonnet, balance accounts,
build a wall, set a bone, comfort the dying, take orders, give orders,
cooperate, act alone, solve equations, analyze a new problem, pitch manure,
program a computer, cook a tasty meal, fight efficiently, die gallantly.
Specialization is for insects.
---Heinlein
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20161018/1c887bb8/attachment.html>


More information about the asterisk-users mailing list