CFD script to delete file

Discussion in 'Call Flow Designer' started by pluym, May 29, 2017.

Thread Status:
Not open for further replies.
  1. pluym

    Joined:
    Apr 7, 2011
    Messages:
    8
    Likes Received:
    0
    I use a call flow where the customer is able to record a message. When the customer records a message and disconnects the line i use the disconnect handler flow to email the message (wav file) anyway (many customers forget to decent close the recording) .

    There is one problem: when the customer disconnects before a wav file is recorded and before another customer lefts a message, the previous wav file is send by email again for the second time.

    In the VAD i simply removed the wav file when it existed before starting a recording.

    The new CFD uses C# scripts. Can you give me an exampe of a C# script to remove a file ?

    Or can you add "remove file" to the "Read/Write to file" (Advanced Options) ??
     
  2. edossantos

    edossantos Support Team
    Staff Member 3CX Support

    Joined:
    Jun 27, 2007
    Messages:
    1,367
    Likes Received:
    110
    Hi @pluym,

    Currently there is no component to delete files. You need to use a Launch External Script component, and write the C# code to delete the file, which is pretty simple, just "File.Delete(filePath)". But you need to put this code in a class and call that method from the CFD.

    In this article you have an example on how to call C# code from the CFD.

    Kind regards.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
Thread Status:
Not open for further replies.