diff --git a/apps/pla/models/model_voice_call.py b/apps/pla/models/model_voice_call.py index 73c0564..2062f5d 100644 --- a/apps/pla/models/model_voice_call.py +++ b/apps/pla/models/model_voice_call.py @@ -1,6 +1,7 @@ from django.db import models from apps.pla.models.model_alarm import Alarm +from apps.pla.models.model_channel import PlaChannel class VoiceCall(models.Model): @@ -8,6 +9,7 @@ class VoiceCall(models.Model): created_at = models.DateTimeField(auto_now_add=True) sent = models.BooleanField(default=False) alarm_file = models.ForeignKey(Alarm, on_delete=models.CASCADE) + channels = models.ManyToManyField(PlaChannel) def __str__(self): return f"{self.created_at}" diff --git a/apps/pla/views/views_radiusip.py b/apps/pla/views/views_radiusip.py index a906f4e..4850b0f 100644 --- a/apps/pla/views/views_radiusip.py +++ b/apps/pla/views/views_radiusip.py @@ -21,6 +21,8 @@ from sabron.util import logging def start_call(request, alarm): call = VoiceCall.objects.create(alarm_file=alarm) + active_channels = PlaChannel.objects.filter(active=True) + call.channels.add(*active_channels) return redirect("/pla/")