Reworking of Liblinphone API

* Introduction of LinphoneFactory singleton class to create
  core-independent object like LinphoneAddress or LinphoneVcard.
* Make several C structures inherite from belle_sip_object_t class:
	* LinphoneCore
	* LinphoneVcard
	* LinphoneAuthInfo
* Creation of the LinphoneCoreCbs class that enable to store the
  callbacks used by LinphoneCore.
This commit is contained in:
François Grisez 2017-01-12 17:19:27 +01:00
parent d6d0cbf5a6
commit 85b5ca097a
20 changed files with 1185 additions and 187 deletions

View file

@ -78,6 +78,7 @@ set(LINPHONE_SOURCE_FILES_C
enum.c
error_info.c
event.c
factory.c
friend.c
friendlist.c
im_notif_policy.c

View file

@ -21,13 +21,17 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "linphone/lpconfig.h"
#include "private.h"
LinphoneAddress * linphone_address_new(const char *addr){
LinphoneAddress * _linphone_address_new(const char *addr){
SalAddress *saddr=sal_address_new(addr);
if (saddr==NULL)
ms_error("Cannot create LinphoneAddress, bad uri [%s]",addr);
return saddr;
}
LinphoneAddress * linphone_address_new(const char *addr) {
return _linphone_address_new(addr);
}
LinphoneAddress * linphone_address_clone(const LinphoneAddress *addr){
return sal_address_clone(addr);
}

View file

@ -26,13 +26,22 @@
#include "private.h"
#include "linphone/lpconfig.h"
/**
* @addtogroup authentication
* @{
**/
static void _linphone_auth_info_uninit(LinphoneAuthInfo *obj);
static void _linphone_auth_info_copy(LinphoneAuthInfo *dst, const LinphoneAuthInfo *src);
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneAuthInfo);
BELLE_SIP_DECLARE_VPTR(LinphoneAuthInfo);
BELLE_SIP_INSTANCIATE_VPTR(
LinphoneAuthInfo,
belle_sip_object_t,
_linphone_auth_info_uninit, // destroy
_linphone_auth_info_copy, // clone
NULL, // marshal
FALSE
);
LinphoneAuthInfo *linphone_auth_info_new(const char *username, const char *userid, const char *passwd, const char *ha1, const char *realm, const char *domain){
LinphoneAuthInfo *obj=ms_new0(LinphoneAuthInfo,1);
LinphoneAuthInfo *obj=belle_sip_object_new(LinphoneAuthInfo);
if (username!=NULL && (strlen(username)>0) ) obj->username=ms_strdup(username);
if (userid!=NULL && (strlen(userid)>0)) obj->userid=ms_strdup(userid);
if (passwd!=NULL && (strlen(passwd)>0)) obj->passwd=ms_strdup(passwd);
@ -42,19 +51,29 @@ LinphoneAuthInfo *linphone_auth_info_new(const char *username, const char *useri
return obj;
}
static void _linphone_auth_info_copy(LinphoneAuthInfo *dst, const LinphoneAuthInfo *src) {
if (src->username) dst->username = ms_strdup(src->username);
if (src->userid) dst->userid = ms_strdup(src->userid);
if (src->passwd) dst->passwd = ms_strdup(src->passwd);
if (src->ha1) dst->ha1 = ms_strdup(src->ha1);
if (src->realm) dst->realm = ms_strdup(src->realm);
if (src->domain) dst->domain = ms_strdup(src->domain);
if (src->tls_cert) dst->tls_cert = ms_strdup(src->tls_cert);
if (src->tls_key) dst->tls_key = ms_strdup(src->tls_key);
if (src->tls_cert_path) dst->tls_cert_path = ms_strdup(src->tls_cert_path);
if (src->tls_key_path) dst->tls_key_path = ms_strdup(src->tls_key_path);
}
LinphoneAuthInfo *linphone_auth_info_clone(const LinphoneAuthInfo *ai){
LinphoneAuthInfo *obj=ms_new0(LinphoneAuthInfo,1);
if (ai->username) obj->username = ms_strdup(ai->username);
if (ai->userid) obj->userid = ms_strdup(ai->userid);
if (ai->passwd) obj->passwd = ms_strdup(ai->passwd);
if (ai->ha1) obj->ha1 = ms_strdup(ai->ha1);
if (ai->realm) obj->realm = ms_strdup(ai->realm);
if (ai->domain) obj->domain = ms_strdup(ai->domain);
if (ai->tls_cert) obj->tls_cert = ms_strdup(ai->tls_cert);
if (ai->tls_key) obj->tls_key = ms_strdup(ai->tls_key);
if (ai->tls_cert_path) obj->tls_cert_path = ms_strdup(ai->tls_cert_path);
if (ai->tls_key_path) obj->tls_key_path = ms_strdup(ai->tls_key_path);
return obj;
return LINPHONE_AUTH_INFO(belle_sip_object_clone(BELLE_SIP_OBJECT(ai)));
}
LinphoneAuthInfo *linphone_auth_info_ref(LinphoneAuthInfo *obj) {
return LINPHONE_AUTH_INFO(belle_sip_object_ref(obj));
}
void linphone_auth_info_unref(LinphoneAuthInfo *obj) {
belle_sip_object_unref(obj);
}
const char *linphone_auth_info_get_username(const LinphoneAuthInfo *i) {
@ -178,10 +197,7 @@ void linphone_auth_info_set_tls_key_path(LinphoneAuthInfo *info, const char *tls
if (tls_key_path && strlen(tls_key_path) > 0) info->tls_key_path = ms_strdup(tls_key_path);
}
/**
* Destroys a LinphoneAuthInfo object.
**/
void linphone_auth_info_destroy(LinphoneAuthInfo *obj){
static void _linphone_auth_info_uninit(LinphoneAuthInfo *obj) {
if (obj->username != NULL) ms_free(obj->username);
if (obj->userid != NULL) ms_free(obj->userid);
if (obj->passwd != NULL) ms_free(obj->passwd);
@ -192,7 +208,13 @@ void linphone_auth_info_destroy(LinphoneAuthInfo *obj){
if (obj->tls_key != NULL) ms_free(obj->tls_key);
if (obj->tls_cert_path != NULL) ms_free(obj->tls_cert_path);
if (obj->tls_key_path != NULL) ms_free(obj->tls_key_path);
ms_free(obj);
}
/**
* Destroys a LinphoneAuthInfo object.
**/
void linphone_auth_info_destroy(LinphoneAuthInfo *obj){
belle_sip_object_unref(obj);
}
void linphone_auth_info_write_config(LpConfig *config, LinphoneAuthInfo *obj, int pos) {
@ -457,11 +479,6 @@ void linphone_core_add_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *info)
write_auth_infos(lc);
}
/**
* This method is used to abort a user authentication request initiated by LinphoneCore
* from the auth_info_requested callback of LinphoneCoreVTable.
**/
void linphone_core_abort_authentication(LinphoneCore *lc, LinphoneAuthInfo *info){
}
@ -479,9 +496,6 @@ const bctbx_list_t *linphone_core_get_auth_info_list(const LinphoneCore *lc){
return lc->auth_info;
}
/**
* Clear all authentication information.
**/
void linphone_core_clear_all_auth_info(LinphoneCore *lc){
bctbx_list_t *elem;
int i;
@ -493,7 +507,3 @@ void linphone_core_clear_all_auth_info(LinphoneCore *lc){
bctbx_list_free(lc->auth_info);
lc->auth_info=NULL;
}
/**
* @}
**/

View file

@ -916,6 +916,11 @@ void linphone_chat_room_send_message2(LinphoneChatRoom *cr, LinphoneChatMessage
_linphone_chat_room_send_message(cr, msg);
}
void linphone_chat_room_send_message_3(LinphoneChatRoom *cr, LinphoneChatMessage *msg) {
linphone_chat_message_ref(msg);
_linphone_chat_room_send_message(cr, msg);
}
void linphone_chat_room_send_chat_message(LinphoneChatRoom *cr, LinphoneChatMessage *msg) {
_linphone_chat_room_send_message(cr, msg);
}

View file

@ -208,7 +208,7 @@ private:
const char *m_focusAddr;
char *m_focusContact;
LinphoneCall *m_focusCall;
LinphoneCoreVTable *m_vtable;
LinphoneCoreCbs *m_coreCbs;
std::list<LinphoneCall *> m_pendingCalls;
std::list<LinphoneCall *> m_transferingCalls;
};
@ -625,19 +625,19 @@ RemoteConference::RemoteConference(LinphoneCore *core, const Conference::Params
m_focusAddr = NULL;
m_focusContact = NULL;
m_focusCall = NULL;
m_vtable = NULL;
m_coreCbs = NULL;
m_focusAddr = lp_config_get_string(m_core->config, "misc", "conference_focus_addr", "");
m_vtable = linphone_core_v_table_new();
m_vtable->call_state_changed = callStateChangedCb;
m_vtable->transfer_state_changed = transferStateChanged;
linphone_core_v_table_set_user_data(m_vtable, this);
_linphone_core_add_listener(m_core, m_vtable, FALSE, TRUE);
m_coreCbs = linphone_factory_create_core_cbs(linphone_factory_get());
linphone_core_cbs_set_call_state_changed(m_coreCbs, callStateChangedCb);
linphone_core_cbs_set_transfer_state_changed(m_coreCbs, transferStateChanged);
linphone_core_cbs_set_user_data(m_coreCbs, this);
_linphone_core_add_callbacks(m_core, m_coreCbs, TRUE);
}
RemoteConference::~RemoteConference() {
terminate();
linphone_core_remove_listener(m_core, m_vtable);
linphone_core_v_table_destroy(m_vtable);
linphone_core_remove_callbacks(m_core, m_coreCbs);
linphone_core_cbs_unref(m_coreCbs);
}
int RemoteConference::addParticipant(LinphoneCall *call) {

79
coreapi/factory.c Normal file
View file

@ -0,0 +1,79 @@
/*
linphone
Copyright (C) 2016 Belledonne Communications <info@belledonne-communications.com>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "private.h"
extern LinphoneCore *_linphone_core_new_with_config(LinphoneCoreCbs *cbs, struct _LpConfig *config, void *userdata);
extern LinphoneCoreCbs *_linphone_core_cbs_new(void);
extern LinphoneAddress *_linphone_address_new(const char *addr);
typedef belle_sip_object_t_vptr_t LinphoneFactory_vptr_t;
struct _LinphoneFactory {
belle_sip_object_t base;
};
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneFactory);
BELLE_SIP_INSTANCIATE_VPTR(LinphoneFactory, belle_sip_object_t,
NULL, // destroy
NULL, // clone
NULL, // Marshall
FALSE
);
static LinphoneFactory *_factory = NULL;
static void _linphone_factory_destroying_cb(void) {
if (_factory != NULL) {
belle_sip_object_unref(_factory);
_factory = NULL;
}
}
LinphoneFactory *linphone_factory_get(void) {
if (_factory == NULL) {
_factory = belle_sip_object_new(LinphoneFactory);
atexit(_linphone_factory_destroying_cb);
}
return _factory;
}
LinphoneCore *linphone_factory_create_core(const LinphoneFactory *factory, LinphoneCoreCbs *cbs,
const char *config_path, const char *factory_config_path) {
LpConfig *config = lp_config_new_with_factory(config_path, factory_config_path);
LinphoneCore *lc = _linphone_core_new_with_config(cbs, config, NULL);
lp_config_unref(config);
return lc;
}
LinphoneCore *linphone_factory_create_core_with_config(const LinphoneFactory *factory, LinphoneCoreCbs *cbs, LinphoneConfig *config) {
return _linphone_core_new_with_config(cbs, config, NULL);
}
LinphoneCoreCbs *linphone_factory_create_core_cbs(const LinphoneFactory *factory) {
return _linphone_core_cbs_new();
}
LinphoneAddress *linphone_factory_create_address(const LinphoneFactory *factory, const char *addr) {
return _linphone_address_new(addr);
}
LinphoneAuthInfo *linphone_factory_create_auth_info(const LinphoneFactory *factory, const char *username, const char *userid, const char *passwd, const char *ha1, const char *realm, const char *domain) {
return linphone_auth_info_new(username, userid, passwd, ha1, realm, domain);
}

View file

@ -1223,7 +1223,7 @@ void linphone_core_friends_storage_init(LinphoneCore *lc) {
int ret;
const char *errmsg;
sqlite3 *db;
const bctbx_list_t *friends_lists = NULL;
bctbx_list_t *friends_lists = NULL;
linphone_core_friends_storage_close(lc);
@ -1246,14 +1246,15 @@ void linphone_core_friends_storage_init(LinphoneCore *lc) {
friends_lists = linphone_core_fetch_friends_lists_from_db(lc);
if (friends_lists) {
const bctbx_list_t *it;
ms_warning("Replacing current default friend list by the one(s) from the database");
lc->friends_lists = bctbx_list_free_with_data(lc->friends_lists, (void (*)(void*))linphone_friend_list_unref);
while (friends_lists) {
LinphoneFriendList *list = (LinphoneFriendList *)bctbx_list_get_data(friends_lists);
lc->friends_lists = bctbx_list_free_with_data(lc->friends_lists, (bctbx_list_free_func)linphone_friend_list_unref);
for (it=friends_lists;it!=NULL;it=bctbx_list_next(it)) {
LinphoneFriendList *list = (LinphoneFriendList *)bctbx_list_get_data(it);
linphone_core_add_friend_list(lc, list);
friends_lists = bctbx_list_next(friends_lists);
}
friends_lists = bctbx_list_free_with_data(friends_lists, (bctbx_list_free_func)linphone_friend_list_unref);
}
}

View file

@ -105,6 +105,7 @@ static void set_network_reachable(LinphoneCore* lc,bool_t isReachable, time_t cu
static void set_sip_network_reachable(LinphoneCore* lc,bool_t isReachable, time_t curtime);
static void set_media_network_reachable(LinphoneCore* lc,bool_t isReachable);
static void linphone_core_run_hooks(LinphoneCore *lc);
static void linphone_core_uninit(LinphoneCore *lc);
#include "enum.h"
#include "contact_providers_priv.h"
@ -130,6 +131,165 @@ static void toggle_video_preview(LinphoneCore *lc, bool_t val);
extern SalCallbacks linphone_sal_callbacks;
static void _linphone_core_cbs_uninit(LinphoneCoreCbs *cbs);
typedef belle_sip_object_t_vptr_t LinphoneCoreCbs_vptr_t;
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneCoreCbs);
BELLE_SIP_INSTANCIATE_VPTR(LinphoneCoreCbs, belle_sip_object_t,
_linphone_core_cbs_uninit, // destroy
NULL, // clone
NULL, // Marshall
FALSE
);
LinphoneCoreCbs *_linphone_core_cbs_new(void) {
LinphoneCoreCbs *obj = belle_sip_object_new(LinphoneCoreCbs);
obj->vtable = ms_new0(LinphoneCoreVTable, 1);
obj->autorelease = TRUE;
return obj;
}
static void _linphone_core_cbs_uninit(LinphoneCoreCbs *cbs) {
if (cbs->autorelease) ms_free(cbs->vtable);
}
void _linphone_core_cbs_set_v_table(LinphoneCoreCbs *cbs, LinphoneCoreVTable *vtable, bool_t autorelease) {
ms_free(cbs->vtable);
cbs->vtable = vtable;
cbs->autorelease = autorelease;
}
LinphoneCoreCbs *linphone_core_cbs_ref(LinphoneCoreCbs *cbs) {
return (LinphoneCoreCbs *)belle_sip_object_ref(cbs);
}
void linphone_core_cbs_unref(LinphoneCoreCbs *cbs) {
belle_sip_object_unref(cbs);
}
void linphone_core_cbs_set_user_data(LinphoneCoreCbs *cbs, void *user_data) {
cbs->vtable->user_data = user_data;
}
void *linphone_core_cbs_get_user_data(LinphoneCoreCbs *cbs) {
return cbs->vtable->user_data;
}
LinphoneCoreCbs *linphone_core_get_current_callbacks(const LinphoneCore *lc) {
return lc->current_cbs;
}
void linphone_core_cbs_set_registration_state_changed(LinphoneCoreCbs *cbs, LinphoneCoreCbsRegistrationStateChangedCb cb) {
cbs->vtable->registration_state_changed = cb;
}
void linphone_core_cbs_set_call_state_changed(LinphoneCoreCbs *cbs, LinphoneCoreCbsCallStateChangedCb cb) {
cbs->vtable->call_state_changed = cb;
}
void linphone_core_cbs_set_notify_presence_received(LinphoneCoreCbs *cbs, LinphoneCoreCbsNotifyPresenceReceivedCb cb) {
cbs->vtable->notify_presence_received = cb;
}
void linphone_core_cbs_set_notify_presence_received_for_uri_or_tel(LinphoneCoreCbs *cbs, LinphoneCoreCbsNotifyPresenceReceivedForUriOrTelCb cb) {
cbs->vtable->notify_presence_received_for_uri_or_tel = cb;
}
void linphone_core_cbs_set_new_subscription_requested(LinphoneCoreCbs *cbs, LinphoneCoreCbsNewSubscriptionRequestedCb cb) {
cbs->vtable->new_subscription_requested = cb;
}
void linphone_core_cbs_set_authentication_requested(LinphoneCoreCbs *cbs, LinphoneCoreCbsAuthenticationRequestedCb cb) {
cbs->vtable->authentication_requested = cb;
}
void linphone_core_cbs_set_call_log_updated(LinphoneCoreCbs *cbs, LinphoneCoreCbsCallLogUpdatedCb cb) {
cbs->vtable->call_log_updated = cb;
}
void linphone_core_cbs_set_message_received(LinphoneCoreCbs *cbs, LinphoneCoreCbsMessageReceivedCb cb) {
cbs->vtable->message_received = cb;
}
void linphone_core_cbs_set_is_composing_received(LinphoneCoreCbs *cbs, LinphoneCoreCbsIsComposingReceivedCb cb) {
cbs->vtable->is_composing_received = cb;
}
void linphone_core_cbs_set_dtmf_received(LinphoneCoreCbs *cbs, LinphoneCoreCbsDtmfReceivedCb cb) {
cbs->vtable->dtmf_received = cb;
}
void linphone_core_cbs_set_refer_received(LinphoneCoreCbs *cbs, LinphoneCoreCbsReferReceivedCb cb) {
cbs->vtable->refer_received = cb;
}
void linphone_core_cbs_set_call_encryption_changed(LinphoneCoreCbs *cbs, LinphoneCoreCbsCallEncryptionChangedCb cb) {
cbs->vtable->call_encryption_changed = cb;
}
void linphone_core_cbs_set_transfer_state_changed(LinphoneCoreCbs *cbs, LinphoneCoreCbsTransferStateChangedCb cb) {
cbs->vtable->transfer_state_changed = cb;
}
void linphone_core_cbs_set_buddy_info_updated(LinphoneCoreCbs *cbs, LinphoneCoreCbsBuddyInfoUpdatedCb cb) {
cbs->vtable->buddy_info_updated = cb;
}
void linphone_core_cbs_set_call_stats_updated(LinphoneCoreCbs *cbs, LinphoneCoreCbsCallStatsUpdatedCb cb) {
cbs->vtable->call_stats_updated = cb;
}
void linphone_core_cbs_set_info_received(LinphoneCoreCbs *cbs, LinphoneCoreCbsInfoReceivedCb cb) {
cbs->vtable->info_received = cb;
}
void linphone_core_cbs_set_subscription_state_changed(LinphoneCoreCbs *cbs, LinphoneCoreCbsSubscriptionStateChangedCb cb) {
cbs->vtable->subscription_state_changed = cb;
}
void linphone_core_cbs_set_notify_received(LinphoneCoreCbs *cbs, LinphoneCoreCbsNotifyReceivedCb cb) {
cbs->vtable->notify_received = cb;
}
void linphone_core_cbs_set_publish_state_changed(LinphoneCoreCbs *cbs, LinphoneCoreCbsPublishStateChangedCb cb) {
cbs->vtable->publish_state_changed = cb;
}
void linphone_core_cbs_set_configuring_status(LinphoneCoreCbs *cbs, LinphoneCoreCbsConfiguringStatusCb cb) {
cbs->vtable->configuring_status = cb;
}
void linphone_core_cbs_set_network_reachable(LinphoneCoreCbs *cbs, LinphoneCoreCbsNetworkReachableCb cb) {
cbs->vtable->network_reachable = cb;
}
void linphone_core_cbs_set_log_collection_upload_state_changed(LinphoneCoreCbs *cbs, LinphoneCoreCbsLogCollectionUploadStateChangedCb cb) {
cbs->vtable->log_collection_upload_state_changed = cb;
}
void linphone_core_cbs_set_log_collection_upload_progress_indication(LinphoneCoreCbs *cbs, LinphoneCoreCbsLogCollectionUploadProgressIndicationCb cb) {
cbs->vtable->log_collection_upload_progress_indication = cb;
}
void linphone_core_cbs_set_friend_list_created(LinphoneCoreCbs *cbs, LinphoneCoreCbsFriendListCreatedCb cb) {
cbs->vtable->friend_list_created = cb;
}
void linphone_core_cbs_set_friend_list_removed(LinphoneCoreCbs *cbs, LinphoneCoreCbsFriendListRemovedCb cb) {
cbs->vtable->friend_list_removed = cb;
}
typedef belle_sip_object_t_vptr_t LinphoneCore_vptr_t;
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneCore);
BELLE_SIP_INSTANCIATE_VPTR(LinphoneCore, belle_sip_object_t,
linphone_core_uninit, // destroy
NULL, // clone
NULL, // Marshall
FALSE
);
void lc_callback_obj_init(LCCallbackObj *obj,LinphoneCoreCbFunc func,void* ud) {
obj->_func=func;
obj->_user_data=ud;
@ -1771,10 +1931,9 @@ static void linphone_core_internal_subscription_state_changed(LinphoneCore *lc,
}
}
static void linphone_core_init(LinphoneCore * lc, const LinphoneCoreVTable *vtable, LpConfig *config, void * userdata){
static void linphone_core_init(LinphoneCore * lc, LinphoneCoreCbs *cbs, LpConfig *config, void * userdata){
const char *remote_provisioning_uri = NULL;
LinphoneCoreVTable* local_vtable= linphone_core_v_table_new();
LinphoneCoreVTable *internal_vtable = linphone_core_v_table_new();
LinphoneCoreCbs *internal_cbs = _linphone_core_cbs_new();
ms_message("Initializing LinphoneCore %s", linphone_core_get_version());
@ -1784,11 +1943,20 @@ static void linphone_core_init(LinphoneCore * lc, const LinphoneCoreVTable *vtab
linphone_task_list_init(&lc->hooks);
internal_vtable->notify_received = linphone_core_internal_notify_received;
internal_vtable->subscription_state_changed = linphone_core_internal_subscription_state_changed;
_linphone_core_add_listener(lc, internal_vtable, TRUE, TRUE);
memcpy(local_vtable,vtable,sizeof(LinphoneCoreVTable));
_linphone_core_add_listener(lc, local_vtable, TRUE, FALSE);
linphone_core_cbs_set_notify_received(internal_cbs, linphone_core_internal_notify_received);
linphone_core_cbs_set_subscription_state_changed(internal_cbs, linphone_core_internal_subscription_state_changed);
_linphone_core_add_callbacks(lc, internal_cbs, TRUE);
belle_sip_object_unref(internal_cbs);
if (cbs != NULL) {
_linphone_core_add_callbacks(lc, cbs, FALSE);
} else {
LinphoneCoreCbs *fallback_cbs = linphone_factory_create_core_cbs(linphone_factory_get());
_linphone_core_add_callbacks(lc, fallback_cbs, FALSE);
belle_sip_object_unref(fallback_cbs);
}
linphone_core_set_state(lc,LinphoneGlobalStartup,"Starting up");
ortp_init();
@ -1838,7 +2006,24 @@ static void linphone_core_init(LinphoneCore * lc, const LinphoneCoreVTable *vtab
} // else linphone_core_start will be called after the remote provisioning (see linphone_core_iterate)
}
LinphoneCore *linphone_core_new(const LinphoneCoreVTable *vtable,
LinphoneCore *_linphone_core_new_with_config(LinphoneCoreCbs *cbs, struct _LpConfig *config, void *userdata) {
LinphoneCore *core = belle_sip_object_new(LinphoneCore);
linphone_core_init(core, cbs, config, userdata);
return core;
}
LinphoneCore *linphone_core_new_with_config(const LinphoneCoreVTable *vtable, struct _LpConfig *config, void *userdata) {
LinphoneCoreCbs *cbs = linphone_factory_create_core_cbs(linphone_factory_get());;
LinphoneCoreVTable *local_vtable = linphone_core_v_table_new();
LinphoneCore *core = NULL;
if (vtable != NULL) *local_vtable = *vtable;
_linphone_core_cbs_set_v_table(cbs, local_vtable, TRUE);
core = _linphone_core_new_with_config(cbs, config, userdata);
linphone_core_cbs_unref(cbs);
return core;
}
static LinphoneCore *_linphone_core_new(const LinphoneCoreVTable *vtable,
const char *config_path, const char *factory_config_path, void * userdata) {
LinphoneCore *lc;
LpConfig *config = lp_config_new_with_factory(config_path, factory_config_path);
@ -1847,10 +2032,17 @@ LinphoneCore *linphone_core_new(const LinphoneCoreVTable *vtable,
return lc;
}
LinphoneCore *linphone_core_new_with_config(const LinphoneCoreVTable *vtable, struct _LpConfig *config, void *userdata) {
LinphoneCore *core = ms_new0(LinphoneCore, 1);
linphone_core_init(core, vtable, config, userdata);
return core;
LinphoneCore *linphone_core_new(const LinphoneCoreVTable *vtable,
const char *config_path, const char *factory_config_path, void * userdata) {
return _linphone_core_new(vtable, config_path, factory_config_path, userdata);
}
LinphoneCore *linphone_core_ref(LinphoneCore *lc) {
return (LinphoneCore *)belle_sip_object_ref(BELLE_SIP_OBJECT(lc));
}
void linphone_core_unref(LinphoneCore *lc) {
belle_sip_object_unref(BELLE_SIP_OBJECT(lc));
}
const bctbx_list_t *linphone_core_get_audio_codecs(const LinphoneCore *lc) {
@ -2347,12 +2539,12 @@ int linphone_core_set_sip_transports(LinphoneCore *lc, const LCSipTransports * t
return _linphone_core_apply_transports(lc);
}
int linphone_core_get_sip_transports(LinphoneCore *lc, LCSipTransports *tr){
int linphone_core_get_sip_transports(LinphoneCore *lc, LinphoneSipTransports *tr){
memcpy(tr,&lc->sip_conf.transports,sizeof(*tr));
return 0;
}
void linphone_core_get_sip_transports_used(LinphoneCore *lc, LCSipTransports *tr){
void linphone_core_get_sip_transports_used(LinphoneCore *lc, LinphoneSipTransports *tr){
tr->udp_port=sal_get_listening_port(lc->sal,SalTransportUDP);
tr->tcp_port=sal_get_listening_port(lc->sal,SalTransportTCP);
tr->tls_port=sal_get_listening_port(lc->sal,SalTransportTLS);
@ -4440,9 +4632,6 @@ bool_t linphone_core_mic_enabled(LinphoneCore *lc) {
return !call->audio_muted;
}
// returns rtp transmission status for an active stream
// if audio is muted and config parameter rtp_no_xmit_on_audio_mute
// was set on then rtp transmission is also muted
bool_t linphone_core_is_rtp_muted(LinphoneCore *lc){
LinphoneCall *call=linphone_core_get_current_call(lc);
if (call==NULL){
@ -5205,9 +5394,6 @@ void linphone_core_set_native_preview_window_id(LinphoneCore *lc, void *id){
#endif
}
/**
* Can be used to disable video showing to free XV port
**/
void linphone_core_show_video(LinphoneCore *lc, bool_t show){
#ifdef VIDEO_ENABLED
LinphoneCall *call=linphone_core_get_current_call(lc);
@ -5860,6 +6046,10 @@ LpConfig * linphone_core_create_lp_config(LinphoneCore *lc, const char *filename
return lp_config_new(filename);
}
LinphoneConfig * linphone_core_create_config(LinphoneCore *lc, const char *filename) {
return lp_config_new(filename);
}
static void linphone_core_uninit(LinphoneCore *lc)
{
bctbx_list_t *elem = NULL;
@ -6095,8 +6285,7 @@ ortp_socket_t linphone_core_get_sip_socket(LinphoneCore *lc){
}
void linphone_core_destroy(LinphoneCore *lc){
linphone_core_uninit(lc);
ms_free(lc);
linphone_core_unref(lc);
}
int linphone_core_get_calls_nb(const LinphoneCore *lc){
@ -6268,6 +6457,10 @@ LinphoneCallParams *linphone_core_create_call_params(LinphoneCore *lc, LinphoneC
return NULL;
}
const char *linphone_error_to_string(LinphoneReason err){
return linphone_reason_to_string(err);
}
void linphone_core_enable_keep_alive(LinphoneCore* lc,bool_t enable) {
#ifdef BUILD_UPNP
if (linphone_core_get_firewall_policy(lc)==LinphonePolicyUseUpnp) {

View file

@ -677,6 +677,7 @@ BELLE_SIP_DECLARE_VPTR(LinphoneProxyConfig);
struct _LinphoneAuthInfo
{
belle_sip_object_t base;
char *username;
char *realm;
char *userid;
@ -950,8 +951,19 @@ void linphone_task_list_remove(LinphoneTaskList *t, LinphoneCoreIterateHook hook
void linphone_task_list_run(LinphoneTaskList *t);
void linphone_task_list_free(LinphoneTaskList *t);
struct _LinphoneCoreCbs {
belle_sip_object_t base;
LinphoneCoreVTable *vtable;
bool_t autorelease;
};
void _linphone_core_cbs_set_v_table(LinphoneCoreCbs *cbs, LinphoneCoreVTable *vtable, bool_t autorelease);
struct _LinphoneCore
{
belle_sip_object_t base;
MSFactory* factory;
MSList* vtable_refs;
int vtable_notify_recursion;
@ -1057,7 +1069,7 @@ struct _LinphoneCore
char *file_transfer_server;
const char **supported_formats;
LinphoneContent *log_collection_upload_information;
LinphoneCoreVTable *current_vtable; // the latest vtable to call a callback, see linphone_core_get_current_vtable
LinphoneCoreCbs *current_cbs; // the latest LinphoneCoreCbs object to call a callback, see linphone_core_get_current_cbs()
LinphoneRingtonePlayer *ringtoneplayer;
#ifdef ANDROID
jobject wifi_lock;
@ -1109,7 +1121,13 @@ void linphone_tunnel_destroy(LinphoneTunnel *tunnel);
void linphone_tunnel_configure(LinphoneTunnel *tunnel);
void linphone_tunnel_enable_logs_with_handler(LinphoneTunnel *tunnel, bool_t enabled, OrtpLogFunc logHandler);
/**
* Check if we do not have exceed the number of simultaneous call
*
* @ingroup call_control
**/
bool_t linphone_core_can_we_add_call(LinphoneCore *lc);
int linphone_core_add_call( LinphoneCore *lc, LinphoneCall *call);
int linphone_core_del_call( LinphoneCore *lc, LinphoneCall *call);
int linphone_core_get_calls_nb(const LinphoneCore *lc);
@ -1571,7 +1589,12 @@ BELLE_SIP_TYPE_ID(LinphoneXmlRpcSession),
BELLE_SIP_TYPE_ID(LinphoneTunnelConfig),
BELLE_SIP_TYPE_ID(LinphoneFriendListCbs),
BELLE_SIP_TYPE_ID(LinphoneEvent),
BELLE_SIP_TYPE_ID(LinphoneNatPolicy)
BELLE_SIP_TYPE_ID(LinphoneNatPolicy),
BELLE_SIP_TYPE_ID(LinphoneCore),
BELLE_SIP_TYPE_ID(LinphoneCoreCbs),
BELLE_SIP_TYPE_ID(LinphoneFactory),
BELLE_SIP_TYPE_ID(LinphoneAuthInfo),
BELLE_SIP_TYPE_ID(LinphoneVcard),
BELLE_SIP_DECLARE_TYPES_END
@ -1664,7 +1687,7 @@ void linphone_core_multicast_lock_release(LinphoneCore *lc);
#endif
struct _VTableReference{
LinphoneCoreVTable *vtable;
LinphoneCoreCbs *cbs;
bool_t valid;
bool_t autorelease;
bool_t internal;
@ -1674,7 +1697,7 @@ typedef struct _VTableReference VTableReference;
void v_table_reference_destroy(VTableReference *ref);
LINPHONE_PUBLIC void _linphone_core_add_listener(LinphoneCore *lc, LinphoneCoreVTable *vtable, bool_t autorelease, bool_t internal);
LINPHONE_PUBLIC void _linphone_core_add_callbacks(LinphoneCore *lc, LinphoneCoreCbs *vtable, bool_t internal);
#ifdef VIDEO_ENABLED
LINPHONE_PUBLIC MSWebCam *linphone_call_get_video_device(const LinphoneCall *call);

View file

@ -23,6 +23,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "sal/sal.h"
#include <bctoolbox/crypto.h>
#include "linphone/core.h"
#include "private.h"
#define VCARD_MD5_HASH_SIZE 16
@ -32,17 +33,7 @@ struct _LinphoneVcardContext {
void *user_data;
};
struct _LinphoneVcard {
shared_ptr<belcard::BelCard> belCard;
char *etag;
char *url;
unsigned char md5[VCARD_MD5_HASH_SIZE];
bctbx_list_t *sip_addresses_cache;
};
#ifdef __cplusplus
extern "C" {
#endif
LinphoneVcardContext* linphone_vcard_context_new(void) {
LinphoneVcardContext* context = ms_new0(LinphoneVcardContext, 1);
@ -67,25 +58,66 @@ void linphone_vcard_context_set_user_data(LinphoneVcardContext *context, void *d
if (context) context->user_data = data;
}
LinphoneVcard* linphone_vcard_new(void) {
LinphoneVcard* vCard = (LinphoneVcard*) ms_new0(LinphoneVcard, 1);
} // extern "C"
struct _LinphoneVcard {
belle_sip_object_t base;
shared_ptr<belcard::BelCard> belCard;
char *etag;
char *url;
unsigned char md5[VCARD_MD5_HASH_SIZE];
bctbx_list_t *sip_addresses_cache;
};
extern "C" {
static void _linphone_vcard_uninit(LinphoneVcard *vCard) {
if (vCard->etag) ms_free(vCard->etag);
if (vCard->url) ms_free(vCard->url);
linphone_vcard_clean_cache(vCard);
vCard->belCard.reset();
}
BELLE_SIP_DECLARE_VPTR(LinphoneVcard);
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneVcard);
BELLE_SIP_INSTANCIATE_VPTR(LinphoneVcard, belle_sip_object_t,
_linphone_vcard_uninit, // destroy
NULL, // clone
NULL, // Marshall
FALSE
);
static LinphoneVcard* _linphone_vcard_new(void) {
LinphoneVcard* vCard = belle_sip_object_new(LinphoneVcard);
vCard->belCard = belcard::BelCardGeneric::create<belcard::BelCard>();
return vCard;
}
LinphoneVcard *linphone_vcard_new(void) {
return _linphone_vcard_new();
}
LinphoneVcard *linphone_factory_create_vcard(LinphoneFactory *factory) {
return _linphone_vcard_new();
}
static LinphoneVcard* linphone_vcard_new_from_belcard(shared_ptr<belcard::BelCard> belcard) {
LinphoneVcard* vCard = (LinphoneVcard*) ms_new0(LinphoneVcard, 1);
LinphoneVcard* vCard = belle_sip_object_new(LinphoneVcard);
vCard->belCard = belcard;
return vCard;
}
void linphone_vcard_free(LinphoneVcard *vCard) {
if (!vCard) return;
if (vCard->etag) ms_free(vCard->etag);
if (vCard->url) ms_free(vCard->url);
linphone_vcard_clean_cache(vCard);
vCard->belCard.reset();
ms_free(vCard);
belle_sip_object_unref((belle_sip_object_t *)vCard);
}
LinphoneVcard *linphone_vcard_ref(LinphoneVcard *vCard) {
return (LinphoneVcard *)belle_sip_object_ref((belle_sip_object_t *)vCard);
}
void linphone_vcard_unref(LinphoneVcard *vCard) {
belle_sip_object_unref((belle_sip_object_t *)vCard);
}
bctbx_list_t* linphone_vcard_context_get_vcard_list_from_file(LinphoneVcardContext *context, const char *filename) {
@ -397,6 +429,4 @@ void linphone_vcard_clean_cache(LinphoneVcard *vCard) {
vCard->sip_addresses_cache = NULL;
}
#ifdef __cplusplus
}
#endif
} // extern "C"

View file

@ -38,7 +38,8 @@ void linphone_core_v_table_destroy(LinphoneCoreVTable* table) {
}
LinphoneCoreVTable *linphone_core_get_current_vtable(LinphoneCore *lc) {
return lc->current_vtable;
if (lc->current_cbs != NULL) return lc->current_cbs->vtable;
else return NULL;
}
static void cleanup_dead_vtable_refs(LinphoneCore *lc){
@ -63,8 +64,8 @@ static void cleanup_dead_vtable_refs(LinphoneCore *lc){
bool_t has_cb = FALSE; \
lc->vtable_notify_recursion++;\
for (iterator=lc->vtable_refs; iterator!=NULL; iterator=iterator->next){\
if ((ref=(VTableReference*)iterator->data)->valid && (lc->current_vtable=ref->vtable)->function_name) {\
lc->current_vtable->function_name(__VA_ARGS__);\
if ((ref=(VTableReference*)iterator->data)->valid && (lc->current_cbs=ref->cbs)->vtable->function_name) {\
lc->current_cbs->vtable->function_name(__VA_ARGS__);\
has_cb = TRUE;\
}\
}\
@ -76,8 +77,8 @@ static void cleanup_dead_vtable_refs(LinphoneCore *lc){
VTableReference *ref; \
lc->vtable_notify_recursion++;\
for (iterator=lc->vtable_refs; iterator!=NULL; iterator=iterator->next){\
if ((ref=(VTableReference*)iterator->data)->valid && (lc->current_vtable=ref->vtable)->function_name && (ref->internal == internal_val)) {\
lc->current_vtable->function_name(__VA_ARGS__);\
if ((ref=(VTableReference*)iterator->data)->valid && (lc->current_cbs=ref->cbs)->vtable->function_name && (ref->internal == internal_val)) {\
lc->current_cbs->vtable->function_name(__VA_ARGS__);\
}\
}\
lc->vtable_notify_recursion--;
@ -229,7 +230,7 @@ bool_t linphone_core_dtmf_received_has_listener(const LinphoneCore* lc) {
bctbx_list_t* iterator;
for (iterator=lc->vtable_refs; iterator!=NULL; iterator=iterator->next){
VTableReference *ref=(VTableReference*)iterator->data;
if (ref->valid && ref->vtable->dtmf_received)
if (ref->valid && ref->cbs->vtable->dtmf_received)
return TRUE;
}
return FALSE;
@ -305,27 +306,33 @@ void linphone_core_notify_friend_list_removed(LinphoneCore *lc, LinphoneFriendLi
cleanup_dead_vtable_refs(lc);
}
static VTableReference * v_table_reference_new(LinphoneCoreVTable *vtable, bool_t autorelease, bool_t internal){
static VTableReference * v_table_reference_new(LinphoneCoreCbs *cbs, bool_t internal){
VTableReference *ref=ms_new0(VTableReference,1);
ref->valid=1;
ref->autorelease=autorelease;
ref->valid=TRUE;
ref->internal = internal;
ref->vtable=vtable;
ref->cbs=(LinphoneCoreCbs *)belle_sip_object_ref(cbs);
return ref;
}
void v_table_reference_destroy(VTableReference *ref){
if (ref->autorelease) linphone_core_v_table_destroy(ref->vtable);
belle_sip_object_unref(ref->cbs);
ms_free(ref);
}
void _linphone_core_add_listener(LinphoneCore *lc, LinphoneCoreVTable *vtable, bool_t autorelease, bool_t internal) {
ms_message("Vtable [%p] registered on core [%p]",vtable, lc);
lc->vtable_refs=bctbx_list_append(lc->vtable_refs,v_table_reference_new(vtable, autorelease, internal));
void _linphone_core_add_callbacks(LinphoneCore *lc, LinphoneCoreCbs *vtable, bool_t internal) {
ms_message("Core callbacks [%p] registered on core [%p]", vtable, lc);
lc->vtable_refs=bctbx_list_append(lc->vtable_refs,v_table_reference_new(vtable, internal));
}
void linphone_core_add_listener(LinphoneCore *lc, LinphoneCoreVTable *vtable){
_linphone_core_add_listener(lc, vtable, FALSE, FALSE);
LinphoneCoreCbs *cbs = linphone_factory_create_core_cbs(linphone_factory_get());
_linphone_core_cbs_set_v_table(cbs, vtable, FALSE);
_linphone_core_add_callbacks(lc, cbs, FALSE);
belle_sip_object_unref(cbs);
}
void linphone_core_add_callbacks(LinphoneCore *lc, LinphoneCoreCbs *cbs) {
_linphone_core_add_callbacks(lc, cbs, FALSE);
}
void linphone_core_remove_listener(LinphoneCore *lc, const LinphoneCoreVTable *vtable) {
@ -333,7 +340,19 @@ void linphone_core_remove_listener(LinphoneCore *lc, const LinphoneCoreVTable *v
ms_message("Vtable [%p] unregistered on core [%p]",vtable,lc);
for(it=lc->vtable_refs; it!=NULL; it=it->next){
VTableReference *ref=(VTableReference*)it->data;
if (ref->vtable==vtable)
ref->valid=0;
if (ref->cbs->vtable==vtable) {
ref->valid=FALSE;
}
}
}
void linphone_core_remove_callbacks(LinphoneCore *lc, const LinphoneCoreCbs *cbs) {
bctbx_list_t *it;
ms_message("Callbacks [%p] unregistered on core [%p]",cbs,lc);
for(it=lc->vtable_refs; it!=NULL; it=it->next){
VTableReference *ref=(VTableReference*)it->data;
if (ref->cbs==cbs) {
ref->valid=FALSE;
}
}
}

View file

@ -38,6 +38,7 @@ set(HEADER_FILES
dictionary.h
error_info.h
event.h
factory.h
friend.h
friendlist.h
im_notif_policy.h

View file

@ -122,7 +122,7 @@ LINPHONE_PUBLIC void linphone_address_clean(LinphoneAddress *uri);
* Returns true if address refers to a secure location (sips)
* @deprecated use linphone_address_get_secure()
**/
LINPHONE_PUBLIC bool_t linphone_address_is_secure(const LinphoneAddress *addr);
LINPHONE_DEPRECATED LINPHONE_PUBLIC bool_t linphone_address_is_secure(const LinphoneAddress *addr);
/**
* Returns true if address refers to a secure location (sips)
@ -231,7 +231,7 @@ LINPHONE_PUBLIC const char * linphone_address_get_uri_param(const LinphoneAddres
* Destroys a LinphoneAddress object (actually calls linphone_address_unref()).
* @deprecated Use linphone_address_unref() instead
**/
LINPHONE_PUBLIC void linphone_address_destroy(LinphoneAddress *u);
LINPHONE_DEPRECATED LINPHONE_PUBLIC void linphone_address_destroy(LinphoneAddress *u);
/**
* @}

View file

@ -56,6 +56,11 @@ struct _LinphoneInfoMessage;
*/
typedef struct _LinphoneCore LinphoneCore;
/**
* Safely down-cast a belle_sip_object_t into LinphoneCore
* @ingroup initializing
*/
#define LINPHONE_CORE(object) BELLE_SIP_CAST(object, LinphoneCore)
/**
* Disable a sip transport
@ -83,7 +88,7 @@ typedef struct _LinphoneCore LinphoneCore;
* Use with #linphone_core_set_sip_transports
* @ingroup initializing
*/
typedef struct _LCSipTransports{
typedef struct _LinphoneSipTransports{
/**
* SIP/UDP port.
**/
@ -100,7 +105,10 @@ typedef struct _LCSipTransports{
* SIP/TLS port
* */
int tls_port;
} LCSipTransports;
} LinphoneSipTransports;
/* set LCSipTransports to ensure backward compatibility */
typedef struct _LinphoneSipTransports LCSipTransports;
/**
@ -371,12 +379,55 @@ LINPHONE_PUBLIC LinphoneAddress * linphone_core_create_address(LinphoneCore *lc,
**/
typedef struct _LinphoneInfoMessage LinphoneInfoMessage;
/**
* Creates an empty info message.
* @param lc the LinphoneCore
* @return a new LinphoneInfoMessage.
*
* The info message can later be filled with information using linphone_info_message_add_header() or linphone_info_message_set_content(),
* and finally sent with linphone_core_send_info_message().
**/
LINPHONE_PUBLIC LinphoneInfoMessage *linphone_core_create_info_message(LinphoneCore*lc);
/**
* Send a LinphoneInfoMessage through an established call
* @param call the call
* @param info the info message
**/
LINPHONE_PUBLIC int linphone_call_send_info_message(struct _LinphoneCall *call, const LinphoneInfoMessage *info);
/**
* Add a header to an info message to be sent.
* @param im the info message
* @param name the header'name
* @param value the header's value
**/
LINPHONE_PUBLIC void linphone_info_message_add_header(LinphoneInfoMessage *im, const char *name, const char *value);
/**
* Obtain a header value from a received info message.
* @param im the info message
* @param name the header'name
* @return the corresponding header's value, or NULL if not exists.
**/
LINPHONE_PUBLIC const char *linphone_info_message_get_header(const LinphoneInfoMessage *im, const char *name);
/**
* Assign a content to the info message.
* @param im the linphone info message
* @param content the content described as a #LinphoneContent structure.
* All fields of the LinphoneContent are copied, thus the application can destroy/modify/recycloe the content object freely ater the function returns.
**/
LINPHONE_PUBLIC void linphone_info_message_set_content(LinphoneInfoMessage *im, const LinphoneContent *content);
/**
* Returns the info message's content as a #LinphoneContent structure.
**/
LINPHONE_PUBLIC const LinphoneContent * linphone_info_message_get_content(const LinphoneInfoMessage *im);
/**
* Destroy a LinphoneInfoMessage
**/
LINPHONE_PUBLIC void linphone_info_message_destroy(LinphoneInfoMessage *im);
LINPHONE_PUBLIC LinphoneInfoMessage *linphone_info_message_copy(const LinphoneInfoMessage *orig);
@ -530,6 +581,7 @@ typedef enum _LinphoneRegistrationState{
LinphoneRegistrationFailed /**<Registration failed */
}LinphoneRegistrationState;
/**
* Human readable version of the #LinphoneRegistrationState
* @param cs sate
@ -579,11 +631,15 @@ LINPHONE_PUBLIC const char *linphone_core_log_collection_upload_state_to_string(
/**
* Global state notification callback.
* @param lc
* @param lc the #LinphoneCore.
* @param gstate the global state
* @param message informational message.
*/
typedef void (*LinphoneCoreGlobalStateChangedCb)(LinphoneCore *lc, LinphoneGlobalState gstate, const char *message);
typedef void (*LinphoneCoreCbsGlobalStateChangedCb)(LinphoneCore *lc, LinphoneGlobalState gstate, const char *message);
/**
* Old name of #LinphoneCoreCbsGlobalStateChangedCb.
*/
typedef LinphoneCoreCbsGlobalStateChangedCb LinphoneCoreGlobalStateChangedCb;
/**
* Call state notification callback.
* @param lc the LinphoneCore
@ -591,7 +647,11 @@ typedef void (*LinphoneCoreGlobalStateChangedCb)(LinphoneCore *lc, LinphoneGloba
* @param cstate the new state of the call
* @param message a non NULL informational message about the state.
*/
typedef void (*LinphoneCoreCallStateChangedCb)(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cstate, const char *message);
typedef void (*LinphoneCoreCbsCallStateChangedCb)(LinphoneCore *lc, LinphoneCall *call, LinphoneCallState cstate, const char *message);
/**
* Old name of #LinphoneCoreCbsCallStateChangedCb.
*/
typedef LinphoneCoreCbsCallStateChangedCb LinphoneCoreCallStateChangedCb;
/**
* Call encryption changed callback.
@ -600,12 +660,21 @@ typedef void (*LinphoneCoreCallStateChangedCb)(LinphoneCore *lc, LinphoneCall *c
* @param on whether encryption is activated.
* @param authentication_token an authentication_token, currently set for ZRTP kind of encryption only.
*/
typedef void (*LinphoneCoreCallEncryptionChangedCb)(LinphoneCore *lc, LinphoneCall *call, bool_t on, const char *authentication_token);
typedef void (*LinphoneCoreCbsCallEncryptionChangedCb)(LinphoneCore *lc, LinphoneCall *call, bool_t on, const char *authentication_token);
/**
* Old name of #LinphoneCoreCbsCallEncryptionChangedCb.
*/
typedef LinphoneCoreCbsCallEncryptionChangedCb LinphoneCoreCallEncryptionChangedCb;
/** @ingroup Proxies
* Registration state notification callback prototype
* */
typedef void (*LinphoneCoreRegistrationStateChangedCb)(LinphoneCore *lc, LinphoneProxyConfig *cfg, LinphoneRegistrationState cstate, const char *message) ;
typedef void (*LinphoneCoreCbsRegistrationStateChangedCb)(LinphoneCore *lc, LinphoneProxyConfig *cfg, LinphoneRegistrationState cstate, const char *message) ;
/**
* Old name of #LinphoneCoreCbsRegistrationStateChangedCb.
*/
typedef LinphoneCoreCbsRegistrationStateChangedCb LinphoneCoreRegistrationStateChangedCb;
/** Callback prototype
* @deprecated
*/
@ -630,7 +699,11 @@ typedef void (*LinphoneCoreCbFunc)(LinphoneCore *lc,void * user_data);
* @param lc #LinphoneCore object .
* @param lf Updated #LinphoneFriend .
*/
typedef void (*LinphoneCoreNotifyPresenceReceivedCb)(LinphoneCore *lc, LinphoneFriend * lf);
typedef void (*LinphoneCoreCbsNotifyPresenceReceivedCb)(LinphoneCore *lc, LinphoneFriend * lf);
/**
* Old name of #LinphoneCoreCbsNotifyPresenceReceivedCb.
*/
typedef LinphoneCoreCbsNotifyPresenceReceivedCb LinphoneCoreNotifyPresenceReceivedCb;
/**
* Reports presence model change for a specific URI or phone number of a friend
* @param lc #LinphoneCore object
@ -638,7 +711,11 @@ typedef void (*LinphoneCoreNotifyPresenceReceivedCb)(LinphoneCore *lc, LinphoneF
* @param uri_or_tel The URI or phone number for which teh presence model has changed
* @param presence_model The new presence model
*/
typedef void (*LinphoneCoreNotifyPresenceReceivedForUriOrTelCb)(LinphoneCore *lc, LinphoneFriend *lf, const char *uri_or_tel, const LinphonePresenceModel *presence_model);
typedef void (*LinphoneCoreCbsNotifyPresenceReceivedForUriOrTelCb)(LinphoneCore *lc, LinphoneFriend *lf, const char *uri_or_tel, const LinphonePresenceModel *presence_model);
/**
* Old name of #LinphoneCoreCbsNotifyPresenceReceivedForUriOrTelCb.
*/
typedef LinphoneCoreCbsNotifyPresenceReceivedForUriOrTelCb LinphoneCoreNotifyPresenceReceivedForUriOrTelCb;
/**
* Reports that a new subscription request has been received and wait for a decision.
* Status on this subscription request is notified by \link linphone_friend_set_inc_subscribe_policy() changing policy \endlink for this friend
@ -647,7 +724,11 @@ typedef void (*LinphoneCoreNotifyPresenceReceivedForUriOrTelCb)(LinphoneCore *lc
* @param url of the subscriber
* Callback prototype
*/
typedef void (*LinphoneCoreNewSubscriptionRequestedCb)(LinphoneCore *lc, LinphoneFriend *lf, const char *url);
typedef void (*LinphoneCoreCbsNewSubscriptionRequestedCb)(LinphoneCore *lc, LinphoneFriend *lf, const char *url);
/**
* Old name of #LinphoneCoreCbsNewSubscriptionRequestedCb.
*/
typedef LinphoneCoreCbsNewSubscriptionRequestedCb LinphoneCoreNewSubscriptionRequestedCb;
/**
* Callback for requesting authentication information to application or user.
* @param lc the LinphoneCore
@ -665,7 +746,11 @@ typedef void (*LinphoneCoreAuthInfoRequestedCb)(LinphoneCore *lc, const char *re
* @param method the type of authentication requested
* Application shall reply to this callback using linphone_core_add_auth_info().
*/
typedef void (*LinphoneCoreAuthenticationRequestedCb)(LinphoneCore *lc, LinphoneAuthInfo *auth_info, LinphoneAuthMethod method);
typedef void (*LinphoneCoreCbsAuthenticationRequestedCb)(LinphoneCore *lc, LinphoneAuthInfo *auth_info, LinphoneAuthMethod method);
/**
* Old name of #LinphoneCoreCbsAuthenticationRequestedCb.
*/
typedef LinphoneCoreCbsAuthenticationRequestedCb LinphoneCoreAuthenticationRequestedCb;
/**
* Callback to notify a new call-log entry has been added.
@ -673,7 +758,11 @@ typedef void (*LinphoneCoreAuthenticationRequestedCb)(LinphoneCore *lc, Linphone
* @param lc the LinphoneCore
* @param newcl the new call log entry added.
*/
typedef void (*LinphoneCoreCallLogUpdatedCb)(LinphoneCore *lc, LinphoneCallLog *newcl);
typedef void (*LinphoneCoreCbsCallLogUpdatedCb)(LinphoneCore *lc, LinphoneCallLog *newcl);
/**
* Old name of #LinphoneCoreCbsCallLogUpdatedCb.
*/
typedef LinphoneCoreCbsCallLogUpdatedCb LinphoneCoreCallLogUpdatedCb;
/**
* Callback prototype
@ -693,7 +782,11 @@ typedef void (*LinphoneCoreTextMessageReceivedCb)(LinphoneCore *lc, LinphoneChat
* @param room #LinphoneChatRoom involved in this conversation. Can be be created by the framework in case \link #LinphoneAddress the from \endlink is not present in any chat room.
* @param LinphoneChatMessage incoming message
*/
typedef void (*LinphoneCoreMessageReceivedCb)(LinphoneCore *lc, LinphoneChatRoom *room, LinphoneChatMessage *message);
typedef void (*LinphoneCoreCbsMessageReceivedCb)(LinphoneCore *lc, LinphoneChatRoom *room, LinphoneChatMessage *message);
/**
* Old name of #LinphoneCoreCbsMessageReceivedCb.
*/
typedef LinphoneCoreCbsMessageReceivedCb LinphoneCoreMessageReceivedCb;
/**
* File transfer receive callback prototype. This function is called by the core upon an incoming File transfer is started. This function may be call several time for the same file in case of large file.
@ -738,7 +831,11 @@ typedef void (*LinphoneCoreFileTransferProgressIndicationCb)(LinphoneCore *lc, L
* @param[in] lc #LinphoneCore object
* @param[in] room #LinphoneChatRoom involved in the conversation.
*/
typedef void (*LinphoneCoreIsComposingReceivedCb)(LinphoneCore *lc, LinphoneChatRoom *room);
typedef void (*LinphoneCoreCbsIsComposingReceivedCb)(LinphoneCore *lc, LinphoneChatRoom *room);
/**
* Old name of #LinphoneCoreCbsIsComposingReceivedCb.
*/
typedef LinphoneCoreCbsIsComposingReceivedCb LinphoneCoreIsComposingReceivedCb;
/**
* Callback for being notified of DTMFs received.
@ -746,19 +843,35 @@ typedef void (*LinphoneCoreIsComposingReceivedCb)(LinphoneCore *lc, LinphoneChat
* @param call the call that received the dtmf
* @param dtmf the ascii code of the dtmf
*/
typedef void (*LinphoneCoreDtmfReceivedCb)(LinphoneCore* lc, LinphoneCall *call, int dtmf);
typedef void (*LinphoneCoreCbsDtmfReceivedCb)(LinphoneCore* lc, LinphoneCall *call, int dtmf);
/**
* Old name of #LinphoneCoreCbsDtmfReceivedCb.
*/
typedef LinphoneCoreCbsDtmfReceivedCb LinphoneCoreDtmfReceivedCb;
/** Callback prototype */
typedef void (*LinphoneCoreReferReceivedCb)(LinphoneCore *lc, const char *refer_to);
typedef void (*LinphoneCoreCbsReferReceivedCb)(LinphoneCore *lc, const char *refer_to);
/**
* Old name of #LinphoneCoreCbsReferReceivedCb.
*/
typedef LinphoneCoreCbsReferReceivedCb LinphoneCoreReferReceivedCb;
/** Callback prototype */
typedef void (*LinphoneCoreBuddyInfoUpdatedCb)(LinphoneCore *lc, LinphoneFriend *lf);
typedef void (*LinphoneCoreCbsBuddyInfoUpdatedCb)(LinphoneCore *lc, LinphoneFriend *lf);
/**
* Old name of #LinphoneCoreCbsBuddyInfoUpdatedCb.
*/
typedef LinphoneCoreCbsBuddyInfoUpdatedCb LinphoneCoreBuddyInfoUpdatedCb;
/**
* Callback for notifying progresses of transfers.
* @param lc the LinphoneCore
* @param transfered the call that was transfered
* @param new_call_state the state of the call to transfer target at the far end.
*/
typedef void (*LinphoneCoreTransferStateChangedCb)(LinphoneCore *lc, LinphoneCall *transfered, LinphoneCallState new_call_state);
typedef void (*LinphoneCoreCbsTransferStateChangedCb)(LinphoneCore *lc, LinphoneCall *transfered, LinphoneCallState new_call_state);
/**
* Old name of LinphoneCoreCbsTransferStateChangedCb.
*/
typedef LinphoneCoreCbsTransferStateChangedCb LinphoneCoreTransferStateChangedCb;
/**
* Callback for receiving quality statistics for calls.
@ -766,7 +879,11 @@ typedef void (*LinphoneCoreTransferStateChangedCb)(LinphoneCore *lc, LinphoneCal
* @param call the call
* @param stats the call statistics.
*/
typedef void (*LinphoneCoreCallStatsUpdatedCb)(LinphoneCore *lc, LinphoneCall *call, const LinphoneCallStats *stats);
typedef void (*LinphoneCoreCbsCallStatsUpdatedCb)(LinphoneCore *lc, LinphoneCall *call, const LinphoneCallStats *stats);
/**
* Old name of #LinphoneCoreCbsCallStatsUpdatedCb.
*/
typedef LinphoneCoreCbsCallStatsUpdatedCb LinphoneCoreCallStatsUpdatedCb;
/**
* Callback prototype for receiving info messages.
@ -774,7 +891,11 @@ typedef void (*LinphoneCoreCallStatsUpdatedCb)(LinphoneCore *lc, LinphoneCall *c
* @param call the call whose info message belongs to.
* @param msg the info message.
*/
typedef void (*LinphoneCoreInfoReceivedCb)(LinphoneCore *lc, LinphoneCall *call, const LinphoneInfoMessage *msg);
typedef void (*LinphoneCoreCbsInfoReceivedCb)(LinphoneCore *lc, LinphoneCall *call, const LinphoneInfoMessage *msg);
/**
* Old name of #LinphoneCoreCbsInfoReceivedCb.
*/
typedef LinphoneCoreCbsInfoReceivedCb LinphoneCoreInfoReceivedCb;
/**
* LinphoneGlobalState describes the global state of the LinphoneCore object.
@ -797,14 +918,22 @@ LINPHONE_PUBLIC const char *linphone_configuring_state_to_string(LinphoneConfigu
* @param lc the LinphoneCore
* @param message informational message.
*/
typedef void (*LinphoneCoreConfiguringStatusCb)(LinphoneCore *lc, LinphoneConfiguringState status, const char *message);
typedef void (*LinphoneCoreCbsConfiguringStatusCb)(LinphoneCore *lc, LinphoneConfiguringState status, const char *message);
/**
* Old name of #LinphoneCoreCbsConfiguringStatusCb.
*/
typedef LinphoneCoreCbsConfiguringStatusCb LinphoneCoreConfiguringStatusCb;
/**
* Callback prototype for reporting network change either automatically detected or notified by #linphone_core_set_network_reachable.
* @param lc the LinphoneCore
* @param reachable true if network is reachable.
*/
typedef void (*LinphoneCoreNetworkReachableCb)(LinphoneCore *lc, bool_t reachable);
typedef void (*LinphoneCoreCbsNetworkReachableCb)(LinphoneCore *lc, bool_t reachable);
/**
* Old name of #LinphoneCoreCbsNetworkReachableCb.
*/
typedef LinphoneCoreCbsNetworkReachableCb LinphoneCoreNetworkReachableCb;
/**
* Callback prototype for reporting log collection upload state change.
@ -812,28 +941,43 @@ typedef void (*LinphoneCoreNetworkReachableCb)(LinphoneCore *lc, bool_t reachabl
* @param[in] state The state of the log collection upload
* @param[in] info Additional information: error message in case of error state, URL of uploaded file in case of success.
*/
typedef void (*LinphoneCoreLogCollectionUploadStateChangedCb)(LinphoneCore *lc, LinphoneCoreLogCollectionUploadState state, const char *info);
typedef void (*LinphoneCoreCbsLogCollectionUploadStateChangedCb)(LinphoneCore *lc, LinphoneCoreLogCollectionUploadState state, const char *info);
/**
* Old name of #LinphoneCoreCbsLogCollectionUploadStateChangedCb.
*/
typedef LinphoneCoreCbsLogCollectionUploadStateChangedCb LinphoneCoreLogCollectionUploadStateChangedCb;
/**
* Callback prototype for reporting log collection upload progress indication.
* @param[in] lc LinphoneCore object
* @param[in] progress Percentage of the file size of the log collection already uploaded.
*/
typedef void (*LinphoneCoreLogCollectionUploadProgressIndicationCb)(LinphoneCore *lc, size_t offset, size_t total);
typedef void (*LinphoneCoreCbsLogCollectionUploadProgressIndicationCb)(LinphoneCore *lc, size_t offset, size_t total);
/**
* Old name of #LinphoneCoreCbsLogCollectionUploadProgressIndicationCb.
*/
typedef LinphoneCoreCbsLogCollectionUploadProgressIndicationCb LinphoneCoreLogCollectionUploadProgressIndicationCb;
/**
* Callback prototype for reporting when a friend list has been added to the core friends list.
* @param[in] lc LinphoneCore object
* @param[in] list LinphoneFriendList object
*/
typedef void (*LinphoneCoreFriendListCreatedCb) (LinphoneCore *lc, LinphoneFriendList *list);
typedef void (*LinphoneCoreCbsFriendListCreatedCb) (LinphoneCore *lc, LinphoneFriendList *list);
/**
* Old name of #LinphoneCoreCbsFriendListCreatedCb.
*/
typedef LinphoneCoreCbsFriendListCreatedCb LinphoneCoreFriendListCreatedCb;
/**
* Callback prototype for reporting when a friend list has been removed from the core friends list.
* @param[in] lc LinphoneCore object
* @param[in] list LinphoneFriendList object
*/
typedef void (*LinphoneCoreFriendListRemovedCb) (LinphoneCore *lc, LinphoneFriendList *list);
typedef void (*LinphoneCoreCbsFriendListRemovedCb) (LinphoneCore *lc, LinphoneFriendList *list);
/**
* Old name of #LinphoneCoreCbsFriendListRemovedCb.
*/
typedef LinphoneCoreCbsFriendListRemovedCb LinphoneCoreFriendListRemovedCb;
/**
* This structure holds all callbacks that the application should implement.
@ -913,6 +1057,221 @@ LINPHONE_PUBLIC LinphoneCoreVTable *linphone_core_get_current_vtable(LinphoneCor
*/
LINPHONE_PUBLIC void linphone_core_v_table_destroy(LinphoneCoreVTable* table);
/**
* That class holds all the callbacks which are called by #LinphoneCore.
*
* Use linphone_factory_create_core_cbs() to create an instance. Then, call the
* callback setters on the events you need to monitor and pass the object to
* a #LinphoneCore instance through linphone_core_add_listener().
*
* That class is inherited from #belle_sip_object_t.
*/
typedef struct _LinphoneCoreCbs LinphoneCoreCbs;
/**
* Increment the reference counter.
*/
LINPHONE_PUBLIC LinphoneCoreCbs *linphone_core_cbs_ref(LinphoneCoreCbs *cbs);
/**
* Decrement the reference counter.
*/
LINPHONE_PUBLIC void linphone_core_cbs_unref(LinphoneCoreCbs *cbs);
/**
* Set private data to be get from each callbacks.
*/
LINPHONE_PUBLIC void linphone_core_cbs_set_user_data(LinphoneCoreCbs *cbs, void *user_data);
/**
* Get the user pointer.
*/
LINPHONE_PUBLIC void *linphone_core_cbs_get_user_data(LinphoneCoreCbs *cbs);
/**
* Gets the current #LinphoneCoreCbs.
* This is meant only to be called from a callback to be able to get the user_data associated with the #LinphoneCoreCbs that is calling the callback.
* @param lc the linphonecore
* @return the #LinphoneCoreCbs that has called the last callback
*/
LINPHONE_PUBLIC LinphoneCoreCbs *linphone_core_get_current_callbacks(const LinphoneCore *lc);
/**
* Set the #LinphoneCoreCbsRegistrationStateChangedCb callback.
* @param[in] cbs A #LinphoneCoreCbs.
* @param[in] cb The callback.
*/
LINPHONE_PUBLIC void linphone_core_cbs_set_registration_state_changed(LinphoneCoreCbs *cbs, LinphoneCoreCbsRegistrationStateChangedCb cb);
/**
* Set the #LinphoneCoreCbsCallStateChangedCb callback.
* @param[in] cbs A #LinphoneCoreCbs.
* @param[in] cb The callback.
*/
LINPHONE_PUBLIC void linphone_core_cbs_set_call_state_changed(LinphoneCoreCbs *cbs, LinphoneCoreCbsCallStateChangedCb cb);
/**
* Set the #LinphoneCoreCbsNotifyPresenceReceivedCb callback.
* @param[in] cbs A #LinphoneCoreCbs.
* @param[in] cb The callback.
*/
LINPHONE_PUBLIC void linphone_core_cbs_set_notify_presence_received(LinphoneCoreCbs *cbs, LinphoneCoreCbsNotifyPresenceReceivedCb cb);
/**
* Set the #LinphoneCoreCbsNotifyPresenceReceivedForUriOrTelCb callback.
* @param[in] cbs A #LinphoneCoreCbs.
* @param[in] cb The callback.
*/
LINPHONE_PUBLIC void linphone_core_cbs_set_notify_presence_received_for_uri_or_tel(LinphoneCoreCbs *cbs, LinphoneCoreCbsNotifyPresenceReceivedForUriOrTelCb cb);
/**
* Set the #LinphoneCoreCbsNewSubscriptionRequestedCb callback.
* @param[in] cbs A #LinphoneCoreCbs.
* @param[in] cb The callback.
*/
LINPHONE_PUBLIC void linphone_core_cbs_set_new_subscription_requested(LinphoneCoreCbs *cbs, LinphoneCoreCbsNewSubscriptionRequestedCb cb);
/**
* Set the #LinphoneCoreCbsAuthenticationRequestedCb callback.'
* @param[in] cbs A #LinphoneCoreCbs.
* @param[in] cb The callback.
*/
LINPHONE_PUBLIC void linphone_core_cbs_set_authentication_requested(LinphoneCoreCbs *cbs, LinphoneCoreCbsAuthenticationRequestedCb cb);
/**
* Set the #LinphoneCoreCbsCallLogUpdatedCb callback.
* @param[in] cbs A #LinphoneCoreCbs.
* @param[in] cb The callback.
*/
LINPHONE_PUBLIC void linphone_core_cbs_set_call_log_updated(LinphoneCoreCbs *cbs, LinphoneCoreCbsCallLogUpdatedCb cb);
/**
* Set the #LinphoneCoreCbsMessageReceivedCb callback.
* @param[in] cbs A #LinphoneCoreCbs.
* @param[in] cb The callback.
*/
LINPHONE_PUBLIC void linphone_core_cbs_set_message_received(LinphoneCoreCbs *cbs, LinphoneCoreCbsMessageReceivedCb cb);
/**
* Set the #LinphoneCoreCbsIsComposingReceivedCb callback.
* @param[in] cbs A #LinphoneCoreCbs.
* @param[in] cb The callback.
*/
LINPHONE_PUBLIC void linphone_core_cbs_set_is_composing_received(LinphoneCoreCbs *cbs, LinphoneCoreCbsIsComposingReceivedCb cb);
/**
* Set the #LinphoneCoreCbsDtmfReceivedCb callback.
* @param[in] cbs A #LinphoneCoreCbs.
* @param[in] cb The callback.
*/
LINPHONE_PUBLIC void linphone_core_cbs_set_dtmf_received(LinphoneCoreCbs *cbs, LinphoneCoreCbsDtmfReceivedCb cb);
/**
* Set the #LinphoneCoreCbsReferReceivedCb callback.
* @param[in] cbs A #LinphoneCoreCbs.
* @param[in] cb The callback.
*/
LINPHONE_PUBLIC void linphone_core_cbs_set_refer_received(LinphoneCoreCbs *cbs, LinphoneCoreCbsReferReceivedCb cb);
/**
* Set the #LinphoneCoreCbsCallEncryptionChangedCb callback.
* @param[in] cbs A #LinphoneCoreCbs.
* @param[in] cb The callback.
*/
LINPHONE_PUBLIC void linphone_core_cbs_set_call_encryption_changed(LinphoneCoreCbs *cbs, LinphoneCoreCbsCallEncryptionChangedCb cb);
/**
* Set the #LinphoneCoreCbsTransferStateChangedCb callback.
* @param[in] cbs A #LinphoneCoreCbs.
* @param[in] cb The callback.
*/
LINPHONE_PUBLIC void linphone_core_cbs_set_transfer_state_changed(LinphoneCoreCbs *cbs, LinphoneCoreCbsTransferStateChangedCb cb);
/**
* Set the #LinphoneCoreCbsBuddyInfoUpdatedCb callback.
* @param[in] cbs A #LinphoneCoreCbs.
* @param[in] cb The callback.
*/
LINPHONE_PUBLIC void linphone_core_cbs_set_buddy_info_updated(LinphoneCoreCbs *cbs, LinphoneCoreCbsBuddyInfoUpdatedCb cb);
/**
* Set the #LinphoneCoreCbsCallStatsUpdatedCb callback.
* @param[in] cbs A #LinphoneCoreCbs.
* @param[in] cb The callback.
*/
LINPHONE_PUBLIC void linphone_core_cbs_set_call_stats_updated(LinphoneCoreCbs *cbs, LinphoneCoreCbsCallStatsUpdatedCb cb);
/**
* Set the #LinphoneCoreCbsInfoReceivedCb callback.
* @param[in] cbs A #LinphoneCoreCbs.
* @param[in] cb The callback.
*/
LINPHONE_PUBLIC void linphone_core_cbs_set_info_received(LinphoneCoreCbs *cbs, LinphoneCoreCbsInfoReceivedCb cb);
/**
* Set the #LinphoneCoreCbsSubscriptionStateChangedCb callback.
* @param[in] cbs A #LinphoneCoreCbs.
* @param[in] cb The callback.
*/
LINPHONE_PUBLIC void linphone_core_cbs_set_subscription_state_changed(LinphoneCoreCbs *cbs, LinphoneCoreCbsSubscriptionStateChangedCb cb);
/**
* Set the #LinphoneCoreCbsNotifyReceivedCb callback.
* @param[in] cbs A #LinphoneCoreCbs.
* @param[in] cb The callback.
*/
LINPHONE_PUBLIC void linphone_core_cbs_set_notify_received(LinphoneCoreCbs *cbs, LinphoneCoreCbsNotifyReceivedCb cb);
/**
* Set the #LinphoneCoreCbsPublishStateChangedCb callback.
* @param[in] cbs A #LinphoneCoreCbs.
* @param[in] cb The callback.
*/
LINPHONE_PUBLIC void linphone_core_cbs_set_publish_state_changed(LinphoneCoreCbs *cbs, LinphoneCoreCbsPublishStateChangedCb cb);
/**
* Set the #LinphoneCoreCbsConfiguringStatusCb callback.
* @param[in] cbs A #LinphoneCoreCbs.
* @param[in] cb The callback.
*/
LINPHONE_PUBLIC void linphone_core_cbs_set_configuring_status(LinphoneCoreCbs *cbs, LinphoneCoreCbsConfiguringStatusCb cb);
/**
* Set the #LinphoneCoreCbsNetworkReachableCb callback.
* @param[in] cbs A #LinphoneCoreCbs.
* @param[in] cb The callback.
*/
LINPHONE_PUBLIC void linphone_core_cbs_set_network_reachable(LinphoneCoreCbs *cbs, LinphoneCoreCbsNetworkReachableCb cb);
/**
* Set the #LinphoneCoreCbsLogCollectionUploadStateChangedCb callback.
* @param[in] cbs A #LinphoneCoreCbs.
* @param[in] cb The callback.
*/
LINPHONE_PUBLIC void linphone_core_cbs_set_log_collection_upload_state_changed(LinphoneCoreCbs *cbs, LinphoneCoreCbsLogCollectionUploadStateChangedCb cb);
/**
* Set the #LinphoneCoreCbsLogCollectionUploadProgressIndicationCb callback.
* @param[in] cbs A #LinphoneCoreCbs.
* @param[in] cb The callback.
*/
LINPHONE_PUBLIC void linphone_core_cbs_set_log_collection_upload_progress_indication(LinphoneCoreCbs *cbs, LinphoneCoreCbsLogCollectionUploadProgressIndicationCb cb);
/**
* Set the #LinphoneCoreCbsFriendListCreatedCb callback.
* @param[in] cbs A #LinphoneCoreCbs.
* @param[in] cb The callback.
*/
LINPHONE_PUBLIC void linphone_core_cbs_set_friend_list_created(LinphoneCoreCbs *cbs, LinphoneCoreCbsFriendListCreatedCb cb);
/**
* Set the #LinphoneCoreCbsFriendListRemovedCb callback.
* @param[in] cbs A #LinphoneCoreCbs.
* @param[in] cb The callback.
*/
LINPHONE_PUBLIC void linphone_core_cbs_set_friend_list_removed(LinphoneCoreCbs *cbs, LinphoneCoreCbsFriendListRemovedCb cb);
/**
* @}
**/
@ -927,7 +1286,7 @@ typedef struct _LCCallbackObj
/**
* Policy to use to pass through firewalls.
* @ingroup network_parameters
* @deprecated Use LinphoneNatPolicy instead
* @deprecated Use #LinphoneNatPolicy instead.
**/
typedef enum _LinphoneFirewallPolicy {
LinphonePolicyNoFirewall, /**< Do not use any mechanism to pass through firewalls */
@ -1075,7 +1434,7 @@ LINPHONE_PUBLIC void linphone_core_set_log_level_mask(unsigned int loglevel);
* @param file a C FILE* where to fprintf logs. If null stdout is used.
*
**/
LINPHONE_PUBLIC void linphone_core_enable_logs(FILE *file);
LINPHONE_DEPRECATED LINPHONE_PUBLIC void linphone_core_enable_logs(FILE *file);
/**
* Enable logs through the user's supplied log callback.
@ -1086,14 +1445,14 @@ LINPHONE_PUBLIC void linphone_core_enable_logs(FILE *file);
* typedef void (*OrtpLogFunc)(OrtpLogLevel lev, const char *fmt, va_list args);
*
**/
LINPHONE_PUBLIC void linphone_core_enable_logs_with_cb(OrtpLogFunc logfunc);
LINPHONE_DEPRECATED LINPHONE_PUBLIC void linphone_core_enable_logs_with_cb(OrtpLogFunc logfunc);
/**
* Entirely disable logging.
*
* @deprecated Use #linphone_core_set_log_level instead.
**/
LINPHONE_PUBLIC void linphone_core_disable_logs(void);
LINPHONE_DEPRECATED LINPHONE_PUBLIC void linphone_core_disable_logs(void);
/**
* Enable logs serialization (output logs from either the thread that creates the linphone core or the thread that calls linphone_core_iterate()).
@ -1141,8 +1500,9 @@ LINPHONE_PUBLIC LINPHONE_DEPRECATED const char *linphone_core_get_user_agent_ver
* @param userdata an opaque user pointer that can be retrieved at any time (for example in
* callbacks) using linphone_core_get_user_data().
* @see linphone_core_new_with_config
* @deprecated Use linphone_factory_create_core() instead.
**/
LINPHONE_PUBLIC LinphoneCore *linphone_core_new(const LinphoneCoreVTable *vtable,
LINPHONE_DEPRECATED LINPHONE_PUBLIC LinphoneCore *linphone_core_new(const LinphoneCoreVTable *vtable,
const char *config_path, const char *factory_config_path, void* userdata);
/**
@ -1156,8 +1516,25 @@ LINPHONE_PUBLIC LinphoneCore *linphone_core_new(const LinphoneCoreVTable *vtable
* @param userdata an opaque user pointer that can be retrieved at any time (for example in
* callbacks) using linphone_core_get_user_data().
* @see linphone_core_new
* @deprecated Use linphone_factory_create_core_with_config() instead.
**/
LINPHONE_PUBLIC LinphoneCore *linphone_core_new_with_config(const LinphoneCoreVTable *vtable, LpConfig *config, void *userdata);
LINPHONE_DEPRECATED LINPHONE_PUBLIC LinphoneCore *linphone_core_new_with_config(const LinphoneCoreVTable *vtable, LpConfig *config, void *userdata);
/**
* Increment the reference counter of a #LinphoneCore object.
* @param lc The #LinphoneCore which the ref counter is to be incremented.
* @return A pointer on the #LinphoneCore passed as parameter.
* @ingroup initializing
*/
LINPHONE_PUBLIC LinphoneCore *linphone_core_ref(LinphoneCore *lc);
/**
* Decrement the ref counter of a #LinphoneCore object and destroy it
* if the counter reach 0.
* @param lc The #LinphoneCore which the reference counter is to be decreased.
* @ingroup initializing
*/
LINPHONE_PUBLIC void linphone_core_unref(LinphoneCore *lc);
/**
* Main loop function. It is crucial that your application call it periodically.
@ -1182,17 +1559,32 @@ LINPHONE_PUBLIC void linphone_core_iterate(LinphoneCore *lc);
* add a listener to be notified of linphone core events. Once events are received, registered vtable are invoked in order.
* @param vtable a LinphoneCoreVTable structure holding your application callbacks. Object is owned by linphone core until linphone_core_remove_listener.
* @param lc object
*
* @deprecated Use linphone_core_add_callbacks() instead.
*/
LINPHONE_PUBLIC void linphone_core_add_listener(LinphoneCore *lc, LinphoneCoreVTable *vtable);
LINPHONE_DEPRECATED LINPHONE_PUBLIC void linphone_core_add_listener(LinphoneCore *lc, LinphoneCoreVTable *vtable);
/**
* @ingroup initializing
* Add a listener in order to be notified of #LinphoneCore events. Once an event is received, registred #LinphoneCoreCbs are sequencially
* invoked in order.
* @param lc The #LinphoneCore object to monitor.
* @param cbs A #LinphoneCoreCbs object holding the callbakcs you need. A reference is take by #LinphoneCore until you invoke linphone_core_remove_cbs().
*/
LINPHONE_PUBLIC void linphone_core_add_callbacks(LinphoneCore *lc, LinphoneCoreCbs *cbs);
/**
* @ingroup initializing
* remove a listener registred by linphone_core_add_listener.
* @param lc object
* @param vtable a LinphoneCoreVTable structure holding your application callbacks
*
* @param vtable a LinphoneCoreVTable structure holding your application callbacks.
* @deprecated Use linphone_core_remove_callbacks() instead.
*/
LINPHONE_PUBLIC void linphone_core_remove_listener(LinphoneCore *lc, const LinphoneCoreVTable *vtable);
LINPHONE_DEPRECATED LINPHONE_PUBLIC void linphone_core_remove_listener(LinphoneCore *lc, const LinphoneCoreVTable *vtable);
/**
* @ingroup initializing
* Remove a listener from a #LinphoneCore
* @param lc The #LinphoneCore
* @param cbs The pointer on the #LinphoneCoreCbs to remove.
*/
LINPHONE_PUBLIC void linphone_core_remove_callbacks(LinphoneCore *lc, const LinphoneCoreCbs *cbs);
/**
* Sets the user agent string used in SIP messages, ideally called just after linphone_core_new() or linphone_core_init().
@ -1203,8 +1595,11 @@ LINPHONE_PUBLIC void linphone_core_remove_listener(LinphoneCore *lc, const Linph
**/
LINPHONE_PUBLIC void linphone_core_set_user_agent(LinphoneCore *lc, const char *ua_name, const char *version);
/** See linphone_proxy_config_normalize_sip_uri for documentation. Default proxy config is used to parse
the address. */
/**
* See linphone_proxy_config_normalize_sip_uri for documentation. Default proxy config is used to parse
* the address.
* @ingroup misc
*/
LINPHONE_PUBLIC LinphoneAddress * linphone_core_interpret_url(LinphoneCore *lc, const char *url);
/**
@ -1967,6 +2362,10 @@ LINPHONE_PUBLIC void linphone_core_set_payload_type_number(LinphoneCore *lc, Pay
LINPHONE_PUBLIC const char *linphone_core_get_payload_type_description(LinphoneCore *lc, PayloadType *pt);
/**
* Return TRUE if codec can be used with bandwidth, FALSE else
* @ingroup media_parameters
*/
LINPHONE_PUBLIC bool_t linphone_core_check_payload_type_usability(LinphoneCore *lc, const PayloadType *pt);
/**
@ -2091,9 +2490,17 @@ LINPHONE_PUBLIC const bctbx_list_t *linphone_core_get_auth_info_list(const Linph
**/
LINPHONE_PUBLIC const LinphoneAuthInfo *linphone_core_find_auth_info(LinphoneCore *lc, const char *realm, const char *username, const char *sip_domain);
/**
* This method is used to abort a user authentication request initiated by LinphoneCore
* from the auth_info_requested callback of LinphoneCoreVTable.
* @note That function does nothing for now.
**/
LINPHONE_PUBLIC void linphone_core_abort_authentication(LinphoneCore *lc, LinphoneAuthInfo *info);
LINPHONE_PUBLIC void linphone_core_clear_all_auth_info(LinphoneCore *lc);
/**
* Clear all authentication information.
**/
LINPHONE_PUBLIC void linphone_core_clear_all_auth_info(LinphoneCore *lc);
/**
* Enable or disable the audio adaptive jitter compensation.
@ -2357,21 +2764,21 @@ LINPHONE_PUBLIC int linphone_core_set_sip_transports(LinphoneCore *lc, const LCS
* A zero value port for a given transport means the transport
* is not used. A value of LC_SIP_TRANSPORT_RANDOM (-1) means the port is to be chosen randomly by the system.
* @param[in] lc LinphoneCore object
* @param[out] transports A LCSipTransports structure that will receive the configured ports
* @param[out] transports A #LinphoneSipTransports structure that will receive the configured ports
* @return 0
* @ingroup network_parameters
**/
LINPHONE_PUBLIC int linphone_core_get_sip_transports(LinphoneCore *lc, LCSipTransports *transports);
LINPHONE_PUBLIC int linphone_core_get_sip_transports(LinphoneCore *lc, LinphoneSipTransports *transports);
/**
* Retrieves the real port number assigned for each sip transport (udp, tcp, tls).
* A zero value means that the transport is not activated.
* If LC_SIP_TRANSPORT_RANDOM was passed to linphone_core_set_sip_transports(), the random port choosed by the system is returned.
* @param[in] lc LinphoneCore object
* @param[out] transports A LCSipTransports structure that will receive the ports being used
* @param[out] transports A #LinphoneSipTransports structure that will receive the ports being used
* @ingroup network_parameters
**/
LINPHONE_PUBLIC void linphone_core_get_sip_transports_used(LinphoneCore *lc, LCSipTransports *tr);
LINPHONE_PUBLIC void linphone_core_get_sip_transports_used(LinphoneCore *lc, LinphoneSipTransports *tr);
/**
* Tells whether the given transport type is supported by the library.
@ -2514,7 +2921,7 @@ LINPHONE_PUBLIC const char *linphone_core_get_nat_address(const LinphoneCore *lc
* @ingroup network_parameters
* @deprecated Use linphone_core_set_nat_policy() instead.
*/
LINPHONE_PUBLIC void linphone_core_set_firewall_policy(LinphoneCore *lc, LinphoneFirewallPolicy pol);
LINPHONE_DEPRECATED LINPHONE_PUBLIC void linphone_core_set_firewall_policy(LinphoneCore *lc, LinphoneFirewallPolicy pol);
/**
* Get the policy that is used to pass through firewalls.
@ -2523,7 +2930,7 @@ LINPHONE_PUBLIC void linphone_core_set_firewall_policy(LinphoneCore *lc, Linphon
* @ingroup network_parameters
* @deprecated Use linphone_core_get_nat_policy() instead.
*/
LINPHONE_PUBLIC LinphoneFirewallPolicy linphone_core_get_firewall_policy(const LinphoneCore *lc);
LINPHONE_DEPRECATED LINPHONE_PUBLIC LinphoneFirewallPolicy linphone_core_get_firewall_policy(const LinphoneCore *lc);
/**
* Set the policy to use to pass through NATs/firewalls.
@ -2781,9 +3188,9 @@ LINPHONE_PUBLIC void linphone_core_set_root_ca_data(LinphoneCore *lc, const char
/**
* @internal
* Set the pointer to an externally provided ssl configuration for the crypto library
* @param lc #LinphoneCore object
* @param[in] ssl_config A pointer to an opaque structure which will be provided directly to the crypto library used in bctoolbox. Use with extra care.
* This ssl_config structure is responsability of the caller and will not be freed at the connection's end.
* @param lc #LinphoneCore object
* @param[in] ssl_config A pointer to an opaque structure which will be provided directly to the crypto library used in bctoolbox. Use with extra care.
* This ssl_config structure is responsability of the caller and will not be freed at the connection's end.
* @ingroup initializing
* @endinternal
*/
@ -2920,6 +3327,13 @@ LINPHONE_PUBLIC void linphone_core_enable_mic(LinphoneCore *lc, bool_t enable);
**/
LINPHONE_PUBLIC bool_t linphone_core_mic_enabled(LinphoneCore *lc);
/**
* Returns the RTP transmission status for an active stream.
* If audio is muted and config parameter rtp_no_xmit_on_audio_mute
* has been set on then the RTP transmission is also muted.
* @param lc The #LinphoneCore.
* @return TRUE if the RTP transmisison is muted.
*/
LINPHONE_PUBLIC bool_t linphone_core_is_rtp_muted(LinphoneCore *lc);
LINPHONE_PUBLIC bool_t linphone_core_get_rtp_no_xmit_on_audio_mute(const LinphoneCore *lc);
@ -3418,7 +3832,10 @@ LINPHONE_PUBLIC void linphone_core_set_device_rotation(LinphoneCore *lc, int rot
*/
LINPHONE_PUBLIC int linphone_core_get_camera_sensor_rotation(LinphoneCore *lc);
/* start or stop streaming video in case of embedded window */
/**
* Start or stop streaming video in case of embedded window.
* Can be used to disable video showing to free XV port
**/
void linphone_core_show_video(LinphoneCore *lc, bool_t show);
/** @deprecated Use linphone_core_set_use_files() instead. */
@ -3585,28 +4002,42 @@ LINPHONE_PUBLIC void linphone_core_set_user_data(LinphoneCore *lc, void *userdat
* The application can use the LpConfig object to insert its own private
* sections and pairs of key=value in the configuration file.
**/
LINPHONE_PUBLIC LpConfig * linphone_core_get_config(LinphoneCore *lc);
LINPHONE_PUBLIC LinphoneConfig * linphone_core_get_config(LinphoneCore *lc);
/**
* Create a LpConfig object from a user config file.
* @param[in] lc #LinphoneCore object
* @param[in] filename The filename of the config file to read to fill the instantiated LpConfig
* @ingroup misc
* @deprecated Use linphone_core_create_config() instead.
*/
LINPHONE_PUBLIC LpConfig * linphone_core_create_lp_config(LinphoneCore *lc, const char *filename);
LINPHONE_DEPRECATED LINPHONE_PUBLIC LinphoneConfig * linphone_core_create_lp_config(LinphoneCore *lc, const char *filename);
/*set a callback for some blocking operations, it takes you informed of the progress of the operation*/
/**
* Create a #LinphoneConfig object from a user config file.
* @param[in] lc #LinphoneCore object
* @param[in] filename The filename of the config file to read to fill the instantiated #LinphoneConfig
* @ingroup misc
*/
LINPHONE_PUBLIC LinphoneConfig * linphone_core_create_config(LinphoneCore *lc, const char *filename);
/**
* Set a callback for some blocking operations, it takes you informed of the progress of the operation
*/
LINPHONE_PUBLIC void linphone_core_set_waiting_callback(LinphoneCore *lc, LinphoneCoreWaitingCallback cb, void *user_context);
/*returns the list of registered SipSetup (linphonecore plugins) */
/**
* Returns the list of registered SipSetup (linphonecore plugins)
*/
LINPHONE_PUBLIC const bctbx_list_t * linphone_core_get_sip_setups(LinphoneCore *lc);
/**
* Destroys a LinphoneCore
* @param[in] lc LinphoneCore object
* @ingroup initializing
* @deprecated Use linphone_core_unref() instead.
**/
LINPHONE_PUBLIC void linphone_core_destroy(LinphoneCore *lc);
LINPHONE_DEPRECATED LINPHONE_PUBLIC void linphone_core_destroy(LinphoneCore *lc);
/*for advanced users:*/
typedef RtpTransport * (*LinphoneCoreRtpTransportFactoryFunc)(void *data, int port);
@ -3984,7 +4415,17 @@ LINPHONE_PUBLIC void linphone_core_set_video_dscp(LinphoneCore *lc, int dscp);
**/
LINPHONE_PUBLIC int linphone_core_get_video_dscp(const LinphoneCore *lc);
/**
* Get the name of the mediastreamer2 filter used for rendering video.
* @ingroup media_parameters
**/
LINPHONE_PUBLIC const char *linphone_core_get_video_display_filter(LinphoneCore *lc);
/**
* Set the name of the mediastreamer2 filter to be used for rendering video.
* This is for advanced users of the library, mainly to workaround hardware/driver bugs.
* @ingroup media_parameters
**/
LINPHONE_PUBLIC void linphone_core_set_video_display_filter(LinphoneCore *lc, const char *filtername);
/** Contact Providers
@ -4028,6 +4469,16 @@ LINPHONE_PUBLIC const char* linphone_core_get_provisioning_uri(const LinphoneCor
*/
LINPHONE_PUBLIC bool_t linphone_core_is_provisioning_transient(LinphoneCore *lc);
/**
* Migrate configuration so that all SIP transports are enabled.
* Versions of linphone < 3.7 did not support using multiple SIP transport simultaneously.
* This function helps application to migrate the configuration so that all transports are enabled.
* Existing proxy configuration are added a transport parameter so that they continue using the unique transport that was set previously.
* This function must be used just after creating the core, before any call to linphone_core_iterate()
* @param lc the linphone core
* @return 1 if migration was done, 0 if not done because unnecessary or already done, -1 in case of error.
* @ingroup initializing
**/
LINPHONE_PUBLIC int linphone_core_migrate_to_multi_transport(LinphoneCore *lc);
@ -4063,8 +4514,22 @@ enum _LinphoneToneID{
typedef enum _LinphoneToneID LinphoneToneID;
/**
* Assign an audio file to be played locally upon call failure, for a given reason.
* @param lc the core
* @param reason the #LinphoneReason representing the failure error code.
* @param audiofile a wav file to be played when such call failure happens.
* @ingroup misc
**/
LINPHONE_PUBLIC void linphone_core_set_call_error_tone(LinphoneCore *lc, LinphoneReason reason, const char *audiofile);
/**
* Assign an audio file to be played as a specific tone id.
* This function typically allows to customize telephony tones per country.
* @param lc the core
* @param id the tone id
* @param audiofile a wav file to be played.
**/
LINPHONE_PUBLIC void linphone_core_set_tone(LinphoneCore *lc, LinphoneToneID id, const char *audiofile);
/**
@ -4440,6 +4905,7 @@ LINPHONE_PUBLIC void linphone_core_set_im_encryption_engine(LinphoneCore *lc, Li
LINPHONE_PUBLIC LinphoneImEncryptionEngine * linphone_core_get_im_encryption_engine(const LinphoneCore *lc);
#include "linphone/ringtoneplayer.h"
#include "linphone/factory.h"
#ifdef __cplusplus
}

View file

@ -91,17 +91,29 @@ LINPHONE_PUBLIC const char *linphone_publish_state_to_string(LinphonePublishStat
/**
* Callback prototype for notifying the application about notification received from the network.
**/
typedef void (*LinphoneCoreNotifyReceivedCb)(LinphoneCore *lc, LinphoneEvent *lev, const char *notified_event, const LinphoneContent *body);
typedef void (*LinphoneCoreCbsNotifyReceivedCb)(LinphoneCore *lc, LinphoneEvent *lev, const char *notified_event, const LinphoneContent *body);
/**
* Old name of #LinphoneCoreCbsNotifyReceivedCb.
*/
typedef LinphoneCoreCbsNotifyReceivedCb LinphoneCoreNotifyReceivedCb;
/**
* Callback prototype for notifying the application about changes of subscription states, including arrival of new subscriptions.
**/
typedef void (*LinphoneCoreSubscriptionStateChangedCb)(LinphoneCore *lc, LinphoneEvent *lev, LinphoneSubscriptionState state);
typedef void (*LinphoneCoreCbsSubscriptionStateChangedCb)(LinphoneCore *lc, LinphoneEvent *lev, LinphoneSubscriptionState state);
/**
* Old name of #LinphoneCoreCbsSubscriptionStateChangedCb.
*/
typedef LinphoneCoreCbsSubscriptionStateChangedCb LinphoneCoreSubscriptionStateChangedCb;
/**
* Callback prototype for notifying the application about changes of publish states.
**/
typedef void (*LinphoneCorePublishStateChangedCb)(LinphoneCore *lc, LinphoneEvent *lev, LinphonePublishState state);
typedef void (*LinphoneCoreCbsPublishStateChangedCb)(LinphoneCore *lc, LinphoneEvent *lev, LinphonePublishState state);
/**
* Old name of LinphoneCoreCbsPublishStateChangedCb.
*/
typedef LinphoneCoreCbsPublishStateChangedCb LinphoneCorePublishStateChangedCb;
/**
* Create an outgoing subscription, specifying the destination resource, the event name, and an optional content body.

130
include/linphone/factory.h Normal file
View file

@ -0,0 +1,130 @@
/*
linphone
Copyright (C) 2016 Belledonne Communications <info@belledonne-communications.com>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef LINPHONE_FACTORY_H
#define LINPHONE_FACTORY_H
#include "linphone/core.h"
#ifdef _cplusplus
extern "C" {
#endif
/**
* @addtogroup initializing
* @{
*/
/**
* #LinphoneFactory is a singleton object devoted to the creation of all the object
* of Liblinphone that cannot created by #LinphoneCore or #LinphoneCore itself.
*/
typedef struct _LinphoneFactory LinphoneFactory;
/**
* Create the #LinphoneFactory if that has not been done and return
* a pointer on it.
* @return A pointer on the #LinphoneFactory
*/
LINPHONE_PUBLIC LinphoneFactory *linphone_factory_get(void);
/**
* Instanciate a #LinphoneCore object.
*
* The LinphoneCore object is the primary handle for doing all phone actions.
* It should be unique within your application.
* @param factory The #LinphoneFactory singleton.
* @param cbs a #LinphoneCoreCbs object holding your application callbacks. A reference
* will be taken on it until the destruciton of the core or the unregistration
* with linphone_core_remove_cbs().
* @param config_path a path to a config file. If it does not exists it will be created.
* The config file is used to store all settings, call logs, friends, proxies... so that all these settings
* become persistent over the life of the LinphoneCore object.
* It is allowed to set a NULL config file. In that case LinphoneCore will not store any settings.
* @param factory_config_path a path to a read-only config file that can be used to
* to store hard-coded preference such as proxy settings or internal preferences.
* The settings in this factory file always override the one in the normal config file.
* It is OPTIONAL, use NULL if unneeded.
* @see linphone_core_new_with_config
*/
LINPHONE_PUBLIC LinphoneCore *linphone_factory_create_core(const LinphoneFactory *factory, LinphoneCoreCbs *cbs,
const char *config_path, const char *factory_config_path);
/**
* Instantiates a LinphoneCore object with a given LpConfig.
*
* @param factory The #LinphoneFactory singleton.
* The LinphoneCore object is the primary handle for doing all phone actions.
* It should be unique within your application.
* @param cbs a #LinphoneCoreCbs object holding your application callbacks. A reference
* will be taken on it until the destruciton of the core or the unregistration
* with linphone_core_remove_cbs().
* @param config a pointer to an LpConfig object holding the configuration of the LinphoneCore to be instantiated.
* @see linphone_core_new
*/
LINPHONE_PUBLIC LinphoneCore *linphone_factory_create_core_with_config(const LinphoneFactory *factory, LinphoneCoreCbs *cbs, LinphoneConfig *config);
/**
* Instanciate a #LinphoneCoreCbs object.
* @return a new #LinponeCoreCbs.
*/
LINPHONE_PUBLIC LinphoneCoreCbs *linphone_factory_create_core_cbs(const LinphoneFactory *factory);
/**
* Parse a string holding a SIP URI and create the according #LinphoneAddress object.
* @param factory The #LinphoneFactory singleton.
* @param addr A string holding the SIP URI to parse.
* @return A new #LinphoneAddress.
*/
LINPHONE_PUBLIC LinphoneAddress *linphone_factory_create_address(const LinphoneFactory *factory, const char *addr);
/**
* Creates a #LinphoneAuthInfo object.
* The object can be created empty, that is with all arguments set to NULL.
* Username, userid, password, realm and domain can be set later using specific methods.
* At the end, username and passwd (or ha1) are required.
* @param factory The #LinphoneFactory singleton.
* @param username The username that needs to be authenticated
* @param userid The userid used for authenticating (use NULL if you don't know what it is)
* @param passwd The password in clear text
* @param ha1 The ha1-encrypted password if password is not given in clear text.
* @param realm The authentication domain (which can be larger than the sip domain. Unfortunately many SIP servers don't use this parameter.
* @param domain The SIP domain for which this authentication information is valid, if it has to be restricted for a single SIP domain.
* @return A #LinphoneAuthInfo object. linphone_auth_info_destroy() must be used to destroy it when no longer needed. The LinphoneCore makes a copy of LinphoneAuthInfo
* passed through linphone_core_add_auth_info().
*/
LINPHONE_PUBLIC LinphoneAuthInfo *linphone_factory_create_auth_info(const LinphoneFactory *factory, const char *username, const char *userid, const char *passwd, const char *ha1, const char *realm, const char *domain);
/**
* Create an empty #LinphoneVcard.
* @return a new #LinphoneVcard.
* @ingroup initializing
*/
LINPHONE_PUBLIC LinphoneVcard *linphone_factory_create_vcard(LinphoneFactory *factory);
/**
* @}
*/
#ifdef _cplusplus
}
#endif
#endif // LINPHONE_FACTORY_H

View file

@ -26,6 +26,10 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#define LINPHONE_PUBLIC MS2_PUBLIC
#endif
#ifndef LINPHONE_DEPRECATED
#define LINPHONE_DEPRECATED MS2_DEPRECATED
#endif
#ifdef __cplusplus
extern "C"
{
@ -41,17 +45,34 @@ extern "C"
*/
typedef struct _LinphoneVcard LinphoneVcard;
/**
* Cast a belle_sip_object_t into LinphoneVcard.
*/
#define LINPHONE_VCARD BELLE_SIP_CAST(object, LinphoneVcard)
/**
* Creates a LinphoneVcard object that has a pointer to an empty vCard
* @return a new LinphoneVcard object
* @deprecated Use linphone_factory_create_vcard() instead.
*/
LINPHONE_PUBLIC LinphoneVcard* linphone_vcard_new(void);
LINPHONE_DEPRECATED LINPHONE_PUBLIC LinphoneVcard* linphone_vcard_new(void);
/**
* Deletes a LinphoneVcard object properly
* @param[in] vCard the LinphoneVcard to destroy
* @deprecated Use linphone_vcard_unref() or belle_sip_object_unref() instead.
*/
LINPHONE_PUBLIC void linphone_vcard_free(LinphoneVcard *vCard);
LINPHONE_DEPRECATED LINPHONE_PUBLIC void linphone_vcard_free(LinphoneVcard *vCard);
/**
* Take a ref on a #LinphoneVcard.
*/
LINPHONE_PUBLIC LinphoneVcard *linphone_vcard_ref(LinphoneVcard *vCard);
/**
* Release a #LinphoneVcard.
*/
LINPHONE_PUBLIC void linphone_vcard_unref(LinphoneVcard *vCard);
/**
* Returns the vCard4 representation of the LinphoneVcard.

View file

@ -2896,7 +2896,7 @@ static void call_rejected_because_wrong_credentials_with_params(const char* user
linphone_core_set_user_agent(marie->lc,user_agent,NULL);
}
if (!enable_auth_req_cb) {
((VTableReference*)(marie->lc->vtable_refs->data))->vtable->auth_info_requested=NULL;
((VTableReference*)(marie->lc->vtable_refs->data))->cbs->vtable->auth_info_requested=NULL;
linphone_core_add_auth_info(marie->lc,wrong_auth_info);
}

View file

@ -48,11 +48,12 @@ static void simple(void) {
LinphonePresenceModel *pauline_presence = linphone_presence_model_new_with_activity(LinphonePresenceActivityDinner, NULL);
LinphoneFriend* f = linphone_core_create_friend_with_address(marie->lc, get_identity(pauline));
LinphonePresenceActivity *activity = NULL;
LinphoneCoreVTable *vtable = linphone_core_v_table_new();
vtable->publish_state_changed = linphone_publish_state_changed;
_linphone_core_add_listener(pauline->lc, vtable, TRUE, TRUE );
LinphoneCoreCbs *callbacks = linphone_factory_create_core_cbs(linphone_factory_get());
linphone_core_cbs_set_publish_state_changed(callbacks, linphone_publish_state_changed);
_linphone_core_add_callbacks(pauline->lc, callbacks, TRUE);
linphone_core_cbs_unref(callbacks);
lp_config_set_int(marie->lc->config, "sip", "subscribe_expires", 40);
linphone_core_set_user_agent(pauline->lc, "full-presence-support", NULL);
linphone_core_set_user_agent(marie->lc, "full-presence-support", NULL);

View file

@ -150,9 +150,11 @@ static void simple_publish_with_expire(int expires) {
LinphoneCoreManager* marie = linphone_core_manager_new( "marie_rc");
LinphoneProxyConfig* proxy;
LinphonePresenceModel* presence;
LinphoneCoreVTable *vtable = linphone_core_v_table_new();
vtable->publish_state_changed = linphone_publish_state_changed;
_linphone_core_add_listener(marie->lc, vtable, TRUE, TRUE );
LinphoneCoreCbs *cbs = linphone_factory_create_core_cbs(linphone_factory_get());
linphone_core_cbs_set_publish_state_changed(cbs, linphone_publish_state_changed);
_linphone_core_add_callbacks(marie->lc, cbs, TRUE);
linphone_core_cbs_unref(cbs);
proxy = linphone_core_get_default_proxy_config(marie->lc);
linphone_proxy_config_edit(proxy);