Update voiceai-server.js

This commit is contained in:
2026-04-13 03:30:45 +00:00
parent 87d0e5dcb8
commit a7f08a0ebd

View File

@@ -51,7 +51,7 @@ app.post('/respond',async(req,res)=>{
}); });
const t=new twilio.twiml.VoiceResponse(); const t=new twilio.twiml.VoiceResponse();
t.say({voice:'Polly.Joanna-Neural'},'One moment please.'); t.say({voice:'Polly.Joanna-Neural'},'One moment please.');
t.pause({length:2}); t.pause({length:1});
t.redirect({method:'POST'},'https://voice.onsethost.com/check?sid='+sid+'&attempt=0'); t.redirect({method:'POST'},'https://voice.onsethost.com/check?sid='+sid+'&attempt=0');
res.type('text/xml');res.send(t.toString()); res.type('text/xml');res.send(t.toString());
}); });
@@ -71,7 +71,7 @@ app.post('/check',async(req,res)=>{
t.say({voice:'Polly.Joanna-Neural'},'Thank you for calling. Goodbye!'); t.say({voice:'Polly.Joanna-Neural'},'Thank you for calling. Goodbye!');
t.hangup(); t.hangup();
} else if(attempt<20){ } else if(attempt<20){
t.pause({length:2}); t.pause({length:1});
t.redirect({method:'POST'},'https://voice.onsethost.com/check?sid='+sid+'&attempt='+(attempt+1)); t.redirect({method:'POST'},'https://voice.onsethost.com/check?sid='+sid+'&attempt='+(attempt+1));
} else { } else {
t.say({voice:'Polly.Joanna-Neural'},'I apologize for the delay. Please call back shortly.'); t.say({voice:'Polly.Joanna-Neural'},'I apologize for the delay. Please call back shortly.');