Send a phone call from AI agent, in an API call. Or, directly call the bot from the configured phone number!
Python
ux: Send SMS to both current caller and policyholder
Clémence Lesnéa34c81d6d026
diff --git a/helpers/call_events.py b/helpers/call_events.pyindex 4a316ad..c2f1a35 100644--- a/helpers/call_events.py+++ b/helpers/call_events.py@@ -319,23 +319,29 @@ async def _post_call_sms(call: CallModel) -> None:if not content:_logger.warning("Error generating SMS report")return-_logger.info(f"SMS report: {content}")- success = await _sms.asend(content, call.phone_number)-- if not success:- _logger.warning("Failed sending SMS report")- return- # Store the SMS in the call messages- call.messages.append(- MessageModel(- action=MessageActionEnum.SMS,- content=content,- persona=MessagePersonaEnum.ASSISTANT,+ # Send the SMS to both the current caller and the policyholder+ success = False+ for number in set([call.phone_number, call.claim.policyholder_phone]):+ if not number:+ continue+ res = await _sms.asend(content, number)+ if not res:+ _logger.warning(f"Failed sending SMS report to {number}")+ continue+ success = True++ if success:+ # Store the SMS in the call messages+ call.messages.append(+ MessageModel(+ action=MessageActionEnum.SMS,+ content=content,+ persona=MessagePersonaEnum.ASSISTANT,+ ))- )- await _db.call_aset(call)+ await _db.call_aset(call)async def _post_call_synthesis(call: CallModel) -> None: