Liblinphone: linphone::Event Class Reference

Liblinphone 5.3.0

Public Member Functions | List of all members
linphone::Event Class Reference

Object representing an event state, which is subcribed or published. More...

`#include <event.hh>`

Inheritance diagram for linphone::Event:

## Public Member Functions
LINPHONECXX_PUBLIC | Event (void *ptr, bool takeRef=true)
LINPHONECXX_PUBLIC _LinphoneEvent * | cPtr ()
LINPHONECXX_PUBLIC void | addListener (const std::shared_ptr< EventListener > &listener)
| Add an application listener to the Event instance.
LINPHONECXX_PUBLIC void | removeListener (const std::shared_ptr< EventListener > &listener)
| Remove a previously added listener from the Event instance.
LINPHONECXX_PUBLIC std::shared_ptr< linphone::Core > | getCore () const
| Returns back pointer to the Core that created this Event.
LINPHONECXX_PUBLIC std::shared_ptr< const linphone::ErrorInfo > | getErrorInfo () const
| Get full details about an error occured.
LINPHONECXX_PUBLIC std::shared_ptr< const linphone::Address > | getFrom () const
| Get the "from" address of the subscription.
LINPHONECXX_PUBLIC std::string | getName () const
| Get the name of the event as specified in the event package RFC.
LINPHONECXX_PUBLIC linphone::PublishState | getPublishState () const
| Get publish state.
LINPHONECXX_PUBLIC linphone::Reason | getReason () const
| Return reason code (in case of error state reached).
LINPHONECXX_PUBLIC std::shared_ptr< const linphone::Address > | getRemoteContact () const
| Get the "contact" address of the subscription.
LINPHONECXX_PUBLIC std::shared_ptr< const linphone::Address > | getResource () const
| Get the resource address of the subscription or publish.
LINPHONECXX_PUBLIC linphone::SubscriptionDir | getSubscriptionDir ()
| Get subscription direction.
LINPHONECXX_PUBLIC linphone::SubscriptionState | getSubscriptionState () const
| Get subscription state.
LINPHONECXX_PUBLIC std::shared_ptr< const linphone::Address > | getTo () const
| Get the "to" address of the subscription.
LINPHONECXX_PUBLIC linphone::Status | acceptPublish ()
| Accept an incoming publish.
LINPHONECXX_PUBLIC linphone::Status | acceptSubscription ()
| Accept an incoming subcription.
LINPHONECXX_PUBLIC void | addCustomHeader (const std::string &name, const std::string &value)
| Add a custom header to an outgoing susbscription or publish.
LINPHONECXX_PUBLIC linphone::Status | denyPublish (linphone::Reason reason)
| Deny an incoming publish with given reason.
LINPHONECXX_PUBLIC linphone::Status | denySubscription (linphone::Reason reason)
| Deny an incoming subscription with given reason.
LINPHONECXX_PUBLIC std::string | getCustomHeader (const std::string &name)
| Obtain the value of a given header for an incoming subscription.
LINPHONECXX_PUBLIC linphone::Status | notify (const std::shared_ptr< const linphone::Content > &body)
| Send a notification.
LINPHONECXX_PUBLIC void | pausePublish ()
| Prevent an event from refreshing its publish.
LINPHONECXX_PUBLIC linphone::Status | refreshPublish ()
| Refresh an outgoing publish keeping the same body.
LINPHONECXX_PUBLIC linphone::Status | refreshSubscribe ()
| Refresh an outgoing subscription keeping the same body.
LINPHONECXX_PUBLIC void | removeCustomHeader (const std::string &name)
| Remove custom header to an outgoing susbscription or publish.
LINPHONECXX_PUBLIC linphone::Status | sendPublish (const std::shared_ptr< const linphone::Content > &body)
| Send a publish created by Core::createPublish().
LINPHONECXX_PUBLIC linphone::Status | sendSubscribe (const std::shared_ptr< const linphone::Content > &body)
| Send a subscription previously created by Core::createSubscribe().
LINPHONECXX_PUBLIC void | terminate ()
| Terminate an incoming or outgoing subscription that was previously acccepted, or a previous publication.
LINPHONECXX_PUBLIC linphone::Status | updatePublish (const std::shared_ptr< const linphone::Content > &body)
| Update (refresh) a publish.
LINPHONECXX_PUBLIC linphone::Status | updateSubscribe (const std::shared_ptr< const linphone::Content > &body)
| Update (refresh) an outgoing subscription, changing the body.

## Detailed Description

Object representing an event state, which is subcribed or published.

See also
  Core::publish()
  Core::subscribe()

## Member Function Documentation

## ◆ acceptPublish()

LINPHONECXX_PUBLIC linphone::Status linphone::Event::acceptPublish | ( |  | ) |

Accept an incoming publish.

Returns
  0 if successful, error code otherwise

## ◆ acceptSubscription()

LINPHONECXX_PUBLIC linphone::Status linphone::Event::acceptSubscription | ( |  | ) |

Accept an incoming subcription.

Returns
  0 if successful, error code otherwise

## ◆ addCustomHeader()

LINPHONECXX_PUBLIC void linphone::Event::addCustomHeader | ( | const std::string & | name,
|  | const std::string & | value )

Add a custom header to an outgoing susbscription or publish.

Parameters

  name | header's name
  value | the header's value.

## ◆ addListener()

LINPHONECXX_PUBLIC void linphone::Event::addListener | ( | const std::shared_ptr< EventListener > & | listener | ) |

Add an application listener to the Event instance.

Parameters

  listener | the application listener

## ◆ denyPublish()

LINPHONECXX_PUBLIC linphone::Status linphone::Event::denyPublish | ( | linphone::Reason | reason | ) |

Deny an incoming publish with given reason.

Parameters

  reason | The Reason of denial.

Returns
  0 if successful, error code otherwise

## ◆ denySubscription()

LINPHONECXX_PUBLIC linphone::Status linphone::Event::denySubscription | ( | linphone::Reason | reason | ) |

Deny an incoming subscription with given reason.

Parameters

  reason | The Reason of denial.

Returns
  0 if successful, error code otherwise

## ◆ getCore()

LINPHONECXX_PUBLIC std::shared_ptr< linphone::Core > linphone::Event::getCore | ( |  | ) | const

Returns back pointer to the Core that created this Event.

Returns
  the Core object associated.

## ◆ getCustomHeader()

LINPHONECXX_PUBLIC std::string linphone::Event::getCustomHeader | ( | const std::string & | name | ) |

Obtain the value of a given header for an incoming subscription.

Parameters

  name | header's name

Returns
  the header's value or nullptr if such header doesn't exist.

## ◆ getErrorInfo()

LINPHONECXX_PUBLIC std::shared_ptr< const linphone::ErrorInfo > linphone::Event::getErrorInfo | ( |  | ) | const

Get full details about an error occured.

Returns
  a ErrorInfo object.

## ◆ getFrom()

LINPHONECXX_PUBLIC std::shared_ptr< const linphone::Address > linphone::Event::getFrom | ( |  | ) | const

Get the "from" address of the subscription.

Returns
  the from Address.

## ◆ getName()

LINPHONECXX_PUBLIC std::string linphone::Event::getName | ( |  | ) | const

Get the name of the event as specified in the event package RFC.

Returns
  the event name.

## ◆ getPublishState()

LINPHONECXX_PUBLIC linphone::PublishState linphone::Event::getPublishState | ( |  | ) | const

Get publish state.

If the event object was not created by a publish mechanism, PublishState::None is returned.

Returns
  the current PublishState

## ◆ getReason()

LINPHONECXX_PUBLIC linphone::Reason linphone::Event::getReason | ( |  | ) | const

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

Returns
  a Reason enum

## ◆ getRemoteContact()

LINPHONECXX_PUBLIC std::shared_ptr< const linphone::Address > linphone::Event::getRemoteContact | ( |  | ) | const

Get the "contact" address of the subscription.

Returns
  The "contact" address of the subscription

## ◆ getResource()

LINPHONECXX_PUBLIC std::shared_ptr< const linphone::Address > linphone::Event::getResource | ( |  | ) | const

Get the resource address of the subscription or publish.

Returns
  the resource Address.

## ◆ getSubscriptionDir()

LINPHONECXX_PUBLIC linphone::SubscriptionDir linphone::Event::getSubscriptionDir | ( |  | ) |

Get subscription direction.

If the object wasn't created by a subscription mechanism, SubscriptionDir::InvalidDir is returned.

Returns
  the SubscriptionDir

## ◆ getSubscriptionState()

LINPHONECXX_PUBLIC linphone::SubscriptionState linphone::Event::getSubscriptionState | ( |  | ) | const

Get subscription state.

If the event object was not created by a subscription mechanism, SubscriptionState::None is returned.

Returns
  the current SubscriptionState

## ◆ getTo()

LINPHONECXX_PUBLIC std::shared_ptr< const linphone::Address > linphone::Event::getTo | ( |  | ) | const

Get the "to" address of the subscription.

Returns
  the "to" Address.

## ◆ notify()

LINPHONECXX_PUBLIC linphone::Status linphone::Event::notify | ( | const std::shared_ptr< const linphone::Content > & | body | ) |

Send a notification.

Parameters

  body | an optional body containing the actual notification data.

Returns
  0 if successful, -1 otherwise.

## ◆ pausePublish()

LINPHONECXX_PUBLIC void linphone::Event::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()

LINPHONECXX_PUBLIC linphone::Status linphone::Event::refreshPublish | ( |  | ) |

Refresh an outgoing publish keeping the same body.

Returns
  0 if successful, -1 otherwise.

## ◆ refreshSubscribe()

LINPHONECXX_PUBLIC linphone::Status linphone::Event::refreshSubscribe | ( |  | ) |

Refresh an outgoing subscription keeping the same body.

Returns
  0 if successful, -1 otherwise.

## ◆ removeCustomHeader()

LINPHONECXX_PUBLIC void linphone::Event::removeCustomHeader | ( | const std::string & | name | ) |

Remove custom header to an outgoing susbscription or publish.

Parameters

  name | header's name

## ◆ removeListener()

LINPHONECXX_PUBLIC void linphone::Event::removeListener | ( | const std::shared_ptr< EventListener > & | listener | ) |

Remove a previously added listener from the Event instance.

Parameters

  listener | the application listener

## ◆ sendPublish()

LINPHONECXX_PUBLIC linphone::Status linphone::Event::sendPublish | ( | const std::shared_ptr< const linphone::Content > & | body | ) |

Send a publish created by Core::createPublish().

Parameters

  body | the new data to be published

Returns
  0 if successful, -1 otherwise.

## ◆ sendSubscribe()

LINPHONECXX_PUBLIC linphone::Status linphone::Event::sendSubscribe | ( | const std::shared_ptr< const linphone::Content > & | body | ) |

Send a subscription previously created by Core::createSubscribe().

Parameters

  body | optional content to attach with the subscription.

Returns
  0 if successful, -1 otherwise.

## ◆ terminate()

LINPHONECXX_PUBLIC void linphone::Event::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()

LINPHONECXX_PUBLIC linphone::Status linphone::Event::updatePublish | ( | const std::shared_ptr< const linphone::Content > & | body | ) |

Update (refresh) a publish.

Parameters

  body | the new data to be published

Returns
  0 if successful, error code otherwise

## ◆ updateSubscribe()

LINPHONECXX_PUBLIC linphone::Status linphone::Event::updateSubscribe | ( | const std::shared_ptr< const linphone::Content > & | body | ) |

Update (refresh) an outgoing subscription, changing the body.

Parameters

  body | an optional body to include in the subscription update, may be nullptr.

Returns
  0 if successful, error code otherwise

The documentation for this class was generated from the following file:

- event.hh