On Demand Recording causing lag on outgoing stream

I hope someone can help with this as its driving me up the wall!

I’m currently setting up a freepbx server that must record all external incoming and outgoing calls to extensions, this works fine and there is no noticeable latency introduced to the conversation. The issue arrives when I want to pause the recording (i.e. to take a card payment so we dont capture the details) I have setup the ondemand toggle for each extension (sangoma s500), this appears to work but the system introduces at least a 500ms lag on the outgoing audio stream but the incoming stream is completely fine. Oddly the time difference seems to match the length of the beeps played to the agent.

This is replicable with no other load on the system and no other disk activity (on an empty recording directory), it also seems to do it on internal recorded calls also so that rules out any trunk weirdness.

Server: (Dell 2950 ii):
Dual Xeon X5365 3.00ghz (total of 8 cores)
32 Gb Ram
x6 SATA in RAID 5 (perc 5/i)

Freepbx 13 (asterisk 13.12.2), fully updated (both centos and freepbx)

Any help or pointers to this would be most helpful.

It looks to be that the beeps played to the agent is the culprit.

I have defined a custom feature code that basically calls the /var/lib/asterisk/bin/one_touch_record.php script:


exten => s,1,System(/var/lib/asterisk/bin/one_touch_record.php “${CHANNEL(name)}”)
exten => s,n,MacroExit()


testCallRecord => *66,self,Macro,testCallRecord



When using this feature code, the recording is stopped/started as expected but without the delay introduced in playing beeps:
exten => s,n,ExecIf($["${REC_STATUS}"=“RECORDING”]?Playback(beep))
exten => s,n,ExecIf($["${REC_STATUS}"=“STOPPED”]?Playback(beep&beep))
exten => s,n,ExecIf($["${ONETOUCH_REC_SCRIPT_STATUS:0:6}"=“DENIED”]?Playback(access-denied))

Can anybody think of a work around? I do want the beeps played to the agent, but its just not acceptable that it introduces as much delay as it does.


Scratch that, it still does it.

But, the plot thickens!
It only introduces lag when I initiate the recording start/stop via a button on my s500 (programmed via the endpoint manager), entering the feature code via the keypad works properly with the default *1 feature code.

Weird. Sounds like it’s time for a ticket to me. Seems like that might be a phone bug.