NS Call Monitor

An application that will allow you to monitor incoming and outgoing calls.

       

Tech stack

  • Minimum SDK level 23
  • Kotlin based, Coroutines
    • Flow for call logs.
  • Jetpack
    • Lifecycle: Observe Android lifecycles and handle UI states upon the lifecycle changes.
    • ViewModel: Manages UI-related data holder and lifecycle aware. Allows data to survive configuration changes such as screen rotations.
    • DataBinding: Used to update the Server Details View on the dashboard based on observations from the DashboardViewModel.
    • Room: A database consisting of two tables serving the Call Logs (call_log) + Query Count ( call_log_query) shared between client and server.
    • Hilt: for dependency injection.
  • Architecture
    • Clean MVVM Architecture (View - DataBinding - ViewModel - UseCase - Model)
  • KTOR for the HTTP Server monitoring the call logs
  • Material-Components: Material design to help with the the dark and light theming + text styling.
  • Mockk with Junit5-Jupiter for Unit Testing.

API

Root

Model

Services
Type Description
startTime: String Start time of the server.
services: Array List of endpoints on the server
Service
Type Description
name: String Endpoint name
uri: String Full uri for endpoint

Responses

curl http://<SERVER_HOST>:<PORT>

(200) Success Response
{
  "startTime": "2022-10-20T12:27:35.483",
  "services": [
    {
      "name": "ongoing",
      "uri": "http://192.168.0.146:12345/ongoing"
    },
    {
      "name": "logs",
      "uri": "http://192.168.0.146:12345/logs"
    }
  ]
}          

Logs

Model

Type Description
name: String | null Name of contact, null if unknown
number: String Number of contact formatted based on Locale
startTime: String | null Time call is answered in ISO 8601 format using UTC timezone. null if call is ringing.
endTime: String | null Time call ends in ISO 8601 format using UTC timezone. null if call is ongoing or missed.
duration: Number Duration of call in milliseconds
status: String Status of call. Options are: Ringing, Missed, Ongoing, Complete.
type: String Type of call. Options are: Incoming, Outgoing.
numberOfQueries: Number Number of times this call log has been queried

Responses

curl http://<SERVER_HOST>:<PORT>/logs

(200) Success Response
[
  {
    "name": null,
    "number": "+49 30 351288585",
    "startTime": "2022-10-18T01:04:22.34Z",
    "endTime": "2022-10-18T01:04:29.232Z",
    "duration": 6892,
    "status": "Complete",
    "type": "Outgoing",
    "numberOfQueries": 5
  },
  {
    "name": "Jane Doe",
    "number": "+49 50 234593848",
    "startTime": null,
    "endTime": null,
    "duration": 0,
    "status": "Ringing",
    "type": "Incoming",
    "numberOfQueries": 2
  }
]
(404) Error Response
No monitored calls available.

Ongoing Call

curl http://<SERVER_HOST>:<PORT>/ongoing

(200) Success Response
{
  "name": "Jane Doe",
  "number": "+49 50 234593848",
  "startTime": "2022-10-18T01:04:22.34Z",
  "endTime": null,
  "duration": 0,
  "status": "Ongoing",
  "type": "Outgoing",
  "numberOfQueries": 5
}
(404) Error Response
There are no ongoing calls happening.