PhonecallController
struct PhonecallController : APIRouteCollectionThe collection of /api/v3/phone/* route endpoints and handler functions related to phone call management..
- 
                  
                  DeclarationSwift static let logger: <<error type>>
- 
                  
                  DeclarationSwift var encoder: JSONEncoder { get }
- 
                  
                  Required. Registers routes to the incoming router. DeclarationSwift func registerRoutes(_ app: Application) throws
- 
                  initiateCallHandler(_:Asynchronous) POST /api/v3/phone/initiate/:call_id/to/:user_idThe requester is trying to start a phone call to the given user. Notify the target user of the incoming phone call via their notification socket and provide the IP address(es) of the caller. The callee is then expected to open a socket to the caller for moving audio. Throws BadRequest if malformed. notFound if user can’t be notified of call.DeclarationSwift func initiateCallHandler(_ req: Request) async throws -> HTTPStatusParameterscallIDin URL path. Caller-provided UUID for this call. Callee needs to send this to caller to verify the socket is for the correct call. userIDThe userID of the user to call. Return Value200 OK on success 
- 
                  shouldCreatePhoneSocket(_:Asynchronous) GET /api/v3/phone/socket/initiate/:call_id/to/:user_idThe requester is trying to start a phone call to the given user. Notify the target user of the incoming phone call via their notification socket and save the caller socket. The callee should open a phone socket to the server using answerPhoneSocketat which point the server will start forwarding websocket packets between the caller and callee sockets.This is the server-mediated phone call path. Throws BadRequest if malformed. notFound if user can’t be notified of call.DeclarationSwift func shouldCreatePhoneSocket(_ req: Request) async throws -> HTTPHeaders?ParameterscallIDin URL path. Caller-provided UUID for this call. Callee needs to send this to caller to verify the socket is for the correct call. userIDThe userID of the user to call. Return Value200 OK on success 
- 
                  createPhoneSocket(_:Asynchronous_: ) WS /api/v3/phone/socket/initiate/:call_id/to/:user_idThe requester is trying to start a phone call to the given user. Notify the target user of the incoming phone call via their notification socket and save the caller socket. The callee should open a phone socket to the server using answerPhoneSocketat which point the server will start forwarding websocket packets between the caller and callee sockets.This is the server-mediated phone call path. Throws BadRequest if malformed. notFound if user can’t be notified of call.DeclarationSwift func createPhoneSocket(_ req: Request, _ ws: WebSocket) asyncParameterscallIDin URL path. Caller-provided UUID for this call. Callee needs to send this to caller to verify the socket is for the correct call. userIDThe userID of the user to call. Return Value200 OK on success 
- 
                  shouldAnswerPhoneSocket(_:Asynchronous) GET /api/v3/phone/socket/answer/:call_idThe requester is trying to answer an incoming phone call. This is the server-mediated phone call path. Throws BadRequest if malformed. NotFound if callID doesn’t exist.DeclarationSwift func shouldAnswerPhoneSocket(_ req: Request) async throws -> HTTPHeaders?ParameterscallIDin URL path. Caller-provided UUID for this call. Callee needs to send this to caller to verify the socket is for the correct call. Return Value200 OK on success 
- 
                  answerPhoneSocket(_:Asynchronous_: ) WS /api/v3/phone/socket/answer/:call_idThe requester is trying to answer an incoming phone call. This is the server-mediated phone call path. Throws BadRequest if malformed. NotFound if callID doesn’t exist.DeclarationSwift func answerPhoneSocket(_ req: Request, _ ws: WebSocket) asyncParameterscallIDin URL path. Caller-provided UUID for this call. Callee needs to send this to caller to verify the socket is for the correct call. Return Value200 OK on success 
- 
                  answerPhoneCall(_:Asynchronous) POST /api/v3/phone/answer/:call_IDThe answering party should call this when they answer the incoming call; this notifies other devices where that user is logged in to stop ringing. Only necessary for the direct-socket path. Throws BadRequest if malformed. NotFound if callID doesn’t exist.DeclarationSwift func answerPhoneCall(_ req: Request) async throws -> HTTPStatusParameterscallIDin URL path. UUID for this call. Return Value200 OK on success 
- 
                  declinePhoneCall(_:Asynchronous) POST /api/v3/phone/decline/:call_IDEither party may call this to end a server-mediated phone call. But, if you have an open socket for the call, it’s easier to just close the socket–the server will detect this and close the other socket and clean up. Requester must be a party to the call. This route is for when a phone call needs to be ended and the client does not have a socket connection. May be used for both direct and server-mediated calls. Throws BadRequest if malformed. NotFound if callID doesn’t exist.DeclarationSwift func declinePhoneCall(_ req: Request) async throws -> HTTPStatusParameterscallIDin URL path. Caller-provided UUID for this call. Callee needs to send this to caller to verify the socket is for the correct call. Return Value200 OK on success 
- 
                  
                  DeclarationSwift func endPhoneCall(callID: UUID)
 View on GitHub
            View on GitHub
           PhonecallController Structure Reference
      PhonecallController Structure Reference