Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix status callbacks #2014

Merged
merged 1 commit into from
May 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion engine/apps/phone_notifications/phone_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def notify_by_call(self, user, alert_group, notification_policy):
renderer = AlertGroupPhoneCallRenderer(alert_group)
message = renderer.render()

record = PhoneCallRecord.objects.create(
record = PhoneCallRecord(
represents_alert_group=alert_group,
receiver=user,
notification_policy=notification_policy,
Expand Down
17 changes: 13 additions & 4 deletions engine/apps/twilioapp/status_callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ def update_twilio_call_status(call_sid, call_status):
# Will be removed soon.
if twilio_phone_call:
logger.info(
f"twilioapp.update_twilio_call_status: found legacy twilio_phone_call sid={call_sid}"
f" status={call_status}"
f"twilioapp.update_twilio_call_status: found twilio_phone_call sid={call_sid}" f" status={call_status}"
)
status = TwilioCallStatuses.DETERMINANT.get(call_status)
twilio_phone_call.status = status
Expand All @@ -46,7 +45,7 @@ def update_twilio_call_status(call_sid, call_status):

if phone_call_record and status:
logger.info(
f"twilioapp.update_twilio_call_status: processing using phone_call_record id={phone_call_record.id} "
f"twilioapp.update_twilio_call_status: found phone_call_record_id={phone_call_record.id} "
f"sid={call_sid} status={call_status}"
)
log_record_type = None
Expand All @@ -72,6 +71,11 @@ def update_twilio_call_status(call_sid, call_status):
if phone_call_record.notification_policy
else None,
)
log_record.save()
logger.info(
f"twilioapp.update_twilio_call_status: created log_record log_record_id={log_record.id} "
f"type={log_record_type}"
)
user_notification_action_triggered_signal.send(sender=update_twilio_call_status, log_record=log_record)


Expand Down Expand Up @@ -121,7 +125,7 @@ def update_twilio_sms_status(message_sid, message_status):

if sms_record and status:
logger.info(
f"twilioapp.update_twilio_sms_status: processing using sms_record id={sms_record.id} "
f"twilioapp.update_twilio_sms_status: found sms_record_id={sms_record.id} "
f"sid={message_sid} status={message_status}"
)
log_record_type = None
Expand All @@ -144,6 +148,11 @@ def update_twilio_sms_status(message_sid, message_status):
if sms_record.notification_policy
else None,
)
log_record.save()
logger.info(
f"twilioapp.update_twilio_sms_status: created log_record log_record_id={log_record.id} "
f"type={log_record_type}"
)
user_notification_action_triggered_signal.send(sender=update_twilio_sms_status, log_record=log_record)


Expand Down