Пример #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::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);
  }
}