How to know the record duration

I have setup a recording option in my dial plan as given below. It is working smoothly but the problem is i could not get the time of recording means For how much duration recording has been done. How to get that information? Any trick or anything already there in asterisk for this purpose. I think this is possible because in VoiceMail we can get the duration so What you think.
Any help or suggestion will be helpful.

exten => 555,1,Record(mymessage:gsm|2|60)
exten => 555,2,Playback(you-said)
exten => 555,3,Playback(mymessage)


The reason you get the duration in voice mail is because because when asterisk saves the file it saves it with a text file with information on the message. You can do that, write a script to store all the information about the call in to a database, or rename the file once it is done recording to have the time of the call as part of the file name.

I could not store it into any database for my project sake. Please tell me or help me how to make some script so that i can get the recording duration with the file. As i a saving a GSM formatted file. It doesn’t have any headers for storing that kindof information. I tried with mp3info command.
As you are saying for going for some script please help me in that. I also think that can be possible.


I do not make it till now. How should i go. I am weak in Perl Script. Can anybody help me with this? Please show me some sample code. I need to get the duration of record as recording is a important aspect in my project. In record() option there is nothing to know the recording duration. How should i go. Please somebody help me.

Thanks in advance.

i made it with the help of mp3info program. I am calling a AGI perl script from my asterisk which is giving me the duration of that particular file. I dont know this is the perfect way or not. But this is what i did. Any advice will be appreciated.