Commit fbc23966 authored by Ghislain MARY's avatar Ghislain MARY

Add API to get the remote contact of a SIP event.

parent 36e73b29
......@@ -442,6 +442,7 @@ static void linphone_event_destroy(LinphoneEvent *lev){
if (lev->send_custom_headers) sal_custom_header_free(lev->send_custom_headers);
if (lev->to_address) linphone_address_unref(lev->to_address);
if (lev->from_address) linphone_address_unref(lev->from_address);
if (lev->remote_contact_address) linphone_address_unref(lev->remote_contact_address);
ms_free(lev->name);
}
......@@ -480,6 +481,15 @@ static const LinphoneAddress *_linphone_event_cache_from (const LinphoneEvent *l
return lev->from_address;
}
static const LinphoneAddress *_linphone_event_cache_remote_contact (const LinphoneEvent *lev) {
if (lev->remote_contact_address)
linphone_address_unref(lev->remote_contact_address);
char *buf = sal_address_as_string(lev->op->get_remote_contact_address());
((LinphoneEvent *)lev)->remote_contact_address = linphone_address_new(buf);
ms_free(buf);
return lev->remote_contact_address;
}
const LinphoneAddress *linphone_event_get_from (const LinphoneEvent *lev) {
if (lev->is_out_of_dialog_op && lev->dir == LinphoneSubscriptionOutgoing)
return _linphone_event_cache_to(lev);
......@@ -492,6 +502,10 @@ const LinphoneAddress *linphone_event_get_resource(const LinphoneEvent *lev){
return _linphone_event_cache_to(lev);
}
const LinphoneAddress *linphone_event_get_remote_contact (const LinphoneEvent *lev) {
return _linphone_event_cache_remote_contact(lev);
}
LinphoneCore *linphone_event_get_core(const LinphoneEvent *lev){
return lev->lc;
}
......
......@@ -972,6 +972,7 @@ struct _LinphoneEvent{
// Cache.
LinphoneAddress *to_address;
LinphoneAddress *from_address;
LinphoneAddress *remote_contact_address;
};
BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneEvent);
......
......@@ -191,6 +191,13 @@ LINPHONE_PUBLIC const LinphoneAddress *linphone_event_get_from(const LinphoneEve
**/
LINPHONE_PUBLIC const LinphoneAddress *linphone_event_get_resource(const LinphoneEvent *lev);
/**
* Get the "contact" address of the subscription.
* @param[in] lev LinphoneEvent object
* @return The "contact" address of the subscription
*/
LINPHONE_PUBLIC const LinphoneAddress *linphone_event_get_remote_contact (const LinphoneEvent *lev);
/**
* Returns back pointer to the LinphoneCore that created this LinphoneEvent
**/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment