Merge branch 'dev_refactor_cpp' into dev_content_cpp

This commit is contained in:
Sylvain Berfini 2018-03-20 15:39:47 +01:00
commit c001364b39
4 changed files with 23 additions and 8 deletions

View file

@ -820,8 +820,9 @@ void CallSessionPrivate::repairIfBroken () {
case CallSession::State::Pausing:
if (op->dialog_request_pending()) {
// Need to cancel first re-INVITE as described in section 5.5 of RFC 6141
op->cancel_invite();
reinviteOnCancelResponseRequested = true;
if (op->cancel_invite() == 0){
reinviteOnCancelResponseRequested = true;
}
}
break;
case CallSession::State::StreamsRunning:
@ -839,8 +840,9 @@ void CallSessionPrivate::repairIfBroken () {
break;
case CallSession::State::OutgoingInit:
case CallSession::State::OutgoingProgress:
op->cancel_invite();
reinviteOnCancelResponseRequested = true;
if (op->cancel_invite() == 0){
reinviteOnCancelResponseRequested = true;
}
break;
case CallSession::State::OutgoingEarlyMedia:
case CallSession::State::OutgoingRinging:

View file

@ -1120,9 +1120,15 @@ int SalCallOp::update(const char *subject, bool_t no_user_consent) {
return -1;
}
void SalCallOp::cancel_invite_with_info(const SalErrorInfo *info) {
int SalCallOp::cancel_invite_with_info(const SalErrorInfo *info) {
belle_sip_request_t* cancel;
ms_message("Cancelling INVITE request from [%s] to [%s] ",get_from(), get_to());
if (this->pending_client_trans == NULL){
ms_warning("There is no transaction to cancel.");
return -1;
}
cancel = belle_sip_client_transaction_create_cancel(this->pending_client_trans);
if (cancel){
if (info != NULL){
@ -1130,6 +1136,7 @@ void SalCallOp::cancel_invite_with_info(const SalErrorInfo *info) {
belle_sip_message_add_header(BELLE_SIP_MESSAGE(cancel),BELLE_SIP_HEADER(reason));
}
send_request(cancel);
return 0;
}else if (this->dialog){
belle_sip_dialog_state_t state = belle_sip_dialog_get_state(this->dialog);;
/*case where the response received is invalid (could not establish a dialog), but the transaction is not cancellable
@ -1145,6 +1152,7 @@ void SalCallOp::cancel_invite_with_info(const SalErrorInfo *info) {
break;
}
}
return -1;
}
SalMediaDescription *SalCallOp::get_final_media_description() {

View file

@ -45,8 +45,8 @@ public:
int decline(SalReason reason, const char *redirection /*optional*/);
int decline_with_error_info(const SalErrorInfo *info, const SalAddress *redirectionAddr /*optional*/);
int update(const char *subject, bool_t no_user_consent);
void cancel_invite() {cancel_invite_with_info(NULL);}
void cancel_invite_with_info(const SalErrorInfo *info);
int cancel_invite() { return cancel_invite_with_info(NULL);}
int cancel_invite_with_info(const SalErrorInfo *info);
int refer(const char *refer_to_);
int refer_with_replaces(SalCallOp *other_call_op);
int set_referer(SalCallOp *refered_call);

View file

@ -28,9 +28,14 @@
#include <zlib.h>
#endif
#ifdef __ANDROID__
#include "android/api-level.h"
#endif
/*getline is POSIX 2008, not available on many systems.*/
#if (defined(__ANDROID__) && !defined(__LP64__)) || defined(_WIN32) || defined(__QNX__)
/*It is declared since NDK14 unified headers, that can be detected by the presence of __ANDROID_API_O__ define*/
#if (defined(__ANDROID__) && __ANDROID_API__ <= 16) || defined(_WIN32) || defined(__QNX__)
/* This code is public domain -- Will Hartung 4/9/09 */
static ssize_t getline(char **lineptr, size_t *n, FILE *stream) {
char *bufptr = NULL;