register method

void register({
  1. String? displayName,
  2. String? sipServer,
  3. String? wsServer,
  4. String? authUsername,
  5. String? username,
  6. String? password,
  7. String? callTo,
  8. String? callToAlias,
  9. bool? keyboard,
})

Registers the SIP client with the provided settings.

Any parameter that is not provided will fall back to predefined defaults.

After registration, the SIP stack becomes ready for making calls.

Implementation

void register({
  String? displayName,
  String? sipServer,
  String? wsServer,
  String? authUsername,
  String? username,
  String? password,
  String? callTo,
  String? callToAlias,
  bool? keyboard,
}) {
  const defaultDisplayName = "Mobile Call Button";
  const defaultSipServer = "webcall.ccms.vn";
  const defaultWsServer = "wss://webcall.ccms.vn:8089/ws";
  const defaultAuthUsername = "1658102";
  const defaultUsername = "1658102";
  const defaultPassword = "5m!1r!37h8";
  const defaultCallTo = "sip:917102899998899@webcall.ccms.vn";
  const defaultCallToAlias = "HOTLINE CSKH TRIANH";
  const defaultKeyboard = true;

  init();

  final sipConfig = SipConfigModel(
    displayName: displayName ?? defaultDisplayName,
    sipServer: sipServer ?? defaultSipServer,
    wsServer: wsServer ?? defaultWsServer,
    authUsername: authUsername ?? defaultAuthUsername,
    username: username ?? defaultUsername,
    password: password ?? defaultPassword,
    callTo: callTo ?? defaultCallTo,
    callToAlias: callToAlias ?? defaultCallToAlias,
    keyboard: keyboard ?? defaultKeyboard,
  );

  _bloc.add(InitializeSipEvent(sipConfig));
}