Tuesday, June 27, 2017

Freeswitch/Fusion stop/resume record on the fly

Most common solution to pause/resume recording on Freeswitch is use stop_record_session and after - record_session along with RECORD_APPEND=true.
What is bad with this solution.
1. Only WAV is supported
2. Seems it's broken for now (1.6.18)
Other option to use is
uuid_record mask/unmask

For FusionPBX it will looks like
action - bind_digit_action - local,*1,api:uuid_record,${uuid} mask ${recordings_dir}/${domain_name}/archive/${strftime(%Y)}/${strftime(%b)}/${strftime(%d)}/${uuid}.${record_ext},${bind_target}

action - bind_digit_action - local,*2,api:uuid_record,${uuid} unmask ${recordings_dir}/${domain_name}/archive/${strftime(%Y)}/${strftime(%b)}/${strftime(%d)}/${uuid}.${record_ext},${bind_target}

So, you may press *1 to stop recording and *2 to resume it. Bad in this solution - you will have pauses in conversation while record is masked.

Sunday, June 11, 2017

Freeswitch Postgres database scheme

Freeswitch has a great option to put internal database from SQL to Postgres. But in a case if Postgres DB is BDR (as I've described here), there is need some additional work on this database.
So, I've created SQL file to use, based on DigiDaz file. 

You can find it here. Don't forget to set

<param name="auto-create-schemas" value="false"/>
<param name="auto-clear-sql" value="false"/>

in your switch.comf.xml file.

Also few things about BDR. You can't add primary key to existing database in one command. But you can use thing like:

ALTER TABLE tbl ADD COLUMN tbl_uuid uuid;
ALTER TABLE tbl ALTER COLUMN tbl_uuid  SET DEFAULT  gen_random_uuid();
ALTER TABLE tbl ADD PRIMARY KEY (tbl_uuid);