Package org.linphone.core

# Interface Event

public interface Event
Object representing an event state, which is subcribed or published.
see: `Core.publish(org.linphone.core.Address, java.lang.String, int, org.linphone.core.Content)`
see: `Core.subscribe(org.linphone.core.Address, java.lang.String, int, org.linphone.core.Content)`

## Method Summary

Modifier and Type
Method
Description
`int`
`acceptPublish()`
Accept an incoming publish.
`int`
`acceptSubscription()`
Accept an incoming subcription.
`void`
`addCustomHeader(String name, String value)`
Add a custom header to an outgoing susbscription or publish.
`void`
`addListener(EventListener listener)`
`int`
`denyPublish(Reason reason)`
Deny an incoming publish with given reason.
`int`
`denySubscription(Reason reason)`
Deny an incoming subscription with given reason.
`String`
`getCallId()`
Get the call ID of the subscription.
`Core`
`getCore()`
Returns back pointer to the `Core` that created this `Event`.
`String`
`getCustomHeader(String name)`
Obtain the value of a given header for an incoming subscription.
`ErrorInfo`
`getErrorInfo()`
Gets full details about an error that occurred.
`Address`
`getFrom()`
Deprecated.
`Address`
`getFromAddress()`
Get the "from" address of the subscription.
`String`
`getName()`
Get the name of the event as specified in the event package RFC.
`long`
`getNativePointer()`
Gets the native pointer used by this class to make native method calls.
`PublishState`
`getPublishState()`
Get publish state.
`Reason`
`getReason()`
Return reason code (in case of error state reached).
`Address`
`getRemoteContact()`
Get the "contact" address of the subscription.
`Address`
`getRequestAddress()`
Get the "request uri" address of the subscription.
`Address`
`getResource()`
Get the resource address of the subscription or publish.
`SubscriptionDir`
`getSubscriptionDir()`
Get subscription direction.
`SubscriptionState`
`getSubscriptionState()`
Get subscription state.
`Address`
`getTo()`
Deprecated.
`Address`
`getToAddress()`
Get the "to" address of the subscription.
`Object`
`getUserData()`
Gets the object stored in this object user's data
`int`
`notify(Content body)`
Send a notification.
`void`
`pausePublish()`
Prevent an event from refreshing its publish.
`int`
`refreshPublish()`
Refresh an outgoing publish keeping the same body.
`int`
`refreshSubscribe()`
Refresh an outgoing subscription keeping the same body.
`void`
`removeCustomHeader(String name)`
Remove custom header to an outgoing susbscription or publish.
`void`
`removeListener(EventListener listener)`
`int`
`sendPublish(Content body)`
Send a publish created by `Core.createPublish(org.linphone.core.Address, java.lang.String, int)`.
`int`
`sendSubscribe(Content body)`
Send a subscription previously created by `Core.createSubscribe(org.linphone.core.Address, java.lang.String, int)`.
`void`
`setRequestAddress(Address requestAddress)`
Sets the "request uri" address of the subscription.
`void`
`setUserData(Object data)`
Sets the object to store in this object user's data
`void`
`terminate()`
Terminate an incoming or outgoing subscription that was previously acccepted,
or a previous publication.
`String`
`toString()`
`int`
`updatePublish(Content body)`
Update (refresh) a publish.
`int`
`updateSubscribe(Content body)`
Update (refresh) an outgoing subscription, changing the body.

## Method Details

### getCallId

@Nullable String getCallId()
Get the call ID of the subscription.

Returns:
  The call ID used by the call as a string.

### getCore

@NonNull Core getCore()
Returns back pointer to the `Core` that created this `Event`.

Returns:
  the `Core` object associated.

### getErrorInfo

@NonNull ErrorInfo getErrorInfo()
Gets full details about an error that occurred.

Returns:
  A `ErrorInfo` object.

### getFrom

@Deprecated @NonNull Address getFrom()
Deprecated.
Get the "from" address of the subscription.

Returns:
  the from `Address`.
  deprecated: 19/07/2020 use `getFromAddress()` instead

### getFromAddress

@NonNull Address getFromAddress()
Get the "from" address of the subscription.

Returns:
  the from `Address`.

### getName

@NonNull String getName()
Get the name of the event as specified in the event package RFC.

Returns:
  the event name.

### getPublishState

PublishState getPublishState()
Get publish state.
If the event object was not created by a publish mechanism, `PublishState.None`
is returned.

Returns:
  the current `PublishState`

### getReason

Reason getReason()
Return reason code (in case of error state reached).

Returns:
  a `Reason` enum

### getRemoteContact

@NonNull Address getRemoteContact()
Get the "contact" address of the subscription.

Returns:
  The "contact" address of the subscription

### getRequestAddress

@Nullable Address getRequestAddress()
Get the "request uri" address of the subscription.

Returns:
  the request uri `Address`.

### setRequestAddress

void setRequestAddress(@Nullable Address requestAddress)
Sets the "request uri" address of the subscription.

Parameters:
  `requestAddress` - `Address` to use in the request uri

### getResource

@NonNull Address getResource()
Get the resource address of the subscription or publish.

Returns:
  the resource `Address`.

### getSubscriptionDir

SubscriptionDir getSubscriptionDir()
Get subscription direction.
If the object wasn't created by a subscription mechanism, `SubscriptionDir.InvalidDir`
is returned.

Returns:
  the `SubscriptionDir`

### getSubscriptionState

SubscriptionState getSubscriptionState()
Get subscription state.
If the event object was not created by a subscription mechanism, `SubscriptionState.None`
is returned.

Returns:
  the current `SubscriptionState`

### getTo

@Deprecated @NonNull Address getTo()
Deprecated.
Get the "to" address of the subscription.

Returns:
  the to `Address`.
  deprecated: 19/07/2020 use `getToAddress()` instead

### getToAddress

@NonNull Address getToAddress()
Get the "to" address of the subscription.

Returns:
  the to `Address`.

### acceptPublish

int acceptPublish()
Accept an incoming publish.

Returns:
  0 if successful, error code otherwise

### acceptSubscription

int acceptSubscription()
Accept an incoming subcription.

Returns:
  0 if successful, error code otherwise

### addCustomHeader

void addCustomHeader(@NonNull String name, @Nullable String value)
Add a custom header to an outgoing susbscription or publish.

Parameters:
  `name` - header's name
  `value` - the header's value.

### denyPublish

int denyPublish(@NonNull Reason reason)
Deny an incoming publish with given reason.

Parameters:
  `reason` - The `Reason` of denial.
Returns:
  0 if successful, error code otherwise

### denySubscription

int denySubscription(@NonNull Reason reason)
Deny an incoming subscription with given reason.

Parameters:
  `reason` - The `Reason` of denial.
Returns:
  0 if successful, error code otherwise

### getCustomHeader

@Nullable String getCustomHeader(@NonNull String name)
Obtain the value of a given header for an incoming subscription.

Parameters:
  `name` - header's name
Returns:
  the header's value or null if such header doesn't exist.

### notify

int notify(@Nullable Content body)
Send a notification.

Parameters:
  `body` - an optional body containing the actual notification data.
Returns:
  0 if successful, -1 otherwise.

### pausePublish

void pausePublish()
Prevent an event from refreshing its publish.
This is useful to let registrations to expire naturally (or) when the
application wants to keep control on when refreshes are sent. The refreshing
operations can be resumed with `ProxyConfig.refreshRegister()`.

### refreshPublish

int refreshPublish()
Refresh an outgoing publish keeping the same body.

Returns:
  0 if successful, -1 otherwise.

### refreshSubscribe

int refreshSubscribe()
Refresh an outgoing subscription keeping the same body.

Returns:
  0 if successful, -1 otherwise.

### removeCustomHeader

void removeCustomHeader(@NonNull String name)
Remove custom header to an outgoing susbscription or publish.

Parameters:
  `name` - header's name

### sendPublish

int sendPublish(@NonNull Content body)
Send a publish created by `Core.createPublish(org.linphone.core.Address, java.lang.String, int)`.

Parameters:
  `body` - the new data to be published
Returns:
  0 if successful, -1 otherwise.

### sendSubscribe

int sendSubscribe(@Nullable Content body)
Send a subscription previously created by `Core.createSubscribe(org.linphone.core.Address, java.lang.String, int)`.

Parameters:
  `body` - optional content to attach with the subscription.
Returns:
  0 if successful, -1 otherwise.

### terminate

void terminate()
Terminate an incoming or outgoing subscription that was previously acccepted,
or a previous publication.
The `Event` shall not be used anymore after this operation.

### updatePublish

int updatePublish(@NonNull Content body)
Update (refresh) a publish.

Parameters:
  `body` - the new data to be published
Returns:
  0 if successful, error code otherwise

### updateSubscribe

@Nullable int updateSubscribe(@Nullable Content body)
Update (refresh) an outgoing subscription, changing the body.

Parameters:
  `body` - an optional body to include in the subscription update, may be
  null.
Returns:
  0 if successful, error code otherwise

### addListener

void addListener(EventListener listener)

### removeListener

void removeListener(EventListener listener)

### setUserData

void setUserData(Object data)
Sets the object to store in this object user's data

Parameters:
  `data` - the object to store

### getUserData

Object getUserData()
Gets the object stored in this object user's data

Returns:
  the object store if any, null otherwise

### getNativePointer

long getNativePointer()
Gets the native pointer used by this class to make native method calls.

Returns:
  the nativer pointer, as long

### toString

String toString()

Overrides:
  `toString` in class `Object`