Reputation: 29
I'm currently using Twilio Flex for my work, and I set up a custom hold music as per these instructions: https://support.twilio.com/hc/en-us/articles/360024055153-Change-the-Hold-Music-with-Twilio-Flex#h_031b6c4b-32cd-4c15-a50b-cc6e9685b3ae
It works fine when the user initially calls, but when an agent sets them on hold, it plays the default music. I tried to write a plugin that would replace the music on HoldCall, but it simply does not work. Help? Ideas?
init(flex, manager) {
this.registerReducers(manager);
flex.Actions.replaceAction(
"HoldCall",
(payload, original) => {
return new Promise((resolve, reject) => {
resolve();
}).then(() => original(payload));
},
"https://handler.twilio.com/twiml/EH994450acfdcfea4b1f097ed2367d4e94"
);}
Upvotes: 2
Views: 1556
Reputation: 366
You can do like below to get it working Make sure you create twimil first and use that url
You twimil will contain your hold music...
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Play>http://demo.twilio.com/docs/classic.mp3</Play>
</Response>
flex.Actions.replaceAction("HoldCall", (payload, original) => {
alert("ON HOLD");
return new Promise((resolve, reject) => {
resolve();
}).then(() => {
original({
...payload,
holdMusicUrl: "https://handler.twilio.com/twiml/EH68cc31b0a9c96616cb877ee471169c60", // your twimil url
holdMusicMethod: "POST",
});
});
});
Upvotes: 2