コード例 #1
0
void CMobileOpalDlg::OnCallAnswer()
{
  if (!UpdateData())
    return;

  if (m_callAddress.IsEmpty())
    return;

  CStringA utfAddress((const TCHAR *)m_callAddress);

  OpalMessage command;
  memset(&command, 0, sizeof(command));
  command.m_type = OpalCmdSetUpCall;
  command.m_param.m_callSetUp.m_partyB = utfAddress;
  OpalMessage * response = OpalSendMessage(m_opal, &command);
  if (response != NULL) {
    if (response->m_type == OpalIndCommandError)
      ErrorBox(IDS_CALL_START_FAIL);
    else {
      m_currentCallToken = response->m_param.m_callSetUp.m_callToken;
      SetStatusText(IDS_CALLING);
      SetCallButton(true, IDS_HANGUP);
    }
    OpalFreeMessage(response);
  }
}
コード例 #2
0
void CMobileOpalDlg::OnTimer(UINT_PTR nIDEvent)
{
  if (nIDEvent == TimerID && m_opal != NULL) {
    OpalMessage * message = OpalGetMessage(m_opal, 0);
    if (message != NULL) {
      switch (message->m_type) {
        case OpalIndRegistration :
          if (message->m_param.m_registrationStatus.m_error == NULL ||
              message->m_param.m_registrationStatus.m_error[0] == '\0')
            SetStatusText(IDS_REGISTERED);
          else {
            CString text(message->m_param.m_registrationStatus.m_error);
            m_ctrlStatus.SetWindowText(text);
          }
          break;

        case OpalIndIncomingCall :
          SetStatusText(IDS_INCOMING_CALL);
          SetCallButton(true, IDS_ANSWER);
          m_ctrlAddress.EnableWindow(false);
          ShowWindow(true);
          BringWindowToTop();
          break;

        case OpalIndAlerting :
          SetStatusText(IDS_RINGING);
          break;

        case OpalIndEstablished :
          SetStatusText(IDS_ESTABLISHED);
          break;

        case OpalIndUserInput :
          if (message->m_param.m_userInput.m_userInput != NULL) {
            CString text(message->m_param.m_callCleared.m_reason);
            m_ctrlStatus.SetWindowText(text);
          }
          break;

        case OpalIndCallCleared :
          SetCallButton(true, IDS_CALL);
          m_ctrlAddress.EnableWindow(true);
          m_currentCallToken.Empty();

          if (message->m_param.m_callCleared.m_reason == NULL)
            SetStatusText(IDS_READY);
          else {
            CString text(message->m_param.m_callCleared.m_reason);
            m_ctrlStatus.SetWindowText(text);
          }
      }
      OpalFreeMessage(message);
    }
  }

  CDialog::OnTimer(nIDEvent);
}
コード例 #3
0
void CMobileOpalDlg::OnCallAnswer()
{
  UpdateData();

  OpalMessage * response = NULL;
  OpalMessage command;
  memset(&command, 0, sizeof(command));

  if (!m_incomingCallToken.IsEmpty()) {
    SetStatusText(IDS_ANSWERING);
    SetCallButton(true, IDS_HANGUP);
    command.m_type = OpalCmdAnswerCall;
    command.m_param.m_callToken = m_incomingCallToken;
    response = OpalSendMessage(m_opal, &command);
  }
  else if (!m_currentCallToken.IsEmpty()) {
    SetStatusText(IDS_HANGINGUP);
    SetCallButton(false, IDS_HANGUP);
    command.m_type = OpalCmdClearCall;
    command.m_param.m_callToken = m_currentCallToken;
    response = OpalSendMessage(m_opal, &command);
  }
  else if (!m_callAddress.IsEmpty()) {
    SetStatusText(IDS_CALLING);
    SetCallButton(true, IDS_HANGUP);
    CStringA utfAddress((const TCHAR *)m_callAddress);
    command.m_type = OpalCmdSetUpCall;
    command.m_param.m_callSetUp.m_partyB = utfAddress;
    response = OpalSendMessage(m_opal, &command);
  }

  if (response == NULL)
    ErrorBox(IDS_CALL_START_FAIL);
  else {
    if (response->m_type == OpalIndCommandError) {
      if (response->m_param.m_commandError == NULL || *response->m_param.m_commandError == '\0')
        ErrorBox(IDS_CALL_START_FAIL);
      else {
        CString text(response->m_param.m_commandError);
        MessageBox(text, NULL, MB_OK|MB_ICONEXCLAMATION);
      }
      SetCallButton(true, IDS_CALL);
    }
    else if (command.m_type == OpalCmdSetUpCall)
      m_currentCallToken = response->m_param.m_callSetUp.m_callToken;
    else if (command.m_type == OpalCmdAnswerCall) {
      m_currentCallToken = m_incomingCallToken;
      m_incomingCallToken.Empty();
    }

    OpalFreeMessage(response);
  }
}
コード例 #4
0
void CMobileOpalDlg::OnTimer(UINT_PTR nIDEvent)
{
  if (m_opal == NULL)
    InitialiseOPAL();

  if (nIDEvent == TimerID && m_opal != NULL) {
    OpalMessage * message = OpalGetMessage(m_opal, 0);
    if (message != NULL) {
      HandleMessage(*message);
      OpalFreeMessage(message);
    }
  }

  CDialog::OnTimer(nIDEvent);
}
コード例 #5
0
void CMobileOpalDlg::HandleMessage(OpalMessage & message)
{
  switch (message.m_type) {
    case OpalIndRegistration :
      switch (message.m_param.m_registrationStatus.m_status) {
        case OpalRegisterSuccessful :
        case OpalRegisterRestored :
          SetStatusText(IDS_REGISTERED);
          break;

        case OpalRegisterRemoved :
          SetStatusText(IDS_UNREGISTERED, message.m_param.m_registrationStatus.m_error);
          break;

        case OpalRegisterRetrying :
          SetStatusText(IDS_REGISTERING);
          break;

        case OpalRegisterFailed :
          SetStatusText(0, message.m_param.m_registrationStatus.m_error);
      }
      break;

    case OpalIndMessageWaiting :
      if (message.m_param.m_messageWaiting.m_type != NULL && *message.m_param.m_messageWaiting.m_type != '\0') {
        CStringA msg;
        msg.Format(IDS_MESSAGE_WAITING,
                   message.m_param.m_messageWaiting.m_type,
                   message.m_param.m_messageWaiting.m_party);
        SetStatusText(0, msg);
      }
      break;

    case OpalIndIncomingCall :
      if (m_incomingCallToken.IsEmpty() && m_currentCallToken.IsEmpty()) {
        m_incomingCallToken = message.m_param.m_incomingCall.m_callToken;
        SetStatusText(IDS_INCOMING_CALL);
        SetCallButton(true, IDS_ANSWER);
        m_ctrlCallAddress.EnableWindow(false);
        ShowWindow(true);
        BringWindowToTop();
        EnableFullPower();
      }
      else {
        OpalMessage command;
        memset(&command, 0, sizeof(command));
        command.m_type = OpalCmdClearCall;
        command.m_param.m_clearCall.m_callToken = message.m_param.m_incomingCall.m_callToken;
        command.m_param.m_clearCall.m_reason = OpalCallEndedByAnswerDenied;
        OpalMessage * response = OpalSendMessage(m_opal, &command);
        if (response != NULL)
          OpalFreeMessage(response);
        SetStatusText(IDS_BUSY);
      }
      break;

    case OpalIndAlerting :
      SetStatusText(IDS_RINGING);
      break;

    case OpalIndEstablished :
      SetSpeakerMode(m_speakerphone);
      SetStatusText(IDS_ESTABLISHED);
      break;

    case OpalIndUserInput :
      SetStatusText(0, message.m_param.m_userInput.m_userInput);
      break;

    case OpalIndCallCleared :
      if (m_currentCallToken  == message.m_param.m_callCleared.m_callToken ||
          m_incomingCallToken == message.m_param.m_callCleared.m_callToken) {
        m_incomingCallToken.Empty();
        m_currentCallToken.Empty();

        SetCallButton(true, IDS_CALL);
        m_ctrlCallAddress.EnableWindow(true);

        SetStatusText(IDS_READY, message.m_param.m_callCleared.m_reason);

        if (m_hPowerRequirement != NULL) {
          ReleasePowerRequirement(m_hPowerRequirement);
          m_hPowerRequirement = NULL;
        }
        PowerPolicyNotify(PPN_UNATTENDEDMODE, TRUE);
      }
  }
}
コード例 #6
0
void CMobileOpalDlg::InitialiseOPAL()
{
  /////////////////////////////////////////////////////////////////////
  // Start up and initialise OPAL

  if (m_opal == NULL) {
    m_opal = OpalInitialise(&m_opalVersion, "pc h323 sip " TRACE_OPTIONS);
    if (m_opal == NULL) {
      ErrorBox(IDS_INIT_FAIL);
      EndDialog(IDCANCEL);
      return;
    }
  }

  OpalMessage command;
  OpalMessage * response;

  // SIP registrar un-regisration
  CStringA strAOR = GetOptionStringA(RegistrarAorKey);
  CStringA strHost = GetOptionStringA(RegistrarHostKey);
  if (!m_currentAOR.IsEmpty() && (m_currentAOR != strAOR || m_currentHost != strHost)) {
    // Registration changed, so unregister the previous name
    memset(&command, 0, sizeof(command));
    command.m_type = OpalCmdRegistration;
    command.m_param.m_registrationInfo.m_protocol = "sip";
    command.m_param.m_registrationInfo.m_identifier = m_currentAOR;
    command.m_param.m_registrationInfo.m_hostName = m_currentHost;
    response = OpalSendMessage(m_opal, &command);
    if (response != NULL && response->m_type == OpalCmdRegistration) {
      OpalFreeMessage(response);

      UpdateWindow();

      // Wait for unregister to complete.
      while ((response = OpalGetMessage(m_opal, 30000)) != NULL) {
        HandleMessage(*response);
        if (response->m_type == OpalIndRegistration && response->m_param.m_registrationStatus.m_status == OpalRegisterRemoved)
          break;
      }
    }
    OpalFreeMessage(response);
    m_currentAOR.Empty();
    m_currentHost.Empty();
  }

  /* Calucalte some configuration strings, determine position of a QCIF
     window so is in bottom left corner, and a preview window for camera
     in lower right corner, scaled to fit remaining space. */
  static const unsigned videoWidth = 176;
  static const unsigned videoHeight = 144;
  CRect box;
  GetClientRect(&box);

  CRect commandBox;
  m_dlgCommandBar.GetWindowRect(&commandBox);
  box.bottom -= commandBox.Height();

  CStringA strVideoOutputDevice;
  strVideoOutputDevice.Format("MSWIN STYLE=0x%08X PARENT=0x%08X X=%i Y=%i WIDTH=%u HEIGHT=%u",
                              WS_CHILD|WS_BORDER, GetSafeHwnd(),
                              0, box.Height()-videoHeight,
                              videoWidth, videoHeight);

  unsigned previewWidth = box.Width() - videoWidth - 2;
  unsigned previewHeight = previewWidth*videoHeight/videoWidth;
  CStringA strVideoPreviewDevice;
  strVideoPreviewDevice.Format("MSWIN STYLE=0x%08X PARENT=0x%08X X=%i Y=%i WIDTH=%u HEIGHT=%u",
                               WS_CHILD|WS_BORDER, GetSafeHwnd(),
                               videoWidth+2, box.Height()-previewHeight,
                               previewWidth, previewHeight);

  CStringA strMediaOptions;
  strMediaOptions.Format("Video:Max Bit Rate=128000\n"
                         "Video:Target Bit Rate=128000\n"
                         "Video:Frame Time=9000\n" // 10 frames/second
                         "Video:Frame Width=%u\n"
                         "Video:Frame Height=%u\n"
                         "Video:Max Rx Frame Width=%u\n"
                         "Video:Max Rx Frame Height=%u\n"
                         "H.264:Level=1b\n",
                          videoWidth, videoHeight,
                          videoWidth, videoHeight);

  // General options
  memset(&command, 0, sizeof(command));
  command.m_type = OpalCmdSetGeneralParameters;

  CStringA strStunServer = GetOptionStringA(STUNServerKey);
  command.m_param.m_general.m_stunServer = strStunServer;
  command.m_param.m_general.m_audioPlayerDevice = "Audio Output";
  command.m_param.m_general.m_audioRecordDevice = "Audio Input";
  command.m_param.m_general.m_videoInputDevice = "CAM1:";
  command.m_param.m_general.m_videoOutputDevice = strVideoOutputDevice;
  command.m_param.m_general.m_videoPreviewDevice = strVideoPreviewDevice;
  command.m_param.m_general.m_mediaMask = "RFC4175*\nMPEG4";
  command.m_param.m_general.m_mediaOptions = strMediaOptions;
  command.m_param.m_general.m_autoTxMedia = GetOptionInt(AutoStartTxVideoKey, true) != 0 ? "audio video" : "audio";
  command.m_param.m_general.m_rtpMaxPayloadSize = 1400;

  if ((response = OpalSendMessage(m_opal, &command)) == NULL || response->m_type == OpalIndCommandError)
    ErrorBox(IDS_CONFIGURATION_FAIL, response);
  OpalFreeMessage(response);

  // Options across all protocols
  memset(&command, 0, sizeof(command));
  command.m_type = OpalCmdSetProtocolParameters;

  CStringA strUserName = GetOptionStringA(UserNameKey);
  command.m_param.m_protocol.m_userName = strUserName;

  CStringA strDisplayName = GetOptionStringA(UserNameKey);
  command.m_param.m_protocol.m_displayName = strDisplayName;

  CStringA interfaceAddress = GetOptionStringA(InterfaceAddressKey, L"*");
  command.m_param.m_protocol.m_interfaceAddresses = interfaceAddress;

  if ((response = OpalSendMessage(m_opal, &command)) == NULL || response->m_type == OpalIndCommandError)
    ErrorBox(IDS_LISTEN_FAIL, response);
  OpalFreeMessage(response);

  // H.323 gatekeeper registration
  memset(&command, 0, sizeof(command));
  command.m_type = OpalCmdRegistration;

  UINT gkType = GetOptionInt(GkTypeKey);
  if (gkType > 0) {
    command.m_param.m_registrationInfo.m_protocol = "h323";

    CStringA strAliasName = GetOptionStringA(GkAliasKey);
    command.m_param.m_registrationInfo.m_identifier = strAliasName;

    CStringA strGkId = GetOptionStringA(GkIdKey);
    command.m_param.m_registrationInfo.m_adminEntity = strGkId;

    CStringA strGkHost = GetOptionStringA(GkHostKey);
    command.m_param.m_registrationInfo.m_hostName = strGkHost;

    CStringA strGkAuthUser = GetOptionStringA(GkAuthUserKey);
    command.m_param.m_registrationInfo.m_authUserName = strGkAuthUser;

    CStringA strGkPassword = GetOptionStringA(GkPasswordKey);
    command.m_param.m_registrationInfo.m_password = strGkPassword;

    SetStatusText(IDS_REGISTERING);
    if ((response = OpalSendMessage(m_opal, &command)) == NULL || response->m_type == OpalIndCommandError)
      ErrorBox(IDS_REGISTRATION_FAIL, response);
    OpalFreeMessage(response);
  }

  // SIP registrar registration
  if (strAOR.IsEmpty())
    SetStatusText(IDS_READY);
  else {
    memset(&command, 0, sizeof(command));
    command.m_type = OpalCmdRegistration;

    command.m_param.m_registrationInfo.m_protocol = "sip";

    command.m_param.m_registrationInfo.m_identifier = strAOR;
    command.m_param.m_registrationInfo.m_hostName = strHost;

    CStringA strAuthUser = GetOptionStringA(RegistrarUserKey);
    command.m_param.m_registrationInfo.m_authUserName = strAuthUser;

    CStringA strPassword = GetOptionStringA(RegistrarPassKey);
    command.m_param.m_registrationInfo.m_password = strPassword;

    CStringA strRealm = GetOptionStringA(RegistrarRealmKey);
    command.m_param.m_registrationInfo.m_adminEntity = strRealm;

    command.m_param.m_registrationInfo.m_timeToLive = 300;

    SetStatusText(IDS_REGISTERING);
    if ((response = OpalSendMessage(m_opal, &command)) != NULL && response->m_type != OpalIndCommandError) {
      m_currentAOR = strAOR;
      m_currentHost = strHost;
    }
    else {
      ErrorBox(IDS_REGISTRATION_FAIL, response);
      SetStatusText(IDS_READY);
    }
    OpalFreeMessage(response);
  }

  PowerPolicyNotify(PPN_UNATTENDEDMODE, TRUE);
}
コード例 #7
0
void CMobileOpalDlg::InitialiseOPAL()
{
  /////////////////////////////////////////////////////////////////////
  // Start up and initialise OPAL

  if (m_opal == NULL) {
    m_opal = OpalInitialise("pc h323 sip");
    if (m_opal == NULL) {
      ErrorBox(IDS_INIT_FAIL);
      EndDialog(IDCANCEL);
      return;
    }
  }

  OpalMessage command;
  OpalMessage * response;

  // General options
  memset(&command, 0, sizeof(command));
  command.m_type = OpalCmdSetGeneralParameters;

  CStringA strStunServer = GetOptionStringA(STUNServerKey);
  command.m_param.m_general.m_stunServer = strStunServer;

  if ((response = OpalSendMessage(m_opal, &command)) == NULL || response->m_type == OpalIndCommandError)
    ErrorBox(IDS_CONFIGURATION_FAIL);
  OpalFreeMessage(response);

  // Options across all protocols
  memset(&command, 0, sizeof(command));
  command.m_type = OpalCmdSetProtocolParameters;

  CStringA strUserName = GetOptionStringA(UserNameKey);
  command.m_param.m_protocol.m_name = strUserName;

  CStringA strDisplayName = GetOptionStringA(UserNameKey);
  command.m_param.m_protocol.m_displayName = strDisplayName;

  command.m_param.m_protocol.m_interfaceAddresses = "*";

  if ((response = OpalSendMessage(m_opal, &command)) == NULL || response->m_type == OpalIndCommandError)
    ErrorBox(IDS_LISTEN_FAIL);
  OpalFreeMessage(response);

  // H.323 gatekeeper regisration
  memset(&command, 0, sizeof(command));
  command.m_type = OpalCmdRegistration;

  UINT gkType = GetOptionInt(GkTypeKey);
  if (gkType > 0) {
    command.m_param.m_registrationInfo.m_protocol = "h323";

    CStringA strAliasName = GetOptionStringA(GkAliasKey);
    command.m_param.m_registrationInfo.m_identifier = strAliasName;

    CStringA strGkId = GetOptionStringA(GkIdKey);
    command.m_param.m_registrationInfo.m_adminEntity = strGkId;

    CStringA strGkHost = GetOptionStringA(GkHostKey);
    command.m_param.m_registrationInfo.m_hostName = strGkHost;

    CStringA strGkAuthUser = GetOptionStringA(GkAuthUserKey);
    command.m_param.m_registrationInfo.m_authUserName = strGkAuthUser;

    CStringA strGkPassword = GetOptionStringA(GkPasswordKey);
    command.m_param.m_registrationInfo.m_password = strGkPassword;

    if ((response = OpalSendMessage(m_opal, &command)) == NULL || response->m_type == OpalIndCommandError)
      ErrorBox(IDS_REGISTRATION_FAIL);
    OpalFreeMessage(response);
  }

  // SIP registrar regisration
  CStringA strAor = GetOptionStringA(RegistrarAorKey);
  if (!strAor.IsEmpty()) {
    memset(&command, 0, sizeof(command));
    command.m_type = OpalCmdRegistration;

    command.m_param.m_registrationInfo.m_protocol = "sip";

    command.m_param.m_registrationInfo.m_identifier = strAor;

    CStringA strHost = GetOptionStringA(RegistrarHostKey);
    command.m_param.m_registrationInfo.m_hostName = strHost;

    CStringA strAuthUser = GetOptionStringA(RegistrarUserKey);
    command.m_param.m_registrationInfo.m_authUserName = strAuthUser;

    CStringA strPassword = GetOptionStringA(RegistrarPassKey);
    command.m_param.m_registrationInfo.m_password = strPassword;

    CStringA strRealm = GetOptionStringA(RegistrarRealmKey);
    command.m_param.m_registrationInfo.m_adminEntity = strRealm;

    command.m_param.m_registrationInfo.m_timeToLive = 300;

    if ((response = OpalSendMessage(m_opal, &command)) == NULL || response->m_type == OpalIndCommandError)
      ErrorBox(IDS_REGISTRATION_FAIL);
    OpalFreeMessage(response);
  }
}
コード例 #8
0
void CMobileOpalDlg::InitialiseOPAL()
{
  /////////////////////////////////////////////////////////////////////
  // Start up and initialise OPAL

  if (m_opal == NULL) {
    m_opal = OpalInitialise(&m_opalVersion, "pc h323 sip " TRACE_OPTIONS);
    if (m_opal == NULL) {
      ErrorBox(IDS_INIT_FAIL);
      EndDialog(IDCANCEL);
      return;
    }
  }

  OpalMessage command;
  OpalMessage * response;

  // SIP registrar un-regisration
  CStringA strAOR = GetOptionStringA(RegistrarAorKey);
  CStringA strHost = GetOptionStringA(RegistrarHostKey);
  if (!m_currentAOR.IsEmpty() && (m_currentAOR != strAOR || m_currentHost != strHost)) {
    // Registration changed, so unregister the previous name
    memset(&command, 0, sizeof(command));
    command.m_type = OpalCmdRegistration;
    command.m_param.m_registrationInfo.m_protocol = "sip";
    command.m_param.m_registrationInfo.m_identifier = m_currentAOR;
    command.m_param.m_registrationInfo.m_hostName = m_currentHost;
    response = OpalSendMessage(m_opal, &command);
    if (response != NULL && response->m_type == OpalCmdRegistration) {
      OpalFreeMessage(response);

      UpdateWindow();

      // Wait for unregister to complete.
      while ((response = OpalGetMessage(m_opal, 30000)) != NULL) {
        HandleMessage(*response);
        if (response->m_type == OpalIndRegistration && response->m_param.m_registrationStatus.m_status == OpalRegisterRemoved)
          break;
      }
    }
    OpalFreeMessage(response);
    m_currentAOR.Empty();
    m_currentHost.Empty();
  }

  // General options
  memset(&command, 0, sizeof(command));
  command.m_type = OpalCmdSetGeneralParameters;

  CStringA strStunServer = GetOptionStringA(STUNServerKey);
  command.m_param.m_general.m_stunServer = strStunServer;

  if ((response = OpalSendMessage(m_opal, &command)) == NULL || response->m_type == OpalIndCommandError)
    ErrorBox(IDS_CONFIGURATION_FAIL, response);
  OpalFreeMessage(response);

  // Options across all protocols
  memset(&command, 0, sizeof(command));
  command.m_type = OpalCmdSetProtocolParameters;

  CStringA strUserName = GetOptionStringA(UserNameKey);
  command.m_param.m_protocol.m_userName = strUserName;

  CStringA strDisplayName = GetOptionStringA(UserNameKey);
  command.m_param.m_protocol.m_displayName = strDisplayName;

  CStringA interfaceAddress = GetOptionStringA(InterfaceAddressKey, L"*");
  command.m_param.m_protocol.m_interfaceAddresses = interfaceAddress;

  if ((response = OpalSendMessage(m_opal, &command)) == NULL || response->m_type == OpalIndCommandError)
    ErrorBox(IDS_LISTEN_FAIL, response);
  OpalFreeMessage(response);

  // H.323 gatekeeper registration
  memset(&command, 0, sizeof(command));
  command.m_type = OpalCmdRegistration;

  UINT gkType = GetOptionInt(GkTypeKey);
  if (gkType > 0) {
    command.m_param.m_registrationInfo.m_protocol = "h323";

    CStringA strAliasName = GetOptionStringA(GkAliasKey);
    command.m_param.m_registrationInfo.m_identifier = strAliasName;

    CStringA strGkId = GetOptionStringA(GkIdKey);
    command.m_param.m_registrationInfo.m_adminEntity = strGkId;

    CStringA strGkHost = GetOptionStringA(GkHostKey);
    command.m_param.m_registrationInfo.m_hostName = strGkHost;

    CStringA strGkAuthUser = GetOptionStringA(GkAuthUserKey);
    command.m_param.m_registrationInfo.m_authUserName = strGkAuthUser;

    CStringA strGkPassword = GetOptionStringA(GkPasswordKey);
    command.m_param.m_registrationInfo.m_password = strGkPassword;

    SetStatusText(IDS_REGISTERING);
    if ((response = OpalSendMessage(m_opal, &command)) == NULL || response->m_type == OpalIndCommandError)
      ErrorBox(IDS_REGISTRATION_FAIL, response);
    OpalFreeMessage(response);
  }

  // SIP registrar registration
  if (strAOR.IsEmpty())
    SetStatusText(IDS_READY);
  else {
    memset(&command, 0, sizeof(command));
    command.m_type = OpalCmdRegistration;

    command.m_param.m_registrationInfo.m_protocol = "sip";

    command.m_param.m_registrationInfo.m_identifier = strAOR;
    command.m_param.m_registrationInfo.m_hostName = strHost;

    CStringA strAuthUser = GetOptionStringA(RegistrarUserKey);
    command.m_param.m_registrationInfo.m_authUserName = strAuthUser;

    CStringA strPassword = GetOptionStringA(RegistrarPassKey);
    command.m_param.m_registrationInfo.m_password = strPassword;

    CStringA strRealm = GetOptionStringA(RegistrarRealmKey);
    command.m_param.m_registrationInfo.m_adminEntity = strRealm;

    command.m_param.m_registrationInfo.m_timeToLive = 300;
    command.m_param.m_registrationInfo.m_messageWaiting = 300;

    SetStatusText(IDS_REGISTERING);
    if ((response = OpalSendMessage(m_opal, &command)) != NULL && response->m_type != OpalIndCommandError) {
      m_currentAOR = strAOR;
      m_currentHost = strHost;
    }
    else {
      ErrorBox(IDS_REGISTRATION_FAIL, response);
      SetStatusText(IDS_READY);
    }
    OpalFreeMessage(response);
  }
}