3CX SFTP backup to AWS S3

Status
Not open for further replies.

Discovery87

Silver Partner
Basic Certified
Joined
Jan 7, 2020
Messages
81
Reaction score
12
Afternoon!

So I have setup the AWS SFTP service and tested this works fine using Win SCP FTP client. However no matter what format I enter my server address into the 3CX backup location dialog box it does not connect.

Am I missing something here?

I have tried server addresses:
sftp://[email protected]-west-2.amazonaws.com:22
sftp://[email protected]-west-2.amazonaws.com
sftp://awsinstanceID.server.transfer.eu-west-2.amazonaws.com
awsinstanceID.server.transfer.eu-west-2.amazonaws.com

I am connecting using username, password & private key.

Thanks in advance.
 
Nevermind! Was the private key format. Having some other problem now with the backup actually saving to the location :/
 
Nevermind! Was the private key format. Having some other problem now with the backup actually saving to the location :/
Normally you have a path after the sftp://<aws s3 sftp endpoint>/<path or bucket maybe>

Right now it would save in the root folder, wherever it actually is on your S3.

Also, you can configure recordings archives the same way.
 
Getting this error now, no idea what this means >.<

3CX Phone System tried to backup but failed due to the following reason(s):

Renci.SshNet.Common.SshException: Cant write to this buffer again. offset=14, WriteBuffer=WriteBuffer [startOffset=0, endOffset=5242880, readySetEnd=139, numWrites=1]

at Renci.SshNet.Sftp.SftpSession.RequestWrite(Byte[] handle, UInt64 serverOffset, Byte[] data, Int32 offset, Int32 length, AutoResetEvent wait, Action`1 writeCompleted)

at Renci.SshNet.Sftp.SftpFileStream.FlushWriteBuffer()

at Renci.SshNet.Sftp.SftpFileStream.Seek(Int64 offset, SeekOrigin origin)

at System.IO.Compression.ZipArchiveEntry.WriteCrcAndSizesInLocalHeader(Boolean zip64HeaderUsed)

at System.IO.Compression.ZipArchiveEntry.DirectToArchiveWriterStream.Dispose(Boolean disposing)

at System.IO.Stream.Close()

at System.IO.Compression.WrappedStream.Dispose(Boolean disposing)

at System.IO.Stream.Close()

at _3cxNetBackupAndRestore._3cxBackup.WriteMetadata(ZipArchive zipStream)

at _3cxNetBackupAndRestore._3cxBackup.StartBackup(Stream backupStream)

at ManagementConsoleJS.Services.BackupService.Backup(BackupDescription backupDescription)
 
Getting this error now, no idea what this means >.<

3CX Phone System tried to backup but failed due to the following reason(s):

Renci.SshNet.Common.SshException: Cant write to this buffer again. offset=14, WriteBuffer=WriteBuffer [startOffset=0, endOffset=5242880, readySetEnd=139, numWrites=1]

at Renci.SshNet.Sftp.SftpSession.RequestWrite(Byte[] handle, UInt64 serverOffset, Byte[] data, Int32 offset, Int32 length, AutoResetEvent wait, Action`1 writeCompleted)

at Renci.SshNet.Sftp.SftpFileStream.FlushWriteBuffer()

at Renci.SshNet.Sftp.SftpFileStream.Seek(Int64 offset, SeekOrigin origin)

at System.IO.Compression.ZipArchiveEntry.WriteCrcAndSizesInLocalHeader(Boolean zip64HeaderUsed)

at System.IO.Compression.ZipArchiveEntry.DirectToArchiveWriterStream.Dispose(Boolean disposing)

at System.IO.Stream.Close()

at System.IO.Compression.WrappedStream.Dispose(Boolean disposing)

at System.IO.Stream.Close()

at _3cxNetBackupAndRestore._3cxBackup.WriteMetadata(ZipArchive zipStream)

at _3cxNetBackupAndRestore._3cxBackup.StartBackup(Stream backupStream)

at ManagementConsoleJS.Services.BackupService.Backup(BackupDescription backupDescription)
Do you have any options for the SFTP Gateway? Similar to Async Uploads or such?

We use Couchdrop to go from SFTP to S3 and they had us disable a setting on their panel to make 3CX works better. There is also a parameter that can be used to force backups to use the TMP folder instead of writing directly to the SFTP.
 
Ah great, so SFTP on 3CX isn't regular SFTP... wonderful :/
So how do I "shim" it to make it work? That parameter sounds hopeful please could you shed some more light on that?

Thanks for your time mate.
 
Ah great, so SFTP on 3CX isn't regular SFTP... wonderful :/
So how do I "shim" it to make it work? That parameter sounds hopeful please could you shed some more light on that?

Thanks for your time mate.
Try this:

  • Go to Settings -> Parameters
  • Click "Add", enter the name ALWAYS_USE_TMP_FILE_FOR_BACKUP with value 1 then save.
  • Restart config server service
  • Try a backup again

Like I said, check your path. Normally you'd have one unless you really want to upload to the root folder, and if so, try adding a trailing / at the SFTP url end, it might be needed.
 
  • Like
Reactions: tronic
Brill thanks mate!! that parameter fixed it! Sorry I forgot to say I had already amended my path with the correct directory etc.
 
  • Like
Reactions: Evolute IT
Note that it might not work for the recordings since there's no parameter like this for those.
 
That's fine thanks mate, where do you find out about these parameters is there a list somewhere?
 
That's fine thanks mate, where do you find out about these parameters is there a list somewhere?
No. This one was provided to us in a support ticket because me and @DavidRostoker needed Files.com to work for backups.

These are probably not to be used unless told to. Your issue is similar to what we had with Files.com and we finally decided to use something else because of that.

This parameter fixes the backups, but not the recording archives.
 
OK mate thanks for all your help, I now have backup to S3 setup on all of my instances via AWS SFTP thanks to you! :)
 
  • Like
Reactions: Evolute IT
Status
Not open for further replies.

Forum statistics

Threads
111,935
Messages
589,823
Members
164,818
Latest member
Guriqbal Singh