End of Call Report - Cost and Cost Breakdown
# support
w
When receiving the end-of-call-report I do not seem to have the cost or cost breakdonw included. Both appear as -> None
s
Can you check once again cause I can see the cost breakdown.
w
Have double checked and still not coming through. I have set it up so that my server collects the message only when it is of type "end-of-call-report" however when I receive this report the status is still "in-progress" so maybe the report is being sent too early. I am sure that it is the end-of call report as all of the other server messages have their own handling.
s
Change the server messages to display only the end-of-call report. Then, could you inform me about the result you are obtaining?
w
@Sahil Just tried this and it's still not showing
Copy code
python

class FunctionsAPIView(APIView):
  def post(self, request, *args, **kwargs):
    data = request.data  # DRF uses request.data instead of request.json
    payload = data.get('message')
    
    if payload['type'] == 'end-of-call-report':
      # Handle end-of-call report by sending the data to the call analysis view
      return self.handle_end_of_call_report(request, data)

    elif payload["type"] == "function-call":
      function_call = payload.get('functionCall')

      if not function_call:
        raise ValueError("Invalid function call")

      function_name = function_call.get('name')
      parameters = function_call.get('parameters')

      if function_name == "get_availability":
        timezone = parameters.get('timezone')
        availability = get_free_slots(timezone)
        print("AVAILABILITY FUNCTION CALLED", "\n")
        return Response({"result": f"{availability}"})

    elif payload["type"] == 'status-update':
      return Response({"result": "ignore"})

    elif payload['type'] == 'hang':
      return Response({"result": "ignore"})
      
    else:
      print(f"{payload['type']}", "\n")
      raise ValueError("Unhandled message type")
Here is part of the code, so will only analyse anything that has 'end-of-call-report' and the message type
2 Views