Changing asterisk Call Recording filename


I want to change asterisk’s call monitor filename, which should include the dialed number (for out call) or the incoming number (for in call) in the call filename.

But currently the asterisk call recording filename has the format of


I want it in such a way that the format has to be


Can anyone please help me on doing this !

Thanks in advance

exten => s,1,Set(filename=whataver-you-want)
exten => s,n,Monitor(wav,${filename},m)

Thanks buddy, I’ve got things done now. It’s working !!


You welcome :smile:

Hi Raffle,

I need one more customization in the dial plan.

Is it possible to prefix “OUT” for out-call and “IN” for in-call in that dial plan.

Your help is very much appreciated.

Vino :smile:

If you mean you want separate files for the ‘in’ leg and the ‘out’ leg - don’t put the ,m at the end.

This will give you ‘whatever-you-want-in.wav’ and ‘whatever-you-want-out.wav’. You would then need something like soxmix to join them together.

It is possible to do it so that you get ‘in’ and ‘out’ the correct way around by making the context part of the file name (eg inbound-rest-of-file.wav). You just have to make sure your dialplan (extensions.conf) have proper contexts defined (ie. not all in one big context - yes, I’ve seen it done).


Thanks for your reply.

Now I have created two new contexts. The first context will prefix “OUT” and the second one will prefix “IN”.

I have a “GosubIf” in asterisk’s macro-record-enable context, which should check what type of call it is ( outbound-call or inbound-call) and jumps to the specific context for outbound-call and inbound-call respectively and returns back.

Now my question is, how to find the type of current call (i.e. inbound-call or outbound-call) using GosubIf condition. What condition should i use for “GosubIf” to check whether it is incoming call or outgoing call.

Can you please help me on choosing the condition for GosubIf.

Thanks in advance