invite method

void invite(
  1. String callerName,
  2. String callerNumber,
  3. String destinationNumber,
  4. String clientState,
  5. String callId,
  6. String telnyxSessionId,
  7. Map<String, String> customHeaders,
)

Implementation

void invite(
  String callerName,
  String callerNumber,
  String destinationNumber,
  String clientState,
  String callId,
  String telnyxSessionId,
  Map<String, String> customHeaders,
) async {
  final sessionId = _selfId;

  final Session session = await _createSession(
    null,
    peerId: '0',
    sessionId: sessionId,
    media: 'audio',
  );

  _sessions[sessionId] = session;

  await _createOffer(
    session,
    'audio',
    callerName,
    callerNumber,
    destinationNumber,
    clientState,
    callId,
    telnyxSessionId,
    customHeaders,
  );
  onCallStateChange?.call(session, CallState.newCall);
}