#18: Record and replace Announcements
VBScript
Inspired by a question in the forum I spent a little bit more time not just giving a few hints as answer in the forum, but instead made a complete call routing script from it.
There are cases in which you need to be able to replace an existing announcement of a user by recording a new one from within a call routing script.
If this is done within the call routing of the user you need to replace the announcement for, this is a very straight forward task.
Lets assume the user has an announcement file "welcome.wav" which you need to replace by an new announcement.
The idea for the call routing here is, that it checks if the caller is authorized to replace the announcement first. There are multiple ways to get this done, e.g.
- by checking the caller number ("Call" condition block, and then "Calls from caller ID (calling party number)")
- by asking the caller for a pin ("Get DTMF String" block and then "Evaluate" block to validate the entered pin, an example can be found here)
- check for specific post dialing digits (instead of asking the caller for a pin)
- or a combination of the above
You place this call routing on top of the list of rules in the call routing manager. This makes sure that regardless of what other call routing the user has activated, you will be able to call in and replace the announcement. If your call routing script figures that it is not you who is calling it just leaves the script via the "Rule skipped" exit to let let the rest of the users call routing handle this call.
So once you have identified and authorized the caller your call routing could do the following:
- Play the current "Welcome.wav" announcement to make sure that this really is the announcement you want to replace
- Record a new announcement by using the "Record Message" block
- Save/upload this newly recorded message file into the SwyxWare database with the name "Welcome.wav". By doing so you overwrite the existing one.
- Play the "Welcome.wav" announcement again, to make sure that your recorded announcement has really been updated.
Of course this is just a suggestion. You can do what ever else you want/need to here. This just demonstrates how to do the replacement.
The call routing script looks as simple as this:
The "Call" block just does a simple caller verification and authentication by the caller number.
The "Record Message" block places the name of the newly recorded wav file into the "sNewWelcome" variable.
The "Insert Script Code" blok uses the PBXUser.UploadFile function from the Server Script API to upload the recorded file into the database and store it there with the name "welcome.wav". The previously existing file will be overwritten.
You can download this simple rule via the following link:
Open a new GSE rule, import this file via the "File | Import..." menu and save the rule.
Now move the new rule on top of the list of your rules.
Enjoy!
PS: don't miss to take a look into the ECR Useful Link Collection.
0 Comments
Recommended Comments
There are no comments to display.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now