setExtensionInfo method

void setExtensionInfo(
  1. GetExtensionResponse extensionResponse
)

Implementation

void setExtensionInfo(GetExtensionResponse extensionResponse) {
  _logger.info('sipServer ${extensionResponse.sipServer.toString()}');
  final String userAgentInit = extensionResponse.sipServer.userAgent ?? '';
  final String userAgentConvert = userAgentInit.isNotEmpty
      ? userAgentInit
      : 'Flutter SDK: Pitel Connect v1.0.6';

  _sipServer = extensionResponse.sipServer;
  _username = extensionResponse.username;
  _password = extensionResponse.password;
  _displayName = extensionResponse.displayName;
  _userAgent = userAgentConvert;

  if (isTest) {
    _username = usernameTest;
    _password = passwordTest;
    _sipServer = SipServer(
      id: 0,
      domain: domainTest,
      port: portTest,
      outboundProxy: '',
      wss: wssTest,
      transport: 0,
      createdAt: '',
      project: '',
    );
  }
  _logger.info('sipAccount ${extensionResponse.username} enabled');
}