api.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:universal_notifications 作者: ArabellaTech 项目源码 文件源码
def post(self, request):
        data = request.data

        # Clean emoji for now
        if isinstance(data, dict) and data.get('Body'):
            if isinstance(data, QueryDict):
                data = data.dict()
            data['Body'] = clean_text(data['Body'])
        PhoneReceivedRaw.objects.create(data=data)

        if data.get('Direction') == 'inbound':
            if data.get('CallStatus') == 'ringing':  # incoming voice call
                text = getattr(settings, 'UNIVERSAL_NOTIFICATIONS_TWILIO_CALL_RESPONSE_DEFAULT',
                               '<?xml version="1.0" encoding="UTF-8"?>' +
                               '<Response>' +
                               '<Say>Hello, thanks for calling. ' +
                               'To leave a message wait for the tone.</Say>' +
                               '<Record timeout="30" />'
                               '</Response>')
                return Response(SafeString(text), content_type='text/xml')
        return Response({}, status=status.HTTP_202_ACCEPTED)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号