mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-21 13:08:08 +00:00
Add API to get the remote contact of a SIP event.
This commit is contained in:
parent
36e73b29f2
commit
fbc239661b
3 changed files with 22 additions and 0 deletions
|
|
@ -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
|
||||
**/
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue