Commit 483d2f0d authored by DanmeiChen's avatar DanmeiChen
Browse files

add callid updated callback

parent 6b572162
......@@ -292,6 +292,14 @@ void linphone_core_cbs_set_call_log_updated(LinphoneCoreCbs *cbs, LinphoneCoreCb
cbs->vtable->call_log_updated = cb;
}
LinphoneCoreCbsCallIdUpdatedCb linphone_core_cbs_get_call_id_updated(LinphoneCoreCbs *cbs) {
return cbs->vtable->call_id_updated;
}
void linphone_core_cbs_set_call_id_updated(LinphoneCoreCbs *cbs, LinphoneCoreCbsCallIdUpdatedCb cb) {
cbs->vtable->call_id_updated = cb;
}
LinphoneCoreCbsChatRoomReadCb linphone_core_cbs_get_chat_room_read(LinphoneCoreCbs *cbs) {
return cbs->vtable->chat_room_read;
}
......
......@@ -562,6 +562,7 @@ void linphone_core_notify_new_subscription_requested(LinphoneCore *lc, LinphoneF
void linphone_core_notify_auth_info_requested(LinphoneCore *lc, const char *realm, const char *username, const char *domain);
void linphone_core_notify_authentication_requested(LinphoneCore *lc, LinphoneAuthInfo *auth_info, LinphoneAuthMethod method);
void linphone_core_notify_call_log_updated(LinphoneCore *lc, LinphoneCallLog *newcl);
void linphone_core_notify_call_id_updated(LinphoneCore *lc, const char*previous, const char *current);
void linphone_core_notify_text_message_received(LinphoneCore *lc, LinphoneChatRoom *room, const LinphoneAddress *from, const char *message);
void linphone_core_notify_message_received(LinphoneCore *lc, LinphoneChatRoom *room, LinphoneChatMessage *message);
void linphone_core_notify_message_sent(LinphoneCore *lc, LinphoneChatRoom *room, LinphoneChatMessage *message);
......
......@@ -163,6 +163,11 @@ void linphone_core_notify_call_log_updated(LinphoneCore *lc, LinphoneCallLog *ne
NOTIFY_IF_EXIST(call_log_updated, lc, newcl);
cleanup_dead_vtable_refs(lc);
}
void linphone_core_notify_call_id_updated(LinphoneCore *lc, const char*previous, const char *current) {
NOTIFY_IF_EXIST(call_id_updated, lc, previous, current);
cleanup_dead_vtable_refs(lc);
}
#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
#pragma GCC diagnostic push
#endif
......
......@@ -170,6 +170,20 @@ typedef void (*LinphoneCoreCbsCallLogUpdatedCb)(LinphoneCore *core, LinphoneCall
*/
typedef LinphoneCoreCbsCallLogUpdatedCb LinphoneCoreCallLogUpdatedCb;
/**
* Callback to notify the callid of a call has been updated.
* This is done typically when a call retry.
* @param core the #LinphoneCore @notnil
* @param previous_call_id the previous callid. @notnil
* @param current_call_id the new callid. @notnil
*/
typedef void (*LinphoneCoreCbsCallIdUpdatedCb)(LinphoneCore *core, const char *previous_call_id, const char *current_call_id);
/**
* Old name of #LinphoneCoreCbsCallIdUpdatedCb.
*/
typedef LinphoneCoreCbsCallIdUpdatedCb LinphoneCoreCallIdUpdatedCb;
/**
* Chat message callback prototype.
* @param core #LinphoneCore object @notnil
......
......@@ -193,6 +193,7 @@ typedef struct _LinphoneCoreVTable{
@deprecated 21/09/2016 Use authentication_requested instead. */
LinphoneCoreAuthenticationRequestedCb authentication_requested; /**< Ask the application some authentication information */
LinphoneCoreCallLogUpdatedCb call_log_updated; /**< Notifies that call log list has been updated */
LinphoneCoreCallIdUpdatedCb call_id_updated;/**< Notifies that callid of a call has been updated */
LinphoneCoreMessageReceivedCb message_received; /**< a message is received, can be text or external body*/
LinphoneCoreCbsMessageReceivedUnableDecryptCb message_received_unable_decrypt; /**< an encrypted message is received but we can't decrypt it*/
LinphoneCoreIsComposingReceivedCb is_composing_received; /**< An is-composing notification has been received */
......@@ -428,6 +429,20 @@ LINPHONE_PUBLIC void linphone_core_cbs_set_call_log_updated(LinphoneCoreCbs *cbs
*/
LINPHONE_PUBLIC LinphoneCoreCbsCallLogUpdatedCb linphone_core_cbs_get_call_log_updated(LinphoneCoreCbs *cbs);
/**
* Set the #LinphoneCoreCbsCallIdUpdatedCb callback.
* @param cbs A #LinphoneCoreCbs. @notnil
* @param cb The callback.
*/
LINPHONE_PUBLIC void linphone_core_cbs_set_call_id_updated(LinphoneCoreCbs *cbs, LinphoneCoreCbsCallIdUpdatedCb cb);
/**
* Get the #LinphoneCoreCbsCallIdUpdatedCb callback.
* @param cbs A #LinphoneCoreCbs. @notnil
* @return The callback.
*/
LINPHONE_PUBLIC LinphoneCoreCbsCallIdUpdatedCb linphone_core_cbs_get_call_id_updated(LinphoneCoreCbs *cbs);
/**
* Set the #LinphoneCoreCbsMessageReceivedCb callback.
* @param cbs A #LinphoneCoreCbs. @notnil
......
......@@ -251,6 +251,7 @@ bool MediaSessionPrivate::failure () {
bool avpfEnabled = getParams()->avpfEnabled();
if (mediaEncrptionSrtp || avpfEnabled) {
lInfo() << "Outgoing CallSession [" << q << "] failed with SRTP and/or AVPF enabled";
string previousCallId = op->getCallId();
for (int i = 0; i < localDesc->nb_streams; i++) {
if (!sal_stream_description_enabled(&localDesc->streams[i]))
......@@ -261,6 +262,7 @@ bool MediaSessionPrivate::failure () {
lInfo() << "Retrying CallSession [" << q << "] with SAVP";
getParams()->enableAvpf(false);
restartInvite();
linphone_core_notify_call_id_updated(q->getCore()->getCCore(), previousCallId.c_str(), op->getCallId().c_str());
return true;
} else if (!linphone_core_is_media_encryption_mandatory(q->getCore()->getCCore())) {
if (i == 0)
......@@ -268,6 +270,7 @@ bool MediaSessionPrivate::failure () {
getParams()->setMediaEncryption(LinphoneMediaEncryptionNone);
memset(localDesc->streams[i].crypto, 0, sizeof(localDesc->streams[i].crypto));
restartInvite();
linphone_core_notify_call_id_updated(q->getCore()->getCCore(), previousCallId.c_str(), op->getCallId().c_str());
return true;
}
} else if (avpfEnabled) {
......@@ -275,6 +278,7 @@ bool MediaSessionPrivate::failure () {
lInfo() << "Retrying CallSession [" << q << "] with AVP";
getParams()->enableAvpf(false);
restartInvite();
linphone_core_notify_call_id_updated(q->getCore()->getCCore(), previousCallId.c_str(), op->getCallId().c_str());
return true;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment