diff --git a/src/pipecat/transports/smallwebrtc/request_handler.py b/src/pipecat/transports/smallwebrtc/request_handler.py index 3a6c77843..00d9ebb6a 100644 --- a/src/pipecat/transports/smallwebrtc/request_handler.py +++ b/src/pipecat/transports/smallwebrtc/request_handler.py @@ -116,6 +116,10 @@ class SmallWebRTCRequestHandler: detail="Cannot create new connection with existing connection active", ) + def update_ice_servers(self, ice_servers: Optional[List[IceServer]] = None): + """Update the list of ICE servers used for WebRTC connections.""" + self._ice_servers = ice_servers + async def handle_web_request( self, request: SmallWebRTCRequest, diff --git a/src/pipecat/transports/whatsapp/api.py b/src/pipecat/transports/whatsapp/api.py index b7e9388ee..b06ac5c6b 100644 --- a/src/pipecat/transports/whatsapp/api.py +++ b/src/pipecat/transports/whatsapp/api.py @@ -241,6 +241,14 @@ class WhatsAppApi: self._whatsapp_url = f"{self.BASE_URL}{phone_number_id}/calls" self._whatsapp_token = whatsapp_token + def update_whatsapp_token(self, whatsapp_token: str): + """Update the WhatsApp access token for authentication.""" + self._whatsapp_token = whatsapp_token + + def update_whatsapp_phone_number_id(self, phone_number_id: str): + """Update the WhatsApp phone number ID for authentication.""" + self._phone_number_id = phone_number_id + async def answer_call_to_whatsapp(self, call_id: str, action: str, sdp: str, from_: str): """Answer an incoming WhatsApp call. diff --git a/src/pipecat/transports/whatsapp/client.py b/src/pipecat/transports/whatsapp/client.py index f6fd83e7b..f48174f90 100644 --- a/src/pipecat/transports/whatsapp/client.py +++ b/src/pipecat/transports/whatsapp/client.py @@ -73,6 +73,22 @@ class WhatsAppClient: else: self._ice_servers = ice_servers + def update_ice_servers(self, ice_servers: Optional[List[IceServer]] = None): + """Update the list of ICE servers used for WebRTC connections.""" + self._ice_servers = ice_servers + + def update_whatsapp_secret(self, whatsapp_secret: Optional[str] = None): + """Update the WhatsApp APP secret for validating that the webhook request came from WhatsApp.""" + self._whatsapp_secret = whatsapp_secret + + def update_whatsapp_token(self, whatsapp_token: str): + """Update the WhatsApp API access token.""" + self._whatsapp_api.update_whatsapp_token(whatsapp_token) + + def update_whatsapp_phone_number_id(self, phone_number_id: str): + """Update the WhatsApp phone number ID for authentication.""" + self._whatsapp_api.update_whatsapp_phone_number_id(phone_number_id) + async def terminate_all_calls(self) -> None: """Terminate all ongoing WhatsApp calls.