Class Friend
This object is used to store a SIP address.
Friend is mainly used to implement an adressbook feature, and are used as data for the MagicSearch object. If your proxy supports it, you can also use it to subscribe to presence information. The objects are stored in a FriendList which are in turn stored inside the Core. They can be stored inside a database if the path to it is configured, otherwise they will be lost after the 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 Address. |
Remarks
Note : the Address object returned is hold by the LinphoneFriend, however calling several time this function may return different objects.
Addresses
Returns a list of Address for this friend.
Declaration
public IEnumerable<Address> Addresses { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<Address> | A list of 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.
Declaration
public ConsolidatedPresence ConsolidatedPresence { get; }
Property Value
Type | Description |
---|---|
ConsolidatedPresence | The ConsolidatedPresence of the friend |
Core
Returns the Core object managing this friend, if any.
Declaration
public Core Core { get; }
Property Value
Type | Description |
---|---|
Core | the Core object associated. |
IncSubscribePolicy
get current subscription policy for this Friend
Declaration
public SubscribePolicy IncSubscribePolicy { get; set; }
Property Value
Type | Description |
---|---|
SubscribePolicy | the 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. |
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. |
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. |
PresenceModel
Get the presence model of a friend.
Declaration
public PresenceModel PresenceModel { get; set; }
Property Value
Type | Description |
---|---|
PresenceModel | A 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. |
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 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 Vcard or null. |
Methods
AddAddress(Address)
Adds an address in this friend.
Declaration
public void AddAddress(Address address)
Parameters
Type | Name | Description |
---|---|---|
Address | address | 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 |
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 Edit() before doing any attempts to modify friend configuration (such as Address or IncSubscribePolicy). Once the modifications are done, then the application must call 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 | FriendCapability object |
Returns
Type | Description |
---|---|
System.Single | the version of a friend's capbility. |
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 PresenceModel object, or null if the friend do not have presence information for this SIP URI or phone number. |
HasCapability(FriendCapability)
Returns whether or not a friend has a capbility.
Declaration
public bool HasCapability(FriendCapability capability)
Parameters
Type | Name | Description |
---|---|---|
FriendCapability | capability | 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 | 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 | 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. |
NewFromVcard(Vcard)
Contructor same as linphone_friend_new + Address
Declaration
public static Friend NewFromVcard(Vcard vcard)
Parameters
Type | Name | Description |
---|---|---|
Vcard | vcard | a Vcard object |
Returns
Type | Description |
---|---|
Friend | a new Friend which has its vCard attribute initialized from the given vCard. This can be get by Vcard. |
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 | 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 |
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 PresenceModel object to set |