zoom support
This commit is contained in:
parent
1c5d4eb7ab
commit
32a1ddca40
4 changed files with 98 additions and 11 deletions
|
|
@ -14,7 +14,10 @@ class CreateInboundCall(BaseModel):
|
|||
agent_config: AgentConfig
|
||||
synthesizer_config: Optional[SynthesizerConfig] = None
|
||||
twilio_sid: str
|
||||
conversation_id: Optional[str] = None
|
||||
|
||||
|
||||
class EndOutboundCall(BaseModel):
|
||||
call_id: str
|
||||
|
||||
|
||||
class CreateOutboundCall(BaseModel):
|
||||
|
|
@ -25,3 +28,14 @@ class CreateOutboundCall(BaseModel):
|
|||
synthesizer_config: Optional[SynthesizerConfig] = None
|
||||
conversation_id: Optional[str] = None
|
||||
# TODO add IVR/etc.
|
||||
|
||||
|
||||
class DialIntoZoomCall(BaseModel):
|
||||
recipient: CallEntity
|
||||
caller: CallEntity
|
||||
zoom_meeting_id: str
|
||||
zoom_meeting_password: Optional[str]
|
||||
transcriber_config: Optional[TranscriberConfig] = None
|
||||
agent_config: AgentConfig
|
||||
synthesizer_config: Optional[SynthesizerConfig] = None
|
||||
conversation_id: Optional[str] = None
|
||||
|
|
|
|||
|
|
@ -2,11 +2,12 @@ from typing import Optional
|
|||
from vocode.models.agent import AgentConfig
|
||||
from vocode.models.synthesizer import SynthesizerConfig
|
||||
from vocode.models.transcriber import TranscriberConfig
|
||||
from ..models.telephony import CallEntity, CreateOutboundCall
|
||||
from ..models.telephony import CallEntity, CreateOutboundCall, EndOutboundCall
|
||||
import requests
|
||||
from .. import api_key, BASE_URL
|
||||
|
||||
VOCODE_OUTBOUND_CALL_URL = f"https://{BASE_URL}/create_outbound_call"
|
||||
VOCODE_CREATE_OUTBOUND_CALL_URL = f"https://{BASE_URL}/create_outbound_call"
|
||||
VOCODE_END_OUTBOUND_CALL_URL = f"https://{BASE_URL}/end_outbound_call"
|
||||
|
||||
|
||||
class OutboundCall:
|
||||
|
|
@ -17,16 +18,18 @@ class OutboundCall:
|
|||
agent_config: AgentConfig,
|
||||
transcriber_config: Optional[TranscriberConfig] = None,
|
||||
synthesizer_config: Optional[SynthesizerConfig] = None,
|
||||
conversation_id: Optional[str] = None,
|
||||
):
|
||||
self.recipient = recipient
|
||||
self.caller = caller
|
||||
self.agent_config = agent_config
|
||||
self.transcriber_config = transcriber_config
|
||||
self.synthesizer_config = synthesizer_config
|
||||
self.conversation_id = conversation_id
|
||||
|
||||
def start(self):
|
||||
return requests.post(
|
||||
VOCODE_OUTBOUND_CALL_URL,
|
||||
def start(self) -> str:
|
||||
response = requests.post(
|
||||
VOCODE_CREATE_OUTBOUND_CALL_URL,
|
||||
headers={"Authorization": f"Bearer {api_key}"},
|
||||
json=CreateOutboundCall(
|
||||
recipient=self.recipient,
|
||||
|
|
@ -34,5 +37,19 @@ class OutboundCall:
|
|||
agent_config=self.agent_config,
|
||||
transcriber_config=self.transcriber_config,
|
||||
synthesizer_config=self.synthesizer_config,
|
||||
conversation_id=self.conversation_id,
|
||||
).dict(),
|
||||
)
|
||||
assert response.ok, response.text
|
||||
data = response.json()
|
||||
self.conversation_id = data["id"]
|
||||
|
||||
def end(self) -> str:
|
||||
response = requests.post(
|
||||
VOCODE_END_OUTBOUND_CALL_URL,
|
||||
headers={"Authorization": f"Bearer {api_key}"},
|
||||
json=EndOutboundCall(
|
||||
call_id=self.conversation_id,
|
||||
).dict(),
|
||||
)
|
||||
assert response.ok, response.text
|
||||
|
|
|
|||
53
vocode/telephony/zoom_dial_in.py
Normal file
53
vocode/telephony/zoom_dial_in.py
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
from typing import Optional
|
||||
from vocode.models.agent import AgentConfig
|
||||
from vocode.models.synthesizer import SynthesizerConfig
|
||||
from vocode.models.transcriber import TranscriberConfig
|
||||
from vocode.telephony.outbound_call import OutboundCall
|
||||
from ..models.telephony import CallEntity, DialIntoZoomCall
|
||||
import requests
|
||||
from .. import api_key, BASE_URL
|
||||
|
||||
VOCODE_ZOOM_DIAL_IN_URL = f"https://{BASE_URL}/dial_into_zoom_call"
|
||||
|
||||
|
||||
class ZoomDialIn(OutboundCall):
|
||||
def __init__(
|
||||
self,
|
||||
recipient: CallEntity,
|
||||
caller: CallEntity,
|
||||
zoom_meeting_id: str,
|
||||
zoom_meeting_password: str,
|
||||
agent_config: AgentConfig,
|
||||
transcriber_config: Optional[TranscriberConfig] = None,
|
||||
synthesizer_config: Optional[SynthesizerConfig] = None,
|
||||
conversation_id: Optional[str] = None,
|
||||
):
|
||||
super().__init__(
|
||||
recipient=recipient,
|
||||
caller=caller,
|
||||
agent_config=agent_config,
|
||||
transcriber_config=transcriber_config,
|
||||
synthesizer_config=synthesizer_config,
|
||||
conversation_id=conversation_id,
|
||||
)
|
||||
self.zoom_meeting_id = zoom_meeting_id
|
||||
self.zoom_meeting_password = zoom_meeting_password
|
||||
|
||||
def start(self) -> str:
|
||||
response = requests.post(
|
||||
VOCODE_ZOOM_DIAL_IN_URL,
|
||||
headers={"Authorization": f"Bearer {api_key}"},
|
||||
json=DialIntoZoomCall(
|
||||
recipient=self.recipient,
|
||||
caller=self.caller,
|
||||
zoom_meeting_id=self.zoom_meeting_id,
|
||||
zoom_meeting_password=self.zoom_meeting_password,
|
||||
agent_config=self.agent_config,
|
||||
transcriber_config=self.transcriber_config,
|
||||
synthesizer_config=self.synthesizer_config,
|
||||
conversation_id=self.conversation_id,
|
||||
).dict(),
|
||||
)
|
||||
assert response.ok, response.text
|
||||
data = response.json()
|
||||
self.conversation_id = data["id"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue