Commit 85b5ca09 authored by François Grisez's avatar François Grisez

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.
parent d6d0cbf5
......@@ -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
......
......@@ -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);
}
......
......@@ -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;
}
/**
* @}
**/
......@@ -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);
}
......
......@@ -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) {
......
/*
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);
}
......@@ -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);
}
}
......
......@@ -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);
...