LinphoneProxyConfig.h 4.08 KB
Newer Older
1 2
#pragma once

3 4
#include "LinphoneCore.h"

5 6
namespace Linphone
{
7
	namespace Core
8
	{
9 10 11 12 13 14 15 16
		/// <summary>
		/// This object represents a proxy configuration to be used by the LinphoneCore object. 
		/// Its fields mustn't be used directly in favour of the accessors methods.
		/// Once created and filled properly, the LinphoneProxyConfig can be given to LinphoneCore using LinphoneCore::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 LinphoneCoreFactory::CreateLinphoneCore there might already be a default proxy that can be examined with LinphoneCore::GetDefaultProxyConfig.
		/// </summary>
17 18
		public ref class LinphoneProxyConfig sealed
		{
Sylvain Berfini's avatar
Sylvain Berfini committed
19
		public:
20 21 22 23 24
			/// <summary>
			/// 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.
			/// </summary>
Sylvain Berfini's avatar
Sylvain Berfini committed
25
			void Edit();
26 27 28 29

			/// <summary>
			/// Commits changes made to the proxy config.
			/// </summary>
Sylvain Berfini's avatar
Sylvain Berfini committed
30
			void Done();
31

32
			void SetIdentity(Platform::String^ displayname, Platform::String^ username, Platform::String^ domain);
Sylvain Berfini's avatar
Sylvain Berfini committed
33
			Platform::String^ GetIdentity();
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54

			/// <summary>
			/// Sets the proxy address.
			/// <example>
			/// Examples of valid sip proxy are:
			/// <list type="bullet">
			/// <item>
			/// <term>sip:87.98.157.38</term>
			/// <description>IP address</description>
			/// </item>
			/// <item>
			/// <term>sip:87.98.157.38:5062</term>
			/// <description>IP address with port</description>
			/// </item>
			/// <item>
			/// <term>sip:sip.example.net</term>
			/// <description>Hostname</description>
			/// </item>
			/// </list>
			/// </example>
			/// </summary>
Sylvain Berfini's avatar
Sylvain Berfini committed
55
			void SetProxy(Platform::String^ proxyUri);
56 57 58 59 60

			/// <summary>
			/// Enables register for this proxy config.
			/// Register message is issued after call to Done.
			/// </summary>
Sylvain Berfini's avatar
Sylvain Berfini committed
61 62
			void EnableRegister(Platform::Boolean enable);
			Platform::Boolean IsRegisterEnabled();
63 64 65 66 67 68 69

			/// <summary>
			/// Normalizes a human readable phone number into a basic string.
			/// <example>
			/// 888-444-222 becomes 888444222
			/// </example>
			/// </summary>
Sylvain Berfini's avatar
Sylvain Berfini committed
70
			Platform::String^ NormalizePhoneNumber(Platform::String^ phoneNumber);
71 72 73 74

			/// <summary>
			/// Automatically add international prefix to e164 phone numbers
			/// </summary>
Sylvain Berfini's avatar
Sylvain Berfini committed
75
			void SetDialPrefix(Platform::String^ prefix);
76 77 78 79

			/// <summary>
			/// Sets whether Linphone should replace "+" by "00" in dialed numbers passed to LinphoneCore::Invite.
			/// </summary>
Sylvain Berfini's avatar
Sylvain Berfini committed
80 81 82
			void SetDialEscapePlus(Platform::Boolean value);
			Platform::String^ GetDomain();
			Platform::Boolean IsRegistered();
83 84 85 86 87

			/// <summary>
			/// 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 LinphoneCore::GetDefaultProxyConfig).
			/// </summary>
Sylvain Berfini's avatar
Sylvain Berfini committed
88 89
			void SetRoute(Platform::String^ routeUri);
			Platform::String^ GetRoute();
90 91 92 93

			/// <summary>
			/// Indicates either or not PUBLISH must be issued for this LinphoneProxyConfig.
			/// </summary>
Sylvain Berfini's avatar
Sylvain Berfini committed
94 95
			void EnablePublish(Platform::Boolean enable);
			Platform::Boolean IsPublishEnabled();
96
			RegistrationState GetState();
97 98 99 100

			/// <summary>
			/// Sets the registration expiration time in seconds.
			/// </summary>
Sylvain Berfini's avatar
Sylvain Berfini committed
101 102
			void SetExpires(int delay);
			void SetContactParameters(Platform::String^ params);
103 104 105 106

			/// <summary>
			/// Returns the international prefix for the given country.
			/// </summary>
Sylvain Berfini's avatar
Sylvain Berfini committed
107
			int LookupCCCFromIso(Platform::String^ iso);
108 109 110 111

			/// <summary>
			/// Returns the international prefix for the given country.
			/// </summary>
Sylvain Berfini's avatar
Sylvain Berfini committed
112
			int LookupCCCFromE164(Platform::String^ e164);
113 114 115 116

		private:
			friend ref class Linphone::Core::LinphoneCore;

117
			LinphoneProxyConfig();
118 119 120
			~LinphoneProxyConfig();

			::LinphoneProxyConfig *proxy_config;
121 122
		};
	}
123
}