File tree Expand file tree Collapse file tree 8 files changed +15
-19
lines changed
twilio-voice-ai-conversation
twilio-voice-dialer/public Expand file tree Collapse file tree 8 files changed +15
-19
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ The reference components demonstrate several common Twilio Voice use cases. Thes
2020 - View quality metrics
2121 - Receive warnings
2222 - View errors
23- - Voice AI Assistant
23+ - Voice AI Conversation
2424 - Place an outbound call and connect to an agent
2525 - Provide a Websocket server to interface with Conversation Relay
2626 - Basic OpenAI integration
@@ -51,7 +51,7 @@ cp example.env .env
5151https://yourdomain/twilio-voice-dialer/twiml
5252https://yourdomain/twilio-voice-basic-call-control/twiml
5353https://yourdomain/twilio-voice-monitoring/twiml
54- https://yourdomain/twilio-voice-ai-assistant /twiml
54+ https://yourdomain/twilio-voice-ai-conversation /twiml
5555```
5656
5757## Run the project locally
@@ -67,4 +67,4 @@ npm start
6767- Dialer: [ http://localhost:3030/twilio-voice-dialer?identity=bob ] ( http://localhost:3030/twilio-voice-dialer?identity=bob ) .
6868- Basic Call Control: [ http://localhost:3030/twilio-voice-basic-call-control?identity=bob ] ( http://localhost:3030/twilio-voice-basic-call-control?identity=bob ) .
6969- Monitoring: [ http://localhost:3030/twilio-voice-monitoring?identity=bob ] ( http://localhost:3030/twilio-voice-monitoring?identity=bob ) .
70- - Voice AI Assistant : [ http://localhost:3030/twilio-voice-ai-assistant ?identity=bob ] ( http://localhost:3030/twilio-voice-ai-assistant ?identity=bob ) .
70+ - Voice AI Conversation : [ http://localhost:3030/twilio-voice-ai-conversation ?identity=bob ] ( http://localhost:3030/twilio-voice-ai-conversation ?identity=bob ) .
Original file line number Diff line number Diff line change @@ -31,6 +31,6 @@ CALLBACK_BASE_URL=foo.ngrok.dev
3131# Default identity to use
3232DEFAULT_IDENTITY = alice
3333
34- # twilio-voice-ai-assistant
34+ # twilio-voice-ai-conversation
3535# See https://platform.openai.com/settings/organization/api-keys
3636OPENAI_API_KEY = sk-proj.......
File renamed without changes.
Original file line number Diff line number Diff line change 44 < meta charset ="UTF-8 " />
55 < meta name ="viewport " content ="width=device-width, initial-scale=1.0 " />
66 < meta http-equiv ="X-UA-Compatible " content ="ie=edge " />
7- < title > Twilio Voice AI Assistant </ title >
7+ < title > Twilio Voice AI Conversation </ title >
88 </ head >
99 < body >
10- < h1 > Twilio Voice AI Assistant </ h1 >
10+ < h1 > Twilio Voice AI Conversation </ h1 >
1111
12- < twilio-voice-ai-assistant > </ twilio-voice-ai-assistant >
12+ < twilio-voice-ai-conversation > </ twilio-voice-ai-conversation >
1313
1414 < script src ="/twilio.js "> </ script >
15- < script src ="twilio-voice-ai-assistant .js "> </ script >
15+ < script src ="twilio-voice-ai-conversation .js "> </ script >
1616 < script src ="index.js "> </ script >
1717 </ body >
1818</ html >
Original file line number Diff line number Diff line change 11( async function ( ) {
22 const urlParams = new URLSearchParams ( window . location . search ) ;
33 const identity = urlParams . get ( 'identity' ) ;
4- const tokenUrl = `/twilio-voice-ai-assistant /token?identity=${ identity } ` ;
4+ const tokenUrl = `/twilio-voice-ai-conversation /token?identity=${ identity } ` ;
55
66 const response = await fetch ( tokenUrl ) ;
77 const data = await response . json ( ) ;
88
9- const twilioVoiceAIAssistant = document . querySelector ( 'twilio-voice-ai-assistant ' ) ;
10- twilioVoiceAIAssistant . setToken ( data . token ) ;
11- twilioVoiceAIAssistant . addEventListener ( 'tokenWillExpire' , async ( e ) => {
9+ const twilioVoiceAIConversation = document . querySelector ( 'twilio-voice-ai-conversation ' ) ;
10+ twilioVoiceAIConversation . setToken ( data . token ) ;
11+ twilioVoiceAIConversation . addEventListener ( 'tokenWillExpire' , async ( e ) => {
1212 const device = e . detail . device ;
1313
1414 const updateTokenResponse = await fetch ( tokenUrl ) ;
Original file line number Diff line number Diff line change 1- class TwilioVoiceAIAssistant extends HTMLElement {
1+ class TwilioVoiceAIConversation extends HTMLElement {
22 #call;
33 #conversationRelayLog;
44 #device;
@@ -114,6 +114,6 @@ class TwilioVoiceAIAssistant extends HTMLElement {
114114}
115115
116116customElements . define (
117- 'twilio-voice-ai-assistant ' ,
118- TwilioVoiceAIAssistant
117+ 'twilio-voice-ai-conversation ' ,
118+ TwilioVoiceAIConversation
119119) ;
File renamed without changes.
Original file line number Diff line number Diff line change @@ -76,10 +76,6 @@ class TwilioVoiceDialer extends HTMLElement {
7676 this . dispatchEvent ( tokenWillExpireEvent ) ;
7777 }
7878
79- disconnectedCallback ( ) {
80- this . #device. destroy ( ) ;
81- }
82-
8379 #handleAccept( ) {
8480 this . #call. accept ( ) ;
8581 this . #setStatus( 'inprogress' ) ;
You can’t perform that action at this time.
0 commit comments