Commit 548a8122 authored by Ghislain MARY's avatar Ghislain MARY

Add definition of callbacks on the LinphoneCall object.

parent a6208815
......@@ -1114,10 +1114,9 @@ static void vfu_request(SalOp *op){
}
static void dtmf_received(SalOp *op, char dtmf){
LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(op));
LinphoneCall *call=(LinphoneCall*)sal_op_get_user_pointer(op);
if (!call) return;
linphone_core_notify_dtmf_received(lc, call, dtmf);
linphone_call_notify_dtmf_received(call, dtmf);
}
static void refer_received(Sal *sal, SalOp *op, const char *referto){
......
......@@ -32,7 +32,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#endif
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;
......@@ -133,6 +132,10 @@ LinphoneAuthInfo *linphone_factory_create_auth_info(const LinphoneFactory *facto
return linphone_auth_info_new(username, userid, passwd, ha1, realm, domain);
}
LinphoneCallCbs * linphone_factory_create_call_cbs(const LinphoneFactory *factory) {
return _linphone_call_cbs_new();
}
LinphoneVcard *linphone_factory_create_vcard(LinphoneFactory *factory) {
return _linphone_vcard_new();
}
......
......@@ -104,7 +104,7 @@ void linphone_core_notify_info_message(LinphoneCore* lc,SalOp *op, SalBodyHandle
LinphoneInfoMessage *info=linphone_core_create_info_message(lc);
info->headers=sal_custom_header_clone(sal_op_get_recv_custom_header(op));
if (body_handler) info->content=linphone_content_from_sal_body_handler(body_handler);
linphone_core_notify_info_received(lc,call,info);
linphone_call_notify_info_message_received(call, info);
linphone_info_message_unref(info);
}
}
......@@ -51,6 +51,85 @@ static void _linphone_call_set_next_video_frame_decoded_trigger(LinphoneCall *ca
void linphone_call_handle_stream_events(LinphoneCall *call, int stream_index);
typedef belle_sip_object_t_vptr_t LinphoneCallCbs_vptr_t;
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneCallCbs);
BELLE_SIP_INSTANCIATE_VPTR(LinphoneCallCbs, belle_sip_object_t,
NULL, // destroy
NULL, // clone
NULL, // Marshall
FALSE
);
LinphoneCallCbs *_linphone_call_cbs_new(void) {
LinphoneCallCbs *obj = belle_sip_object_new(LinphoneCallCbs);
return obj;
}
LinphoneCallCbs *linphone_call_cbs_ref(LinphoneCallCbs *cbs) {
return (LinphoneCallCbs *)belle_sip_object_ref(cbs);
}
void linphone_call_cbs_unref(LinphoneCallCbs *cbs) {
belle_sip_object_unref(cbs);
}
void *linphone_call_cbs_get_user_data(const LinphoneCallCbs *cbs) {
return cbs->user_data;
}
void linphone_call_cbs_set_user_data(LinphoneCallCbs *cbs, void *user_data) {
cbs->user_data = user_data;
}
LinphoneCallCbsDtmfReceivedCb linphone_call_cbs_get_dtmf_received(LinphoneCallCbs *cbs) {
return cbs->dtmf_received_cb;
}
void linphone_call_cbs_set_dtmf_received(LinphoneCallCbs *cbs, LinphoneCallCbsDtmfReceivedCb cb) {
cbs->dtmf_received_cb = cb;
}
LinphoneCallCbsEncryptionChangedCb linphone_call_cbs_get_encryption_changed(LinphoneCallCbs *cbs) {
return cbs->encryption_changed_cb;
}
void linphone_call_cbs_set_encryption_changed(LinphoneCallCbs *cbs, LinphoneCallCbsEncryptionChangedCb cb) {
cbs->encryption_changed_cb = cb;
}
LinphoneCallCbsInfoMessageReceivedCb linphone_call_cbs_get_info_message_received(LinphoneCallCbs *cbs) {
return cbs->info_message_received_cb;
}
void linphone_call_cbs_set_info_message_received(LinphoneCallCbs *cbs, LinphoneCallCbsInfoMessageReceivedCb cb) {
cbs->info_message_received_cb = cb;
}
LinphoneCallCbsStateChangedCb linphone_call_cbs_get_state_changed(LinphoneCallCbs *cbs) {
return cbs->state_changed_cb;
}
void linphone_call_cbs_set_state_changed(LinphoneCallCbs *cbs, LinphoneCallCbsStateChangedCb cb) {
cbs->state_changed_cb = cb;
}
LinphoneCallCbsStatsUpdatedCb linphone_call_cbs_get_stats_updated(LinphoneCallCbs *cbs) {
return cbs->stats_updated_cb;
}
void linphone_call_cbs_set_stats_updated(LinphoneCallCbs *cbs, LinphoneCallCbsStatsUpdatedCb cb) {
cbs->stats_updated_cb = cb;
}
LinphoneCallCbsTransferStateChangedCb linphone_call_cbs_get_transfer_state_changed(LinphoneCallCbs *cbs) {
return cbs->transfer_state_changed_cb;
}
void linphone_call_cbs_set_transfer_state_changed(LinphoneCallCbs *cbs, LinphoneCallCbsTransferStateChangedCb cb) {
cbs->transfer_state_changed_cb = cb;
}
bool_t linphone_call_state_is_early(LinphoneCallState state){
switch (state){
case LinphoneCallIdle:
......@@ -207,7 +286,7 @@ static void propagate_encryption_changed(LinphoneCall *call){
if (!linphone_call_all_streams_encrypted(call)) {
ms_message("Some streams are not encrypted");
call->current_params->media_encryption=LinphoneMediaEncryptionNone;
linphone_core_notify_call_encryption_changed(call->core, call, FALSE, call->auth_token);
linphone_call_notify_encryption_changed(call, FALSE, call->auth_token);
} else {
if (call->auth_token) {/* ZRTP only is using auth_token */
call->current_params->media_encryption=LinphoneMediaEncryptionZRTP;
......@@ -215,7 +294,7 @@ static void propagate_encryption_changed(LinphoneCall *call){
call->current_params->media_encryption=LinphoneMediaEncryptionDTLS;
}
ms_message("All streams are encrypted key exchanged using %s", call->current_params->media_encryption==LinphoneMediaEncryptionZRTP?"ZRTP":call->current_params->media_encryption==LinphoneMediaEncryptionDTLS?"DTLS":"Unknown mechanism");
linphone_core_notify_call_encryption_changed(call->core, call, TRUE, call->auth_token);
linphone_call_notify_encryption_changed(call, TRUE, call->auth_token);
#ifdef VIDEO_ENABLED
if (linphone_call_encryption_mandatory(call) && call->videostream && media_stream_started((MediaStream *)call->videostream)) {
video_stream_send_vfu(call->videostream); /*nothing could have been sent yet so generating key frame*/
......@@ -1779,7 +1858,7 @@ void linphone_call_set_state(LinphoneCall *call, LinphoneCallState cstate, const
, linphone_call_state_to_string(call->prevstate)
, linphone_call_state_to_string(call->state));
}
linphone_core_notify_call_state_changed(lc,call,cstate,message?message:"");
linphone_call_notify_state_changed(call, cstate, message ? message : "");
linphone_reporting_call_state_updated(call);
if (cstate==LinphoneCallReleased) {/*shall be performed after app notification*/
linphone_call_set_released(call);
......@@ -1789,6 +1868,7 @@ void linphone_call_set_state(LinphoneCall *call, LinphoneCallState cstate, const
static void linphone_call_destroy(LinphoneCall *obj){
ms_message("Call [%p] freed.",obj);
bctbx_list_free_with_data(obj->callbacks, (bctbx_list_free_func)linphone_call_cbs_unref);
if (obj->audiostream || obj->videostream){
linphone_call_free_media_resources(obj);
}
......@@ -2754,7 +2834,7 @@ static void linphone_core_dtmf_received(LinphoneCall *call, int dtmf){
ms_warning("Bad dtmf value %i",dtmf);
return;
}
linphone_core_notify_dtmf_received(call->core, call, dtmf_tab[dtmf]);
linphone_call_notify_dtmf_received(call, dtmf_tab[dtmf]);
}
static void parametrize_equalizer(LinphoneCore *lc, AudioStream *st){
......@@ -4299,7 +4379,7 @@ static void report_bandwidth_for_stream(LinphoneCall *call, MediaStream *ms, Lin
if (call->core->send_call_stats_periodical_updates){
if (active) update_local_stats(stats, ms);
stats->updated |= LINPHONE_CALL_STATS_PERIODICAL_UPDATE;
linphone_core_notify_call_stats_updated(call->core, call, stats);
linphone_call_notify_stats_updated(call, stats);
stats->updated=0;
}
}
......@@ -4456,9 +4536,8 @@ void linphone_call_stats_uninit(LinphoneCallStats *stats){
}
}
void linphone_call_notify_stats_updated(LinphoneCall *call, int stream_index){
void linphone_call_notify_stats_updated_with_stream_index(LinphoneCall *call, int stream_index){
LinphoneCallStats *stats = &call->stats[stream_index];
LinphoneCore *lc = call->core;
if (stats->updated){
switch(stats->updated) {
case LINPHONE_CALL_STATS_RECEIVED_RTCP_UPDATE:
......@@ -4468,7 +4547,7 @@ void linphone_call_notify_stats_updated(LinphoneCall *call, int stream_index){
default:
break;
}
linphone_core_notify_call_stats_updated(lc, call, stats);
linphone_call_notify_stats_updated(call, stats);
stats->updated = 0;
}
}
......@@ -4535,7 +4614,7 @@ void linphone_call_handle_stream_events(LinphoneCall *call, int stream_index){
ms = linphone_call_get_media_stream(call, stream_index);
if (ms) linphone_call_stats_fill(&call->stats[stats_index],ms,ev);
linphone_call_notify_stats_updated(call,stats_index);
linphone_call_notify_stats_updated_with_stream_index(call,stats_index);
if (evt == ORTP_EVENT_ZRTP_ENCRYPTION_CHANGED){
if (stream_index == call->main_audio_stream_index)
......@@ -4654,12 +4733,11 @@ LinphoneCallState linphone_call_get_transfer_state(LinphoneCall *call) {
void linphone_call_set_transfer_state(LinphoneCall* call, LinphoneCallState state) {
if (state != call->transfer_state) {
LinphoneCore* lc = call->core;
ms_message("Transfer state for call [%p] changed from [%s] to [%s]",call
,linphone_call_state_to_string(call->transfer_state)
,linphone_call_state_to_string(state));
call->transfer_state = state;
linphone_core_notify_transfer_state_changed(lc, call, state);
linphone_call_notify_transfer_state_changed(call, state);
}
}
......@@ -5836,3 +5914,55 @@ void linphone_call_ogl_render(LinphoneCall *call, bool_t is_preview) {
if (stream->output2 && ms_filter_get_id(stream->output2) == MS_OGL_ID)
ms_filter_call_method(stream->output2, MS_OGL_RENDER, NULL);
}
void linphone_call_add_callbacks(LinphoneCall *call, LinphoneCallCbs *cbs) {
call->callbacks = bctbx_list_append(call->callbacks, linphone_call_cbs_ref(cbs));
}
void linphone_call_remove_callbacks(LinphoneCall *call, LinphoneCallCbs *cbs) {
call->callbacks = bctbx_list_remove(call->callbacks, cbs);
linphone_call_cbs_unref(cbs);
}
LinphoneCallCbs *linphone_call_get_current_callbacks(const LinphoneCall *call) {
return call->current_cbs;
}
#define NOTIFY_IF_EXIST(function_name, ...) \
bctbx_list_t* iterator; \
for (iterator = call->callbacks; iterator != NULL; iterator = bctbx_list_next(iterator)) { \
call->current_cbs = (LinphoneCallCbs *)bctbx_list_get_data(iterator); \
if (call->current_cbs->function_name != NULL) { \
call->current_cbs->function_name(__VA_ARGS__); \
} \
}
void linphone_call_notify_state_changed(LinphoneCall *call, LinphoneCallState cstate, const char *message) {
NOTIFY_IF_EXIST(state_changed_cb, call, cstate, message)
linphone_core_notify_call_state_changed(linphone_call_get_core(call), call, cstate, message);
}
void linphone_call_notify_dtmf_received(LinphoneCall *call, int dtmf) {
NOTIFY_IF_EXIST(dtmf_received_cb, call, dtmf)
linphone_core_notify_dtmf_received(linphone_call_get_core(call), call, dtmf);
}
void linphone_call_notify_encryption_changed(LinphoneCall *call, bool_t on, const char *authentication_token) {
NOTIFY_IF_EXIST(encryption_changed_cb, call, on, authentication_token)
linphone_core_notify_call_encryption_changed(linphone_call_get_core(call), call, on, authentication_token);
}
void linphone_call_notify_transfer_state_changed(LinphoneCall *call, LinphoneCallState cstate) {
NOTIFY_IF_EXIST(transfer_state_changed_cb, call, cstate)
linphone_core_notify_transfer_state_changed(linphone_call_get_core(call), call, cstate);
}
void linphone_call_notify_stats_updated(LinphoneCall *call, const LinphoneCallStats *stats) {
NOTIFY_IF_EXIST(stats_updated_cb, call, stats)
linphone_core_notify_call_stats_updated(linphone_call_get_core(call), call, stats);
}
void linphone_call_notify_info_message_received(LinphoneCall *call, const LinphoneInfoMessage *msg) {
NOTIFY_IF_EXIST(info_message_received_cb, call, msg)
linphone_core_notify_info_received(linphone_call_get_core(call), call, msg);
}
......@@ -389,6 +389,14 @@ void linphone_core_cbs_set_friend_list_removed(LinphoneCoreCbs *cbs, LinphoneCor
cbs->vtable->friend_list_removed = cb;
}
LinphoneCoreCbsCallCreatedCb linphone_core_cbs_get_call_created(LinphoneCoreCbs *cbs) {
return cbs->vtable->call_created;
}
void linphone_core_cbs_set_call_created(LinphoneCoreCbs *cbs, LinphoneCoreCbsCallCreatedCb cb) {
cbs->vtable->call_created = 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,
......@@ -5949,6 +5957,7 @@ int linphone_core_add_call( LinphoneCore *lc, LinphoneCall *call) {
if (linphone_core_can_we_add_call(lc)){
if (lc->calls==NULL) notify_soundcard_usage(lc,TRUE);
lc->calls = bctbx_list_append(lc->calls,call);
linphone_core_notify_call_created(lc, call);
return 0;
}
return -1;
......
......@@ -290,6 +290,19 @@ typedef struct _PortConfig{
int rtcp_port;
}PortConfig;
struct _LinphoneCallCbs {
belle_sip_object_t base;
void *user_data;
LinphoneCallCbsDtmfReceivedCb dtmf_received_cb;
LinphoneCallCbsEncryptionChangedCb encryption_changed_cb;
LinphoneCallCbsInfoMessageReceivedCb info_message_received_cb;
LinphoneCallCbsStateChangedCb state_changed_cb;
LinphoneCallCbsStatsUpdatedCb stats_updated_cb;
LinphoneCallCbsTransferStateChangedCb transfer_state_changed_cb;
};
LinphoneCallCbs * _linphone_call_cbs_new(void);
struct _LinphoneCall{
belle_sip_object_t base;
void *user_data;
......@@ -379,11 +392,21 @@ struct _LinphoneCall{
bool_t reinvite_on_cancel_response_requested;
bool_t non_op_error; /*set when the LinphoneErrorInfo was set at higher level than sal*/
bctbx_list_t *callbacks; /* A list of LinphoneCallCbs object */
LinphoneCallCbs *current_cbs; /* The current LinphoneCallCbs object used to call a callback */
};
BELLE_SIP_DECLARE_VPTR_NO_EXPORT(LinphoneCall);
void linphone_call_notify_state_changed(LinphoneCall *call, LinphoneCallState cstate, const char *message);
void linphone_call_notify_dtmf_received(LinphoneCall *call, int dtmf);
void linphone_call_notify_encryption_changed(LinphoneCall *call, bool_t on, const char *authentication_token);
void linphone_call_notify_transfer_state_changed(LinphoneCall *call, LinphoneCallState cstate);
void linphone_call_notify_stats_updated(LinphoneCall *call, const LinphoneCallStats *stats);
void linphone_call_notify_info_message_received(LinphoneCall *call, const LinphoneInfoMessage *msg);
LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddress *from, LinphoneAddress *to, const LinphoneCallParams *params, LinphoneProxyConfig *cfg);
LinphoneCall * linphone_call_new_incoming(struct _LinphoneCore *lc, LinphoneAddress *from, LinphoneAddress *to, SalOp *op);
void linphone_call_set_new_params(LinphoneCall *call, const LinphoneCallParams *params);
......@@ -967,6 +990,7 @@ struct _LinphoneCoreCbs {
bool_t autorelease;
};
LinphoneCoreCbs * _linphone_core_cbs_new(void);
void _linphone_core_cbs_set_v_table(LinphoneCoreCbs *cbs, LinphoneCoreVTable *vtable, bool_t autorelease);
typedef struct _LCCallbackObj {
......@@ -1620,6 +1644,7 @@ BELLE_SIP_TYPE_ID(LinphoneBuffer),
BELLE_SIP_TYPE_ID(LinphoneContactProvider),
BELLE_SIP_TYPE_ID(LinphoneContactSearch),
BELLE_SIP_TYPE_ID(LinphoneCall),
BELLE_SIP_TYPE_ID(LinphoneCallCbs),
BELLE_SIP_TYPE_ID(LinphoneCallLog),
BELLE_SIP_TYPE_ID(LinphoneCallParams),
BELLE_SIP_TYPE_ID(LinphoneChatMessage),
......@@ -1701,6 +1726,7 @@ void linphone_core_notify_log_collection_upload_state_changed(LinphoneCore *lc,
void linphone_core_notify_log_collection_upload_progress_indication(LinphoneCore *lc, size_t offset, size_t total);
void linphone_core_notify_friend_list_created(LinphoneCore *lc, LinphoneFriendList *list);
void linphone_core_notify_friend_list_removed(LinphoneCore *lc, LinphoneFriendList *list);
void linphone_core_notify_call_created(LinphoneCore *lc, LinphoneCall *call);
void set_mic_gain_db(AudioStream *st, float gain);
void set_playback_gain_db(AudioStream *st, float gain);
......
......@@ -311,6 +311,11 @@ void linphone_core_notify_friend_list_removed(LinphoneCore *lc, LinphoneFriendLi
cleanup_dead_vtable_refs(lc);
}
void linphone_core_notify_call_created(LinphoneCore *lc, LinphoneCall *call) {
NOTIFY_IF_EXIST(call_created, lc, call);
cleanup_dead_vtable_refs(lc);
}
static VTableReference * v_table_reference_new(LinphoneCoreCbs *cbs, bool_t internal){
VTableReference *ref=ms_new0(VTableReference,1);
ref->valid=TRUE;
......
......@@ -27,6 +27,7 @@ set(HEADER_FILES
auth_info.h
buffer.h
call.h
callbacks.h
call_log.h
call_params.h
call_stats.h
......
......@@ -7,6 +7,7 @@ linphone_include_HEADERS=\
auth_info.h \
buffer.h \
call.h \
callbacks.h \
call_log.h \
call_params.h \
call_stats.h \
......
......@@ -524,6 +524,118 @@ LINPHONE_PUBLIC int linphone_call_transfer(LinphoneCall *call, const char *refer
**/
LINPHONE_PUBLIC int linphone_call_transfer_to_another(LinphoneCall *call, LinphoneCall *dest);
/**
* Acquire a reference to the LinphoneCallCbs object.
* @param[in] cbs LinphoneCallCbs object.
* @return The same LinphoneCallCbs object.
*/
LINPHONE_PUBLIC LinphoneCallCbs *linphone_call_cbs_ref(LinphoneCallCbs *cbs);
/**
* Release reference to the LinphoneCallCbs object.
* @param[in] cbs LinphoneCallCbs object.
*/
LINPHONE_PUBLIC void linphone_call_cbs_unref(LinphoneCallCbs *cbs);
/**
* Retrieve the user pointer associated with the LinphoneCallCbs object.
* @param[in] cbs LinphoneCallCbs object.
* @return The user pointer associated with the LinphoneCallCbs object.
*/
LINPHONE_PUBLIC void *linphone_call_cbs_get_user_data(const LinphoneCallCbs *cbs);
/**
* Assign a user pointer to the LinphoneCallCbs object.
* @param[in] cbs LinphoneCallCbs object.
* @param[in] ud The user pointer to associate with the LinphoneCallCbs object.
*/
LINPHONE_PUBLIC void linphone_call_cbs_set_user_data(LinphoneCallCbs *cbs, void *user_data);
/**
* Get the dtmf received callback.
* @param[in] cbs LinphoneCallCbs object.
* @return The current dtmf received callback.
*/
LINPHONE_PUBLIC LinphoneCallCbsDtmfReceivedCb linphone_call_cbs_get_dtmf_received(LinphoneCallCbs *cbs);
/**
* Set the dtmf received callback.
* @param[in] cbs LinphoneCallCbs object.
* @param[in] cb The dtmf received callback to be used.
*/
LINPHONE_PUBLIC void linphone_call_cbs_set_dtmf_received(LinphoneCallCbs *cbs, LinphoneCallCbsDtmfReceivedCb cb);
/**
* Get the encryption changed callback.
* @param[in] cbs LinphoneCallCbs object.
* @return The current encryption changed callback.
*/
LINPHONE_PUBLIC LinphoneCallCbsEncryptionChangedCb linphone_call_cbs_get_encryption_changed(LinphoneCallCbs *cbs);
/**
* Set the encryption changed callback.
* @param[in] cbs LinphoneCallCbs object.
* @param[in] cb The encryption changed callback to be used.
*/
LINPHONE_PUBLIC void linphone_call_cbs_set_encryption_changed(LinphoneCallCbs *cbs, LinphoneCallCbsEncryptionChangedCb cb);
/**
* Get the info message received callback.
* @param[in] cbs LinphoneCallCbs object.
* @return The current info message received callback.
*/
LINPHONE_PUBLIC LinphoneCallCbsInfoMessageReceivedCb linphone_call_cbs_get_info_message_received(LinphoneCallCbs *cbs);
/**
* Set the info message received callback.
* @param[in] cbs LinphoneCallCbs object.
* @param[in] cb The info message received callback to be used.
*/
LINPHONE_PUBLIC void linphone_call_cbs_set_info_message_received(LinphoneCallCbs *cbs, LinphoneCallCbsInfoMessageReceivedCb cb);
/**
* Get the state changed callback.
* @param[in] cbs LinphoneCallCbs object.
* @return The current state changed callback.
*/
LINPHONE_PUBLIC LinphoneCallCbsStateChangedCb linphone_call_cbs_get_state_changed(LinphoneCallCbs *cbs);
/**
* Set the state changed callback.
* @param[in] cbs LinphoneCallCbs object.
* @param[in] cb The state changed callback to be used.
*/
LINPHONE_PUBLIC void linphone_call_cbs_set_state_changed(LinphoneCallCbs *cbs, LinphoneCallCbsStateChangedCb cb);
/**
* Get the stats updated callback.
* @param[in] cbs LinphoneCallCbs object.
* @return The current stats updated callback.
*/
LINPHONE_PUBLIC LinphoneCallCbsStatsUpdatedCb linphone_call_cbs_get_stats_updated(LinphoneCallCbs *cbs);
/**
* Set the stats updated callback.
* @param[in] cbs LinphoneCallCbs object.
* @param[in] cb The stats updated callback to be used.
*/
LINPHONE_PUBLIC void linphone_call_cbs_set_stats_updated(LinphoneCallCbs *cbs, LinphoneCallCbsStatsUpdatedCb cb);
/**
* Get the transfer state changed callback.
* @param[in] cbs LinphoneCallCbs object.
* @return The current transfer state changed callback.
*/
LINPHONE_PUBLIC LinphoneCallCbsTransferStateChangedCb linphone_call_cbs_get_transfer_state_changed(LinphoneCallCbs *cbs);
/**
* Set the transfer state changed callback.
* @param[in] cbs LinphoneCallCbs object.
* @param[in] cb The transfer state changed callback to be used.
*/
LINPHONE_PUBLIC void linphone_call_cbs_set_transfer_state_changed(LinphoneCallCbs *cbs, LinphoneCallCbsTransferStateChangedCb cb);
/**
* @}
*/
......@@ -715,6 +827,29 @@ LINPHONE_PUBLIC const LinphoneCallStats *linphone_call_get_video_stats(LinphoneC
LINPHONE_PUBLIC const LinphoneCallStats *linphone_call_get_text_stats(LinphoneCall *call);
/**
* Add a listener in order to be notified of LinphoneCall events. Once an event is received, registred LinphoneCallCbs are
* invoked sequencially.
* @param[in] call LinphoneCall object to monitor.
* @param[in] cbs A LinphoneCallCbs object holding the callbacks you need. A reference is taken by the LinphoneCall until you invoke linphone_call_remove_callbacks().
*/
LINPHONE_PUBLIC void linphone_call_add_callbacks(LinphoneCall *call, LinphoneCallCbs *cbs);
/**
* Remove a listener from a LinphoneCall
* @param[in] call LinphoneCall object
* @param[in] cbs LinphoneCallCbs object to remove.
*/
LINPHONE_PUBLIC void linphone_call_remove_callbacks(LinphoneCall *call, LinphoneCallCbs *cbs);
/**
* Gets the current LinphoneCallCbs.
* This is meant only to be called from a callback to be able to get the user_data associated with the LinphoneCallCbs that is calling the callback.
* @param[in] call LinphoneCall object
* @return The LinphoneCallCbs that has called the last callback
* @donotwrap
*/
LINPHONE_PUBLIC LinphoneCallCbs *linphone_call_get_current_callbacks(const LinphoneCall *call);
/**
* @}
......
This diff is collapsed.
......@@ -33,50 +33,6 @@ extern "C" {
* @{
*/
/**
* Call back used to notify message delivery status
* @param msg #LinphoneChatMessage object
* @param status LinphoneChatMessageState
* @param ud application user data
* @deprecated Use LinphoneChatMessageCbsMsgStateChangedCb instead.
* @donotwrap
*/
typedef void (*LinphoneChatMessageStateChangedCb)(LinphoneChatMessage* msg,LinphoneChatMessageState state,void* ud);
/**
* Call back used to notify message delivery status
* @param msg #LinphoneChatMessage object
* @param status LinphoneChatMessageState
*/
typedef void (*LinphoneChatMessageCbsMsgStateChangedCb)(LinphoneChatMessage* msg, LinphoneChatMessageState state);
/**
* 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.
* @param message #LinphoneChatMessage message from which the body is received.
* @param content #LinphoneContent incoming content information
* @param buffer #LinphoneBuffer holding the received data. Empty buffer means end of file.
*/
typedef void (*LinphoneChatMessageCbsFileTransferRecvCb)(LinphoneChatMessage *message, const LinphoneContent* content, const LinphoneBuffer *buffer);
/**
* File transfer send callback prototype. This function is called by the core when an outgoing file transfer is started. This function is called until size is set to 0.
* @param message #LinphoneChatMessage message from which the body is received.
* @param content #LinphoneContent outgoing content
* @param offset the offset in the file from where to get the data to be sent
* @param size the number of bytes expected by the framework
* @return A LinphoneBuffer object holding the data written by the application. An empty buffer means end of file.
*/
typedef LinphoneBuffer * (*LinphoneChatMessageCbsFileTransferSendCb)(LinphoneChatMessage *message, const LinphoneContent* content, size_t offset, size_t size);
/**
* File transfer progress indication callback prototype.
* @param message #LinphoneChatMessage message from which the body is received.
* @param content #LinphoneContent incoming content information
* @param offset The number of bytes sent/received since the beginning of the transfer.
* @param total The total number of bytes to be sent/received.
*/
typedef void (*LinphoneChatMessageCbsFileTransferProgressIndicationCb)(LinphoneChatMessage *message, const LinphoneContent* content, size_t offset, size_t total);
/**
* Destroy a LinphoneChatRoom.
* @param cr #LinphoneChatRoom object
......
......@@ -29,6 +29,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "linphone/defs.h"
#include "linphone/types.h"
#include "linphone/callbacks.h"
#include "linphone/sipsetup.h"
#include "linphone/account_creator.h"
......@@ -129,58 +130,6 @@ LINPHONE_PUBLIC const LinphoneAddress * linphone_core_get_current_call_remote_ad
* @{
**/
/**
* Global state notification callback.
* @param lc the #LinphoneCore.
* @param gstate the global state
* @param message informational message.
*/
typedef void (*LinphoneCoreCbsGlobalStateChangedCb)(LinphoneCore *lc, LinphoneGlobalState gstate, const char *message);
/**