Call recording in Asterisk java not record all Calls

Hello All,

I have problem regarding to monitoring action in Asterisk Java. Currently I use 250 concurrent calls and record each call using monitor action. Each monitor action have different filename to write and always unique to each other.

The problem is apparently not all call recorded the conversation. However, the recording files are not even near that number. I only get few file in /var/spool/asterisk/monitor/ below than 50 % of calls. No exception found while running the program. Do monitor action append some recording to another recording? how to prevent this?

Please Asterisk version, log file with that could provide relevant informtion to determine the issue

Hi ,
Thanks for your reply, i am currently using asterisk version 11.25

For call recording I use event record in java to record all calls. But apparently, it could only record less than 50% of calls. I already tried to configure record_cache_file at asterisk.conf to store it in temp first before store it to /var/spool/monitor, I thought before it was caused by disk io problem.

Currently I use 250 concurrent channel. Where I find the logs for recording? How could I fix the recording issue?

Asterisk 11.X it is not supported it EOL on 2017-10-25, so upgarde to Asterisk 13

Hi Ambiorixg

I will try to update it, because we have a production currently run on asterisk 11.25…

Are there any differences for asterisk functions or configuration when we update to 13 that we should concern about?

However, the asterisk 11.x it supports the record event in java, is there any diferrences with version 13? Because for us the problem is some calls are not recorded

The UPGRADE.txt files state things to be aware of when upgrading. As for the Java side, that’s not something made by Asterisk so it’s an unknown.

1 Like

Hi jcolp,

Thanks for the info, currently I already upgrade to version 13.X certified version of Asterisk.
But I still got the problem, I use Event in java to get and record call process from org.asteriskjava.manager.event.VarSetEvent.

Currently I am able to record Call process, but when the number of concurrent channel increased in my case until 250 concurrent channel, it only record few of Call process. Is there any limitation maximum channel can trigger the event ? your answer / feedback will be very useful for us


There is no fixed limitation built in or maximum thing.

So basically, asterisk should be able to record all call process for all concurrent channels? What could cause that some calls are not recording?

You haven’t provided enough information to be able to answer that. You need to look at the console log and the interaction between Asterisk java and Asterisk and see where it doesn’t work as needed in that specific scenario.

Hitting some operating system limit. In that case, I would expect the logs to show errors relating to failing to allocate resources.

(At least at one time, parts of Asterisk, although not, as far as I know, call recording, used the select system call, which treats file descriptor number modulo 1024. That could cause confusing failures.)

Hi jcolp,

I was trying to get event from Asterisk and do record process using asteriskjava.manager.ManagerConnection.sendAction, every time I got new set event triggered I call this method to record my Call process, here is some logs proces between Asterisk java and Asterisk. I am checking another event NewStateEvent triggered when the status changed to Ringing or Up. If the Record process already executed from the previous event, then I will not call asteriskjava.manager.ManagerConnection.sendAction again.

INFO [main] - TRACKING - Assign channel to Unique-ID
INFO [Asterisk-Java ManagerConnection-0-Reader-0] - RECORD when SET EVENT triggered , ChannelId = SIP/Channel-ID
INFO [Asterisk-Java ManagerConnection-0-Reader-0] - Ringing Process Unique-ID, ChannelId = SIP/Channel-ID
INFO [Asterisk-Java ManagerConnection-0-Reader-0] - NOT RECORD CALL RINGING NEW EVENT triggered Unique-ID, ChannelId = SIP/Channel-ID
INFO [Asterisk-Java ManagerConnection-0-Reader-0] - UP Process NEW STATE EVENT triggered Unique-ID, ChannelId = SIP/Channel-ID
INFO [Asterisk-Java ManagerConnection-0-Reader-0] - NOT RECORD CALL UP , ChannelId = SIP/Channel-ID
INFO [Asterisk-Java ManagerConnection-0-Reader-0] - TRACKING - Successfully releasing channel for Unique-ID

This process is success to record calls from Asterisk, but I still lost recording process when many concurrent channel (more than 50 channels) is active. How could I solve this problem?

I’ve already told you what needs to be done, more investigation on the Asterisk side to understand exactly what is going on.

While calling sendAction for monitoring to record our call in asterisk, for some cases we got the response message “No such channel” from asterisk server. After checking to the unique ID, this occurred when our call is not recorded. I always call sendAction command after creating a channel. does “No such channel” mean that the channel has not establish yet?

It means just that, the channel when you attempted to use it was not found in Asterisk.

How to resolve this problem?

I got channel ID when an event come by using
channelId = event.getChannel();

but when I send command to this channel

ManagerResponse response = managerConnection.sendAction(new MonitorAction(channelId, uniqueID, wav, true))

It gets response : "No such channel"

However I already wait until newStateEvent for ringing and up, but the response always No such channel. How to resolve this problem?

Does the channel actually exist? Has it been terminated between when you received the event and acted on it?

Yes the channel exist, the channel should be existed when I got the event.

  • I got the event,
  • Read the channel ID using event.getChannel()
  • Then act directly the sendAction process

I got the reponse No such channel.
This response frequently occurred when number of concurrent channel is high (>50)

Does anyone has this experienced before? Or any other method that I could do to record the call?

The channel existed when the event was sent, but may have ceased to have existed before the action arrived.

But outgoing call process is occurred with the channel, what I do when the event triggered:

  1. Event triggered (SetVarEvent, NewStateEvent)
  2. Get the channel ID using event.getChannel()
  3. Try to monitor / record the existing call process using sendAction process for the channel ID

Do you mean that the channel existed while the action number 2 then ceased / modified while I tried to monitor this channel in action number 3?

How could the outgoing call still processed if the channel already ceased? Ho could I prevent this ?