> For the complete documentation index, see [llms.txt](https://docs.mikopbx.com/mikopbx/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mikopbx.com/mikopbx/english/faq/management/storing-records-in-a-windows-shared-folder.md).

# Storing Recordings in a Shared Windows Folder

In some cases, it is necessary to save call recordings on a network drive. This example shows how to connect a shared Windows folder to MikoPBX.

{% hint style="warning" %}
**Note**: If the network folder becomes unavailable, it may cause disruptions in PBX operation.
{% endhint %}

1. Create a directory for the script:

```bash
mkdir /storage/usbdisk1/mikopbx/custom_modules/shared-folder-script
```

2. Create the script file:

```
/cat > /storage/usbdisk1/mikopbx/custom_modules/shared-folder-script/mount-shared-folder.sh
```

3. Insert the script content:

```php
#!/bin/sh
HOST='//172.16.32.38/SharedFolder';
USER='';
PASS='';
REC_DIR='autorecords';
mountPoint='/storage/win-shared';

createLink ()
{
  subDir="$(date '+%Y/%m')";
  monitorDir="$(/bin/busybox grep monitordir < /etc/inc/mikopbx-settings.json | /bin/busybox cut -f 4 -d '"')";
  if [ "${monitorDir}x" = 'x' ];then
    echo "Empty monitor dir";
    return;
  fi;
  /bin/busybox mkdir -p "$monitorDir" "$mountPoint/$REC_DIR/$subDir";
  if [ ! -L "$monitorDir/$subDir" ] && [ -d "$monitorDir/$subDir" ];then
    cp -r "$monitorDir/$subDir/"*  "$mountPoint/$REC_DIR/$subDir";
    rm -rf "${monitorDir:?}/$subDir/";
    ln -s "$mountPoint/$REC_DIR/$subDir" "${monitorDir:?}/$subDir";
  fi;

  if [ ! -L "$monitorDir/$subDir" ] && [ ! -f "${monitorDir:?}/$subDir" ]; then
    ln -s "$mountPoint/$REC_DIR/$subDir" "${monitorDir:?}/$subDir";
  fi;
}

/bin/busybox mount | /bin/busybox grep "$HOST";
resGrep="$?";
if [ "$resGrep" = "0" ]; then
  echo "Disk is mounted..."
  createLink;
  exit 2;
fi;

mkdir -p "$mountPoint";
/bin/busybox mount -t cifs "$HOST" "$mountPoint" -o "username=$USER,password=$PASS,vers=2.0"
resMount="$?";

if [ "$resMount" != '0' ];then
  echo "Error mount $HOST"
  exit 1;
fi;

createLink;

```

4. Press "CTRL+D" twice to finish creating the file.
5. Grant execution permissions:

```
chmod +x /storage/usbdisk1/mikopbx/custom_modules/shared-folder-script/mount-shared-folder.sh
```

6. In the script variables "**HOST, USER, PASS**", specify the connection parameters to the shared folder.
7. Add the script to cron for automatic connection of the shared folder.
8. Go to the **System** → **Customizing System Files** section.
9. Add the following rule to the end of the **/var/spool/cron/crontabs/root** file:

```
*/1 * * * * /storage/usbdisk1/mikopbx/custom_modules/shared-folder-script/mount-shared-folder.sh > /dev/null 2> /dev/null
```

Test the PBX operation to ensure that call recordings are being saved to the network drive.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.mikopbx.com/mikopbx/english/faq/management/storing-records-in-a-windows-shared-folder.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
