Class Friend
This object is used to store a SIP address.
Linphone.Friend is mainly used to implement an adressbook feature, and are used as data for the Linphone.MagicSearch object. If your proxy supports it, you can also use it to subscribe to presence information. The objects are stored in a Linphone.FriendList which are in turn stored inside the Linphone.Core. They can be stored inside a database if the path to it is configured, otherwise they will be lost after the Linphone.Core is destroyed. Thanks to the vCard plugin, you can also store more information like phone numbers, organization, etc...
Inherited Members
Namespace: Linphone
Assembly: cs.temp.dll.dll
Syntax
public class Friend : LinphoneObject
Properties
Address
Get address of this friend.
Declaration
public Address Address { get; set; }
Property Value
| Type | Description |
|---|---|
| Address | the Linphone.Address. |
Remarks
Note : the Linphone.Address object returned is hold by the LinphoneFriend, however calling several time this function may return different objects.
Addresses
Returns a list of Linphone.Address for this friend.
Declaration
public IEnumerable<Address> Addresses { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<Address> | A list of Linphone.Address. |
Capabilities
Returns the capabilities associated to this friend.
Declaration
public int Capabilities { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 | an int representing the capabilities of the friend |
ConsolidatedPresence
Get the consolidated presence of a friend.
It will return the "most open" presence found if more than one presence model are found.
Declaration
public ConsolidatedPresence ConsolidatedPresence { get; }
Property Value
| Type | Description |
|---|---|
| ConsolidatedPresence | The Linphone.ConsolidatedPresence of the friend |
Core
Returns the Linphone.Core object managing this friend, if any.
Declaration
public Core Core { get; }
Property Value
| Type | Description |
|---|---|
| Core | the Linphone.Core object associated. |
Devices
Returns a list of Linphone.FriendDevice for this friend, for all known addresses.
Declaration
public IEnumerable<FriendDevice> Devices { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<FriendDevice> | A list of Linphone.FriendDevice. |
FriendList
Check that the given friend is in a friend list.
Declaration
public FriendList FriendList { get; }
Property Value
| Type | Description |
|---|---|
| FriendList | The Linphone.FriendList the friend is in if any, null otherwise. |
IncSubscribePolicy
get current subscription policy for this Linphone.Friend
Declaration
public SubscribePolicy IncSubscribePolicy { get; set; }
Property Value
| Type | Description |
|---|---|
| SubscribePolicy | the Linphone.SubscribePolicy enum |
IsPresenceReceived
Tells whether we already received presence information for a friend.
Declaration
public bool IsPresenceReceived { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean | true if presence information has been received for the friend, false otherwise. |
JobTitle
Gets the contact's job title from it's vCard.
It's a shortcut to Linphone.Friend.Vcard and Linphone.Vcard.JobTitle.
Declaration
public string JobTitle { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String | the job_title set if any & vCard is available, null otherwise. |
Listener
Declaration
public FriendListener Listener { get; set; }
Property Value
| Type | Description |
|---|---|
| FriendListener |
Name
Get the display name for this friend.
Declaration
public string Name { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String | The display name of this friend. |
NativeUri
Gets the contact's native URI.
Declaration
public string NativeUri { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String | the native URI set if any, null otherwise. |
Organization
Gets the contact's organization from it's vCard.
It's a shortcut to Linphone.Friend.Vcard and Linphone.Vcard.Organization.
Declaration
public string Organization { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String | the organization set if any & vCard is available, null otherwise. |
PhoneNumbers
Returns a list of phone numbers for this friend.
Declaration
public IEnumerable<string> PhoneNumbers { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<System.String> | A list of phone numbers as string. |
PhoneNumbersWithLabel
Returns a list of Linphone.FriendPhoneNumber for this friend.
Declaration
public IEnumerable<FriendPhoneNumber> PhoneNumbersWithLabel { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<FriendPhoneNumber> | A list of phone numbers as string. |
Photo
Gets the contact's picture URI.
Declaration
public string Photo { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String | the picture URI set if any, null otherwise. |
PresenceModel
Get the presence model of a friend.
If a friend has more than one SIP address and phone number, this method will return the most recent presence model using Linphone.PresenceModel.Timestamp.
Declaration
public PresenceModel PresenceModel { get; set; }
Property Value
| Type | Description |
|---|---|
| PresenceModel | A Linphone.PresenceModel object, or null if the friend do not have presence information (in which case he is considered offline). |
RefKey
Get the reference key of a friend.
Declaration
public string RefKey { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String | The reference key of the friend. |
SecurityLevel
Returns the security level of a friend which is the lowest among all devices we know for it.
Declaration
public SecurityLevel SecurityLevel { get; }
Property Value
| Type | Description |
|---|---|
| SecurityLevel | A Linphone.SecurityLevel, which is the lowest among all known devices. |
Starred
Gets if the friend is to be considered as important for the user.
Declaration
public bool Starred { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean | true if the contact is a user's favorite, false otherwise. |
SubscribesEnabled
get subscription flag value
Declaration
public bool SubscribesEnabled { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean | returns true is subscription is activated for this friend |
SubscriptionState
Get subscription state of a friend.
Declaration
public SubscriptionState SubscriptionState { get; }
Property Value
| Type | Description |
|---|---|
| SubscriptionState | the Linphone.SubscriptionState enum |
Vcard
Returns the vCard object associated to this friend, if any.
Declaration
public Vcard Vcard { get; set; }
Property Value
| Type | Description |
|---|---|
| Vcard | the Linphone.Vcard or null. |
Methods
AddAddress(Address)
Adds an address in this friend.
Declaration
public void AddAddress(Address address)
Parameters
| Type | Name | Description |
|---|---|---|
| Address | address | Linphone.Address object |
AddPhoneNumber(String)
Adds a phone number in this friend.
Declaration
public void AddPhoneNumber(string phoneNumber)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | phoneNumber | number to add |
AddPhoneNumberWithLabel(FriendPhoneNumber)
Adds a Linphone.FriendPhoneNumber to this friend.
Declaration
public void AddPhoneNumberWithLabel(FriendPhoneNumber phoneNumber)
Parameters
| Type | Name | Description |
|---|---|---|
| FriendPhoneNumber | phoneNumber | the Linphone.FriendPhoneNumber to add |
CreateVcard(String)
Creates a vCard object associated to this friend if there isn't one yet and if the full name is available, either by the parameter or the one in the friend's SIP URI.
Declaration
public bool CreateVcard(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The full name of the friend or null to use the one from the friend's SIP URI |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if the vCard has been created, false if it wasn't possible (for exemple if name and the friend's SIP URI are null or if the friend's SIP URI doesn't have a display name), or if there is already one vcard |
Done()
Commits modification made to the friend configuration.
Declaration
public void Done()
Edit()
Starts editing a friend configuration.
Because friend configuration must be consistent, applications MUST call Linphone.Friend.Edit() before doing any attempts to modify friend configuration (such as Linphone.Friend.Address or Linphone.Friend.IncSubscribePolicy). Once the modifications are done, then the application must call Linphone.Friend.Done() to commit the changes.
Declaration
public void Edit()
GetCapabilityVersion(FriendCapability)
Returns the version of a friend's capbility.
Declaration
public float GetCapabilityVersion(FriendCapability capability)
Parameters
| Type | Name | Description |
|---|---|---|
| FriendCapability | capability | Linphone.FriendCapability object |
Returns
| Type | Description |
|---|---|
| System.Single | the version of a friend's capbility. |
GetDevicesForAddress(Address)
Returns a list of Linphone.FriendDevice for this friend and a specific address.
Declaration
public IEnumerable<FriendDevice> GetDevicesForAddress(Address address)
Parameters
| Type | Name | Description |
|---|---|---|
| Address | address | Linphone.Address object |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IEnumerable<FriendDevice> | A list of Linphone.FriendDevice. |
GetPresenceModelForUriOrTel(String)
Get the presence model for a specific SIP URI or phone number of a friend.
Declaration
public PresenceModel GetPresenceModelForUriOrTel(string uriOrTel)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | uriOrTel | The SIP URI or phone number for which to get the presence model |
Returns
| Type | Description |
|---|---|
| PresenceModel | A Linphone.PresenceModel object, or null if the friend do not have presence information for this SIP URI or phone number. |
GetSecurityLevelForAddress(Address)
Returns the security level of a friend for a given address which is the lowest among all devices we know for that address.
Declaration
public SecurityLevel GetSecurityLevelForAddress(Address address)
Parameters
| Type | Name | Description |
|---|---|---|
| Address | address | Linphone.Address object |
Returns
| Type | Description |
|---|---|
| SecurityLevel | A Linphone.SecurityLevel, which is the lowest among all known devices for that address. |
HasCapability(FriendCapability)
Returns whether or not a friend has a capbility.
Declaration
public bool HasCapability(FriendCapability capability)
Parameters
| Type | Name | Description |
|---|---|---|
| FriendCapability | capability | Linphone.FriendCapability object |
Returns
| Type | Description |
|---|---|
| System.Boolean | whether or not a friend has a capbility |
HasCapabilityWithVersion(FriendCapability, Single)
Returns whether or not a friend has a capbility with a given version.
Declaration
public bool HasCapabilityWithVersion(FriendCapability capability, float version)
Parameters
| Type | Name | Description |
|---|---|---|
| FriendCapability | capability | Linphone.FriendCapability object |
| System.Single | version | the version to test |
Returns
| Type | Description |
|---|---|
| System.Boolean | whether or not a friend has a capbility with a given version or -1.0 if friend has not capability. |
HasCapabilityWithVersionOrMore(FriendCapability, Single)
Returns whether or not a friend has a capbility with a given version or more.
Declaration
public bool HasCapabilityWithVersionOrMore(FriendCapability capability, float version)
Parameters
| Type | Name | Description |
|---|---|---|
| FriendCapability | capability | Linphone.FriendCapability object |
| System.Single | version | the version to test |
Returns
| Type | Description |
|---|---|
| System.Boolean | whether or not a friend has a capbility with a given version or more. |
HasPhoneNumber(String)
Returns whether a friend contains the given phone number.
Declaration
public bool HasPhoneNumber(string phoneNumber)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | phoneNumber | the phone number to search for |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if found, false otherwise |
InList()
Check that the given friend is in a friend list.
Declaration
public bool InList()
Returns
| Type | Description |
|---|---|
| System.Boolean | true if the friend is in a friend list, false otherwise. |
Remove()
Removes a friend from it's friend list and from the rc if exists.
Declaration
public void Remove()
RemoveAddress(Address)
Removes an address in this friend.
Declaration
public void RemoveAddress(Address address)
Parameters
| Type | Name | Description |
|---|---|---|
| Address | address | Linphone.Address object |
RemovePhoneNumber(String)
Removes a phone number in this friend.
Declaration
public void RemovePhoneNumber(string phoneNumber)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | phoneNumber | number to remove |
RemovePhoneNumberWithLabel(FriendPhoneNumber)
Removes a Linphone.FriendPhoneNumber from this friend.
Declaration
public void RemovePhoneNumberWithLabel(FriendPhoneNumber phoneNumber)
Parameters
| Type | Name | Description |
|---|---|---|
| FriendPhoneNumber | phoneNumber | the Linphone.FriendPhoneNumber to remove |
Save(Core)
Saves a friend either in database if configured, otherwise in linphonerc.
Declaration
public void Save(Core core)
Parameters
| Type | Name | Description |
|---|---|---|
| Core | core | the linphone core |
SetPresenceModelForUriOrTel(String, PresenceModel)
Set the presence model for a specific SIP URI or phone number of a friend.
Declaration
public void SetPresenceModelForUriOrTel(string uriOrTel, PresenceModel presence)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | uriOrTel | The SIP URI or phone number for which to set the presence model |
| PresenceModel | presence | The Linphone.PresenceModel object to set |