/*
ProxyConfig.h
Copyright (C) 2015 Belledonne Communications, Grenoble, France
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#pragma once
#include "ApiLock.h"
#include "Core.h"
namespace BelledonneCommunications
{
namespace Linphone
{
namespace Native
{
///
/// This object represents a proxy configuration to be used by the Core object.
/// Its fields mustn't be used directly in favour of the accessors methods.
/// Once created and filled properly, the ProxyConfig can be given to Core using Core::AddProxyConfig.
/// This will automatically triggers the registration if enabled.
/// The proxy configuration are persistent to restarts because they are saved in the configuration file.
/// As a consequence, after creating a Core there might already be a default proxy that can be examined with Core::GetDefaultProxyConfig.
///
public ref class ProxyConfig sealed
{
public:
///
/// Sets the contact params to be sent along with the REGISTERs.
///
property Platform::String^ ContactParameters
{
Platform::String^ get();
void set(Platform::String^ value);
}
///
/// Set optional contact parameters that will be added to the contact information sent in the registration, inside the URI.
/// The main use case for this function is provide the proxy additional information regarding the user agent, like for example unique identifier or apple push id.
/// As an example, the contact address in the SIP register sent will look like <sip:joe@15.128.128.93:50421;apple-push-id=43143-DFE23F-2323-FA2232>.
///
property Platform::String^ ContactUriParameters
{
Platform::String^ get();
void set(Platform::String^ value);
}
///
/// Sets whether Linphone should replace "+" by "00" in dialed numbers passed to Core::Invite.
///
property Platform::Boolean DialEscapePlus
{
Platform::Boolean get();
void set(Platform::Boolean value);
}
///
/// Automatically add international prefix to e164 phone numbers
///
property Platform::String^ DialPrefix
{
Platform::String^ get();
void set(Platform::String^ value);
}
///
/// Gets the domain of the address.
///
property Platform::String^ Domain
{
Platform::String^ get();
}
///
/// Get the reason why registration failed when the proxy config state is LinphoneRegistrationFailed.
/// The reason why registration failed for this proxy config.
///
property Reason Error
{
Reason get();
}
///
/// Sets the registration expiration time in seconds.
///
property int Expires
{
int get();
void set(int value);
}
///
/// Sets the identity for this proxy config.
///
property Platform::String^ Identity
{
Platform::String^ get();
void set(Platform::String^ value);
}
///
/// Indicates whether AVPF/SAVPF is being used for calls using this proxy config.
///
property Platform::Boolean IsAvpfEnabled
{
Platform::Boolean get();
void set(Platform::Boolean value);
}
///
/// Indicates either or not PUBLISH must be issued for this ProxyConfig.
///
property Platform::Boolean IsPublishEnabled
{
Platform::Boolean get();
void set(Platform::Boolean value);
}
///
/// Returns true if this proxy config is currently registered, else returns false.
///
property Platform::Boolean IsRegistered
{
Platform::Boolean get();
}
///
/// Enables register for this proxy config.
/// Register message is issued after call to Done.
///
property Platform::Boolean IsRegisterEnabled
{
Platform::Boolean get();
void set(Platform::Boolean value);
}
///
/// Sets a SIP route.
/// When a route is set, all outgoing calls will go the the route's destination if this proxy is the default one (see Core::GetDefaultProxyConfig).
///
property Platform::String^ Route
{
Platform::String^ get();
void set(Platform::String^ value);
}
///
/// Sets the proxy address.
///
/// Examples of valid sip proxy are:
///
/// -
/// sip:87.98.157.38
/// IP address
///
/// -
/// sip:87.98.157.38:5062
/// IP address with port
///
/// -
/// sip:sip.example.net
/// Hostname
///
///
///
///
property Platform::String^ ServerAddr
{
Platform::String^ get();
void set(Platform::String^ value);
}
///
/// Returns the current RegistrationState for this proxy config.
///
property RegistrationState State
{
RegistrationState get();
}
///
/// Commits changes made to the proxy config.
///
void Done();
///
/// Starts editing a proxy config.
/// Because proxy config must be consistent, app MUST call Edit before doing any attempts to modify proxy config (such as identity, address and so on).
/// Once modifications are done, then the app MUST call Done to commit the changes.
///
void Edit();
///
/// Returns the international prefix for the given e164 number.
///
/// The e164 number
/// The international prefix or -1 if not found
int LookupCccFromE164(Platform::String^ e164);
///
/// Returns the international prefix for the given country.
///
/// The country as ISO 3166-1 alpha-2 code
/// The international prefix or -1 if not found
int LookupCccFromIso(Platform::String^ iso);
///
/// Normalizes a human readable phone number into a basic string.
///
/// 888-444-222 becomes 888444222
///
///
/// The phone number to be normalized
/// The normalized phone number
Platform::String^ NormalizeNumber(Platform::String^ phoneNumber);
private:
friend ref class Core;
friend class Utils;
ProxyConfig(::LinphoneProxyConfig* proxyConfig);
~ProxyConfig();
::LinphoneProxyConfig *proxyConfig;
};
}
}
}