# How i got Stereo Audio working in Freepbx

**URL:** <https://community.freepbx.org/t/how-i-got-stereo-audio-working-in-freepbx/79643>\
**Category:** Tips and Tricks\
**Tags:** freepbx, configuration, freepbx-15\
**Created:** [November 30, 2021, 4:33pm UTC](https://community.freepbx.org/t/how-i-got-stereo-audio-working-in-freepbx/79643 "2021-11-30T16:33:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sholinaty](https://community.freepbx.org/user_avatar/community.freepbx.org/sholinaty/32/18987_2.png) [@sholinaty](https://community.freepbx.org/u/sholinaty)\
**Post date:** [November 30, 2021, 4:33pm UTC](https://community.freepbx.org/t/how-i-got-stereo-audio-working-in-freepbx/79643/1 "2021-11-30T16:33:42Z")

</div>

I wanted to share a how-to / story on something I’ve been working on lately.

Why would you want to do this?  
For my use case, we have a 3rd party integration that needs the ability to separate who was talking, when. and I just plain like having one person per ear, because that’s my preference.

So… Heres me trying to document a not-overly-vague way to do this, as I have struggled with the documentation recently.

1. (Background stuff, not for you)

- I had to submit an improvement to the Freepbx CallRecording module to get this working. its currently in a Pull Request, and likely to be merged by the time you read this.

1. Create a script that handles your transcription.  
for this use case, I wanted to keep BOTH a stereo audio file, AND a mono audio file, because reasons.

note that the sox tool has -M mix (stereo) from 2 sources, and -m merge (mono).

`/usr/bin/mix-stereo.sh`

```auto
#!/bin/bash

SOX="/usr/bin/sox"
RM="/bin/rm"

IN="${1}recv_$2.wav"
OUT="${1}trans_$2.wav"
//todo: update this
MIXDESTINATION="${1}stereo_$2.wav"
//todo: update this
MERGEDESTINATION="${1}mono_$2.wav"

$SOX -M $IN $OUT $MIXDESTINATION && $SOX -m $IN $OUT $MERGEDESTINATION && $RM $IN $OUT

```

1. add something like the following to`/etc/asterisk/globals_custom.conf`

```auto
SS=$
MIXMON_DIR=/var/spool/asterisk/monitor/
MONITOR_REC_OPTION=br(${SS}{MIXMON_DIR}${SS}{YEAR}/${SS}{MONTH}/${SS}{DAY}/recv_${SS}{CALLFILENAME}.${SS}{MON_FMT})t(${SS}{MIXMON_DIR}${SS}{YEAR}/${SS}{MONTH}/${SS}{DAY}/trans_${SS}{CALLFILENAME}.${SS}{MON_FMT})
MIXMON_POST=/usr/bin/mix-stereo.sh ${SS}{MIXMON_DIR}${SS}{YEAR}/${SS}{MONTH}/${SS}{DAY}/ ${SS}{CALLFILENAME}

```

1. throw in a `>fwconsole reload` for good measure

and enjoy!

if this doesn’t work for you, you likely don’t (yet) have the updated version of the callrecording module I worked on. the current (as of Nov 2021) version doesn’t like you passing in variables like {YEAR}…

---

<div class="post-metadata">

**Author:** ![system](https://community.freepbx.org/uploads/default/original/3X/f/7/f7056d57e04fdbf71c6ad967e1ced351317f5c3f.png) [@system](https://community.freepbx.org/u/system)\
**Post date:** [December 31, 2021, 4:34pm UTC](https://community.freepbx.org/t/how-i-got-stereo-audio-working-in-freepbx/79643/2 "2021-12-31T16:34:16Z")

</div>

Closed on December 31, 2021, 4:34pm UTC

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
