diff --git a/src/conference/session/call-session.cpp b/src/conference/session/call-session.cpp index 4ff820ab0..b4da30b40 100644 --- a/src/conference/session/call-session.cpp +++ b/src/conference/session/call-session.cpp @@ -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: diff --git a/src/sal/call-op.cpp b/src/sal/call-op.cpp index a73c021ea..936eb983b 100644 --- a/src/sal/call-op.cpp +++ b/src/sal/call-op.cpp @@ -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() { diff --git a/src/sal/call-op.h b/src/sal/call-op.h index 414a808b6..fea958e6d 100644 --- a/src/sal/call-op.h +++ b/src/sal/call-op.h @@ -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); diff --git a/tester/log_collection_tester.c b/tester/log_collection_tester.c index 6027e7d13..b81d43449 100644 --- a/tester/log_collection_tester.c +++ b/tester/log_collection_tester.c @@ -28,9 +28,14 @@ #include #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;