示例#1
0
    def initiate_conference_call(self, conference, user):
        path = reverse('conference_response', args=(conference.id, ))
        url = "{}{}".format(settings.BASE_URL, path)
        sid = self._make_call(user.userprofile.phone_number,
                              self.calling_number, url)

        call = Call(conference=conference, user=user, twilio_sid=sid)
        call.save()

        call_event = CallEvent(call=call, event_type=CallEvent.CALL)
        call_event.save()
示例#2
0
    def initiate_conference_call(self, conference, user):
        path = reverse('conference_response', args=(conference.id,))
        url = "{}{}".format(
            settings.BASE_URL,
            path)
        sid = self._make_call(user.userprofile.phone_number, self.calling_number, url)

        call = Call(conference=conference, user=user, twilio_sid=sid)
        call.save()

        call_event = CallEvent(call=call, event_type=CallEvent.CALL)
        call_event.save()
示例#3
0
文件: tests.py 项目: JBKahn/escalator
    def test_incoming_call(self):
        self.conference.user_set.add(self.user)
        call = Call(conference=self.conference, user=self.user, twilio_sid='888')
        call.save()
        self.assertEquals(call.call_state, call.INCOMING)

        url = reverse('conference_response', args=(self.conference.id,))
        resp = self.client.post(url, {'CallSid':call.twilio_sid})
        #self.assertContains(resp.content, self.conference.name)
        call_result = Call.objects.get(id=call.id)
        self.assertEquals(call_result.call_state, Call.IN_CALL)
        self.assertTrue(CallEvent.objects.filter(call=call, event_type=CallEvent.JOIN).exists())
示例#4
0
    def test_incoming_call(self):
        self.conference.user_set.add(self.user)
        call = Call(conference=self.conference,
                    user=self.user,
                    twilio_sid='888')
        call.save()
        self.assertEquals(call.call_state, call.INCOMING)

        url = reverse('conference_response', args=(self.conference.id, ))
        resp = self.client.post(url, {'CallSid': call.twilio_sid})
        #self.assertContains(resp.content, self.conference.name)
        call_result = Call.objects.get(id=call.id)
        self.assertEquals(call_result.call_state, Call.IN_CALL)
        self.assertTrue(
            CallEvent.objects.filter(call=call,
                                     event_type=CallEvent.JOIN).exists())