void Opal::Sip::EndPoint::Register (const Opal::Account & account)
{
  std::stringstream aor;
  std::string host = account.get_host ();
  std::string::size_type loc = host.find (":", 0);
  if (loc != std::string::npos)
    host = host.substr (0, loc);

  if (account.get_username ().find ("@") == std::string::npos) 
    aor << account.get_username () << "@" << host;
  else
    aor << account.get_username ();

  SIPRegister::Params params;
  params.m_addressOfRecord = aor.str ();
  params.m_registrarAddress = account.get_host ();
  params.m_authID = account.get_authentication_username ();
  params.m_password = account.get_password ();
  params.m_expire = (account.is_enabled () ? account.get_timeout () : 0);
  params.m_minRetryTime = 0;
  params.m_maxRetryTime = 0;

  if (!SIPEndPoint::Register (params))
    OnRegistrationFailed (aor.str (), SIP_PDU::MaxStatusCode, account.is_enabled ());
}
Beispiel #2
0
bool
Opal::Sip::EndPoint::unsubscribe (const Opal::Account & account,
                                  const PSafePtr<OpalPresentity> & presentity)
{
  if (account.get_protocol_name () != "SIP")
    return false;

  new subscriber (account.get_username (),
		  account.get_host (),
		  account.get_authentication_username (),
		  account.get_password (),
		  account.is_enabled (),
		  account.get_compat_mode (),
		  account.get_timeout (),
		  account.get_aor (),
		  *this,
                  false,
                  presentity);
  return true;
}