mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 11:08:06 +00:00
Use correct naming convention in sal API.
This commit is contained in:
parent
9a4cdb305d
commit
baa4eebbe1
45 changed files with 2373 additions and 2337 deletions
|
|
@ -281,7 +281,7 @@ TunnelManager::~TunnelManager(){
|
|||
mTunnelClient->stop();
|
||||
delete mTunnelClient;
|
||||
}
|
||||
mCore->sal->set_tunnel(NULL);
|
||||
mCore->sal->setTunnel(NULL);
|
||||
linphone_core_remove_listener(mCore, mVTable);
|
||||
linphone_core_v_table_destroy(mVTable);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -472,10 +472,10 @@ void linphone_core_add_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *info)
|
|||
lc->auth_info=bctbx_list_append(lc->auth_info,linphone_auth_info_clone(info));
|
||||
|
||||
/* retry pending authentication operations */
|
||||
for(l=elem=lc->sal->get_pending_auths();elem!=NULL;elem=elem->next){
|
||||
for(l=elem=lc->sal->getPendingAuths();elem!=NULL;elem=elem->next){
|
||||
LinphonePrivate::SalOp *op= static_cast<LinphonePrivate::SalOp*>(elem->data);
|
||||
LinphoneAuthInfo *ai;
|
||||
const SalAuthInfo *req_sai=op->get_auth_requested();
|
||||
const SalAuthInfo *req_sai=op->getAuthRequested();
|
||||
ai=(LinphoneAuthInfo*)_linphone_core_find_auth_info(lc,req_sai->realm,req_sai->username,req_sai->domain, FALSE);
|
||||
if (ai){
|
||||
SalAuthInfo sai;
|
||||
|
|
@ -495,7 +495,7 @@ void linphone_core_add_auth_info(LinphoneCore *lc, const LinphoneAuthInfo *info)
|
|||
}
|
||||
/*proxy case*/
|
||||
for (proxy=(bctbx_list_t*)linphone_core_get_proxy_config_list(lc);proxy!=NULL;proxy=proxy->next) {
|
||||
if (proxy->data == op->get_user_pointer()) {
|
||||
if (proxy->data == op->getUserPointer()) {
|
||||
linphone_proxy_config_set_state((LinphoneProxyConfig*)(proxy->data),LinphoneRegistrationProgress,"Authentication...");
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ using namespace LinphonePrivate;
|
|||
static void register_failure(SalOp *op);
|
||||
|
||||
static void call_received(SalCallOp *h) {
|
||||
LinphoneCore *lc = reinterpret_cast<LinphoneCore *>(h->get_sal()->get_user_pointer());
|
||||
LinphoneCore *lc = reinterpret_cast<LinphoneCore *>(h->getSal()->getUserPointer());
|
||||
|
||||
if (linphone_core_get_global_state(lc) != LinphoneGlobalOn) {
|
||||
h->decline(SalReasonServiceUnavailable, nullptr);
|
||||
|
|
@ -71,13 +71,13 @@ static void call_received(SalCallOp *h) {
|
|||
return;
|
||||
|
||||
LinphoneAddress *fromAddr = nullptr;
|
||||
const char *pAssertedId = sal_custom_header_find(h->get_recv_custom_header(), "P-Asserted-Identity");
|
||||
const char *pAssertedId = sal_custom_header_find(h->getRecvCustomHeaders(), "P-Asserted-Identity");
|
||||
/* In some situation, better to trust the network rather than the UAC */
|
||||
if (lp_config_get_int(linphone_core_get_config(lc), "sip", "call_logs_use_asserted_id_instead_of_from", 0)) {
|
||||
if (pAssertedId) {
|
||||
LinphoneAddress *pAssertedIdAddr = linphone_address_new(pAssertedId);
|
||||
if (pAssertedIdAddr) {
|
||||
ms_message("Using P-Asserted-Identity [%s] instead of from [%s] for op [%p]", pAssertedId, h->get_from(), h);
|
||||
ms_message("Using P-Asserted-Identity [%s] instead of from [%s] for op [%p]", pAssertedId, h->getFrom(), h);
|
||||
fromAddr = pAssertedIdAddr;
|
||||
} else
|
||||
ms_warning("Unsupported P-Asserted-Identity header for op [%p] ", h);
|
||||
|
|
@ -86,20 +86,20 @@ static void call_received(SalCallOp *h) {
|
|||
}
|
||||
|
||||
if (!fromAddr)
|
||||
fromAddr = linphone_address_new(h->get_from());
|
||||
LinphoneAddress *toAddr = linphone_address_new(h->get_to());
|
||||
fromAddr = linphone_address_new(h->getFrom());
|
||||
LinphoneAddress *toAddr = linphone_address_new(h->getTo());
|
||||
|
||||
if (_linphone_core_is_conference_creation(lc, toAddr)) {
|
||||
linphone_address_unref(toAddr);
|
||||
linphone_address_unref(fromAddr);
|
||||
if (sal_address_has_param(h->get_remote_contact_address(), "text")) {
|
||||
if (sal_address_has_param(h->getRemoteContactAddress(), "text")) {
|
||||
bool oneToOneChatRoom = false;
|
||||
const char *oneToOneChatRoomStr = sal_custom_header_find(h->get_recv_custom_header(), "One-To-One-Chat-Room");
|
||||
const char *oneToOneChatRoomStr = sal_custom_header_find(h->getRecvCustomHeaders(), "One-To-One-Chat-Room");
|
||||
if (oneToOneChatRoomStr && (strcmp(oneToOneChatRoomStr, "true") == 0))
|
||||
oneToOneChatRoom = true;
|
||||
if (oneToOneChatRoom) {
|
||||
IdentityAddress from(h->get_from());
|
||||
list<IdentityAddress> identAddresses = ServerGroupChatRoom::parseResourceLists(h->get_remote_body());
|
||||
IdentityAddress from(h->getFrom());
|
||||
list<IdentityAddress> identAddresses = ServerGroupChatRoom::parseResourceLists(h->getRemoteBody());
|
||||
if (identAddresses.size() != 1) {
|
||||
h->decline(SalReasonNotAcceptable, nullptr);
|
||||
h->release();
|
||||
|
|
@ -116,12 +116,12 @@ static void call_received(SalCallOp *h) {
|
|||
}
|
||||
// TODO: handle media conference creation if the "text" feature tag is not present
|
||||
return;
|
||||
} else if (sal_address_has_param(h->get_remote_contact_address(), "text")) {
|
||||
} else if (sal_address_has_param(h->getRemoteContactAddress(), "text")) {
|
||||
linphone_address_unref(toAddr);
|
||||
linphone_address_unref(fromAddr);
|
||||
if (linphone_core_conference_server_enabled(lc)) {
|
||||
shared_ptr<AbstractChatRoom> chatRoom = L_GET_CPP_PTR_FROM_C_OBJECT(lc)->findChatRoom(
|
||||
ChatRoomId(IdentityAddress(h->get_to()), IdentityAddress(h->get_to()))
|
||||
ChatRoomId(IdentityAddress(h->getTo()), IdentityAddress(h->getTo()))
|
||||
);
|
||||
if (chatRoom) {
|
||||
L_GET_PRIVATE(static_pointer_cast<ServerGroupChatRoom>(chatRoom))->confirmJoining(h);
|
||||
|
|
@ -132,11 +132,11 @@ static void call_received(SalCallOp *h) {
|
|||
}
|
||||
} else {
|
||||
shared_ptr<AbstractChatRoom> chatRoom = L_GET_CPP_PTR_FROM_C_OBJECT(lc)->findChatRoom(
|
||||
ChatRoomId(IdentityAddress(h->get_from()), IdentityAddress(h->get_to()))
|
||||
ChatRoomId(IdentityAddress(h->getFrom()), IdentityAddress(h->getTo()))
|
||||
);
|
||||
if (!chatRoom) {
|
||||
chatRoom = L_GET_PRIVATE_FROM_C_OBJECT(lc)->createClientGroupChatRoom(
|
||||
L_C_TO_STRING(h->get_subject()), h->get_remote_contact(), h->get_remote_body(), false
|
||||
L_C_TO_STRING(h->getSubject()), h->getRemoteContact(), h->getRemoteBody(), false
|
||||
);
|
||||
}
|
||||
L_GET_PRIVATE(static_pointer_cast<ClientGroupChatRoom>(chatRoom))->confirmJoining(h);
|
||||
|
|
@ -159,7 +159,7 @@ static void call_received(SalCallOp *h) {
|
|||
memset(&sei, 0, sizeof(sei));
|
||||
sal_error_info_set(&sei, SalReasonRedirect, "SIP", 0, nullptr, nullptr);
|
||||
SalAddress *altAddr = sal_address_new(altContact);
|
||||
h->decline_with_error_info(&sei, altAddr);
|
||||
h->declineWithErrorInfo(&sei, altAddr);
|
||||
ms_free(altContact);
|
||||
sal_address_unref(altAddr);
|
||||
LinphoneErrorInfo *ei = linphone_error_info_new();
|
||||
|
|
@ -187,7 +187,7 @@ static void call_received(SalCallOp *h) {
|
|||
|
||||
/* Check if I'm the caller */
|
||||
LinphoneAddress *fromAddressToSearchIfMe = nullptr;
|
||||
if (h->get_privacy() == SalPrivacyNone)
|
||||
if (h->getPrivacy() == SalPrivacyNone)
|
||||
fromAddressToSearchIfMe = linphone_address_clone(fromAddr);
|
||||
else if (pAssertedId)
|
||||
fromAddressToSearchIfMe = linphone_address_new(pAssertedId);
|
||||
|
|
@ -215,14 +215,14 @@ static void call_received(SalCallOp *h) {
|
|||
}
|
||||
|
||||
static void call_rejected(SalCallOp *h){
|
||||
LinphoneCore *lc=(LinphoneCore *)h->get_sal()->get_user_pointer();
|
||||
LinphoneCore *lc = reinterpret_cast<LinphoneCore *>(h->getSal()->getUserPointer());
|
||||
LinphoneErrorInfo *ei = linphone_error_info_new();
|
||||
linphone_error_info_from_sal_op(ei, h);
|
||||
linphone_core_report_early_failed_call(lc, LinphoneCallIncoming, linphone_address_new(h->get_from()), linphone_address_new(h->get_to()), ei);
|
||||
linphone_core_report_early_failed_call(lc, LinphoneCallIncoming, linphone_address_new(h->getFrom()), linphone_address_new(h->getTo()), ei);
|
||||
}
|
||||
|
||||
static void call_ringing(SalOp *h) {
|
||||
LinphonePrivate::CallSession *session = reinterpret_cast<LinphonePrivate::CallSession *>(h->get_user_pointer());
|
||||
LinphonePrivate::CallSession *session = reinterpret_cast<LinphonePrivate::CallSession *>(h->getUserPointer());
|
||||
if (!session) return;
|
||||
auto sessionRef = session->getSharedFromThis();
|
||||
L_GET_PRIVATE(sessionRef)->remoteRinging();
|
||||
|
|
@ -234,7 +234,7 @@ static void call_ringing(SalOp *h) {
|
|||
* - when a request is accepted (pause, resume)
|
||||
*/
|
||||
static void call_accepted(SalOp *op) {
|
||||
LinphonePrivate::CallSession *session = reinterpret_cast<LinphonePrivate::CallSession *>(op->get_user_pointer());
|
||||
LinphonePrivate::CallSession *session = reinterpret_cast<LinphonePrivate::CallSession *>(op->getUserPointer());
|
||||
if (!session) {
|
||||
ms_warning("call_accepted: CallSession no longer exists");
|
||||
return;
|
||||
|
|
@ -245,7 +245,7 @@ static void call_accepted(SalOp *op) {
|
|||
|
||||
/* this callback is called when an incoming re-INVITE/ SIP UPDATE modifies the session*/
|
||||
static void call_updating(SalOp *op, bool_t is_update) {
|
||||
LinphonePrivate::CallSession *session = reinterpret_cast<LinphonePrivate::CallSession *>(op->get_user_pointer());
|
||||
LinphonePrivate::CallSession *session = reinterpret_cast<LinphonePrivate::CallSession *>(op->getUserPointer());
|
||||
if (!session) {
|
||||
ms_warning("call_updating: CallSession no longer exists");
|
||||
return;
|
||||
|
|
@ -256,7 +256,7 @@ static void call_updating(SalOp *op, bool_t is_update) {
|
|||
|
||||
|
||||
static void call_ack_received(SalOp *op, SalCustomHeader *ack) {
|
||||
LinphonePrivate::CallSession *session = reinterpret_cast<LinphonePrivate::CallSession *>(op->get_user_pointer());
|
||||
LinphonePrivate::CallSession *session = reinterpret_cast<LinphonePrivate::CallSession *>(op->getUserPointer());
|
||||
if (!session) {
|
||||
ms_warning("call_ack_received(): no CallSession for which an ack is expected");
|
||||
return;
|
||||
|
|
@ -267,7 +267,7 @@ static void call_ack_received(SalOp *op, SalCustomHeader *ack) {
|
|||
|
||||
|
||||
static void call_ack_being_sent(SalOp *op, SalCustomHeader *ack) {
|
||||
LinphonePrivate::CallSession *session = reinterpret_cast<LinphonePrivate::CallSession *>(op->get_user_pointer());
|
||||
LinphonePrivate::CallSession *session = reinterpret_cast<LinphonePrivate::CallSession *>(op->getUserPointer());
|
||||
if (!session) {
|
||||
ms_warning("call_ack_being_sent(): no CallSession for which an ack is supposed to be sent");
|
||||
return;
|
||||
|
|
@ -277,7 +277,7 @@ static void call_ack_being_sent(SalOp *op, SalCustomHeader *ack) {
|
|||
}
|
||||
|
||||
static void call_terminated(SalOp *op, const char *from) {
|
||||
LinphonePrivate::CallSession *session = reinterpret_cast<LinphonePrivate::CallSession *>(op->get_user_pointer());
|
||||
LinphonePrivate::CallSession *session = reinterpret_cast<LinphonePrivate::CallSession *>(op->getUserPointer());
|
||||
if (!session)
|
||||
return;
|
||||
auto sessionRef = session->getSharedFromThis();
|
||||
|
|
@ -285,7 +285,7 @@ static void call_terminated(SalOp *op, const char *from) {
|
|||
}
|
||||
|
||||
static void call_failure(SalOp *op) {
|
||||
LinphonePrivate::CallSession *session = reinterpret_cast<LinphonePrivate::CallSession *>(op->get_user_pointer());
|
||||
LinphonePrivate::CallSession *session = reinterpret_cast<LinphonePrivate::CallSession *>(op->getUserPointer());
|
||||
if (!session) {
|
||||
ms_warning("Failure reported on already terminated CallSession");
|
||||
return;
|
||||
|
|
@ -295,7 +295,7 @@ static void call_failure(SalOp *op) {
|
|||
}
|
||||
|
||||
static void call_released(SalOp *op) {
|
||||
LinphonePrivate::CallSession *session = reinterpret_cast<LinphonePrivate::CallSession *>(op->get_user_pointer());
|
||||
LinphonePrivate::CallSession *session = reinterpret_cast<LinphonePrivate::CallSession *>(op->getUserPointer());
|
||||
if (!session) {
|
||||
/* We can get here when the core manages call at Sal level without creating a Call object. Typicially,
|
||||
* when declining an incoming call with busy because maximum number of calls is reached. */
|
||||
|
|
@ -306,7 +306,7 @@ static void call_released(SalOp *op) {
|
|||
}
|
||||
|
||||
static void call_cancel_done(SalOp *op) {
|
||||
LinphonePrivate::CallSession *session = reinterpret_cast<LinphonePrivate::CallSession *>(op->get_user_pointer());
|
||||
LinphonePrivate::CallSession *session = reinterpret_cast<LinphonePrivate::CallSession *>(op->getUserPointer());
|
||||
if (!session) {
|
||||
ms_warning("Cancel done reported on already terminated CallSession");
|
||||
return;
|
||||
|
|
@ -316,7 +316,7 @@ static void call_cancel_done(SalOp *op) {
|
|||
}
|
||||
|
||||
static void auth_failure(SalOp *op, SalAuthInfo* info) {
|
||||
LinphoneCore *lc = reinterpret_cast<LinphoneCore *>(op->get_sal()->get_user_pointer());
|
||||
LinphoneCore *lc = reinterpret_cast<LinphoneCore *>(op->getSal()->getUserPointer());
|
||||
LinphoneAuthInfo *ai = NULL;
|
||||
|
||||
if (info != NULL) {
|
||||
|
|
@ -335,7 +335,7 @@ static void auth_failure(SalOp *op, SalAuthInfo* info) {
|
|||
}
|
||||
|
||||
static void register_success(SalOp *op, bool_t registered){
|
||||
LinphoneProxyConfig *cfg=(LinphoneProxyConfig *)op->get_user_pointer();
|
||||
LinphoneProxyConfig *cfg=(LinphoneProxyConfig *)op->getUserPointer();
|
||||
if (!cfg){
|
||||
ms_message("Registration success for deleted proxy config, ignored");
|
||||
return;
|
||||
|
|
@ -345,8 +345,8 @@ static void register_success(SalOp *op, bool_t registered){
|
|||
}
|
||||
|
||||
static void register_failure(SalOp *op){
|
||||
LinphoneProxyConfig *cfg=(LinphoneProxyConfig*)op->get_user_pointer();
|
||||
const SalErrorInfo *ei=op->get_error_info();
|
||||
LinphoneProxyConfig *cfg=(LinphoneProxyConfig*)op->getUserPointer();
|
||||
const SalErrorInfo *ei=op->getErrorInfo();
|
||||
const char *details=ei->full_string;
|
||||
|
||||
if (cfg==NULL){
|
||||
|
|
@ -371,7 +371,7 @@ static void register_failure(SalOp *op){
|
|||
}
|
||||
|
||||
static void vfu_request(SalOp *op) {
|
||||
LinphonePrivate::CallSession *session = reinterpret_cast<LinphonePrivate::CallSession *>(op->get_user_pointer());
|
||||
LinphonePrivate::CallSession *session = reinterpret_cast<LinphonePrivate::CallSession *>(op->getUserPointer());
|
||||
if (!session)
|
||||
return;
|
||||
auto sessionRef = session->getSharedFromThis();
|
||||
|
|
@ -384,7 +384,7 @@ static void vfu_request(SalOp *op) {
|
|||
}
|
||||
|
||||
static void dtmf_received(SalOp *op, char dtmf) {
|
||||
LinphonePrivate::CallSession *session = reinterpret_cast<LinphonePrivate::CallSession *>(op->get_user_pointer());
|
||||
LinphonePrivate::CallSession *session = reinterpret_cast<LinphonePrivate::CallSession *>(op->getUserPointer());
|
||||
if (!session)
|
||||
return;
|
||||
auto sessionRef = session->getSharedFromThis();
|
||||
|
|
@ -397,7 +397,7 @@ static void dtmf_received(SalOp *op, char dtmf) {
|
|||
}
|
||||
|
||||
static void call_refer_received(SalOp *op, const SalAddress *referTo) {
|
||||
LinphonePrivate::CallSession *session = reinterpret_cast<LinphonePrivate::CallSession *>(op->get_user_pointer());
|
||||
LinphonePrivate::CallSession *session = reinterpret_cast<LinphonePrivate::CallSession *>(op->getUserPointer());
|
||||
char *addrStr = sal_address_as_string_uri_only(referTo);
|
||||
Address referToAddr(addrStr);
|
||||
string method;
|
||||
|
|
@ -407,21 +407,21 @@ static void call_refer_received(SalOp *op, const SalAddress *referTo) {
|
|||
auto sessionRef = session->getSharedFromThis();
|
||||
L_GET_PRIVATE(sessionRef)->referred(referToAddr);
|
||||
} else {
|
||||
LinphoneCore *lc = reinterpret_cast<LinphoneCore *>(op->get_sal()->get_user_pointer());
|
||||
LinphoneCore *lc = reinterpret_cast<LinphoneCore *>(op->getSal()->getUserPointer());
|
||||
linphone_core_notify_refer_received(lc, addrStr);
|
||||
}
|
||||
bctbx_free(addrStr);
|
||||
}
|
||||
|
||||
static void message_received(SalOp *op, const SalMessage *msg){
|
||||
LinphoneCore *lc=(LinphoneCore *)op->get_sal()->get_user_pointer();
|
||||
LinphoneCore *lc=(LinphoneCore *)op->getSal()->getUserPointer();
|
||||
|
||||
if (linphone_core_get_global_state(lc) != LinphoneGlobalOn) {
|
||||
static_cast<SalMessageOp *>(op)->reply(SalReasonServiceUnavailable);
|
||||
return;
|
||||
}
|
||||
|
||||
LinphoneCall *call=(LinphoneCall*)op->get_user_pointer();
|
||||
LinphoneCall *call=(LinphoneCall*)op->getUserPointer();
|
||||
LinphoneReason reason = lc->chat_deny_code;
|
||||
if (reason == LinphoneReasonNone) {
|
||||
linphone_core_message_received(lc, op, msg);
|
||||
|
|
@ -447,12 +447,12 @@ static void convert_presence_to_xml_requested(SalOp *op, SalPresenceModel *prese
|
|||
}
|
||||
|
||||
static void notify_presence(SalOp *op, SalSubscribeStatus ss, SalPresenceModel *model, const char *msg){
|
||||
LinphoneCore *lc=(LinphoneCore *)op->get_sal()->get_user_pointer();
|
||||
LinphoneCore *lc=(LinphoneCore *)op->getSal()->getUserPointer();
|
||||
linphone_notify_recv(lc,op,ss,model);
|
||||
}
|
||||
|
||||
static void subscribe_presence_received(SalPresenceOp *op, const char *from){
|
||||
LinphoneCore *lc=(LinphoneCore *)op->get_sal()->get_user_pointer();
|
||||
LinphoneCore *lc=(LinphoneCore *)op->getSal()->getUserPointer();
|
||||
if (linphone_core_get_global_state(lc) != LinphoneGlobalOn) {
|
||||
op->decline(SalReasonServiceUnavailable);
|
||||
return;
|
||||
|
|
@ -461,12 +461,12 @@ static void subscribe_presence_received(SalPresenceOp *op, const char *from){
|
|||
}
|
||||
|
||||
static void subscribe_presence_closed(SalPresenceOp *op, const char *from){
|
||||
LinphoneCore *lc=(LinphoneCore *)op->get_sal()->get_user_pointer();
|
||||
LinphoneCore *lc=(LinphoneCore *)op->getSal()->getUserPointer();
|
||||
linphone_subscription_closed(lc,op);
|
||||
}
|
||||
|
||||
static void ping_reply(SalOp *op) {
|
||||
LinphonePrivate::CallSession *session = reinterpret_cast<LinphonePrivate::CallSession *>(op->get_user_pointer());
|
||||
LinphonePrivate::CallSession *session = reinterpret_cast<LinphonePrivate::CallSession *>(op->getUserPointer());
|
||||
if (!session) {
|
||||
ms_warning("Ping reply without CallSession attached...");
|
||||
return;
|
||||
|
|
@ -552,7 +552,7 @@ static bool_t fill_auth_info(LinphoneCore *lc, SalAuthInfo* sai) {
|
|||
}
|
||||
}
|
||||
static bool_t auth_requested(Sal* sal, SalAuthInfo* sai) {
|
||||
LinphoneCore *lc = (LinphoneCore *)sal->get_user_pointer();
|
||||
LinphoneCore *lc = (LinphoneCore *)sal->getUserPointer();
|
||||
if (fill_auth_info(lc,sai)) {
|
||||
return TRUE;
|
||||
} else {
|
||||
|
|
@ -570,7 +570,7 @@ static bool_t auth_requested(Sal* sal, SalAuthInfo* sai) {
|
|||
}
|
||||
|
||||
static void notify_refer(SalOp *op, SalReferStatus status) {
|
||||
LinphonePrivate::CallSession *session = reinterpret_cast<LinphonePrivate::CallSession *>(op->get_user_pointer());
|
||||
LinphonePrivate::CallSession *session = reinterpret_cast<LinphonePrivate::CallSession *>(op->getUserPointer());
|
||||
if (!session) {
|
||||
ms_warning("Receiving notify_refer for unknown CallSession");
|
||||
return;
|
||||
|
|
@ -607,13 +607,13 @@ static LinphoneChatMessageState chatStatusSal2Linphone(SalMessageDeliveryStatus
|
|||
}
|
||||
|
||||
static void message_delivery_update(SalOp *op, SalMessageDeliveryStatus status) {
|
||||
auto lc = reinterpret_cast<LinphoneCore *>(op->get_sal()->get_user_pointer());
|
||||
auto lc = reinterpret_cast<LinphoneCore *>(op->getSal()->getUserPointer());
|
||||
if (linphone_core_get_global_state(lc) != LinphoneGlobalOn) {
|
||||
static_cast<SalReferOp *>(op)->reply(SalReasonDeclined);
|
||||
return;
|
||||
}
|
||||
|
||||
LinphonePrivate::ChatMessage *msg = reinterpret_cast<LinphonePrivate::ChatMessage *>(op->get_user_pointer());
|
||||
LinphonePrivate::ChatMessage *msg = reinterpret_cast<LinphonePrivate::ChatMessage *>(op->getUserPointer());
|
||||
if (!msg)
|
||||
return; // Do not handle delivery status for isComposing messages.
|
||||
|
||||
|
|
@ -623,7 +623,7 @@ static void message_delivery_update(SalOp *op, SalMessageDeliveryStatus status)
|
|||
}
|
||||
|
||||
static void info_received(SalOp *op, SalBodyHandler *body_handler) {
|
||||
LinphonePrivate::CallSession *session = reinterpret_cast<LinphonePrivate::CallSession *>(op->get_user_pointer());
|
||||
LinphonePrivate::CallSession *session = reinterpret_cast<LinphonePrivate::CallSession *>(op->getUserPointer());
|
||||
if (!session)
|
||||
return;
|
||||
auto sessionRef = session->getSharedFromThis();
|
||||
|
|
@ -631,7 +631,7 @@ static void info_received(SalOp *op, SalBodyHandler *body_handler) {
|
|||
}
|
||||
|
||||
static void subscribe_response(SalOp *op, SalSubscribeStatus status, int will_retry){
|
||||
LinphoneEvent *lev=(LinphoneEvent*)op->get_user_pointer();
|
||||
LinphoneEvent *lev=(LinphoneEvent*)op->getUserPointer();
|
||||
|
||||
if (lev==NULL) return;
|
||||
|
||||
|
|
@ -648,8 +648,8 @@ static void subscribe_response(SalOp *op, SalSubscribeStatus status, int will_re
|
|||
}
|
||||
|
||||
static void notify(SalSubscribeOp *op, SalSubscribeStatus st, const char *eventname, SalBodyHandler *body_handler){
|
||||
LinphoneEvent *lev=(LinphoneEvent*)op->get_user_pointer();
|
||||
LinphoneCore *lc=(LinphoneCore *)op->get_sal()->get_user_pointer();
|
||||
LinphoneEvent *lev=(LinphoneEvent*)op->getUserPointer();
|
||||
LinphoneCore *lc=(LinphoneCore *)op->getSal()->getUserPointer();
|
||||
bool_t out_of_dialog = (lev==NULL);
|
||||
if (out_of_dialog) {
|
||||
/*out of dialog notify */
|
||||
|
|
@ -671,8 +671,8 @@ static void notify(SalSubscribeOp *op, SalSubscribeStatus st, const char *eventn
|
|||
}
|
||||
|
||||
static void subscribe_received(SalSubscribeOp *op, const char *eventname, const SalBodyHandler *body_handler){
|
||||
LinphoneEvent *lev=(LinphoneEvent*)op->get_user_pointer();
|
||||
LinphoneCore *lc=(LinphoneCore *)op->get_sal()->get_user_pointer();
|
||||
LinphoneEvent *lev=(LinphoneEvent*)op->getUserPointer();
|
||||
LinphoneCore *lc=(LinphoneCore *)op->getSal()->getUserPointer();
|
||||
|
||||
if (linphone_core_get_global_state(lc) != LinphoneGlobalOn) {
|
||||
op->decline(SalReasonServiceUnavailable);
|
||||
|
|
@ -689,14 +689,14 @@ static void subscribe_received(SalSubscribeOp *op, const char *eventname, const
|
|||
}
|
||||
|
||||
static void incoming_subscribe_closed(SalOp *op){
|
||||
LinphoneEvent *lev=(LinphoneEvent*)op->get_user_pointer();
|
||||
LinphoneEvent *lev=(LinphoneEvent*)op->getUserPointer();
|
||||
|
||||
linphone_event_set_state(lev,LinphoneSubscriptionTerminated);
|
||||
}
|
||||
|
||||
static void on_publish_response(SalOp* op){
|
||||
LinphoneEvent *lev=(LinphoneEvent*)op->get_user_pointer();
|
||||
const SalErrorInfo *ei=op->get_error_info();
|
||||
LinphoneEvent *lev=(LinphoneEvent*)op->getUserPointer();
|
||||
const SalErrorInfo *ei=op->getErrorInfo();
|
||||
|
||||
if (lev==NULL) return;
|
||||
if (ei->reason==SalReasonNone){
|
||||
|
|
@ -715,7 +715,7 @@ static void on_publish_response(SalOp* op){
|
|||
|
||||
|
||||
static void on_expire(SalOp *op){
|
||||
LinphoneEvent *lev=(LinphoneEvent*)op->get_user_pointer();
|
||||
LinphoneEvent *lev=(LinphoneEvent*)op->getUserPointer();
|
||||
|
||||
if (lev==NULL) return;
|
||||
|
||||
|
|
@ -727,14 +727,14 @@ static void on_expire(SalOp *op){
|
|||
}
|
||||
|
||||
static void on_notify_response(SalOp *op){
|
||||
LinphoneEvent *lev=(LinphoneEvent*)op->get_user_pointer();
|
||||
LinphoneEvent *lev=(LinphoneEvent*)op->getUserPointer();
|
||||
if (!lev)
|
||||
return;
|
||||
|
||||
if (lev->is_out_of_dialog_op) {
|
||||
switch (linphone_event_get_subscription_state(lev)) {
|
||||
case LinphoneSubscriptionIncomingReceived:
|
||||
if (op->get_error_info()->reason == SalReasonNone)
|
||||
if (op->getErrorInfo()->reason == SalReasonNone)
|
||||
linphone_event_set_state(lev, LinphoneSubscriptionTerminated);
|
||||
else
|
||||
linphone_event_set_state(lev, LinphoneSubscriptionError);
|
||||
|
|
@ -756,7 +756,7 @@ static void refer_received(SalOp *op, const SalAddress *refer_to){
|
|||
LinphonePrivate::Address addr(refer_uri);
|
||||
bctbx_free(refer_uri);
|
||||
if (addr.isValid()) {
|
||||
LinphoneCore *lc = reinterpret_cast<LinphoneCore *>(op->get_sal()->get_user_pointer());
|
||||
LinphoneCore *lc = reinterpret_cast<LinphoneCore *>(op->getSal()->getUserPointer());
|
||||
|
||||
if (linphone_core_get_global_state(lc) != LinphoneGlobalOn) {
|
||||
static_cast<SalReferOp *>(op)->reply(SalReasonDeclined);
|
||||
|
|
@ -767,10 +767,10 @@ static void refer_received(SalOp *op, const SalAddress *refer_to){
|
|||
if (linphone_core_conference_server_enabled(lc)) {
|
||||
// Removal of a participant at the server side
|
||||
shared_ptr<AbstractChatRoom> chatRoom = L_GET_CPP_PTR_FROM_C_OBJECT(lc)->findChatRoom(
|
||||
ChatRoomId(IdentityAddress(op->get_to()), IdentityAddress(op->get_to()))
|
||||
ChatRoomId(IdentityAddress(op->getTo()), IdentityAddress(op->getTo()))
|
||||
);
|
||||
if (chatRoom) {
|
||||
std::shared_ptr<Participant> participant = chatRoom->findParticipant(IdentityAddress(op->get_from()));
|
||||
std::shared_ptr<Participant> participant = chatRoom->findParticipant(IdentityAddress(op->getFrom()));
|
||||
if (!participant || !participant->isAdmin()) {
|
||||
static_cast<SalReferOp *>(op)->reply(SalReasonDeclined);
|
||||
return;
|
||||
|
|
@ -784,7 +784,7 @@ static void refer_received(SalOp *op, const SalAddress *refer_to){
|
|||
} else {
|
||||
// The server asks a participant to leave a chat room
|
||||
LinphoneChatRoom *cr = L_GET_C_BACK_PTR(
|
||||
L_GET_CPP_PTR_FROM_C_OBJECT(lc)->findChatRoom(ChatRoomId(addr, IdentityAddress(op->get_to())))
|
||||
L_GET_CPP_PTR_FROM_C_OBJECT(lc)->findChatRoom(ChatRoomId(addr, IdentityAddress(op->getTo())))
|
||||
);
|
||||
if (cr) {
|
||||
L_GET_CPP_PTR_FROM_C_OBJECT(cr)->leave();
|
||||
|
|
@ -796,11 +796,11 @@ static void refer_received(SalOp *op, const SalAddress *refer_to){
|
|||
} else {
|
||||
if (linphone_core_conference_server_enabled(lc)) {
|
||||
shared_ptr<AbstractChatRoom> chatRoom = L_GET_CPP_PTR_FROM_C_OBJECT(lc)->findChatRoom(
|
||||
ChatRoomId(IdentityAddress(op->get_to()), IdentityAddress(op->get_to()))
|
||||
ChatRoomId(IdentityAddress(op->getTo()), IdentityAddress(op->getTo()))
|
||||
);
|
||||
LinphoneChatRoom *cr = L_GET_C_BACK_PTR(chatRoom);
|
||||
if (cr) {
|
||||
Address fromAddr(op->get_from());
|
||||
Address fromAddr(op->getFrom());
|
||||
shared_ptr<Participant> participant = chatRoom->findParticipant(fromAddr);
|
||||
if (!participant || !participant->isAdmin()) {
|
||||
static_cast<SalReferOp *>(op)->reply(SalReasonDeclined);
|
||||
|
|
@ -820,7 +820,7 @@ static void refer_received(SalOp *op, const SalAddress *refer_to){
|
|||
list<IdentityAddress> identAddresses;
|
||||
identAddresses.push_back(addr);
|
||||
L_GET_PRIVATE(static_pointer_cast<ServerGroupChatRoom>(chatRoom))->checkCompatibleParticipants(
|
||||
IdentityAddress(op->get_remote_contact()),
|
||||
IdentityAddress(op->getRemoteContact()),
|
||||
identAddresses
|
||||
);
|
||||
static_cast<SalReferOp *>(op)->reply(SalReasonNone);
|
||||
|
|
@ -830,7 +830,7 @@ static void refer_received(SalOp *op, const SalAddress *refer_to){
|
|||
}
|
||||
} else {
|
||||
shared_ptr<AbstractChatRoom> chatRoom = L_GET_CPP_PTR_FROM_C_OBJECT(lc)->findChatRoom(
|
||||
ChatRoomId(addr, IdentityAddress(op->get_to()))
|
||||
ChatRoomId(addr, IdentityAddress(op->getTo()))
|
||||
);
|
||||
if (!chatRoom)
|
||||
chatRoom = L_GET_PRIVATE_FROM_C_OBJECT(lc)->createClientGroupChatRoom("", addr.asString(), Content(), false);
|
||||
|
|
|
|||
|
|
@ -573,7 +573,7 @@ static char* generate_url_from_server_address_and_uid(const char *server_url) {
|
|||
char *result = NULL;
|
||||
if (server_url) {
|
||||
char *uuid = reinterpret_cast<char *>(ms_malloc(64));
|
||||
if (LinphonePrivate::Sal::generate_uuid(uuid, 64) == 0) {
|
||||
if (LinphonePrivate::Sal::generateUuid(uuid, 64) == 0) {
|
||||
char *url = reinterpret_cast<char *>(ms_malloc(300));
|
||||
snprintf(url, 300, "%s/linphone-%s.vcf", server_url, uuid);
|
||||
ms_debug("Generated url is %s", url);
|
||||
|
|
|
|||
|
|
@ -127,10 +127,10 @@ int linphone_core_message_received(LinphoneCore *lc, LinphonePrivate::SalOp *op,
|
|||
const char *peerAddress;
|
||||
const char *localAddress;
|
||||
if (linphone_core_conference_server_enabled(lc)) {
|
||||
localAddress = peerAddress = op->get_to();
|
||||
localAddress = peerAddress = op->getTo();
|
||||
} else {
|
||||
peerAddress = op->get_from();
|
||||
localAddress = op->get_to();
|
||||
peerAddress = op->getFrom();
|
||||
localAddress = op->getTo();
|
||||
}
|
||||
|
||||
shared_ptr<LinphonePrivate::AbstractChatRoom> chatRoom = L_GET_CPP_PTR_FROM_C_OBJECT(lc)->findChatRoom(
|
||||
|
|
|
|||
|
|
@ -207,9 +207,9 @@ void linphone_error_info_from_sal_op(LinphoneErrorInfo *ei, const LinphonePrivat
|
|||
}else{
|
||||
const SalErrorInfo *sei;
|
||||
linphone_error_info_reset(ei);
|
||||
sei = op->get_error_info();
|
||||
sei = op->getErrorInfo();
|
||||
linphone_error_info_from_sal(ei, sei);
|
||||
sei = op->get_reason_error_info();
|
||||
sei = op->getReasonErrorInfo();
|
||||
linphone_error_info_from_sal_reason_ei(ei, sei);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ void linphone_event_cbs_set_notify_response(LinphoneEventCbs *cbs, LinphoneEvent
|
|||
static void linphone_event_release(LinphoneEvent *lev){
|
||||
if (lev->op) {
|
||||
/*this will stop the refresher*/
|
||||
lev->op->stop_refreshing();
|
||||
lev->op->stopRefreshing();
|
||||
}
|
||||
linphone_event_unref(lev);
|
||||
}
|
||||
|
|
@ -133,7 +133,7 @@ static LinphoneEvent * linphone_event_new_base(LinphoneCore *lc, LinphoneSubscri
|
|||
lev->name=ms_strdup(name);
|
||||
if (strcmp(lev->name, "conference") == 0)
|
||||
lev->internal = TRUE;
|
||||
lev->op->set_user_pointer(lev);
|
||||
lev->op->setUserPointer(lev);
|
||||
return lev;
|
||||
}
|
||||
|
||||
|
|
@ -221,7 +221,7 @@ LinphoneReason linphone_event_get_reason(const LinphoneEvent *lev){
|
|||
LinphoneEvent *linphone_core_create_subscribe(LinphoneCore *lc, const LinphoneAddress *resource, const char *event, int expires){
|
||||
LinphoneEvent *lev=linphone_event_new(lc, LinphoneSubscriptionOutgoing, event, expires);
|
||||
linphone_configure_op(lc,lev->op,resource,NULL,TRUE);
|
||||
lev->op->set_manual_refresher_mode(!lp_config_get_int(lc->config,"sip","refresh_generic_subscribe",1));
|
||||
lev->op->setManualRefresherMode(!lp_config_get_int(lc->config,"sip","refresh_generic_subscribe",1));
|
||||
return lev;
|
||||
}
|
||||
|
||||
|
|
@ -229,7 +229,7 @@ LinphoneEvent *linphone_core_create_notify(LinphoneCore *lc, const LinphoneAddre
|
|||
LinphoneEvent *lev=linphone_event_new(lc, LinphoneSubscriptionIncoming, event, -1);
|
||||
linphone_configure_op(lc,lev->op,resource,NULL,TRUE);
|
||||
lev->subscription_state = LinphoneSubscriptionIncomingReceived;
|
||||
lev->op->set_event(event);
|
||||
lev->op->setEvent(event);
|
||||
lev->is_out_of_dialog_op = TRUE;
|
||||
return lev;
|
||||
}
|
||||
|
|
@ -265,10 +265,10 @@ LinphoneStatus linphone_event_send_subscribe(LinphoneEvent *lev, const LinphoneC
|
|||
}
|
||||
|
||||
if (lev->send_custom_headers){
|
||||
lev->op->set_sent_custom_header(lev->send_custom_headers);
|
||||
lev->op->setSentCustomHeaders(lev->send_custom_headers);
|
||||
sal_custom_header_free(lev->send_custom_headers);
|
||||
lev->send_custom_headers=NULL;
|
||||
}else lev->op->set_sent_custom_header(NULL);
|
||||
}else lev->op->setSentCustomHeaders(NULL);
|
||||
|
||||
body_handler = sal_body_handler_from_content(body);
|
||||
auto subscribeOp = dynamic_cast<SalSubscribeOp *>(lev->op);
|
||||
|
|
@ -347,7 +347,7 @@ static LinphoneEvent *_linphone_core_create_publish(LinphoneCore *core, Linphone
|
|||
lev = linphone_event_new_with_op(lc, new SalPublishOp(lc->sal), LinphoneSubscriptionInvalidDir, event);
|
||||
lev->expires = expires;
|
||||
linphone_configure_op_with_proxy(lc,lev->op,resource,NULL, !!lp_config_get_int(lc->config,"sip","publish_msg_with_contact",0),cfg);
|
||||
lev->op->set_manual_refresher_mode(!lp_config_get_int(lc->config,"sip","refresh_generic_publish",1));
|
||||
lev->op->setManualRefresherMode(!lp_config_get_int(lc->config,"sip","refresh_generic_publish",1));
|
||||
return lev;
|
||||
}
|
||||
LinphoneEvent *linphone_core_create_publish(LinphoneCore *lc, const LinphoneAddress *resource, const char *event, int expires){
|
||||
|
|
@ -374,10 +374,10 @@ static int _linphone_event_send_publish(LinphoneEvent *lev, const LinphoneConten
|
|||
return -1;
|
||||
}
|
||||
if (lev->send_custom_headers){
|
||||
lev->op->set_sent_custom_header(lev->send_custom_headers);
|
||||
lev->op->setSentCustomHeaders(lev->send_custom_headers);
|
||||
sal_custom_header_free(lev->send_custom_headers);
|
||||
lev->send_custom_headers=NULL;
|
||||
}else lev->op->set_sent_custom_header(NULL);
|
||||
}else lev->op->setSentCustomHeaders(NULL);
|
||||
body_handler = sal_body_handler_from_content(body);
|
||||
auto publishOp = dynamic_cast<SalPublishOp *>(lev->op);
|
||||
err=publishOp->publish(NULL,NULL,lev->name,lev->expires,body_handler);
|
||||
|
|
@ -413,7 +413,7 @@ LinphoneStatus linphone_event_refresh_publish(LinphoneEvent *lev) {
|
|||
return lev->op->refresh();
|
||||
}
|
||||
void linphone_event_pause_publish(LinphoneEvent *lev) {
|
||||
if (lev->op) lev->op->stop_refreshing();
|
||||
if (lev->op) lev->op->stopRefreshing();
|
||||
}
|
||||
void linphone_event_unpublish(LinphoneEvent *lev) {
|
||||
lev->terminating = TRUE; /* needed to get clear event*/
|
||||
|
|
@ -435,7 +435,7 @@ void linphone_event_add_custom_header(LinphoneEvent *ev, const char *name, const
|
|||
}
|
||||
|
||||
const char* linphone_event_get_custom_header(LinphoneEvent* ev, const char* name){
|
||||
const SalCustomHeader *ch=ev->op->get_recv_custom_header();
|
||||
const SalCustomHeader *ch=ev->op->getRecvCustomHeaders();
|
||||
return sal_custom_header_find(ch,name);
|
||||
}
|
||||
|
||||
|
|
@ -453,7 +453,7 @@ void linphone_event_terminate(LinphoneEvent *lev){
|
|||
lev->terminating=TRUE;
|
||||
if (lev->dir==LinphoneSubscriptionIncoming){
|
||||
auto op = dynamic_cast<SalSubscribeOp *>(lev->op);
|
||||
op->close_notify();
|
||||
op->closeNotify();
|
||||
}else if (lev->dir==LinphoneSubscriptionOutgoing){
|
||||
auto op = dynamic_cast<SalSubscribeOp *>(lev->op);
|
||||
op->unsubscribe();
|
||||
|
|
@ -511,7 +511,7 @@ const char *linphone_event_get_name(const LinphoneEvent *lev){
|
|||
static const LinphoneAddress *_linphone_event_cache_to (const LinphoneEvent *lev) {
|
||||
if (lev->to_address)
|
||||
linphone_address_unref(lev->to_address);
|
||||
char *buf = sal_address_as_string(lev->op->get_to_address());
|
||||
char *buf = sal_address_as_string(lev->op->getToAddress());
|
||||
((LinphoneEvent *)lev)->to_address = linphone_address_new(buf);
|
||||
ms_free(buf);
|
||||
return lev->to_address;
|
||||
|
|
@ -520,7 +520,7 @@ static const LinphoneAddress *_linphone_event_cache_to (const LinphoneEvent *lev
|
|||
static const LinphoneAddress *_linphone_event_cache_from (const LinphoneEvent *lev) {
|
||||
if (lev->from_address)
|
||||
linphone_address_unref(lev->from_address);
|
||||
char *buf = sal_address_as_string(lev->op->get_from_address());
|
||||
char *buf = sal_address_as_string(lev->op->getFromAddress());
|
||||
((LinphoneEvent *)lev)->from_address = linphone_address_new(buf);
|
||||
ms_free(buf);
|
||||
return lev->from_address;
|
||||
|
|
@ -529,7 +529,7 @@ static const LinphoneAddress *_linphone_event_cache_from (const LinphoneEvent *l
|
|||
static const LinphoneAddress *_linphone_event_cache_remote_contact (const LinphoneEvent *lev) {
|
||||
if (lev->remote_contact_address)
|
||||
linphone_address_unref(lev->remote_contact_address);
|
||||
char *buf = sal_address_as_string(lev->op->get_remote_contact_address());
|
||||
char *buf = sal_address_as_string(lev->op->getRemoteContactAddress());
|
||||
((LinphoneEvent *)lev)->remote_contact_address = linphone_address_new(buf);
|
||||
ms_free(buf);
|
||||
return lev->remote_contact_address;
|
||||
|
|
|
|||
|
|
@ -478,7 +478,7 @@ void linphone_friend_notify(LinphoneFriend *lf, LinphonePresenceModel *presence)
|
|||
}
|
||||
for(elem=lf->insubs; elem!=NULL; elem=bctbx_list_next(elem)){
|
||||
auto op = reinterpret_cast<SalPresenceOp *>(bctbx_list_get_data(elem));
|
||||
op->notify_presence((SalPresenceModel *)presence);
|
||||
op->notifyPresence((SalPresenceModel *)presence);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -531,7 +531,7 @@ void linphone_friend_invalidate_subscription(LinphoneFriend *lf){
|
|||
}
|
||||
|
||||
static void close_presence_notification(SalPresenceOp *op) {
|
||||
op->notify_presence_close();
|
||||
op->notifyPresenceClose();
|
||||
}
|
||||
|
||||
static void release_sal_op(SalOp *op) {
|
||||
|
|
@ -773,7 +773,7 @@ void linphone_friend_update_subscribes(LinphoneFriend *fr, bool_t only_when_regi
|
|||
linphone_friend_unsubscribe(fr);
|
||||
}else if (!can_subscribe && fr->outsub){
|
||||
fr->subscribe_active=FALSE;
|
||||
fr->outsub->stop_refreshing();
|
||||
fr->outsub->stopRefreshing();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -834,7 +834,7 @@ LinphoneFriend * linphone_friend_list_find_friend_by_out_subscribe (
|
|||
const bctbx_list_t *elem;
|
||||
for (elem = list->friends; elem != NULL; elem = bctbx_list_next(elem)) {
|
||||
LinphoneFriend *lf = (LinphoneFriend *)bctbx_list_get_data(elem);
|
||||
if (lf->outsub && ((lf->outsub == op) || lf->outsub->is_forked_of(op))) return lf;
|
||||
if (lf->outsub && ((lf->outsub == op) || lf->outsub->isForkedOf(op))) return lf;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1296,12 +1296,12 @@ static void sip_config_read(LinphoneCore *lc) {
|
|||
int ipv6_default = TRUE;
|
||||
|
||||
if (lp_config_get_int(lc->config,"sip","use_session_timers",0)==1){
|
||||
lc->sal->use_session_timers(200);
|
||||
lc->sal->useSessionTimers(200);
|
||||
}
|
||||
|
||||
lc->sal->use_no_initial_route(!!lp_config_get_int(lc->config,"sip","use_no_initial_route",0));
|
||||
lc->sal->use_rport(!!lp_config_get_int(lc->config,"sip","use_rport",1));
|
||||
lc->sal->set_contact_linphone_specs(lp_config_get_string(lc->config, "sip", "linphone_specs", NULL));
|
||||
lc->sal->useNoInitialRoute(!!lp_config_get_int(lc->config,"sip","use_no_initial_route",0));
|
||||
lc->sal->useRport(!!lp_config_get_int(lc->config,"sip","use_rport",1));
|
||||
lc->sal->setContactLinphoneSpecs(lp_config_get_string(lc->config, "sip", "linphone_specs", NULL));
|
||||
|
||||
if (!lp_config_get_int(lc->config,"sip","ipv6_migration_done",FALSE) && lp_config_has_entry(lc->config,"sip","use_ipv6")) {
|
||||
lp_config_clean_entry(lc->config,"sip","use_ipv6");
|
||||
|
|
@ -1320,7 +1320,7 @@ static void sip_config_read(LinphoneCore *lc) {
|
|||
|
||||
certificates_config_read(lc);
|
||||
/*setting the dscp must be done before starting the transports, otherwise it is not taken into effect*/
|
||||
lc->sal->set_dscp(linphone_core_get_sip_dscp(lc));
|
||||
lc->sal->setDscp(linphone_core_get_sip_dscp(lc));
|
||||
/*start listening on ports*/
|
||||
linphone_core_set_sip_transports(lc,&tr);
|
||||
|
||||
|
|
@ -1386,7 +1386,7 @@ static void sip_config_read(LinphoneCore *lc) {
|
|||
linphone_core_set_media_encryption(lc,linphone_core_get_media_encryption(lc));
|
||||
|
||||
/*enable the reconnection to the primary server when it is up again asap*/
|
||||
lc->sal->enable_reconnect_to_primary_asap(!!lp_config_get_int(lc->config,"sip","reconnect_to_primary_asap",0));
|
||||
lc->sal->enableReconnectToPrimaryAsap(!!lp_config_get_int(lc->config,"sip","reconnect_to_primary_asap",0));
|
||||
|
||||
/*for tuning or test*/
|
||||
lc->sip_conf.sdp_200_ack = !!lp_config_get_int(lc->config,"sip","sdp_200_ack",0);
|
||||
|
|
@ -1399,12 +1399,12 @@ static void sip_config_read(LinphoneCore *lc) {
|
|||
lc->sip_conf.keepalive_period = (unsigned int)lp_config_get_int(lc->config,"sip","keepalive_period",10000);
|
||||
lc->sip_conf.tcp_tls_keepalive = !!lp_config_get_int(lc->config,"sip","tcp_tls_keepalive",0);
|
||||
linphone_core_enable_keep_alive(lc, (lc->sip_conf.keepalive_period > 0));
|
||||
lc->sal->use_one_matching_codec_policy(!!lp_config_get_int(lc->config,"sip","only_one_codec",0));
|
||||
lc->sal->use_dates(!!lp_config_get_int(lc->config,"sip","put_date",0));
|
||||
lc->sal->enable_sip_update_method(!!lp_config_get_int(lc->config,"sip","sip_update",1));
|
||||
lc->sal->useOneMatchingCodecPolicy(!!lp_config_get_int(lc->config,"sip","only_one_codec",0));
|
||||
lc->sal->useDates(!!lp_config_get_int(lc->config,"sip","put_date",0));
|
||||
lc->sal->enableSipUpdateMethod(!!lp_config_get_int(lc->config,"sip","sip_update",1));
|
||||
lc->sip_conf.vfu_with_info = !!lp_config_get_int(lc->config,"sip","vfu_with_info",1);
|
||||
linphone_core_set_sip_transport_timeout(lc, lp_config_get_int(lc->config, "sip", "transport_timeout", 63000));
|
||||
lc->sal->set_supported_tags(lp_config_get_string(lc->config,"sip","supported","replaces, outbound, gruu"));
|
||||
lc->sal->setSupportedTags(lp_config_get_string(lc->config,"sip","supported","replaces, outbound, gruu"));
|
||||
lc->sip_conf.save_auth_info = !!lp_config_get_int(lc->config, "sip", "save_auth_info", 1);
|
||||
linphone_core_create_im_notif_policy(lc);
|
||||
}
|
||||
|
|
@ -1851,13 +1851,13 @@ void linphone_core_set_expected_bandwidth(LinphoneCore *lc, int bw){
|
|||
}
|
||||
|
||||
void linphone_core_set_sip_transport_timeout(LinphoneCore *lc, int timeout_ms) {
|
||||
lc->sal->set_transport_timeout(timeout_ms);
|
||||
lc->sal->setTransportTimeout(timeout_ms);
|
||||
if (linphone_core_ready(lc))
|
||||
lp_config_set_int(lc->config, "sip", "transport_timeout", timeout_ms);
|
||||
}
|
||||
|
||||
int linphone_core_get_sip_transport_timeout(LinphoneCore *lc) {
|
||||
return lc->sal->get_transport_timeout();
|
||||
return lc->sal->getTransportTimeout();
|
||||
}
|
||||
|
||||
bool_t linphone_core_get_dns_set_by_app(LinphoneCore *lc) {
|
||||
|
|
@ -1870,27 +1870,27 @@ void linphone_core_set_dns_servers_app(LinphoneCore *lc, const bctbx_list_t *ser
|
|||
}
|
||||
|
||||
void linphone_core_set_dns_servers(LinphoneCore *lc, const bctbx_list_t *servers){
|
||||
lc->sal->set_dns_servers(servers);
|
||||
lc->sal->setDnsServers(servers);
|
||||
}
|
||||
|
||||
void linphone_core_enable_dns_srv(LinphoneCore *lc, bool_t enable) {
|
||||
lc->sal->enable_dns_srv(enable);
|
||||
lc->sal->enableDnsSrv(enable);
|
||||
if (linphone_core_ready(lc))
|
||||
lp_config_set_int(lc->config, "net", "dns_srv_enabled", enable ? 1 : 0);
|
||||
}
|
||||
|
||||
bool_t linphone_core_dns_srv_enabled(const LinphoneCore *lc) {
|
||||
return lc->sal->dns_srv_enabled();
|
||||
return lc->sal->dnsSrvEnabled();
|
||||
}
|
||||
|
||||
void linphone_core_enable_dns_search(LinphoneCore *lc, bool_t enable) {
|
||||
lc->sal->enable_dns_search(enable);
|
||||
lc->sal->enableDnsSearch(enable);
|
||||
if (linphone_core_ready(lc))
|
||||
lp_config_set_int(lc->config, "net", "dns_search_enabled", enable ? 1 : 0);
|
||||
}
|
||||
|
||||
bool_t linphone_core_dns_search_enabled(const LinphoneCore *lc) {
|
||||
return lc->sal->dns_search_enabled();
|
||||
return lc->sal->dnsSearchEnabled();
|
||||
}
|
||||
|
||||
int linphone_core_get_download_bandwidth(const LinphoneCore *lc){
|
||||
|
|
@ -2228,12 +2228,12 @@ static void linphone_core_init(LinphoneCore * lc, LinphoneCoreCbs *cbs, LpConfig
|
|||
image_resources_dir = linphone_factory_get_image_resources_dir(lfactory);
|
||||
|
||||
lc->sal=new Sal(NULL);
|
||||
lc->sal->set_refresher_retry_after(lp_config_get_int(lc->config, "sip", "refresher_retry_after", 60000));
|
||||
lc->sal->set_http_proxy_host(linphone_core_get_http_proxy_host(lc));
|
||||
lc->sal->set_http_proxy_port(linphone_core_get_http_proxy_port(lc));
|
||||
lc->sal->setRefresherRetryAfter(lp_config_get_int(lc->config, "sip", "refresher_retry_after", 60000));
|
||||
lc->sal->setHttpProxyHost(linphone_core_get_http_proxy_host(lc));
|
||||
lc->sal->setHttpProxyPort(linphone_core_get_http_proxy_port(lc));
|
||||
|
||||
lc->sal->set_user_pointer(lc);
|
||||
lc->sal->set_callbacks(&linphone_sal_callbacks);
|
||||
lc->sal->setUserPointer(lc);
|
||||
lc->sal->setCallbacks(&linphone_sal_callbacks);
|
||||
|
||||
#ifdef __ANDROID__
|
||||
if (system_context)
|
||||
|
|
@ -2244,7 +2244,7 @@ static void linphone_core_init(LinphoneCore * lc, LinphoneCoreCbs *cbs, LpConfig
|
|||
|
||||
// MS Factory MUST be created after Android has been set, otherwise no camera will be detected !
|
||||
lc->factory = ms_factory_new_with_voip_and_directories(msplugins_dir, image_resources_dir);
|
||||
lc->sal->set_factory(lc->factory);
|
||||
lc->sal->setFactory(lc->factory);
|
||||
|
||||
belr::GrammarLoader::get().addPath(getPlatformHelpers(lc)->getDataPath());
|
||||
|
||||
|
|
@ -2283,7 +2283,7 @@ static void linphone_core_init(LinphoneCore * lc, LinphoneCoreCbs *cbs, LpConfig
|
|||
/* Create the http provider in dual stack mode (ipv4 and ipv6.
|
||||
* If this creates problem, we may need to implement parallel ipv6/ ipv4 http requests in belle-sip.
|
||||
*/
|
||||
lc->http_provider = belle_sip_stack_create_http_provider(reinterpret_cast<belle_sip_stack_t *>(lc->sal->get_stack_impl()), "::0");
|
||||
lc->http_provider = belle_sip_stack_create_http_provider(reinterpret_cast<belle_sip_stack_t *>(lc->sal->getStackImpl()), "::0");
|
||||
lc->http_crypto_config = belle_tls_crypto_config_new();
|
||||
belle_http_provider_set_tls_crypto_config(lc->http_provider,lc->http_crypto_config);
|
||||
|
||||
|
|
@ -2321,13 +2321,13 @@ void linphone_core_start (LinphoneCore *lc) {
|
|||
const char* uuid=lp_config_get_string(lc->config,"misc","uuid",NULL);
|
||||
if (!uuid){
|
||||
char tmp[64];
|
||||
lc->sal->create_uuid(tmp,sizeof(tmp));
|
||||
lc->sal->createUuid(tmp,sizeof(tmp));
|
||||
lp_config_set_string(lc->config,"misc","uuid",tmp);
|
||||
}else if (strcmp(uuid,"0")!=0) /*to allow to disable sip.instance*/
|
||||
lc->sal->set_uuid(uuid);
|
||||
lc->sal->setUuid(uuid);
|
||||
|
||||
if (lc->sal->get_root_ca()) {
|
||||
belle_tls_crypto_config_set_root_ca(lc->http_crypto_config, lc->sal->get_root_ca());
|
||||
if (lc->sal->getRootCa()) {
|
||||
belle_tls_crypto_config_set_root_ca(lc->http_crypto_config, lc->sal->getRootCa());
|
||||
belle_http_provider_set_tls_crypto_config(lc->http_provider, lc->http_crypto_config);
|
||||
}
|
||||
|
||||
|
|
@ -2857,12 +2857,12 @@ void linphone_core_set_user_agent(LinphoneCore *lc, const char *name, const char
|
|||
char ua_string[256];
|
||||
snprintf(ua_string, sizeof(ua_string) - 1, "%s/%s", name?name:"", ver?ver:"");
|
||||
if (lc->sal) {
|
||||
lc->sal->set_user_agent(ua_string);
|
||||
lc->sal->append_stack_string_to_user_agent();
|
||||
lc->sal->setUserAgent(ua_string);
|
||||
lc->sal->appendStackStringToUserAgent();
|
||||
}
|
||||
}
|
||||
const char *linphone_core_get_user_agent(LinphoneCore *lc){
|
||||
return lc->sal->get_user_agent();
|
||||
return lc->sal->getUserAgent();
|
||||
}
|
||||
|
||||
const char *linphone_core_get_user_agent_name(void){
|
||||
|
|
@ -2905,32 +2905,32 @@ int _linphone_core_apply_transports(LinphoneCore *lc){
|
|||
else
|
||||
anyaddr="0.0.0.0";
|
||||
|
||||
sal->unlisten_ports();
|
||||
sal->unlistenPorts();
|
||||
|
||||
listening_address = lp_config_get_string(lc->config,"sip","bind_address",anyaddr);
|
||||
if (linphone_core_get_http_proxy_host(lc)) {
|
||||
sal->set_http_proxy_host(linphone_core_get_http_proxy_host(lc));
|
||||
sal->set_http_proxy_port(linphone_core_get_http_proxy_port(lc));
|
||||
sal->setHttpProxyHost(linphone_core_get_http_proxy_host(lc));
|
||||
sal->setHttpProxyPort(linphone_core_get_http_proxy_port(lc));
|
||||
}
|
||||
if (lc->tunnel && linphone_tunnel_sip_enabled(lc->tunnel) && linphone_tunnel_get_activated(lc->tunnel)){
|
||||
sal->set_listen_port(anyaddr,tr->udp_port,SalTransportUDP,TRUE);
|
||||
sal->setListenPort(anyaddr,tr->udp_port,SalTransportUDP,TRUE);
|
||||
}else{
|
||||
if (tr->udp_port!=0){
|
||||
sal->set_listen_port(listening_address,tr->udp_port,SalTransportUDP,FALSE);
|
||||
sal->setListenPort(listening_address,tr->udp_port,SalTransportUDP,FALSE);
|
||||
}
|
||||
if (tr->tcp_port!=0){
|
||||
sal->set_listen_port (listening_address,tr->tcp_port,SalTransportTCP,FALSE);
|
||||
sal->setListenPort (listening_address,tr->tcp_port,SalTransportTCP,FALSE);
|
||||
}
|
||||
if (linphone_core_sip_transport_supported(lc,LinphoneTransportTls)){
|
||||
if (tr->tls_port!=0)
|
||||
sal->set_listen_port (listening_address,tr->tls_port,SalTransportTLS,FALSE);
|
||||
sal->setListenPort (listening_address,tr->tls_port,SalTransportTLS,FALSE);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool_t linphone_core_sip_transport_supported(const LinphoneCore *lc, LinphoneTransportType tp){
|
||||
return !!lc->sal->transport_available((SalTransport)tp);
|
||||
return !!lc->sal->isTransportAvailable((SalTransport)tp);
|
||||
}
|
||||
|
||||
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneTransports);
|
||||
|
|
@ -3070,17 +3070,17 @@ LinphoneTransports *linphone_core_get_transports(LinphoneCore *lc){
|
|||
}
|
||||
|
||||
void linphone_core_get_sip_transports_used(LinphoneCore *lc, LinphoneSipTransports *tr){
|
||||
tr->udp_port=lc->sal->get_listening_port(SalTransportUDP);
|
||||
tr->tcp_port=lc->sal->get_listening_port(SalTransportTCP);
|
||||
tr->tls_port=lc->sal->get_listening_port(SalTransportTLS);
|
||||
tr->udp_port=lc->sal->getListeningPort(SalTransportUDP);
|
||||
tr->tcp_port=lc->sal->getListeningPort(SalTransportTCP);
|
||||
tr->tls_port=lc->sal->getListeningPort(SalTransportTLS);
|
||||
}
|
||||
|
||||
LinphoneTransports *linphone_core_get_transports_used(LinphoneCore *lc){
|
||||
LinphoneTransports *transports = linphone_transports_new();
|
||||
transports->udp_port = lc->sal->get_listening_port(SalTransportUDP);
|
||||
transports->tcp_port = lc->sal->get_listening_port(SalTransportTCP);
|
||||
transports->tls_port = lc->sal->get_listening_port(SalTransportTLS);
|
||||
transports->dtls_port = lc->sal->get_listening_port(SalTransportDTLS);
|
||||
transports->udp_port = lc->sal->getListeningPort(SalTransportUDP);
|
||||
transports->tcp_port = lc->sal->getListeningPort(SalTransportTCP);
|
||||
transports->tls_port = lc->sal->getListeningPort(SalTransportTLS);
|
||||
transports->dtls_port = lc->sal->getListeningPort(SalTransportDTLS);
|
||||
return transports;
|
||||
}
|
||||
|
||||
|
|
@ -3112,7 +3112,7 @@ void linphone_core_enable_ipv6(LinphoneCore *lc, bool_t val){
|
|||
|
||||
bool_t linphone_core_content_encoding_supported(const LinphoneCore *lc, const char *content_encoding) {
|
||||
const char *handle_content_encoding = lp_config_get_string(lc->config, "sip", "handle_content_encoding", "deflate");
|
||||
return (strcmp(handle_content_encoding, content_encoding) == 0) && lc->sal->content_encoding_available(content_encoding);
|
||||
return (strcmp(handle_content_encoding, content_encoding) == 0) && lc->sal->isContentEncodingAvailable(content_encoding);
|
||||
}
|
||||
|
||||
static void monitor_network_state(LinphoneCore *lc, time_t curtime){
|
||||
|
|
@ -3523,7 +3523,7 @@ static void linphone_transfer_routes_to_op(bctbx_list_t *routes, SalOp *op){
|
|||
bctbx_list_t *it;
|
||||
for(it=routes;it!=NULL;it=it->next){
|
||||
SalAddress *addr=(SalAddress*)it->data;
|
||||
op->add_route_address(addr);
|
||||
op->addRouteAddress(addr);
|
||||
sal_address_destroy(addr);
|
||||
}
|
||||
bctbx_list_free(routes);
|
||||
|
|
@ -3536,7 +3536,7 @@ void linphone_configure_op_with_proxy(LinphoneCore *lc, SalOp *op, const Linphon
|
|||
if (proxy){
|
||||
identity=linphone_proxy_config_get_identity(proxy);
|
||||
if (linphone_proxy_config_get_privacy(proxy)!=LinphonePrivacyDefault) {
|
||||
op->set_privacy(linphone_proxy_config_get_privacy(proxy));
|
||||
op->setPrivacy(linphone_proxy_config_get_privacy(proxy));
|
||||
}
|
||||
}else identity=linphone_core_get_primary_contact(lc);
|
||||
/*sending out of calls*/
|
||||
|
|
@ -3545,21 +3545,21 @@ void linphone_configure_op_with_proxy(LinphoneCore *lc, SalOp *op, const Linphon
|
|||
linphone_transfer_routes_to_op(routes,op);
|
||||
}
|
||||
|
||||
op->set_to_address(L_GET_PRIVATE_FROM_C_OBJECT(dest)->getInternalAddress());
|
||||
op->set_from(identity);
|
||||
op->set_sent_custom_header(headers);
|
||||
op->set_realm(linphone_proxy_config_get_realm(proxy));
|
||||
op->setToAddress(L_GET_PRIVATE_FROM_C_OBJECT(dest)->getInternalAddress());
|
||||
op->setFrom(identity);
|
||||
op->setSentCustomHeaders(headers);
|
||||
op->setRealm(linphone_proxy_config_get_realm(proxy));
|
||||
|
||||
if (with_contact && proxy && proxy->op){
|
||||
const LinphoneAddress *contact = linphone_proxy_config_get_contact(proxy);
|
||||
SalAddress *salAddress = nullptr;
|
||||
if (contact)
|
||||
salAddress = sal_address_clone(const_cast<SalAddress *>(L_GET_PRIVATE_FROM_C_OBJECT(contact)->getInternalAddress()));
|
||||
op->set_contact_address(salAddress);
|
||||
op->setContactAddress(salAddress);
|
||||
if (salAddress)
|
||||
sal_address_unref(salAddress);
|
||||
}
|
||||
op->enable_cnx_ip_to_0000_if_sendonly(!!lp_config_get_default_int(lc->config,"sip","cnx_ip_to_0000_if_sendonly_enabled",0)); /*also set in linphone_call_new_incoming*/
|
||||
op->enableCnxIpTo0000IfSendOnly(!!lp_config_get_default_int(lc->config,"sip","cnx_ip_to_0000_if_sendonly_enabled",0)); /*also set in linphone_call_new_incoming*/
|
||||
}
|
||||
void linphone_configure_op(LinphoneCore *lc, SalOp *op, const LinphoneAddress *dest, SalCustomHeader *headers, bool_t with_contact) {
|
||||
linphone_configure_op_with_proxy(lc, op, dest, headers,with_contact,linphone_core_lookup_known_proxy(lc,dest));
|
||||
|
|
@ -4304,7 +4304,7 @@ const char *linphone_core_get_ring(const LinphoneCore *lc){
|
|||
}
|
||||
|
||||
void linphone_core_set_root_ca(LinphoneCore *lc, const char *path) {
|
||||
lc->sal->set_root_ca(path);
|
||||
lc->sal->setRootCa(path);
|
||||
if (lc->http_crypto_config) {
|
||||
belle_tls_crypto_config_set_root_ca(lc->http_crypto_config, path);
|
||||
}
|
||||
|
|
@ -4312,8 +4312,8 @@ void linphone_core_set_root_ca(LinphoneCore *lc, const char *path) {
|
|||
}
|
||||
|
||||
void linphone_core_set_root_ca_data(LinphoneCore *lc, const char *data) {
|
||||
lc->sal->set_root_ca(NULL);
|
||||
lc->sal->set_root_ca_data(data);
|
||||
lc->sal->setRootCa(NULL);
|
||||
lc->sal->setRootCaData(data);
|
||||
if (lc->http_crypto_config) {
|
||||
belle_tls_crypto_config_set_root_ca_data(lc->http_crypto_config, data);
|
||||
}
|
||||
|
|
@ -4324,7 +4324,7 @@ const char *linphone_core_get_root_ca(LinphoneCore *lc){
|
|||
}
|
||||
|
||||
void linphone_core_verify_server_certificates(LinphoneCore *lc, bool_t yesno){
|
||||
lc->sal->verify_server_certificates(yesno);
|
||||
lc->sal->verifyServerCertificates(yesno);
|
||||
if (lc->http_crypto_config){
|
||||
belle_tls_crypto_config_set_verify_exceptions(lc->http_crypto_config, yesno ? 0 : BELLE_TLS_VERIFY_ANY_REASON);
|
||||
}
|
||||
|
|
@ -4332,7 +4332,7 @@ void linphone_core_verify_server_certificates(LinphoneCore *lc, bool_t yesno){
|
|||
}
|
||||
|
||||
void linphone_core_verify_server_cn(LinphoneCore *lc, bool_t yesno){
|
||||
lc->sal->verify_server_cn(yesno);
|
||||
lc->sal->verifyServerCn(yesno);
|
||||
if (lc->http_crypto_config){
|
||||
belle_tls_crypto_config_set_verify_exceptions(lc->http_crypto_config, yesno ? 0 : BELLE_TLS_VERIFY_CN_MISMATCH);
|
||||
}
|
||||
|
|
@ -4340,7 +4340,7 @@ void linphone_core_verify_server_cn(LinphoneCore *lc, bool_t yesno){
|
|||
}
|
||||
|
||||
void linphone_core_set_ssl_config(LinphoneCore *lc, void *ssl_config) {
|
||||
lc->sal->set_ssl_config(ssl_config);
|
||||
lc->sal->setSslConfig(ssl_config);
|
||||
if (lc->http_crypto_config) {
|
||||
belle_tls_crypto_config_set_ssl_config(lc->http_crypto_config, ssl_config);
|
||||
}
|
||||
|
|
@ -4637,9 +4637,9 @@ void linphone_core_set_nat_policy(LinphoneCore *lc, LinphoneNatPolicy *policy) {
|
|||
linphone_nat_policy_save_to_config(lc->nat_policy);
|
||||
}
|
||||
|
||||
lc->sal->enable_nat_helper(!!lp_config_get_int(lc->config, "net", "enable_nat_helper", 1));
|
||||
lc->sal->enable_auto_contacts(TRUE);
|
||||
lc->sal->use_rport(!!lp_config_get_int(lc->config, "sip", "use_rport", 1));
|
||||
lc->sal->enableNatHelper(!!lp_config_get_int(lc->config, "net", "enable_nat_helper", 1));
|
||||
lc->sal->enableAutoContacts(TRUE);
|
||||
lc->sal->useRport(!!lp_config_get_int(lc->config, "sip", "use_rport", 1));
|
||||
if (lc->sip_conf.contact) update_primary_contact(lc);
|
||||
}
|
||||
|
||||
|
|
@ -5844,8 +5844,8 @@ void sip_config_uninit(LinphoneCore *lc)
|
|||
linphone_vcard_context_destroy(lc->vcard_context);
|
||||
}
|
||||
|
||||
lc->sal->reset_transports();
|
||||
lc->sal->unlisten_ports(); /*to make sure no new messages are received*/
|
||||
lc->sal->resetTransports();
|
||||
lc->sal->unlistenPorts(); /*to make sure no new messages are received*/
|
||||
if (lc->http_provider) {
|
||||
belle_sip_object_unref(lc->http_provider);
|
||||
lc->http_provider=NULL;
|
||||
|
|
@ -6152,7 +6152,7 @@ static void set_sip_network_reachable(LinphoneCore* lc,bool_t is_sip_reachable,
|
|||
|
||||
if (!lc->sip_network_reachable){
|
||||
linphone_core_invalidate_friend_subscriptions(lc);
|
||||
lc->sal->reset_transports();
|
||||
lc->sal->resetTransports();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -6217,7 +6217,7 @@ bool_t linphone_core_is_network_reachable(LinphoneCore* lc) {
|
|||
}
|
||||
|
||||
ortp_socket_t linphone_core_get_sip_socket(LinphoneCore *lc){
|
||||
return lc->sal->get_socket();
|
||||
return lc->sal->getSocket();
|
||||
}
|
||||
|
||||
void linphone_core_destroy(LinphoneCore *lc){
|
||||
|
|
@ -6337,15 +6337,15 @@ const char *linphone_error_to_string(LinphoneReason err){
|
|||
|
||||
void linphone_core_enable_keep_alive(LinphoneCore* lc,bool_t enable) {
|
||||
if (enable > 0) {
|
||||
lc->sal->use_tcp_tls_keepalive(lc->sip_conf.tcp_tls_keepalive);
|
||||
lc->sal->set_keepalive_period(lc->sip_conf.keepalive_period);
|
||||
lc->sal->useTcpTlsKeepAlive(lc->sip_conf.tcp_tls_keepalive);
|
||||
lc->sal->setKeepAlivePeriod(lc->sip_conf.keepalive_period);
|
||||
} else {
|
||||
lc->sal->set_keepalive_period(0);
|
||||
lc->sal->setKeepAlivePeriod(0);
|
||||
}
|
||||
}
|
||||
|
||||
bool_t linphone_core_keep_alive_enabled(LinphoneCore* lc) {
|
||||
return lc->sal->get_keepalive_period() > 0;
|
||||
return lc->sal->getKeepAlivePeriod() > 0;
|
||||
}
|
||||
|
||||
void linphone_core_start_dtmf_stream(LinphoneCore* lc) {
|
||||
|
|
@ -6707,7 +6707,7 @@ const char* linphone_core_get_device_identifier(const LinphoneCore *lc) {
|
|||
}
|
||||
|
||||
void linphone_core_set_sip_dscp(LinphoneCore *lc, int dscp){
|
||||
lc->sal->set_dscp(dscp);
|
||||
lc->sal->setDscp(dscp);
|
||||
if (linphone_core_ready(lc)){
|
||||
lp_config_set_int_hex(lc->config,"sip","dscp",dscp);
|
||||
_linphone_core_apply_transports(lc);
|
||||
|
|
@ -6771,13 +6771,13 @@ const char * linphone_core_get_file_transfer_server(LinphoneCore *core) {
|
|||
}
|
||||
|
||||
void linphone_core_add_supported_tag(LinphoneCore *lc, const char *tag){
|
||||
lc->sal->add_supported_tag(tag);
|
||||
lp_config_set_string(lc->config,"sip","supported",lc->sal->get_supported_tags());
|
||||
lc->sal->addSupportedTag(tag);
|
||||
lp_config_set_string(lc->config,"sip","supported",lc->sal->getSupportedTags());
|
||||
}
|
||||
|
||||
void linphone_core_remove_supported_tag(LinphoneCore *lc, const char *tag){
|
||||
lc->sal->remove_supported_tag(tag);
|
||||
lp_config_set_string(lc->config,"sip","supported",lc->sal->get_supported_tags());
|
||||
lc->sal->removeSupportedTag(tag);
|
||||
lp_config_set_string(lc->config,"sip","supported",lc->sal->getSupportedTags());
|
||||
}
|
||||
|
||||
void linphone_core_set_avpf_mode(LinphoneCore *lc, LinphoneAVPFMode mode){
|
||||
|
|
@ -6905,15 +6905,15 @@ void linphone_core_enable_realtime_text(LinphoneCore *lc, bool_t value) {
|
|||
void linphone_core_set_http_proxy_host(LinphoneCore *lc, const char *host) {
|
||||
lp_config_set_string(lc->config,"sip","http_proxy_host",host);
|
||||
if (lc->sal) {
|
||||
lc->sal->set_http_proxy_host(host);
|
||||
lc->sal->set_http_proxy_port(linphone_core_get_http_proxy_port(lc)); /*to make sure default value is set*/
|
||||
lc->sal->setHttpProxyHost(host);
|
||||
lc->sal->setHttpProxyPort(linphone_core_get_http_proxy_port(lc)); /*to make sure default value is set*/
|
||||
}
|
||||
}
|
||||
|
||||
void linphone_core_set_http_proxy_port(LinphoneCore *lc, int port) {
|
||||
lp_config_set_int(lc->config,"sip","http_proxy_port",port);
|
||||
if (lc->sal)
|
||||
lc->sal->set_http_proxy_port(port);
|
||||
lc->sal->setHttpProxyPort(port);
|
||||
}
|
||||
|
||||
const char *linphone_core_get_http_proxy_host(const LinphoneCore *lc) {
|
||||
|
|
@ -7159,23 +7159,23 @@ LinphoneImEncryptionEngine *linphone_core_get_im_encryption_engine(const Linphon
|
|||
}
|
||||
|
||||
void linphone_core_initialize_supported_content_types(LinphoneCore *lc) {
|
||||
lc->sal->add_content_type_support("text/plain");
|
||||
lc->sal->add_content_type_support("message/external-body");
|
||||
lc->sal->add_content_type_support("application/vnd.gsma.rcs-ft-http+xml");
|
||||
lc->sal->add_content_type_support("application/im-iscomposing+xml");
|
||||
lc->sal->add_content_type_support("message/imdn+xml");
|
||||
lc->sal->addContentTypeSupport("text/plain");
|
||||
lc->sal->addContentTypeSupport("message/external-body");
|
||||
lc->sal->addContentTypeSupport("application/vnd.gsma.rcs-ft-http+xml");
|
||||
lc->sal->addContentTypeSupport("application/im-iscomposing+xml");
|
||||
lc->sal->addContentTypeSupport("message/imdn+xml");
|
||||
}
|
||||
|
||||
bool_t linphone_core_is_content_type_supported(const LinphoneCore *lc, const char *content_type) {
|
||||
return lc->sal->is_content_type_supported(content_type);
|
||||
return lc->sal->isContentTypeSupported(content_type);
|
||||
}
|
||||
|
||||
void linphone_core_add_content_type_support(LinphoneCore *lc, const char *content_type) {
|
||||
lc->sal->add_content_type_support(content_type);
|
||||
lc->sal->addContentTypeSupport(content_type);
|
||||
}
|
||||
|
||||
void linphone_core_remove_content_type_support(LinphoneCore *lc, const char *content_type) {
|
||||
lc->sal->remove_content_type_support(content_type);
|
||||
lc->sal->removeContentTypeSupport(content_type);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_UPDATE_CHECK
|
||||
|
|
@ -7333,5 +7333,5 @@ const char *linphone_core_get_linphone_specs (const LinphoneCore *core) {
|
|||
|
||||
void linphone_core_set_linphone_specs (LinphoneCore *core, const char *specs) {
|
||||
lp_config_set_string(linphone_core_get_config(core), "sip", "linphone_specs", specs);
|
||||
core->sal->set_contact_linphone_specs(specs);
|
||||
core->sal->setContactLinphoneSpecs(specs);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -476,7 +476,7 @@ const char * linphone_core_get_echo_canceller_filter_name(const LinphoneCore *lc
|
|||
* task_fun must return BELLE_SIP_STOP when job is finished.
|
||||
**/
|
||||
void linphone_core_queue_task(LinphoneCore *lc, belle_sip_source_func_t task_fun, void *data, const char *task_description){
|
||||
belle_sip_source_t *s=lc->sal->create_timer(task_fun,data, 20, task_description);
|
||||
belle_sip_source_t *s=lc->sal->createTimer(task_fun,data, 20, task_description);
|
||||
belle_sip_object_unref(s);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1563,7 +1563,7 @@ void linphone_subscription_new(LinphoneCore *lc, SalSubscribeOp *op, const char
|
|||
linphone_friend_add_incoming_subscription(lf, op);
|
||||
lf->inc_subscribe_pending=TRUE;
|
||||
if (lp_config_get_int(lc->config,"sip","notify_pending_state",0)) {
|
||||
op->notify_pending_state();
|
||||
op->notifyPendingState();
|
||||
}
|
||||
op->accept();
|
||||
} else {
|
||||
|
|
@ -1936,7 +1936,7 @@ void linphone_notify_recv(LinphoneCore *lc, SalOp *op, SalSubscribeStatus ss, Sa
|
|||
if (linphone_core_get_default_friend_list(lc) != NULL)
|
||||
lf=linphone_core_find_friend_by_out_subscribe(lc, op);
|
||||
if (lf==NULL && lp_config_get_int(lc->config,"sip","allow_out_of_subscribe_presence",0)){
|
||||
char *buf = sal_address_as_string_uri_only(op->get_from_address());
|
||||
char *buf = sal_address_as_string_uri_only(op->getFromAddress());
|
||||
LinphoneAddress *addr = linphone_address_new(buf);
|
||||
lf = linphone_core_find_friend(lc, addr);
|
||||
ms_free(buf);
|
||||
|
|
@ -2000,7 +2000,7 @@ void linphone_subscription_closed(LinphoneCore *lc, SalOp *op){
|
|||
linphone_friend_remove_incoming_subscription(lf, op);
|
||||
}else{
|
||||
/*case of an op that we already released because the friend was destroyed*/
|
||||
ms_message("Receiving unsuscribe for unknown in-subscribtion from %s", op->get_from());
|
||||
ms_message("Receiving unsuscribe for unknown in-subscribtion from %s", op->getFrom());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -436,7 +436,7 @@ void linphone_proxy_config_enable_publish(LinphoneProxyConfig *cfg, bool_t val){
|
|||
}
|
||||
|
||||
void linphone_proxy_config_pause_register(LinphoneProxyConfig *cfg){
|
||||
if (cfg->op) cfg->op->stop_refreshing();
|
||||
if (cfg->op) cfg->op->stopRefreshing();
|
||||
}
|
||||
|
||||
void linphone_proxy_config_edit(LinphoneProxyConfig *cfg){
|
||||
|
|
@ -457,7 +457,7 @@ void linphone_proxy_config_apply(LinphoneProxyConfig *cfg,LinphoneCore *lc){
|
|||
|
||||
void linphone_proxy_config_stop_refreshing(LinphoneProxyConfig * cfg){
|
||||
LinphoneAddress *contact_addr = NULL;
|
||||
const SalAddress *sal_addr = cfg->op && cfg->state == LinphoneRegistrationOk ? cfg->op->get_contact_address() : NULL;
|
||||
const SalAddress *sal_addr = cfg->op && cfg->state == LinphoneRegistrationOk ? cfg->op->getContactAddress() : NULL;
|
||||
if (sal_addr) {
|
||||
char *buf = sal_address_as_string(sal_addr);
|
||||
contact_addr = buf ? linphone_address_new(buf) : NULL;
|
||||
|
|
@ -538,10 +538,10 @@ static void linphone_proxy_config_register(LinphoneProxyConfig *cfg){
|
|||
|
||||
guess_contact_for_register(cfg);
|
||||
if (cfg->contact_address)
|
||||
cfg->op->set_contact_address(L_GET_PRIVATE_FROM_C_OBJECT(cfg->contact_address)->getInternalAddress());
|
||||
cfg->op->set_user_pointer(cfg);
|
||||
cfg->op->setContactAddress(L_GET_PRIVATE_FROM_C_OBJECT(cfg->contact_address)->getInternalAddress());
|
||||
cfg->op->setUserPointer(cfg);
|
||||
|
||||
if (cfg->op->register_(
|
||||
if (cfg->op->sendRegister(
|
||||
proxy_string,
|
||||
cfg->reg_identity,
|
||||
cfg->expires,
|
||||
|
|
@ -568,7 +568,7 @@ static void linphone_proxy_config_register(LinphoneProxyConfig *cfg){
|
|||
|
||||
void linphone_proxy_config_refresh_register(LinphoneProxyConfig *cfg){
|
||||
if (cfg->reg_sendregister && cfg->op && cfg->state!=LinphoneRegistrationProgress){
|
||||
if (cfg->op->register_refresh(cfg->expires) == 0) {
|
||||
if (cfg->op->refreshRegister(cfg->expires) == 0) {
|
||||
linphone_proxy_config_set_state(cfg,LinphoneRegistrationProgress, "Refresh registration");
|
||||
}
|
||||
}
|
||||
|
|
@ -850,7 +850,7 @@ LinphoneStatus linphone_proxy_config_done(LinphoneProxyConfig *cfg)
|
|||
if (res == LinphoneProxyConfigAddressDifferent) {
|
||||
_linphone_proxy_config_unregister(cfg);
|
||||
}
|
||||
cfg->op->set_user_pointer(NULL); /*we don't want to receive status for this un register*/
|
||||
cfg->op->setUserPointer(NULL); /*we don't want to receive status for this un register*/
|
||||
cfg->op->unref(); /*but we keep refresher to handle authentication if needed*/
|
||||
cfg->op=NULL;
|
||||
}
|
||||
|
|
@ -1045,7 +1045,7 @@ struct _LinphoneCore * linphone_proxy_config_get_core(const LinphoneProxyConfig
|
|||
const char *linphone_proxy_config_get_custom_header(LinphoneProxyConfig *cfg, const char *header_name){
|
||||
const SalCustomHeader *ch;
|
||||
if (!cfg->op) return NULL;
|
||||
ch = cfg->op->get_recv_custom_header();
|
||||
ch = cfg->op->getRecvCustomHeaders();
|
||||
return sal_custom_header_find(ch, header_name);
|
||||
}
|
||||
|
||||
|
|
@ -1416,7 +1416,7 @@ const LinphoneErrorInfo *linphone_proxy_config_get_error_info(const LinphoneProx
|
|||
}
|
||||
|
||||
const LinphoneAddress* linphone_proxy_config_get_service_route(const LinphoneProxyConfig* cfg) {
|
||||
return cfg->op?(const LinphoneAddress*) cfg->op->get_service_route():NULL;
|
||||
return cfg->op?(const LinphoneAddress*) cfg->op->getServiceRoute():NULL;
|
||||
}
|
||||
const char* linphone_proxy_config_get_transport(const LinphoneProxyConfig *cfg) {
|
||||
const char* addr=NULL;
|
||||
|
|
@ -1496,7 +1496,7 @@ const LinphoneAddress *linphone_proxy_config_get_contact (const LinphoneProxyCon
|
|||
// Warning : Do not remove, the op can change its contact_address
|
||||
if (!cfg->op)
|
||||
return NULL;
|
||||
const SalAddress *salAddr = cfg->op->get_contact_address();
|
||||
const SalAddress *salAddr = cfg->op->getContactAddress();
|
||||
if (!salAddr)
|
||||
return NULL;
|
||||
if (cfg->contact_address)
|
||||
|
|
|
|||
|
|
@ -380,7 +380,7 @@ static int send_report(LinphoneCall* call, reporting_session_report_t * report,
|
|||
sal_address_has_uri_param(salAddress, "maddr") ||
|
||||
linphone_address_get_port(request_uri) != 0) {
|
||||
ms_message("Publishing report with custom route %s", collector_uri);
|
||||
lev->op->set_route(collector_uri);
|
||||
lev->op->setRoute(collector_uri);
|
||||
}
|
||||
|
||||
if (linphone_event_send_publish(lev, content) != 0){
|
||||
|
|
@ -424,7 +424,7 @@ static const SalStreamDescription * get_media_stream_for_desc(const SalMediaDesc
|
|||
static void update_ip(LinphoneCall * call, int stats_type) {
|
||||
SalStreamType sal_stream_type = stats_type == LINPHONE_CALL_STATS_AUDIO ? SalAudio : stats_type == LINPHONE_CALL_STATS_VIDEO ? SalVideo : SalText;
|
||||
const SalStreamDescription * local_desc = get_media_stream_for_desc(_linphone_call_get_local_desc(call), sal_stream_type);
|
||||
const SalStreamDescription * remote_desc = get_media_stream_for_desc(L_GET_PRIVATE_FROM_C_OBJECT(call)->getOp()->get_remote_media_description(), sal_stream_type);
|
||||
const SalStreamDescription * remote_desc = get_media_stream_for_desc(L_GET_PRIVATE_FROM_C_OBJECT(call)->getOp()->getRemoteMediaDescription(), sal_stream_type);
|
||||
LinphoneCallLog *log = L_GET_CPP_PTR_FROM_C_OBJECT(call)->getLog();
|
||||
|
||||
if (local_desc != NULL) {
|
||||
|
|
@ -444,7 +444,7 @@ static void update_ip(LinphoneCall * call, int stats_type) {
|
|||
if (strlen(remote_desc->rtp_addr) > 0) {
|
||||
STR_REASSIGN(log->reporting.reports[stats_type]->info.remote_addr.ip, ms_strdup(remote_desc->rtp_addr));
|
||||
} else {
|
||||
STR_REASSIGN(log->reporting.reports[stats_type]->info.remote_addr.ip, ms_strdup(L_GET_PRIVATE_FROM_C_OBJECT(call)->getOp()->get_remote_media_description()->addr));
|
||||
STR_REASSIGN(log->reporting.reports[stats_type]->info.remote_addr.ip, ms_strdup(L_GET_PRIVATE_FROM_C_OBJECT(call)->getOp()->getRemoteMediaDescription()->addr));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -511,7 +511,7 @@ void linphone_reporting_update_media_info(LinphoneCall * call, int stats_type) {
|
|||
if (!media_report_enabled(call, stats_type) || !L_GET_PRIVATE_FROM_C_OBJECT(call)->getOp())
|
||||
return;
|
||||
|
||||
dialog_id = L_GET_PRIVATE_FROM_C_OBJECT(call)->getOp()->get_dialog_id();
|
||||
dialog_id = L_GET_PRIVATE_FROM_C_OBJECT(call)->getOp()->getDialogId();
|
||||
|
||||
STR_REASSIGN(report->info.call_id, ms_strdup(log->call_id));
|
||||
|
||||
|
|
|
|||
|
|
@ -367,7 +367,7 @@ bool_t linphone_vcard_generate_unique_id(LinphoneVcard *vCard) {
|
|||
if (linphone_vcard_get_uid(vCard)) {
|
||||
return FALSE;
|
||||
}
|
||||
if (LinphonePrivate::Sal::generate_uuid(uuid, sizeof(uuid)) == 0) {
|
||||
if (LinphonePrivate::Sal::generateUuid(uuid, sizeof(uuid)) == 0) {
|
||||
char vcard_uuid[sizeof(uuid)+4];
|
||||
snprintf(vcard_uuid, sizeof(vcard_uuid), "urn:%s", uuid);
|
||||
linphone_vcard_set_uid(vCard, vcard_uuid);
|
||||
|
|
|
|||
|
|
@ -207,7 +207,7 @@ LinphoneCallState linphone_call_get_state (const LinphoneCall *call) {
|
|||
bool_t linphone_call_asked_to_autoanswer (LinphoneCall *call) {
|
||||
//return TRUE if the unique(for the moment) incoming call asked to be autoanswered
|
||||
if (call)
|
||||
return linphone_call_get_op(call)->autoanswer_asked();
|
||||
return linphone_call_get_op(call)->autoAnswerAsked();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -575,8 +575,8 @@ void linphone_call_ogl_render (const LinphoneCall *call) {
|
|||
|
||||
LinphoneStatus linphone_call_send_info_message (LinphoneCall *call, const LinphoneInfoMessage *info) {
|
||||
SalBodyHandler *body_handler = sal_body_handler_from_content(linphone_info_message_get_content(info));
|
||||
linphone_call_get_op(call)->set_sent_custom_header(linphone_info_message_get_headers(info));
|
||||
return linphone_call_get_op(call)->send_info(nullptr, nullptr, body_handler);
|
||||
linphone_call_get_op(call)->setSentCustomHeaders(linphone_info_message_get_headers(info));
|
||||
return linphone_call_get_op(call)->sendInfo(nullptr, nullptr, body_handler);
|
||||
}
|
||||
|
||||
LinphoneCallStats *linphone_call_get_stats (LinphoneCall *call, LinphoneStreamType type) {
|
||||
|
|
|
|||
|
|
@ -680,11 +680,11 @@ void ChatMessagePrivate::send () {
|
|||
core->getCCore(), op, peer, getSalCustomHeaders(),
|
||||
!!lp_config_get_int(core->getCCore()->config, "sip", "chat_msg_with_contact", 0)
|
||||
);
|
||||
op->set_user_pointer(q); /* If out of call, directly store msg */
|
||||
op->setUserPointer(q); /* If out of call, directly store msg */
|
||||
linphone_address_unref(peer);
|
||||
}
|
||||
op->set_from(q->getFromAddress().asString().c_str());
|
||||
op->set_to(q->getToAddress().asString().c_str());
|
||||
op->setFrom(q->getFromAddress().asString().c_str());
|
||||
op->setTo(q->getToAddress().asString().c_str());
|
||||
|
||||
// ---------------------------------------
|
||||
// Start of message modification
|
||||
|
|
@ -721,7 +721,7 @@ void ChatMessagePrivate::send () {
|
|||
EncryptionChatMessageModifier ecmm;
|
||||
ChatMessageModifier::Result result = ecmm.encode(q->getSharedFromThis(), errorCode);
|
||||
if (result == ChatMessageModifier::Result::Error) {
|
||||
sal_error_info_set((SalErrorInfo *)op->get_error_info(), SalReasonNotAcceptable, "SIP", errorCode, "Unable to encrypt IM", nullptr);
|
||||
sal_error_info_set((SalErrorInfo *)op->getErrorInfo(), SalReasonNotAcceptable, "SIP", errorCode, "Unable to encrypt IM", nullptr);
|
||||
setState(ChatMessage::State::NotDelivered);
|
||||
return;
|
||||
} else if (result == ChatMessageModifier::Result::Suspended) {
|
||||
|
|
@ -783,7 +783,7 @@ void ChatMessagePrivate::send () {
|
|||
currentSendStep = ChatMessagePrivate::Step::None;
|
||||
|
||||
if (imdnId.empty())
|
||||
setImdnMessageId(op->get_call_id()); /* must be known at that time */
|
||||
setImdnMessageId(op->getCallId()); /* must be known at that time */
|
||||
|
||||
if (lcall && linphone_call_get_op(lcall) == op) {
|
||||
/* In this case, chat delivery status is not notified, so unrefing chat message right now */
|
||||
|
|
@ -890,7 +890,7 @@ ChatMessage::~ChatMessage () {
|
|||
}
|
||||
|
||||
if (d->salOp) {
|
||||
d->salOp->set_user_pointer(nullptr);
|
||||
d->salOp->setUserPointer(nullptr);
|
||||
d->salOp->unref();
|
||||
}
|
||||
if (d->salCustomHeaders)
|
||||
|
|
|
|||
|
|
@ -235,7 +235,7 @@ LinphoneReason ChatRoomPrivate::onSipMessageReceived (SalOp *op, const SalMessag
|
|||
LinphoneCore *cCore = core->getCCore();
|
||||
|
||||
msg = createChatMessage(
|
||||
IdentityAddress(op->get_from()) == q->getLocalAddress()
|
||||
IdentityAddress(op->getFrom()) == q->getLocalAddress()
|
||||
? ChatMessage::Direction::Outgoing
|
||||
: ChatMessage::Direction::Incoming
|
||||
);
|
||||
|
|
@ -252,9 +252,9 @@ LinphoneReason ChatRoomPrivate::onSipMessageReceived (SalOp *op, const SalMessag
|
|||
msg->setInternalContent(content);
|
||||
|
||||
msg->getPrivate()->setTime(message->time);
|
||||
msg->getPrivate()->setImdnMessageId(op->get_call_id());
|
||||
msg->getPrivate()->setImdnMessageId(op->getCallId());
|
||||
|
||||
const SalCustomHeader *ch = op->get_recv_custom_header();
|
||||
const SalCustomHeader *ch = op->getRecvCustomHeaders();
|
||||
if (ch)
|
||||
msg->getPrivate()->setSalCustomHeaders(sal_custom_header_clone(ch));
|
||||
|
||||
|
|
|
|||
|
|
@ -110,13 +110,13 @@ void ClientGroupChatRoomPrivate::confirmJoining (SalCallOp *op) {
|
|||
auto focus = qConference->getPrivate()->focus;
|
||||
bool previousSession = (focus->getPrivate()->getSession() != nullptr);
|
||||
auto session = focus->getPrivate()->createSession(*q, nullptr, false, this);
|
||||
session->configure(LinphoneCallIncoming, nullptr, op, Address(op->get_from()), Address(op->get_to()));
|
||||
session->configure(LinphoneCallIncoming, nullptr, op, Address(op->getFrom()), Address(op->getTo()));
|
||||
session->startIncomingNotification(false);
|
||||
|
||||
if (!previousSession) {
|
||||
setState(ClientGroupChatRoom::State::CreationPending);
|
||||
// Handle participants addition
|
||||
list<IdentityAddress> identAddresses = ClientGroupChatRoom::parseResourceLists(op->get_remote_body());
|
||||
list<IdentityAddress> identAddresses = ClientGroupChatRoom::parseResourceLists(op->getRemoteBody());
|
||||
for (const auto &addr : identAddresses) {
|
||||
auto participant = q->findParticipant(addr);
|
||||
if (!participant) {
|
||||
|
|
@ -351,7 +351,7 @@ void ClientGroupChatRoom::addParticipant (const IdentityAddress &addr, const Cal
|
|||
linphone_address_unref(lAddr);
|
||||
Address referToAddr = addr;
|
||||
referToAddr.setParam("text");
|
||||
referOp->send_refer(referToAddr.getPrivate()->getInternalAddress());
|
||||
referOp->sendRefer(referToAddr.getPrivate()->getInternalAddress());
|
||||
referOp->unref();
|
||||
}
|
||||
}
|
||||
|
|
@ -402,7 +402,7 @@ void ClientGroupChatRoom::removeParticipant (const shared_ptr<Participant> &part
|
|||
Address referToAddr = participant->getAddress();
|
||||
referToAddr.setParam("text");
|
||||
referToAddr.setUriParam("method", "BYE");
|
||||
referOp->send_refer(referToAddr.getPrivate()->getInternalAddress());
|
||||
referOp->sendRefer(referToAddr.getPrivate()->getInternalAddress());
|
||||
referOp->unref();
|
||||
}
|
||||
|
||||
|
|
@ -444,7 +444,7 @@ void ClientGroupChatRoom::setParticipantAdminStatus (const shared_ptr<Participan
|
|||
Address referToAddr = participant->getAddress();
|
||||
referToAddr.setParam("text");
|
||||
referToAddr.setParam("admin", Utils::toString(isAdmin));
|
||||
referOp->send_refer(referToAddr.getPrivate()->getInternalAddress());
|
||||
referOp->sendRefer(referToAddr.getPrivate()->getInternalAddress());
|
||||
referOp->unref();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -139,8 +139,8 @@ void ServerGroupChatRoomPrivate::onCallSessionSetReleased (const shared_ptr<Call
|
|||
// =============================================================================
|
||||
|
||||
ServerGroupChatRoom::ServerGroupChatRoom (const shared_ptr<Core> &core, SalCallOp *op)
|
||||
: ChatRoom(*new ServerGroupChatRoomPrivate, core, ChatRoomId(IdentityAddress(op->get_to()), IdentityAddress(op->get_to()))),
|
||||
LocalConference(core, IdentityAddress(op->get_to()), nullptr) {
|
||||
: ChatRoom(*new ServerGroupChatRoomPrivate, core, ChatRoomId(IdentityAddress(op->getTo()), IdentityAddress(op->getTo()))),
|
||||
LocalConference(core, IdentityAddress(op->getTo()), nullptr) {
|
||||
L_D();
|
||||
d->chatRoomListener = d;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -235,7 +235,7 @@ void Imdn::startTimer () {
|
|||
|
||||
unsigned int duration = 500;
|
||||
if (!timer)
|
||||
timer = chatRoom->getCore()->getCCore()->sal->create_timer(timerExpired, this, duration, "imdn timeout");
|
||||
timer = chatRoom->getCore()->getCCore()->sal->createTimer(timerExpired, this, duration, "imdn timeout");
|
||||
else
|
||||
belle_sip_source_set_timeout(timer, duration);
|
||||
bgTask.start(chatRoom->getCore(), 1);
|
||||
|
|
@ -245,7 +245,7 @@ void Imdn::stopTimer () {
|
|||
if (timer) {
|
||||
auto core = chatRoom->getCore()->getCCore();
|
||||
if (core && core->sal)
|
||||
core->sal->cancel_timer(timer);
|
||||
core->sal->cancelTimer(timer);
|
||||
belle_sip_object_unref(timer);
|
||||
timer = nullptr;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ void IsComposing::parse (const Address &remoteAddr, const string &text) {
|
|||
void IsComposing::startIdleTimer () {
|
||||
unsigned int duration = getIdleTimerDuration();
|
||||
if (!idleTimer) {
|
||||
idleTimer = core->sal->create_timer(idleTimerExpired, this,
|
||||
idleTimer = core->sal->createTimer(idleTimerExpired, this,
|
||||
duration * 1000, "composing idle timeout");
|
||||
} else {
|
||||
belle_sip_source_set_timeout(idleTimer, duration * 1000);
|
||||
|
|
@ -95,7 +95,7 @@ void IsComposing::startIdleTimer () {
|
|||
void IsComposing::startRefreshTimer () {
|
||||
unsigned int duration = getRefreshTimerDuration();
|
||||
if (!refreshTimer) {
|
||||
refreshTimer = core->sal->create_timer(refreshTimerExpired, this,
|
||||
refreshTimer = core->sal->createTimer(refreshTimerExpired, this,
|
||||
duration * 1000, "composing refresh timeout");
|
||||
} else {
|
||||
belle_sip_source_set_timeout(refreshTimer, duration * 1000);
|
||||
|
|
@ -113,7 +113,7 @@ void IsComposing::stopTimers () {
|
|||
void IsComposing::stopIdleTimer () {
|
||||
if (idleTimer) {
|
||||
if (core && core->sal)
|
||||
core->sal->cancel_timer(idleTimer);
|
||||
core->sal->cancelTimer(idleTimer);
|
||||
belle_sip_object_unref(idleTimer);
|
||||
idleTimer = nullptr;
|
||||
}
|
||||
|
|
@ -122,7 +122,7 @@ void IsComposing::stopIdleTimer () {
|
|||
void IsComposing::stopRefreshTimer () {
|
||||
if (refreshTimer) {
|
||||
if (core && core->sal)
|
||||
core->sal->cancel_timer(refreshTimer);
|
||||
core->sal->cancelTimer(refreshTimer);
|
||||
belle_sip_object_unref(refreshTimer);
|
||||
refreshTimer = nullptr;
|
||||
}
|
||||
|
|
@ -176,7 +176,7 @@ void IsComposing::startRemoteRefreshTimer (const string &uri, unsigned long long
|
|||
auto it = remoteRefreshTimers.find(uri);
|
||||
if (it == remoteRefreshTimers.end()) {
|
||||
IsRemoteComposingData *data = new IsRemoteComposingData(this, uri);
|
||||
belle_sip_source_t *timer = core->sal->create_timer(remoteRefreshTimerExpired, data,
|
||||
belle_sip_source_t *timer = core->sal->createTimer(remoteRefreshTimerExpired, data,
|
||||
duration * 1000, "composing remote refresh timeout");
|
||||
pair<string, belle_sip_source_t *> p(uri, timer);
|
||||
remoteRefreshTimers.insert(p);
|
||||
|
|
@ -192,7 +192,7 @@ void IsComposing::stopAllRemoteRefreshTimers () {
|
|||
unordered_map<string, belle_sip_source_t *>::iterator IsComposing::stopRemoteRefreshTimer (const unordered_map<string, belle_sip_source_t *>::const_iterator it) {
|
||||
belle_sip_source_t *timer = it->second;
|
||||
if (core && core->sal) {
|
||||
core->sal->cancel_timer(timer);
|
||||
core->sal->cancelTimer(timer);
|
||||
delete reinterpret_cast<IsRemoteComposingData *>(belle_sip_source_get_user_data(timer));
|
||||
}
|
||||
belle_sip_object_unref(timer);
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ void RemoteConferenceEventHandlerPrivate::subscribe () {
|
|||
}
|
||||
|
||||
lev = linphone_event_ref(linphone_core_create_subscribe(conf->getCore()->getCCore(), lAddr, "conference", 600));
|
||||
lev->op->set_from(chatRoomId.getLocalAddress().asString().c_str());
|
||||
lev->op->setFrom(chatRoomId.getLocalAddress().asString().c_str());
|
||||
const string &lastNotifyStr = Utils::toString(lastNotify);
|
||||
linphone_event_add_custom_header(lev, "Last-Notify-Version", lastNotifyStr.c_str());
|
||||
linphone_address_unref(lAddr);
|
||||
|
|
|
|||
|
|
@ -50,13 +50,13 @@ int CallSessionPrivate::computeDuration () const {
|
|||
* end apparently does not support. This features are: privacy, video...
|
||||
*/
|
||||
void CallSessionPrivate::initializeParamsAccordingToIncomingCallParams () {
|
||||
currentParams->setPrivacy((LinphonePrivacyMask)op->get_privacy());
|
||||
currentParams->setPrivacy((LinphonePrivacyMask)op->getPrivacy());
|
||||
}
|
||||
|
||||
void CallSessionPrivate::notifyReferState () {
|
||||
SalCallOp *refererOp = referer->getPrivate()->getOp();
|
||||
if (refererOp)
|
||||
refererOp->notify_refer_state(op);
|
||||
refererOp->notifyReferState(op);
|
||||
}
|
||||
|
||||
void CallSessionPrivate::setState (CallSession::State newState, const string &message) {
|
||||
|
|
@ -177,10 +177,10 @@ bool CallSessionPrivate::startPing () {
|
|||
pingReplied = false;
|
||||
pingOp = new SalOp(q->getCore()->getCCore()->sal);
|
||||
if (direction == LinphoneCallIncoming) {
|
||||
const char *from = pingOp->get_from();
|
||||
const char *to = pingOp->get_to();
|
||||
const char *from = pingOp->getFrom();
|
||||
const char *to = pingOp->getTo();
|
||||
linphone_configure_op(q->getCore()->getCCore(), pingOp, log->from, nullptr, false);
|
||||
pingOp->set_route(op->get_network_origin());
|
||||
pingOp->setRoute(op->getNetworkOrigin());
|
||||
pingOp->ping(from, to);
|
||||
} else if (direction == LinphoneCallOutgoing) {
|
||||
char *from = linphone_address_as_string(log->from);
|
||||
|
|
@ -189,7 +189,7 @@ bool CallSessionPrivate::startPing () {
|
|||
ms_free(from);
|
||||
ms_free(to);
|
||||
}
|
||||
pingOp->set_user_pointer(this);
|
||||
pingOp->setUserPointer(this);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
@ -230,7 +230,7 @@ void CallSessionPrivate::accepted () {
|
|||
default:
|
||||
break;
|
||||
}
|
||||
currentParams->setPrivacy((LinphonePrivacyMask)op->get_privacy());
|
||||
currentParams->setPrivacy((LinphonePrivacyMask)op->getPrivacy());
|
||||
}
|
||||
|
||||
void CallSessionPrivate::ackBeingSent (LinphoneHeaders *headers) {
|
||||
|
|
@ -254,12 +254,12 @@ void CallSessionPrivate::cancelDone () {
|
|||
|
||||
bool CallSessionPrivate::failure () {
|
||||
L_Q();
|
||||
const SalErrorInfo *ei = op->get_error_info();
|
||||
const SalErrorInfo *ei = op->getErrorInfo();
|
||||
switch (ei->reason) {
|
||||
case SalReasonRedirect:
|
||||
if ((state == CallSession::State::OutgoingInit) || (state == CallSession::State::OutgoingProgress)
|
||||
|| (state == CallSession::State::OutgoingRinging) /* Push notification case */ || (state == CallSession::State::OutgoingEarlyMedia)) {
|
||||
const SalAddress *redirectionTo = op->get_remote_contact_address();
|
||||
const SalAddress *redirectionTo = op->getRemoteContactAddress();
|
||||
if (redirectionTo) {
|
||||
char *url = sal_address_as_string(redirectionTo);
|
||||
lWarning() << "Redirecting CallSession [" << q << "] to " << url;
|
||||
|
|
@ -312,7 +312,7 @@ bool CallSessionPrivate::failure () {
|
|||
void CallSessionPrivate::infoReceived (SalBodyHandler *bodyHandler) {
|
||||
L_Q();
|
||||
LinphoneInfoMessage *info = linphone_core_create_info_message(q->getCore()->getCCore());
|
||||
linphone_info_message_set_headers(info, op->get_recv_custom_header());
|
||||
linphone_info_message_set_headers(info, op->getRecvCustomHeaders());
|
||||
if (bodyHandler) {
|
||||
LinphoneContent *content = linphone_content_from_sal_body_handler(bodyHandler);
|
||||
linphone_info_message_set_content(info, content);
|
||||
|
|
@ -344,7 +344,7 @@ void CallSessionPrivate::referred (const Address &referToAddr) {
|
|||
void CallSessionPrivate::remoteRinging () {
|
||||
L_Q();
|
||||
/* Set privacy */
|
||||
currentParams->setPrivacy((LinphonePrivacyMask)op->get_privacy());
|
||||
currentParams->setPrivacy((LinphonePrivacyMask)op->getPrivacy());
|
||||
if (listener)
|
||||
listener->onStartRinging(q->getSharedFromThis());
|
||||
lInfo() << "Remote ringing...";
|
||||
|
|
@ -356,12 +356,12 @@ void CallSessionPrivate::replaceOp (SalCallOp *newOp) {
|
|||
SalCallOp *oldOp = op;
|
||||
CallSession::State oldState = state;
|
||||
op = newOp;
|
||||
op->set_user_pointer(q);
|
||||
op->set_local_media_description(oldOp->get_local_media_description());
|
||||
op->setUserPointer(q);
|
||||
op->setLocalMediaDescription(oldOp->getLocalMediaDescription());
|
||||
switch (state) {
|
||||
case CallSession::State::IncomingEarlyMedia:
|
||||
case CallSession::State::IncomingReceived:
|
||||
op->notify_ringing((state == CallSession::State::IncomingEarlyMedia) ? true : false);
|
||||
op->notifyRinging((state == CallSession::State::IncomingEarlyMedia) ? true : false);
|
||||
break;
|
||||
case CallSession::State::Connected:
|
||||
case CallSession::State::StreamsRunning:
|
||||
|
|
@ -374,17 +374,17 @@ void CallSessionPrivate::replaceOp (SalCallOp *newOp) {
|
|||
switch (oldState) {
|
||||
case CallSession::State::IncomingEarlyMedia:
|
||||
case CallSession::State::IncomingReceived:
|
||||
oldOp->set_user_pointer(nullptr); // In order for the call session to not get terminated by terminating this op
|
||||
oldOp->setUserPointer(nullptr); // In order for the call session to not get terminated by terminating this op
|
||||
// Do not terminate a forked INVITE
|
||||
if (op->get_replaces())
|
||||
if (op->getReplaces())
|
||||
oldOp->terminate();
|
||||
else
|
||||
oldOp->kill_dialog();
|
||||
oldOp->killDialog();
|
||||
break;
|
||||
case CallSession::State::Connected:
|
||||
case CallSession::State::StreamsRunning:
|
||||
oldOp->terminate();
|
||||
oldOp->kill_dialog();
|
||||
oldOp->killDialog();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
@ -401,7 +401,7 @@ void CallSessionPrivate::terminated () {
|
|||
return;
|
||||
case CallSession::State::IncomingReceived:
|
||||
case CallSession::State::IncomingEarlyMedia:
|
||||
if (!op->get_reason_error_info()->protocol || strcmp(op->get_reason_error_info()->protocol, "") == 0) {
|
||||
if (!op->getReasonErrorInfo()->protocol || strcmp(op->getReasonErrorInfo()->protocol, "") == 0) {
|
||||
linphone_error_info_set(ei, nullptr, LinphoneReasonNotAnswered, 0, "Incoming call cancelled", nullptr);
|
||||
nonOpError = true;
|
||||
}
|
||||
|
|
@ -447,7 +447,7 @@ void CallSessionPrivate::updated (bool isUpdate) {
|
|||
case CallSession::State::Pausing:
|
||||
case CallSession::State::Resuming:
|
||||
sal_error_info_set(&sei, SalReasonInternalError, "SIP", 0, nullptr, nullptr);
|
||||
op->decline_with_error_info(&sei, nullptr);
|
||||
op->declineWithErrorInfo(&sei, nullptr);
|
||||
BCTBX_NO_BREAK; /* no break */
|
||||
case CallSession::State::Idle:
|
||||
case CallSession::State::OutgoingInit:
|
||||
|
|
@ -501,7 +501,7 @@ void CallSessionPrivate::accept (const CallSessionParams *csp) {
|
|||
if (csp)
|
||||
setParams(new CallSessionParams(*csp));
|
||||
if (params)
|
||||
op->set_sent_custom_header(params->getPrivate()->getCustomHeaders());
|
||||
op->setSentCustomHeaders(params->getPrivate()->getCustomHeaders());
|
||||
|
||||
op->accept();
|
||||
if (listener)
|
||||
|
|
@ -527,9 +527,9 @@ LinphoneStatus CallSessionPrivate::checkForAcceptation () {
|
|||
listener->onCheckForAcceptation(q->getSharedFromThis());
|
||||
|
||||
/* Check if this call is supposed to replace an already running one */
|
||||
SalOp *replaced = op->get_replaces();
|
||||
SalOp *replaced = op->getReplaces();
|
||||
if (replaced) {
|
||||
CallSession *session = reinterpret_cast<CallSession *>(replaced->get_user_pointer());
|
||||
CallSession *session = reinterpret_cast<CallSession *>(replaced->getUserPointer());
|
||||
if (session) {
|
||||
lInfo() << "CallSession " << q << " replaces CallSession " << session << ". This last one is going to be terminated automatically";
|
||||
session->terminate();
|
||||
|
|
@ -543,8 +543,8 @@ void CallSessionPrivate::handleIncomingReceivedStateInIncomingNotification () {
|
|||
/* Try to be best-effort in giving real local or routable contact address for 100Rel case */
|
||||
setContactOp();
|
||||
if (notifyRinging)
|
||||
op->notify_ringing(false);
|
||||
if (op->get_replaces() && lp_config_get_int(linphone_core_get_config(q->getCore()->getCCore()), "sip", "auto_answer_replacing_calls", 1))
|
||||
op->notifyRinging(false);
|
||||
if (op->getReplaces() && lp_config_get_int(linphone_core_get_config(q->getCore()->getCCore()), "sip", "auto_answer_replacing_calls", 1))
|
||||
q->accept();
|
||||
}
|
||||
|
||||
|
|
@ -647,9 +647,9 @@ LinphoneStatus CallSessionPrivate::startUpdate (const string &subject) {
|
|||
}
|
||||
if (destProxy && destProxy->op) {
|
||||
/* Give a chance to update the contact address if connectivity has changed */
|
||||
op->set_contact_address(destProxy->op->get_contact_address());
|
||||
op->setContactAddress(destProxy->op->getContactAddress());
|
||||
} else
|
||||
op->set_contact_address(nullptr);
|
||||
op->setContactAddress(nullptr);
|
||||
return op->update(newSubject.c_str(), q->getParams()->getPrivate()->getNoUserConsent());
|
||||
}
|
||||
|
||||
|
|
@ -703,7 +703,7 @@ void CallSessionPrivate::setContactOp () {
|
|||
for (auto it = contactParams.begin(); it != contactParams.end(); it++)
|
||||
linphone_address_set_param(contact, it->first.c_str(), it->second.empty() ? nullptr : it->second.c_str());
|
||||
salAddress = const_cast<SalAddress *>(L_GET_PRIVATE_FROM_C_OBJECT(contact)->getInternalAddress());
|
||||
op->set_contact_address(salAddress);
|
||||
op->setContactAddress(salAddress);
|
||||
linphone_address_unref(contact);
|
||||
}
|
||||
}
|
||||
|
|
@ -737,12 +737,12 @@ void CallSessionPrivate::createOpTo (const LinphoneAddress *to) {
|
|||
if (op)
|
||||
op->release();
|
||||
op = new SalCallOp(q->getCore()->getCCore()->sal);
|
||||
op->set_user_pointer(q);
|
||||
op->setUserPointer(q);
|
||||
if (params->getPrivate()->getReferer())
|
||||
op->set_referer(params->getPrivate()->getReferer()->getPrivate()->getOp());
|
||||
op->setReferrer(params->getPrivate()->getReferer()->getPrivate()->getOp());
|
||||
linphone_configure_op(q->getCore()->getCCore(), op, to, q->getParams()->getPrivate()->getCustomHeaders(), false);
|
||||
if (q->getParams()->getPrivacy() != LinphonePrivacyDefault)
|
||||
op->set_privacy((SalPrivacyMask)q->getParams()->getPrivacy());
|
||||
op->setPrivacy((SalPrivacyMask)q->getParams()->getPrivacy());
|
||||
/* else privacy might be set by proxy */
|
||||
}
|
||||
|
||||
|
|
@ -751,13 +751,13 @@ void CallSessionPrivate::createOpTo (const LinphoneAddress *to) {
|
|||
LinphoneAddress * CallSessionPrivate::getFixedContact () const {
|
||||
L_Q();
|
||||
LinphoneAddress *result = nullptr;
|
||||
if (op && op->get_contact_address()) {
|
||||
if (op && op->getContactAddress()) {
|
||||
/* If already choosed, don't change it */
|
||||
return nullptr;
|
||||
} else if (pingOp && pingOp->get_contact_address()) {
|
||||
} else if (pingOp && pingOp->getContactAddress()) {
|
||||
/* If the ping OPTIONS request succeeded use the contact guessed from the received, rport */
|
||||
lInfo() << "Contact has been fixed using OPTIONS";
|
||||
char *addr = sal_address_as_string(pingOp->get_contact_address());
|
||||
char *addr = sal_address_as_string(pingOp->getContactAddress());
|
||||
result = linphone_address_new(addr);
|
||||
ms_free(addr);
|
||||
} else if (destProxy && destProxy->op && linphone_proxy_config_get_contact(destProxy)) {
|
||||
|
|
@ -786,12 +786,12 @@ void CallSessionPrivate::reinviteToRecoverFromConnectionLoss () {
|
|||
|
||||
void CallSessionPrivate::repairByInviteWithReplaces () {
|
||||
L_Q();
|
||||
const char *callId = op->get_call_id();
|
||||
const char *fromTag = op->get_local_tag();
|
||||
const char *toTag = op->get_remote_tag();
|
||||
op->kill_dialog();
|
||||
const char *callId = op->getCallId();
|
||||
const char *fromTag = op->getLocalTag();
|
||||
const char *toTag = op->getRemoteTag();
|
||||
op->killDialog();
|
||||
createOp();
|
||||
op->set_replaces(callId, fromTag, toTag);
|
||||
op->setReplaces(callId, fromTag, toTag);
|
||||
q->startInvite(nullptr);
|
||||
}
|
||||
|
||||
|
|
@ -819,9 +819,9 @@ void CallSessionPrivate::repairIfBroken () {
|
|||
switch (state) {
|
||||
case CallSession::State::Updating:
|
||||
case CallSession::State::Pausing:
|
||||
if (op->dialog_request_pending()) {
|
||||
if (op->dialogRequestPending()) {
|
||||
// Need to cancel first re-INVITE as described in section 5.5 of RFC 6141
|
||||
if (op->cancel_invite() == 0){
|
||||
if (op->cancelInvite() == 0){
|
||||
reinviteOnCancelResponseRequested = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -829,19 +829,19 @@ void CallSessionPrivate::repairIfBroken () {
|
|||
case CallSession::State::StreamsRunning:
|
||||
case CallSession::State::Paused:
|
||||
case CallSession::State::PausedByRemote:
|
||||
if (!op->dialog_request_pending())
|
||||
if (!op->dialogRequestPending())
|
||||
reinviteToRecoverFromConnectionLoss();
|
||||
break;
|
||||
case CallSession::State::UpdatedByRemote:
|
||||
if (op->dialog_request_pending()) {
|
||||
if (op->dialogRequestPending()) {
|
||||
sal_error_info_set(&sei, SalReasonServiceUnavailable, "SIP", 0, nullptr, nullptr);
|
||||
op->decline_with_error_info(&sei, nullptr);
|
||||
op->declineWithErrorInfo(&sei, nullptr);
|
||||
}
|
||||
reinviteToRecoverFromConnectionLoss();
|
||||
break;
|
||||
case CallSession::State::OutgoingInit:
|
||||
case CallSession::State::OutgoingProgress:
|
||||
if (op->cancel_invite() == 0){
|
||||
if (op->cancelInvite() == 0){
|
||||
reinviteOnCancelResponseRequested = true;
|
||||
}
|
||||
break;
|
||||
|
|
@ -931,10 +931,13 @@ void CallSession::configure (LinphoneCallDir direction, LinphoneProxyConfig *cfg
|
|||
if (op) {
|
||||
/* We already have an op for incoming calls */
|
||||
d->op = op;
|
||||
d->op->set_user_pointer(this);
|
||||
op->enable_cnx_ip_to_0000_if_sendonly(!!lp_config_get_default_int(linphone_core_get_config(getCore()->getCCore()),
|
||||
"sip", "cnx_ip_to_0000_if_sendonly_enabled", 0));
|
||||
d->log->call_id = ms_strdup(op->get_call_id()); /* Must be known at that time */
|
||||
d->op->setUserPointer(this);
|
||||
op->enableCnxIpTo0000IfSendOnly(
|
||||
!!lp_config_get_default_int(
|
||||
linphone_core_get_config(getCore()->getCCore()), "sip", "cnx_ip_to_0000_if_sendonly_enabled", 0
|
||||
)
|
||||
);
|
||||
d->log->call_id = ms_strdup(op->getCallId()); /* Must be known at that time */
|
||||
}
|
||||
|
||||
if (direction == LinphoneCallOutgoing) {
|
||||
|
|
@ -968,7 +971,7 @@ LinphoneStatus CallSession::decline (const LinphoneErrorInfo *ei) {
|
|||
}
|
||||
if (ei) {
|
||||
linphone_error_info_to_sal(ei, &sei);
|
||||
d->op->decline_with_error_info(&sei , nullptr);
|
||||
d->op->declineWithErrorInfo(&sei , nullptr);
|
||||
} else
|
||||
d->op->decline(SalReasonDeclined, nullptr);
|
||||
sal_error_info_reset(&sei);
|
||||
|
|
@ -1053,7 +1056,7 @@ LinphoneStatus CallSession::redirect (const Address &redirectAddr) {
|
|||
SalErrorInfo sei;
|
||||
memset(&sei, 0, sizeof(sei));
|
||||
sal_error_info_set(&sei, SalReasonRedirect, "SIP", 0, nullptr, nullptr);
|
||||
d->op->decline_with_error_info(&sei, redirectAddr.getPrivate()->getInternalAddress());
|
||||
d->op->declineWithErrorInfo(&sei, redirectAddr.getPrivate()->getInternalAddress());
|
||||
linphone_error_info_set(d->ei, nullptr, LinphoneReasonMovedPermanently, 302, "Call redirected", nullptr);
|
||||
d->nonOpError = true;
|
||||
d->terminate();
|
||||
|
|
@ -1096,7 +1099,7 @@ int CallSession::startInvite (const Address *destination, const string &subject,
|
|||
/* Take a ref because sal_call() may destroy the CallSession if no SIP transport is available */
|
||||
shared_ptr<CallSession> ref = getSharedFromThis();
|
||||
if (content)
|
||||
d->op->set_local_body(*content);
|
||||
d->op->setLocalBody(*content);
|
||||
int result = d->op->call(from, destinationStr.c_str(), subject.empty() ? nullptr : subject.c_str());
|
||||
ms_free(from);
|
||||
if (result < 0) {
|
||||
|
|
@ -1106,7 +1109,7 @@ int CallSession::startInvite (const Address *destination, const string &subject,
|
|||
d->setState(CallSession::State::Error, "Call failed");
|
||||
}
|
||||
} else {
|
||||
d->log->call_id = ms_strdup(d->op->get_call_id()); /* Must be known at that time */
|
||||
d->log->call_id = ms_strdup(d->op->getCallId()); /* Must be known at that time */
|
||||
d->setState(CallSession::State::OutgoingProgress, "Outgoing call in progress");
|
||||
}
|
||||
return result;
|
||||
|
|
@ -1134,7 +1137,7 @@ LinphoneStatus CallSession::terminate (const LinphoneErrorInfo *ei) {
|
|||
default:
|
||||
if (ei) {
|
||||
linphone_error_info_to_sal(ei, &sei);
|
||||
d->op->terminate_with_error(&sei);
|
||||
d->op->terminate(&sei);
|
||||
sal_error_info_reset(&sei);
|
||||
} else
|
||||
d->op->terminate();
|
||||
|
|
@ -1147,7 +1150,7 @@ LinphoneStatus CallSession::terminate (const LinphoneErrorInfo *ei) {
|
|||
|
||||
LinphoneStatus CallSession::transfer (const shared_ptr<CallSession> &dest) {
|
||||
L_D();
|
||||
int result = d->op->refer_with_replaces(dest->getPrivate()->op);
|
||||
int result = d->op->referWithReplaces(dest->getPrivate()->op);
|
||||
d->setTransferState(CallSession::State::OutgoingInit);
|
||||
return result;
|
||||
}
|
||||
|
|
@ -1175,7 +1178,7 @@ LinphoneStatus CallSession::update (const CallSessionParams *csp, const string &
|
|||
lWarning() << "CallSession::update() is given the current params, this is probably not what you intend to do!";
|
||||
if (csp)
|
||||
d->setParams(new CallSessionParams(*csp));
|
||||
d->op->set_local_body(content ? *content : Content());
|
||||
d->op->setLocalBody(content ? *content : Content());
|
||||
LinphoneStatus result = d->startUpdate(subject);
|
||||
if (result && (d->state != initialState)) {
|
||||
/* Restore initial state */
|
||||
|
|
@ -1194,7 +1197,7 @@ LinphoneCallDir CallSession::getDirection () const {
|
|||
const Address& CallSession::getDiversionAddress () const {
|
||||
L_D();
|
||||
if (d->op) {
|
||||
char *addrStr = sal_address_as_string(d->op->get_diversion_address());
|
||||
char *addrStr = sal_address_as_string(d->op->getDiversionAddress());
|
||||
d->diversionAddress = Address(addrStr);
|
||||
bctbx_free(addrStr);
|
||||
} else {
|
||||
|
|
@ -1257,7 +1260,7 @@ string CallSession::getRemoteContact () const {
|
|||
L_D();
|
||||
if (d->op) {
|
||||
/* sal_op_get_remote_contact preserves header params */
|
||||
return d->op->get_remote_contact();
|
||||
return d->op->getRemoteContact();
|
||||
}
|
||||
return string();
|
||||
}
|
||||
|
|
@ -1267,7 +1270,7 @@ const Address *CallSession::getRemoteContactAddress () const {
|
|||
if (!d->op) {
|
||||
return nullptr;
|
||||
}
|
||||
char *addrStr = sal_address_as_string(d->op->get_remote_contact_address());
|
||||
char *addrStr = sal_address_as_string(d->op->getRemoteContactAddress());
|
||||
d->remoteContactAddress = Address(addrStr);
|
||||
bctbx_free(addrStr);
|
||||
return &d->remoteContactAddress;
|
||||
|
|
@ -1276,7 +1279,7 @@ const Address *CallSession::getRemoteContactAddress () const {
|
|||
const CallSessionParams * CallSession::getRemoteParams () {
|
||||
L_D();
|
||||
if (d->op){
|
||||
const SalCustomHeader *ch = d->op->get_recv_custom_header();
|
||||
const SalCustomHeader *ch = d->op->getRecvCustomHeaders();
|
||||
if (ch) {
|
||||
/* Instanciate a remote_params only if a SIP message was received before (custom headers indicates this) */
|
||||
if (!d->remoteParams)
|
||||
|
|
@ -1300,7 +1303,7 @@ CallSession::State CallSession::getPreviousState () const {
|
|||
|
||||
const Address& CallSession::getToAddress () const {
|
||||
L_D();
|
||||
d->toAddress = Address(d->op->get_to());
|
||||
d->toAddress = Address(d->op->getTo());
|
||||
return d->toAddress;
|
||||
}
|
||||
|
||||
|
|
@ -1316,24 +1319,24 @@ shared_ptr<CallSession> CallSession::getTransferTarget () const {
|
|||
|
||||
string CallSession::getToHeader (const string &name) const {
|
||||
L_D();
|
||||
return L_C_TO_STRING(sal_custom_header_find(d->op->get_recv_custom_header(), name.c_str()));
|
||||
return L_C_TO_STRING(sal_custom_header_find(d->op->getRecvCustomHeaders(), name.c_str()));
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
string CallSession::getRemoteUserAgent () const {
|
||||
L_D();
|
||||
if (d->op && d->op->get_remote_ua())
|
||||
return d->op->get_remote_ua();
|
||||
if (d->op && d->op->getRemoteUserAgent())
|
||||
return d->op->getRemoteUserAgent();
|
||||
return string();
|
||||
}
|
||||
|
||||
shared_ptr<CallSession> CallSession::getReplacedCallSession () const {
|
||||
L_D();
|
||||
SalOp *replacedOp = d->op->get_replaces();
|
||||
SalOp *replacedOp = d->op->getReplaces();
|
||||
if (!replacedOp)
|
||||
return nullptr;
|
||||
return reinterpret_cast<CallSession *>(replacedOp->get_user_pointer())->getSharedFromThis();
|
||||
return reinterpret_cast<CallSession *>(replacedOp->getUserPointer())->getSharedFromThis();
|
||||
}
|
||||
|
||||
CallSessionParams * CallSession::getCurrentParams () const {
|
||||
|
|
|
|||
|
|
@ -83,8 +83,8 @@ void MediaSessionPrivate::accepted () {
|
|||
linphone_task_list_init(&tl);
|
||||
/* Reset the internal call update flag, so it doesn't risk to be copied and used in further re-INVITEs */
|
||||
getParams()->getPrivate()->setInternalCallUpdate(false);
|
||||
SalMediaDescription *rmd = op->get_remote_media_description();
|
||||
SalMediaDescription *md = op->get_final_media_description();
|
||||
SalMediaDescription *rmd = op->getRemoteMediaDescription();
|
||||
SalMediaDescription *md = op->getFinalMediaDescription();
|
||||
if (!md && (prevState == CallSession::State::OutgoingEarlyMedia) && resultDesc) {
|
||||
lInfo() << "Using early media SDP since none was received with the 200 OK";
|
||||
md = resultDesc;
|
||||
|
|
@ -95,7 +95,7 @@ void MediaSessionPrivate::accepted () {
|
|||
/* There is a valid SDP in the response, either offer or answer, and we're able to start/update the streams */
|
||||
if (rmd) {
|
||||
/* Handle remote ICE attributes if any. */
|
||||
iceAgent->updateFromRemoteMediaDescription(localDesc, rmd, !op->is_offerer());
|
||||
iceAgent->updateFromRemoteMediaDescription(localDesc, rmd, !op->isOfferer());
|
||||
}
|
||||
CallSession::State nextState = CallSession::State::Idle;
|
||||
string nextStateMsg;
|
||||
|
|
@ -199,7 +199,7 @@ void MediaSessionPrivate::dtmfReceived (char dtmf) {
|
|||
|
||||
bool MediaSessionPrivate::failure () {
|
||||
L_Q();
|
||||
const SalErrorInfo *ei = op->get_error_info();
|
||||
const SalErrorInfo *ei = op->getErrorInfo();
|
||||
switch (ei->reason) {
|
||||
case SalReasonRedirect:
|
||||
stopStreams();
|
||||
|
|
@ -276,10 +276,10 @@ void MediaSessionPrivate::pausedByRemote () {
|
|||
void MediaSessionPrivate::remoteRinging () {
|
||||
L_Q();
|
||||
/* Set privacy */
|
||||
getCurrentParams()->setPrivacy((LinphonePrivacyMask)op->get_privacy());
|
||||
SalMediaDescription *md = op->get_final_media_description();
|
||||
getCurrentParams()->setPrivacy((LinphonePrivacyMask)op->getPrivacy());
|
||||
SalMediaDescription *md = op->getFinalMediaDescription();
|
||||
if (md) {
|
||||
SalMediaDescription *rmd = op->get_remote_media_description();
|
||||
SalMediaDescription *rmd = op->getRemoteMediaDescription();
|
||||
/* Initialize the remote call params by invoking linphone_call_get_remote_params(). This is useful as the SDP may not be present in the 200Ok */
|
||||
q->getRemoteParams();
|
||||
/* Accept early media */
|
||||
|
|
@ -301,7 +301,7 @@ void MediaSessionPrivate::remoteRinging () {
|
|||
if (listener)
|
||||
listener->onStopRinging(q->getSharedFromThis());
|
||||
lInfo() << "Doing early media...";
|
||||
iceAgent->updateFromRemoteMediaDescription(localDesc, rmd, !op->is_offerer());
|
||||
iceAgent->updateFromRemoteMediaDescription(localDesc, rmd, !op->isOfferer());
|
||||
updateStreams(md, state);
|
||||
if ((q->getCurrentParams()->getAudioDirection() == LinphoneMediaDirectionInactive) && audioStream) {
|
||||
if (listener)
|
||||
|
|
@ -325,7 +325,7 @@ int MediaSessionPrivate::resumeAfterFailedTransfer () {
|
|||
if (automaticallyPaused && (state == CallSession::State::Pausing))
|
||||
return BELLE_SIP_CONTINUE; // Was still in pausing state
|
||||
if (automaticallyPaused && (state == CallSession::State::Paused)) {
|
||||
if (op->is_idle())
|
||||
if (op->isIdle())
|
||||
q->resume();
|
||||
else {
|
||||
lInfo() << "MediaSessionPrivate::resumeAfterFailedTransfer(), op was busy";
|
||||
|
|
@ -361,7 +361,7 @@ void MediaSessionPrivate::terminated () {
|
|||
|
||||
/* This callback is called when an incoming re-INVITE/ SIP UPDATE modifies the session */
|
||||
void MediaSessionPrivate::updated (bool isUpdate) {
|
||||
SalMediaDescription *rmd = op->get_remote_media_description();
|
||||
SalMediaDescription *rmd = op->getRemoteMediaDescription();
|
||||
switch (state) {
|
||||
case CallSession::State::PausedByRemote:
|
||||
if (sal_media_description_has_dir(rmd, SalStreamSendRecv) || sal_media_description_has_dir(rmd, SalStreamRecvOnly)) {
|
||||
|
|
@ -388,7 +388,7 @@ void MediaSessionPrivate::updated (bool isUpdate) {
|
|||
|
||||
void MediaSessionPrivate::updating (bool isUpdate) {
|
||||
L_Q();
|
||||
SalMediaDescription *rmd = op->get_remote_media_description();
|
||||
SalMediaDescription *rmd = op->getRemoteMediaDescription();
|
||||
fixCallParams(rmd);
|
||||
if (state != CallSession::State::Paused) {
|
||||
/* Refresh the local description, but in paused state, we don't change anything. */
|
||||
|
|
@ -398,16 +398,16 @@ void MediaSessionPrivate::updating (bool isUpdate) {
|
|||
params->initDefault(q->getCore());
|
||||
}
|
||||
makeLocalMediaDescription();
|
||||
op->set_local_media_description(localDesc);
|
||||
op->setLocalMediaDescription(localDesc);
|
||||
}
|
||||
if (rmd) {
|
||||
SalErrorInfo sei;
|
||||
memset(&sei, 0, sizeof(sei));
|
||||
expectMediaInAck = false;
|
||||
SalMediaDescription *md = op->get_final_media_description();
|
||||
SalMediaDescription *md = op->getFinalMediaDescription();
|
||||
if (md && (sal_media_description_empty(md) || linphone_core_incompatible_security(q->getCore()->getCCore(), md))) {
|
||||
sal_error_info_set(&sei, SalReasonNotAcceptable, "SIP", 0, nullptr, nullptr);
|
||||
op->decline_with_error_info(&sei, nullptr);
|
||||
op->declineWithErrorInfo(&sei, nullptr);
|
||||
sal_error_info_reset(&sei);
|
||||
return;
|
||||
}
|
||||
|
|
@ -417,7 +417,7 @@ void MediaSessionPrivate::updating (bool isUpdate) {
|
|||
if (diff & (SAL_MEDIA_DESCRIPTION_CRYPTO_POLICY_CHANGED | SAL_MEDIA_DESCRIPTION_STREAMS_CHANGED)) {
|
||||
lWarning() << "Cannot accept this update, it is changing parameters that require user approval";
|
||||
sal_error_info_set(&sei, SalReasonUnknown, "SIP", 504, "Cannot change the session parameters without prompting the user", nullptr);
|
||||
op->decline_with_error_info(&sei, nullptr);
|
||||
op->declineWithErrorInfo(&sei, nullptr);
|
||||
sal_error_info_reset(&sei);
|
||||
return;
|
||||
}
|
||||
|
|
@ -719,7 +719,7 @@ void MediaSessionPrivate::setState (CallSession::State newState, const string &m
|
|||
case CallSession::State::UpdatedByRemote:
|
||||
// Handle specifically the case of an incoming ICE-concluded reINVITE
|
||||
lInfo() << "Checking for ICE reINVITE";
|
||||
rmd = op->get_remote_media_description();
|
||||
rmd = op->getRemoteMediaDescription();
|
||||
if (iceAgent && rmd && iceAgent->checkIceReinviteNeedsDeferedResponse(rmd)) {
|
||||
deferUpdate = true;
|
||||
deferUpdateInternal = true;
|
||||
|
|
@ -880,12 +880,12 @@ void MediaSessionPrivate::initializeParamsAccordingToIncomingCallParams () {
|
|||
CallSessionPrivate::initializeParamsAccordingToIncomingCallParams();
|
||||
getCurrentParams()->getPrivate()->setUpdateCallWhenIceCompleted(getParams()->getPrivate()->getUpdateCallWhenIceCompleted());
|
||||
getParams()->enableVideo(linphone_core_video_enabled(q->getCore()->getCCore()) && q->getCore()->getCCore()->video_policy.automatically_accept);
|
||||
SalMediaDescription *md = op->get_remote_media_description();
|
||||
SalMediaDescription *md = op->getRemoteMediaDescription();
|
||||
if (md) {
|
||||
/* It is licit to receive an INVITE without SDP, in this case WE choose the media parameters according to policy */
|
||||
setCompatibleIncomingCallParams(md);
|
||||
/* Set multicast role & address if any */
|
||||
if (!op->is_offerer()) {
|
||||
if (!op->isOfferer()) {
|
||||
for (int i = 0; i < SAL_MEDIA_DESCRIPTION_MAX_STREAMS; i++) {
|
||||
if (md->streams[i].dir == SalStreamInactive)
|
||||
continue;
|
||||
|
|
@ -938,7 +938,7 @@ void MediaSessionPrivate::updateBiggestDesc (SalMediaDescription *md) {
|
|||
}
|
||||
|
||||
void MediaSessionPrivate::updateRemoteSessionIdAndVer () {
|
||||
SalMediaDescription *desc = op->get_remote_media_description();
|
||||
SalMediaDescription *desc = op->getRemoteMediaDescription();
|
||||
if (desc) {
|
||||
remoteSessionId = desc->session_id;
|
||||
remoteSessionVer = desc->session_ver;
|
||||
|
|
@ -1155,7 +1155,7 @@ void MediaSessionPrivate::getLocalIp (const Address &remoteAddr) {
|
|||
/* If a known proxy was identified for this call, then we may have a chance to take the local ip address
|
||||
* from the socket that connects to this proxy */
|
||||
if (destProxy && destProxy->op) {
|
||||
ip = destProxy->op->get_local_address(nullptr);
|
||||
ip = destProxy->op->getLocalAddress(nullptr);
|
||||
if (ip) {
|
||||
lInfo() << "Found media local-ip from signaling.";
|
||||
mediaLocalIp = ip;
|
||||
|
|
@ -1216,9 +1216,9 @@ void MediaSessionPrivate::selectIncomingIpVersion () {
|
|||
L_Q();
|
||||
if (linphone_core_ipv6_enabled(q->getCore()->getCCore())) {
|
||||
if (destProxy && destProxy->op)
|
||||
af = destProxy->op->get_address_family();
|
||||
af = destProxy->op->getAddressFamily();
|
||||
else
|
||||
af = op->get_address_family();
|
||||
af = op->getAddressFamily();
|
||||
} else
|
||||
af = AF_INET;
|
||||
}
|
||||
|
|
@ -1242,7 +1242,7 @@ void MediaSessionPrivate::selectOutgoingIpVersion () {
|
|||
if (sal_address_is_ipv6(L_GET_PRIVATE_FROM_C_OBJECT(to)->getInternalAddress()))
|
||||
af = AF_INET6;
|
||||
else if (destProxy && destProxy->op)
|
||||
af = destProxy->op->get_address_family();
|
||||
af = destProxy->op->getAddressFamily();
|
||||
else {
|
||||
char ipv4[LINPHONE_IPADDR_SIZE];
|
||||
char ipv6[LINPHONE_IPADDR_SIZE];
|
||||
|
|
@ -1667,15 +1667,15 @@ SalMulticastRole MediaSessionPrivate::getMulticastRole (SalStreamType type) {
|
|||
SalMulticastRole multicastRole = SalMulticastInactive;
|
||||
if (op) {
|
||||
SalStreamDescription *streamDesc = nullptr;
|
||||
SalMediaDescription *remoteDesc = op->get_remote_media_description();
|
||||
SalMediaDescription *remoteDesc = op->getRemoteMediaDescription();
|
||||
if (!localDesc && !remoteDesc && (direction == LinphoneCallOutgoing)) {
|
||||
/* Well using call dir */
|
||||
if (((type == SalAudio) && getParams()->audioMulticastEnabled())
|
||||
|| ((type == SalVideo) && getParams()->videoMulticastEnabled()))
|
||||
multicastRole = SalMulticastSender;
|
||||
} else if (localDesc && (!remoteDesc || op->is_offerer())) {
|
||||
} else if (localDesc && (!remoteDesc || op->isOfferer())) {
|
||||
streamDesc = sal_media_description_find_best_stream(localDesc, type);
|
||||
} else if (!op->is_offerer() && remoteDesc) {
|
||||
} else if (!op->isOfferer() && remoteDesc) {
|
||||
streamDesc = sal_media_description_find_best_stream(remoteDesc, type);
|
||||
}
|
||||
|
||||
|
|
@ -1717,8 +1717,8 @@ void MediaSessionPrivate::setDtlsFingerprint (MSMediaStreamSessions *sessions, c
|
|||
}
|
||||
|
||||
void MediaSessionPrivate::setDtlsFingerprintOnAllStreams () {
|
||||
SalMediaDescription *remote = op->get_remote_media_description();
|
||||
SalMediaDescription *result = op->get_final_media_description();
|
||||
SalMediaDescription *remote = op->getRemoteMediaDescription();
|
||||
SalMediaDescription *result = op->getFinalMediaDescription();
|
||||
if (!remote || !result) {
|
||||
/* This can happen in some tricky cases (early-media without SDP in the 200). In that case, simply skip DTLS code */
|
||||
return;
|
||||
|
|
@ -1830,8 +1830,8 @@ void MediaSessionPrivate::startDtls (MSMediaStreamSessions *sessions, const SalS
|
|||
}
|
||||
|
||||
void MediaSessionPrivate::startDtlsOnAllStreams () {
|
||||
SalMediaDescription *remote = op->get_remote_media_description();
|
||||
SalMediaDescription *result = op->get_final_media_description();
|
||||
SalMediaDescription *remote = op->getRemoteMediaDescription();
|
||||
SalMediaDescription *result = op->getFinalMediaDescription();
|
||||
if (!remote || !result) {
|
||||
/* This can happen in some tricky cases (early-media without SDP in the 200). In that case, simply skip DTLS code */
|
||||
return;
|
||||
|
|
@ -2100,7 +2100,7 @@ void MediaSessionPrivate::configureRtpSessionForRtcpFb (const SalStreamDescripti
|
|||
}
|
||||
|
||||
void MediaSessionPrivate::configureRtpSessionForRtcpXr (SalStreamType type) {
|
||||
SalMediaDescription *remote = op->get_remote_media_description();
|
||||
SalMediaDescription *remote = op->getRemoteMediaDescription();
|
||||
if (!remote)
|
||||
return;
|
||||
const SalStreamDescription *localStream = sal_media_description_find_best_stream(localDesc, type);
|
||||
|
|
@ -2242,7 +2242,7 @@ void MediaSessionPrivate::handleIceEvents (OrtpEvent *ev) {
|
|||
case CallSession::State::Idle:
|
||||
stopStreamsForIceGathering();
|
||||
updateLocalMediaDescriptionFromIce();
|
||||
op->set_local_media_description(localDesc);
|
||||
op->setLocalMediaDescription(localDesc);
|
||||
deferIncomingNotification = false;
|
||||
startIncomingNotification();
|
||||
break;
|
||||
|
|
@ -2356,7 +2356,7 @@ void MediaSessionPrivate::initializeAudioStream () {
|
|||
SalMediaDescription *remoteDesc = nullptr;
|
||||
SalStreamDescription *streamDesc = nullptr;
|
||||
if (op)
|
||||
remoteDesc = op->get_remote_media_description();
|
||||
remoteDesc = op->getRemoteMediaDescription();
|
||||
if (remoteDesc)
|
||||
streamDesc = sal_media_description_find_best_stream(remoteDesc, SalAudio);
|
||||
|
||||
|
|
@ -2462,7 +2462,7 @@ void MediaSessionPrivate::initializeTextStream () {
|
|||
SalMediaDescription *remoteDesc = nullptr;
|
||||
SalStreamDescription *streamDesc = nullptr;
|
||||
if (op)
|
||||
remoteDesc = op->get_remote_media_description();
|
||||
remoteDesc = op->getRemoteMediaDescription();
|
||||
if (remoteDesc)
|
||||
streamDesc = sal_media_description_find_best_stream(remoteDesc, SalText);
|
||||
|
||||
|
|
@ -2506,7 +2506,7 @@ void MediaSessionPrivate::initializeVideoStream () {
|
|||
SalMediaDescription *remoteDesc = nullptr;
|
||||
SalStreamDescription *streamDesc = nullptr;
|
||||
if (op)
|
||||
remoteDesc = op->get_remote_media_description();
|
||||
remoteDesc = op->getRemoteMediaDescription();
|
||||
if (remoteDesc)
|
||||
streamDesc = sal_media_description_find_best_stream(remoteDesc, SalVideo);
|
||||
|
||||
|
|
@ -2746,7 +2746,7 @@ void MediaSessionPrivate::startAudioStream (CallSession::State targetState, bool
|
|||
getCurrentParams()->getPrivate()->setInConference(getParams()->getPrivate()->getInConference());
|
||||
getCurrentParams()->enableLowBandwidth(getParams()->lowBandwidthEnabled());
|
||||
// Start ZRTP engine if needed : set here or remote have a zrtp-hash attribute
|
||||
SalMediaDescription *remote = op->get_remote_media_description();
|
||||
SalMediaDescription *remote = op->getRemoteMediaDescription();
|
||||
const SalStreamDescription *remoteStream = sal_media_description_find_best_stream(remote, SalAudio);
|
||||
if (linphone_core_media_encryption_supported(q->getCore()->getCCore(), LinphoneMediaEncryptionZRTP)
|
||||
&& ((getParams()->getMediaEncryption() == LinphoneMediaEncryptionZRTP) || (remoteStream->haveZrtpHash == 1))) {
|
||||
|
|
@ -2998,7 +2998,7 @@ void MediaSessionPrivate::startVideoStream (CallSession::State targetState) {
|
|||
if (listener)
|
||||
listener->onResetFirstVideoFrameDecoded(q->getSharedFromThis());
|
||||
/* Start ZRTP engine if needed : set here or remote have a zrtp-hash attribute */
|
||||
SalMediaDescription *remote = op->get_remote_media_description();
|
||||
SalMediaDescription *remote = op->getRemoteMediaDescription();
|
||||
const SalStreamDescription *remoteStream = sal_media_description_find_best_stream(remote, SalVideo);
|
||||
if ((getParams()->getMediaEncryption() == LinphoneMediaEncryptionZRTP) || (remoteStream->haveZrtpHash == 1)) {
|
||||
/* Audio stream is already encrypted and video stream is active */
|
||||
|
|
@ -3344,7 +3344,7 @@ uint16_t MediaSessionPrivate::getAvpfRrInterval () const {
|
|||
unsigned int MediaSessionPrivate::getNbActiveStreams () const {
|
||||
SalMediaDescription *md = nullptr;
|
||||
if (op)
|
||||
md = op->get_remote_media_description();
|
||||
md = op->getRemoteMediaDescription();
|
||||
if (!md)
|
||||
return 0;
|
||||
return sal_media_description_nb_active_streams_of_type(md, SalAudio) + sal_media_description_nb_active_streams_of_type(md, SalVideo) + sal_media_description_nb_active_streams_of_type(md, SalText);
|
||||
|
|
@ -3528,8 +3528,8 @@ void MediaSessionPrivate::handleIncomingReceivedStateInIncomingNotification () {
|
|||
if (proposeEarlyMedia)
|
||||
q->acceptEarlyMedia();
|
||||
else
|
||||
op->notify_ringing(false);
|
||||
if (op->get_replaces() && !!lp_config_get_int(linphone_core_get_config(q->getCore()->getCCore()), "sip", "auto_answer_replacing_calls", 1))
|
||||
op->notifyRinging(false);
|
||||
if (op->getReplaces() && !!lp_config_get_int(linphone_core_get_config(q->getCore()->getCCore()), "sip", "auto_answer_replacing_calls", 1))
|
||||
q->accept();
|
||||
}
|
||||
|
||||
|
|
@ -3562,7 +3562,7 @@ LinphoneStatus MediaSessionPrivate::pause () {
|
|||
broken = false;
|
||||
setState(CallSession::State::Pausing, "Pausing call");
|
||||
makeLocalMediaDescription();
|
||||
op->set_local_media_description(localDesc);
|
||||
op->setLocalMediaDescription(localDesc);
|
||||
op->update(subject.c_str(), false);
|
||||
if (listener)
|
||||
listener->onResetCurrentSession(q->getSharedFromThis());
|
||||
|
|
@ -3590,9 +3590,9 @@ LinphoneStatus MediaSessionPrivate::startAcceptUpdate (CallSession::State nextSt
|
|||
}
|
||||
makeLocalMediaDescription();
|
||||
updateRemoteSessionIdAndVer();
|
||||
op->set_local_media_description(localDesc);
|
||||
op->setLocalMediaDescription(localDesc);
|
||||
op->accept();
|
||||
SalMediaDescription *md = op->get_final_media_description();
|
||||
SalMediaDescription *md = op->getFinalMediaDescription();
|
||||
iceAgent->stopIceForInactiveStreams(md);
|
||||
if (md && !sal_media_description_empty(md))
|
||||
updateStreams(md, nextState);
|
||||
|
|
@ -3606,14 +3606,14 @@ LinphoneStatus MediaSessionPrivate::startUpdate (const string &subject) {
|
|||
if (!getParams()->getPrivate()->getNoUserConsent())
|
||||
makeLocalMediaDescription();
|
||||
if (!q->getCore()->getCCore()->sip_conf.sdp_200_ack)
|
||||
op->set_local_media_description(localDesc);
|
||||
op->setLocalMediaDescription(localDesc);
|
||||
else
|
||||
op->set_local_media_description(nullptr);
|
||||
op->setLocalMediaDescription(nullptr);
|
||||
LinphoneStatus result = CallSessionPrivate::startUpdate(subject);
|
||||
if (q->getCore()->getCCore()->sip_conf.sdp_200_ack) {
|
||||
/* We are NOT offering, set local media description after sending the call so that we are ready to
|
||||
* process the remote offer when it will arrive. */
|
||||
op->set_local_media_description(localDesc);
|
||||
op->setLocalMediaDescription(localDesc);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
@ -3725,7 +3725,7 @@ void MediaSessionPrivate::accept (const MediaSessionParams *msp, bool wasRinging
|
|||
setParams(new MediaSessionParams(*msp));
|
||||
iceAgent->prepare(localDesc, true);
|
||||
makeLocalMediaDescription();
|
||||
op->set_local_media_description(localDesc);
|
||||
op->setLocalMediaDescription(localDesc);
|
||||
}
|
||||
|
||||
updateRemoteSessionIdAndVer();
|
||||
|
|
@ -3746,7 +3746,7 @@ void MediaSessionPrivate::accept (const MediaSessionParams *msp, bool wasRinging
|
|||
|
||||
CallSessionPrivate::accept(nullptr);
|
||||
|
||||
SalMediaDescription *newMd = op->get_final_media_description();
|
||||
SalMediaDescription *newMd = op->getFinalMediaDescription();
|
||||
iceAgent->stopIceForInactiveStreams(newMd);
|
||||
if (newMd) {
|
||||
updateStreams(newMd, CallSession::State::StreamsRunning);
|
||||
|
|
@ -3757,7 +3757,7 @@ void MediaSessionPrivate::accept (const MediaSessionParams *msp, bool wasRinging
|
|||
|
||||
LinphoneStatus MediaSessionPrivate::acceptUpdate (const CallSessionParams *csp, CallSession::State nextState, const string &stateInfo) {
|
||||
L_Q();
|
||||
SalMediaDescription *desc = op->get_remote_media_description();
|
||||
SalMediaDescription *desc = op->getRemoteMediaDescription();
|
||||
bool keepSdpVersion = !!lp_config_get_int(linphone_core_get_config(q->getCore()->getCCore()), "sip", "keep_sdp_version", 0);
|
||||
if (keepSdpVersion && (desc->session_id == remoteSessionId) && (desc->session_ver == remoteSessionVer)) {
|
||||
/* Remote has sent an INVITE with the same SDP as before, so send a 200 OK with the same SDP as before. */
|
||||
|
|
@ -3769,7 +3769,7 @@ LinphoneStatus MediaSessionPrivate::acceptUpdate (const CallSessionParams *csp,
|
|||
if (csp)
|
||||
setParams(new MediaSessionParams(*static_cast<const MediaSessionParams *>(csp)));
|
||||
else {
|
||||
if (!op->is_offerer()) {
|
||||
if (!op->isOfferer()) {
|
||||
/* Reset call params for multicast because this param is only relevant when offering */
|
||||
getParams()->enableAudioMulticast(false);
|
||||
getParams()->enableVideoMulticast(false);
|
||||
|
|
@ -3870,7 +3870,7 @@ int MediaSessionPrivate::sendDtmf () {
|
|||
}
|
||||
if (linphone_core_get_use_info_for_dtmf(lc)) {
|
||||
// Out of Band DTMF (use INFO method)
|
||||
op->send_dtmf(dtmfSequence.front());
|
||||
op->sendDtmf(dtmfSequence.front());
|
||||
}
|
||||
|
||||
dtmfSequence.erase(0, 1);
|
||||
|
|
@ -4019,12 +4019,12 @@ LinphoneStatus MediaSession::acceptEarlyMedia (const MediaSessionParams *msp) {
|
|||
if (msp) {
|
||||
d->setParams(new MediaSessionParams(*msp));
|
||||
d->makeLocalMediaDescription();
|
||||
d->op->set_local_media_description(d->localDesc);
|
||||
d->op->set_sent_custom_header(d->getParams()->getPrivate()->getCustomHeaders());
|
||||
d->op->setLocalMediaDescription(d->localDesc);
|
||||
d->op->setSentCustomHeaders(d->getParams()->getPrivate()->getCustomHeaders());
|
||||
}
|
||||
d->op->notify_ringing(true);
|
||||
d->op->notifyRinging(true);
|
||||
d->setState(CallSession::State::IncomingEarlyMedia, "Incoming call early media");
|
||||
SalMediaDescription *md = d->op->get_final_media_description();
|
||||
SalMediaDescription *md = d->op->getFinalMediaDescription();
|
||||
if (md)
|
||||
d->updateStreams(md, d->state);
|
||||
return 0;
|
||||
|
|
@ -4044,7 +4044,7 @@ void MediaSession::cancelDtmfs () {
|
|||
if (!d->dtmfTimer)
|
||||
return;
|
||||
|
||||
getCore()->getCCore()->sal->cancel_timer(d->dtmfTimer);
|
||||
getCore()->getCCore()->sal->cancelTimer(d->dtmfTimer);
|
||||
belle_sip_object_unref(d->dtmfTimer);
|
||||
d->dtmfTimer = nullptr;
|
||||
d->dtmfSequence.clear();
|
||||
|
|
@ -4080,7 +4080,7 @@ void MediaSession::configure (LinphoneCallDir direction, LinphoneProxyConfig *cf
|
|||
d->setParams(new MediaSessionParams());
|
||||
d->params->initDefault(getCore());
|
||||
d->initializeParamsAccordingToIncomingCallParams();
|
||||
SalMediaDescription *md = d->op->get_remote_media_description();
|
||||
SalMediaDescription *md = d->op->getRemoteMediaDescription();
|
||||
if (d->natPolicy && linphone_nat_policy_ice_enabled(d->natPolicy)) {
|
||||
if (md) {
|
||||
/* Create the ice session now if ICE is required */
|
||||
|
|
@ -4181,9 +4181,9 @@ LinphoneStatus MediaSession::resume () {
|
|||
d->makeLocalMediaDescription();
|
||||
sal_media_description_set_dir(d->localDesc, SalStreamSendRecv);
|
||||
if (!getCore()->getCCore()->sip_conf.sdp_200_ack)
|
||||
d->op->set_local_media_description(d->localDesc);
|
||||
d->op->setLocalMediaDescription(d->localDesc);
|
||||
else
|
||||
d->op->set_local_media_description(nullptr);
|
||||
d->op->setLocalMediaDescription(nullptr);
|
||||
string subject = "Call resuming";
|
||||
if (d->getParams()->getPrivate()->getInConference() && !getCurrentParams()->getPrivate()->getInConference())
|
||||
subject = "Conference";
|
||||
|
|
@ -4195,7 +4195,7 @@ LinphoneStatus MediaSession::resume () {
|
|||
if (getCore()->getCCore()->sip_conf.sdp_200_ack) {
|
||||
/* We are NOT offering, set local media description after sending the call so that we are ready to
|
||||
* process the remote offer when it will arrive. */
|
||||
d->op->set_local_media_description(d->localDesc);
|
||||
d->op->setLocalMediaDescription(d->localDesc);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -4218,7 +4218,7 @@ LinphoneStatus MediaSession::sendDtmfs (const std::string &dtmfs) {
|
|||
if (delayMs < 0)
|
||||
delayMs = 0;
|
||||
d->dtmfSequence = dtmfs;
|
||||
d->dtmfTimer = getCore()->getCCore()->sal->create_timer(MediaSessionPrivate::sendDtmf, this, static_cast<unsigned int>(delayMs), "DTMF sequence timer");
|
||||
d->dtmfTimer = getCore()->getCCore()->sal->createTimer(MediaSessionPrivate::sendDtmf, this, static_cast<unsigned int>(delayMs), "DTMF sequence timer");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -4239,7 +4239,7 @@ void MediaSession::sendVfuRequest () {
|
|||
} else if (getCore()->getCCore()->sip_conf.vfu_with_info) {
|
||||
lInfo() << "Request SIP INFO FIR on CallSession [" << this << "]";
|
||||
if (d->state == CallSession::State::StreamsRunning)
|
||||
d->op->send_vfu_request();
|
||||
d->op->sendVfuRequest();
|
||||
} else
|
||||
lInfo() << "vfu request using sip disabled from config [sip,vfu_with_info]";
|
||||
#endif
|
||||
|
|
@ -4248,8 +4248,8 @@ void MediaSession::sendVfuRequest () {
|
|||
void MediaSession::startIncomingNotification (bool notifyRinging) {
|
||||
L_D();
|
||||
d->makeLocalMediaDescription();
|
||||
d->op->set_local_media_description(d->localDesc);
|
||||
SalMediaDescription *md = d->op->get_final_media_description();
|
||||
d->op->setLocalMediaDescription(d->localDesc);
|
||||
SalMediaDescription *md = d->op->getFinalMediaDescription();
|
||||
if (md) {
|
||||
if (sal_media_description_empty(md) || linphone_core_incompatible_security(getCore()->getCCore(), md)) {
|
||||
LinphoneErrorInfo *ei = linphone_error_info_new();
|
||||
|
|
@ -4277,7 +4277,7 @@ int MediaSession::startInvite (const Address *destination, const string &subject
|
|||
}
|
||||
if (!getCore()->getCCore()->sip_conf.sdp_200_ack) {
|
||||
/* We are offering, set local media description before sending the call */
|
||||
d->op->set_local_media_description(d->localDesc);
|
||||
d->op->setLocalMediaDescription(d->localDesc);
|
||||
}
|
||||
|
||||
int result = CallSession::startInvite(destination, subject, content);
|
||||
|
|
@ -4289,7 +4289,7 @@ int MediaSession::startInvite (const Address *destination, const string &subject
|
|||
if (getCore()->getCCore()->sip_conf.sdp_200_ack) {
|
||||
/* We are NOT offering, set local media description after sending the call so that we are ready to
|
||||
process the remote offer when it will arrive. */
|
||||
d->op->set_local_media_description(d->localDesc);
|
||||
d->op->setLocalMediaDescription(d->localDesc);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
@ -4631,7 +4631,7 @@ float MediaSession::getRecordVolume () const {
|
|||
const MediaSessionParams * MediaSession::getRemoteParams () {
|
||||
L_D();
|
||||
if (d->op){
|
||||
SalMediaDescription *md = d->op->get_remote_media_description();
|
||||
SalMediaDescription *md = d->op->getRemoteMediaDescription();
|
||||
if (md) {
|
||||
d->setRemoteParams(new MediaSessionParams());
|
||||
unsigned int nbAudioStreams = sal_media_description_nb_active_streams_of_type(md, SalAudio);
|
||||
|
|
@ -4667,7 +4667,7 @@ const MediaSessionParams * MediaSession::getRemoteParams () {
|
|||
d->getRemoteParams()->getPrivate()->setCustomSdpMediaAttributes(LinphoneStreamTypeVideo, md->streams[d->mainVideoStreamIndex].custom_sdp_attributes);
|
||||
d->getRemoteParams()->getPrivate()->setCustomSdpMediaAttributes(LinphoneStreamTypeText, md->streams[d->mainTextStreamIndex].custom_sdp_attributes);
|
||||
}
|
||||
const SalCustomHeader *ch = d->op->get_recv_custom_header();
|
||||
const SalCustomHeader *ch = d->op->getRecvCustomHeaders();
|
||||
if (ch) {
|
||||
/* Instanciate a remote_params only if a SIP message was received before (custom headers indicates this) */
|
||||
if (!d->remoteParams)
|
||||
|
|
|
|||
|
|
@ -59,16 +59,16 @@ bool CorePrivate::canWeAddCall () const {
|
|||
|
||||
bool CorePrivate::inviteReplacesABrokenCall (SalCallOp *op) {
|
||||
CallSession *replacedSession = nullptr;
|
||||
SalCallOp *replacedOp = op->get_replaces();
|
||||
SalCallOp *replacedOp = op->getReplaces();
|
||||
if (replacedOp)
|
||||
replacedSession = reinterpret_cast<CallSession *>(replacedOp->get_user_pointer());
|
||||
replacedSession = reinterpret_cast<CallSession *>(replacedOp->getUserPointer());
|
||||
for (const auto &call : calls) {
|
||||
shared_ptr<CallSession> session = call->getPrivate()->getActiveSession();
|
||||
if (session
|
||||
&& ((session->getPrivate()->isBroken() && op->compare_op(session->getPrivate()->getOp()))
|
||||
&& ((session->getPrivate()->isBroken() && op->compareOp(session->getPrivate()->getOp()))
|
||||
|| ((replacedSession == session.get())
|
||||
&& (strcmp(op->get_from(), replacedOp->get_from()) == 0)
|
||||
&& (strcmp(op->get_to(), replacedOp->get_to()) == 0)))
|
||||
&& (strcmp(op->getFrom(), replacedOp->getFrom()) == 0)
|
||||
&& (strcmp(op->getTo(), replacedOp->getTo()) == 0)))
|
||||
) {
|
||||
session->getPrivate()->replaceOp(op);
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ void IceAgent::deleteSession () {
|
|||
}
|
||||
|
||||
void IceAgent::gatheringFinished () {
|
||||
const SalMediaDescription *rmd = mediaSession.getPrivate()->getOp()->get_remote_media_description();
|
||||
const SalMediaDescription *rmd = mediaSession.getPrivate()->getOp()->getRemoteMediaDescription();
|
||||
if (rmd)
|
||||
clearUnusedIceCandidates(mediaSession.getPrivate()->getLocalDesc(), rmd);
|
||||
if (!iceSession)
|
||||
|
|
@ -134,7 +134,7 @@ bool IceAgent::prepare (const SalMediaDescription *localDesc, bool incomingOffer
|
|||
SalMediaDescription *remoteDesc = nullptr;
|
||||
bool hasVideo = false;
|
||||
if (incomingOffer) {
|
||||
remoteDesc = mediaSession.getPrivate()->getOp()->get_remote_media_description();
|
||||
remoteDesc = mediaSession.getPrivate()->getOp()->getRemoteMediaDescription();
|
||||
hasVideo = linphone_core_video_enabled(mediaSession.getCore()->getCCore()) &&
|
||||
linphone_core_media_description_contains_video_stream(remoteDesc);
|
||||
} else
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -25,105 +25,103 @@
|
|||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
class SalCallOp: public SalOp, public SalMessageOpInterface {
|
||||
class SalCallOp : public SalOp, public SalMessageOpInterface {
|
||||
public:
|
||||
SalCallOp(Sal *sal): SalOp(sal) {}
|
||||
~SalCallOp() override;
|
||||
SalCallOp (Sal *sal) : SalOp(sal) {}
|
||||
~SalCallOp () override;
|
||||
|
||||
SalMediaDescription *get_local_media_description () const { return local_media; }
|
||||
int set_local_media_description(SalMediaDescription *desc);
|
||||
int set_local_body(const Content &body);
|
||||
int set_local_body(const Content &&body);
|
||||
SalMediaDescription *getLocalMediaDescription () const { return mLocalMedia; }
|
||||
int setLocalMediaDescription (SalMediaDescription *desc);
|
||||
int setLocalBody (const Content &body);
|
||||
int setLocalBody (const Content &&body);
|
||||
|
||||
SalMediaDescription *get_remote_media_description() {return this->remote_media;}
|
||||
const Content &get_remote_body() const {return this->remote_body;}
|
||||
SalMediaDescription *get_final_media_description();
|
||||
SalMediaDescription *getRemoteMediaDescription () { return mRemoteMedia; }
|
||||
const Content &getRemoteBody () const { return mRemoteBody; }
|
||||
SalMediaDescription *getFinalMediaDescription ();
|
||||
|
||||
int call(const char *from, const char *to, const char *subject);
|
||||
int notify_ringing(bool_t early_media);
|
||||
int accept();
|
||||
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);
|
||||
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);
|
||||
SalCallOp *get_replaces();
|
||||
int send_dtmf(char dtmf);
|
||||
int terminate() {return terminate_with_error(NULL);}
|
||||
int terminate_with_error(const SalErrorInfo *info);
|
||||
bool_t autoanswer_asked() const {return this->auto_answer_asked;}
|
||||
void send_vfu_request();
|
||||
int is_offerer() const {return this->sdp_offering;}
|
||||
int notify_refer_state(SalCallOp *newcall);
|
||||
bool_t compare_op(const SalCallOp *op2) const;
|
||||
bool_t dialog_request_pending() const {return (belle_sip_dialog_request_pending(this->dialog) != 0);}
|
||||
const char *get_local_tag() {return belle_sip_dialog_get_local_tag(this->dialog);}
|
||||
const char *get_remote_tag() {return belle_sip_dialog_get_remote_tag(this->dialog);}
|
||||
void set_replaces(const char *call_id, const char *from_tag, const char *to_tag);
|
||||
void set_sdp_handling(SalOpSDPHandling handling);
|
||||
int call (const char *from, const char *to, const char *subject);
|
||||
int notifyRinging (bool_t earlyMedia);
|
||||
int accept ();
|
||||
int decline (SalReason reason, const char *redirection = nullptr);
|
||||
int declineWithErrorInfo (const SalErrorInfo *info, const SalAddress *redirectionAddr = nullptr);
|
||||
int update (const char *subject, bool_t noUserConsent);
|
||||
int cancelInvite (const SalErrorInfo *info = nullptr);
|
||||
int refer (const char *referTo);
|
||||
int referWithReplaces (SalCallOp *otherCallOp);
|
||||
int setReferrer (SalCallOp *referredCall);
|
||||
SalCallOp *getReplaces () const;
|
||||
int sendDtmf (char dtmf);
|
||||
int terminate (const SalErrorInfo *info = nullptr);
|
||||
bool_t autoAnswerAsked () const { return mAutoAnswerAsked; }
|
||||
void sendVfuRequest ();
|
||||
int isOfferer () const { return mSdpOffering; }
|
||||
int notifyReferState (SalCallOp *newCallOp);
|
||||
bool_t compareOp (const SalCallOp *otherCallOp) const;
|
||||
bool_t dialogRequestPending () const { return (belle_sip_dialog_request_pending(mDialog) != 0); }
|
||||
const char *getLocalTag () { return belle_sip_dialog_get_local_tag(mDialog); }
|
||||
const char *getRemoteTag () { return belle_sip_dialog_get_remote_tag(mDialog); }
|
||||
void setReplaces (const char *callId, const char *fromTag, const char *toTag);
|
||||
void setSdpHandling (SalOpSDPHandling handling);
|
||||
|
||||
// Implementation of SalMessageOpInterface
|
||||
int sendMessage (const Content &content) override;
|
||||
int reply(SalReason reason) override {return SalOp::reply_message(reason);}
|
||||
int reply (SalReason reason) override { return SalOp::replyMessage(reason); }
|
||||
|
||||
private:
|
||||
virtual void fill_cbs() override;
|
||||
void set_released();
|
||||
virtual void fillCallbacks () override;
|
||||
void setReleased ();
|
||||
|
||||
void set_error(belle_sip_response_t* response, bool_t fatal);
|
||||
void call_terminated(belle_sip_server_transaction_t* server_transaction, int status_code, belle_sip_request_t* cancel_request);
|
||||
void reset_descriptions();
|
||||
void setError (belle_sip_response_t *response, bool_t fatal);
|
||||
void callTerminated (belle_sip_server_transaction_t *serverTransaction, int statusCode, belle_sip_request_t *cancelRequest);
|
||||
void resetDescriptions ();
|
||||
|
||||
int parse_sdp_body(const Content &body,belle_sdp_session_description_t** session_desc, SalReason *error);
|
||||
void sdp_process();
|
||||
void handle_body_from_response(belle_sip_response_t* response);
|
||||
SalReason process_body_for_invite(belle_sip_request_t* invite);
|
||||
SalReason process_body_for_ack(belle_sip_request_t *ack);
|
||||
void handle_offer_answer_response(belle_sip_response_t* response);
|
||||
int parseSdpBody (const Content &body, belle_sdp_session_description_t **sessionDesc, SalReason *error);
|
||||
void sdpProcess ();
|
||||
void handleBodyFromResponse (belle_sip_response_t *response);
|
||||
SalReason processBodyForInvite (belle_sip_request_t *invite);
|
||||
SalReason processBodyForAck (belle_sip_request_t *ack);
|
||||
void handleOfferAnswerResponse (belle_sip_response_t *response);
|
||||
|
||||
void fill_invite(belle_sip_request_t* invite);
|
||||
void cancelling_invite(const SalErrorInfo *info);
|
||||
int refer_to(belle_sip_header_refer_to_t* refer_to, belle_sip_header_referred_by_t* referred_by);
|
||||
int send_notify_for_refer(int code, const char *reason);
|
||||
void notify_last_response(SalCallOp *newcall);
|
||||
void process_refer(const belle_sip_request_event_t *event, belle_sip_server_transaction_t *server_transaction);
|
||||
void process_notify(const belle_sip_request_event_t *event, belle_sip_server_transaction_t* server_transaction);
|
||||
void fillInvite (belle_sip_request_t *invite);
|
||||
void cancellingInvite (const SalErrorInfo *info);
|
||||
int referTo (belle_sip_header_refer_to_t *referToHeader, belle_sip_header_referred_by_t *referredByHeader);
|
||||
int sendNotifyForRefer (int code, const char *reason);
|
||||
void notifyLastResponse (SalCallOp *newCallOp);
|
||||
void processRefer (const belle_sip_request_event_t *event, belle_sip_server_transaction_t *serverTransaction);
|
||||
void processNotify (const belle_sip_request_event_t *event, belle_sip_server_transaction_t *serverTransaction);
|
||||
|
||||
static void set_addr_to_0000(char value[], size_t sz);
|
||||
static int is_media_description_acceptable(SalMediaDescription *md);
|
||||
static bool_t is_a_pending_invite_incoming_transaction(belle_sip_transaction_t *tr);
|
||||
static void set_call_as_released(SalCallOp *op);
|
||||
static void unsupported_method(belle_sip_server_transaction_t* server_transaction,belle_sip_request_t* request);
|
||||
static belle_sip_header_reason_t *make_reason_header( const SalErrorInfo *info);
|
||||
static belle_sip_header_allow_t *create_allow(bool_t enable_update);
|
||||
static std::vector<char> marshal_media_description(belle_sdp_session_description_t *session_desc, belle_sip_error_code &error);
|
||||
static void setAddrTo0000 (char value[], size_t sz);
|
||||
static int isMediaDescriptionAcceptable (SalMediaDescription *md);
|
||||
static bool_t isAPendingIncomingInviteTransaction (belle_sip_transaction_t *tr);
|
||||
static void setCallAsReleased (SalCallOp *op);
|
||||
static void unsupportedMethod (belle_sip_server_transaction_t *serverTransaction, belle_sip_request_t *request);
|
||||
static belle_sip_header_reason_t *makeReasonHeader (const SalErrorInfo *info);
|
||||
static belle_sip_header_allow_t *createAllow (bool_t enableUpdate);
|
||||
static std::vector<char> marshalMediaDescription (belle_sdp_session_description_t *sessionDesc, belle_sip_error_code &error);
|
||||
|
||||
// belle_sip_message handlers
|
||||
static int set_custom_body(belle_sip_message_t *msg, const Content &body);
|
||||
static int set_sdp(belle_sip_message_t *msg,belle_sdp_session_description_t* session_desc);
|
||||
static int set_sdp_from_desc(belle_sip_message_t *msg, const SalMediaDescription *desc);
|
||||
static void process_io_error_cb(void *user_ctx, const belle_sip_io_error_event_t *event);
|
||||
static Content extract_body(belle_sip_message_t *message);
|
||||
static int setCustomBody (belle_sip_message_t *message, const Content &body);
|
||||
static int setSdp (belle_sip_message_t *message, belle_sdp_session_description_t *sessionDesc);
|
||||
static int setSdpFromDesc (belle_sip_message_t *message, const SalMediaDescription *desc);
|
||||
static void processIoErrorCb (void *userCtx, const belle_sip_io_error_event_t *event);
|
||||
static Content extractBody (belle_sip_message_t *message);
|
||||
|
||||
// Callbacks
|
||||
static int vfu_retry_cb (void *user_data, unsigned int events);
|
||||
static void process_response_cb(void *op_base, const belle_sip_response_event_t *event);
|
||||
static void process_timeout_cb(void *user_ctx, const belle_sip_timeout_event_t *event);
|
||||
static void process_transaction_terminated_cb(void *user_ctx, const belle_sip_transaction_terminated_event_t *event);
|
||||
static void process_request_event_cb(void *op_base, const belle_sip_request_event_t *event);
|
||||
static void process_dialog_terminated_cb(void *ctx, const belle_sip_dialog_terminated_event_t *event);
|
||||
static int vfuRetryCb (void *userCtx, unsigned int events);
|
||||
static void processResponseCb (void *userCtx, const belle_sip_response_event_t *event);
|
||||
static void processTimeoutCb (void *userCtx, const belle_sip_timeout_event_t *event);
|
||||
static void processTransactionTerminatedCb (void *userCtx, const belle_sip_transaction_terminated_event_t *event);
|
||||
static void processRequestEventCb (void *userCtx, const belle_sip_request_event_t *event);
|
||||
static void processDialogTerminatedCb (void *userCtx, const belle_sip_dialog_terminated_event_t *event);
|
||||
|
||||
// Private constants
|
||||
static const size_t SIP_MESSAGE_BODY_LIMIT = 16*1024; // 16kB
|
||||
static const size_t SIP_MESSAGE_BODY_LIMIT = 16 * 1024; // 16kB
|
||||
|
||||
// Attributes
|
||||
SalMediaDescription *local_media = NULL;
|
||||
SalMediaDescription *remote_media = NULL;
|
||||
Content local_body;
|
||||
Content remote_body;
|
||||
SalMediaDescription *mLocalMedia = nullptr;
|
||||
SalMediaDescription *mRemoteMedia = nullptr;
|
||||
Content mLocalBody;
|
||||
Content mRemoteBody;
|
||||
};
|
||||
|
||||
LINPHONE_END_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ using namespace std;
|
|||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
void SalSubscribeOp::subscribe_process_io_error_cb(void *user_ctx, const belle_sip_io_error_event_t *event) {
|
||||
void SalSubscribeOp::subscribeProcessIoErrorCb(void *user_ctx, const belle_sip_io_error_event_t *event) {
|
||||
SalSubscribeOp *op = (SalSubscribeOp *)user_ctx;
|
||||
belle_sip_object_t *src = belle_sip_io_error_event_get_source(event);
|
||||
if (BELLE_SIP_OBJECT_IS_INSTANCE_OF(src, belle_sip_client_transaction_t)){
|
||||
|
|
@ -32,14 +32,14 @@ void SalSubscribeOp::subscribe_process_io_error_cb(void *user_ctx, const belle_s
|
|||
const char *method=belle_sip_request_get_method(req);
|
||||
|
||||
if (strcmp(method,"NOTIFY")==0){
|
||||
SalErrorInfo *ei=&op->error_info;
|
||||
SalErrorInfo *ei=&op->mErrorInfo;
|
||||
sal_error_info_set(ei,SalReasonIOError, "SIP", 0,NULL,NULL);
|
||||
op->root->callbacks.on_notify_response(op);
|
||||
op->mRoot->mCallbacks.on_notify_response(op);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SalSubscribeOp::subscribe_response_event_cb(void *op_base, const belle_sip_response_event_t *event){
|
||||
void SalSubscribeOp::subscribeResponseEventCb(void *op_base, const belle_sip_response_event_t *event){
|
||||
SalSubscribeOp *op = (SalSubscribeOp *)op_base;
|
||||
belle_sip_request_t * req;
|
||||
const char *method;
|
||||
|
|
@ -50,12 +50,12 @@ void SalSubscribeOp::subscribe_response_event_cb(void *op_base, const belle_sip_
|
|||
method = belle_sip_request_get_method(req);
|
||||
|
||||
if (strcmp(method,"NOTIFY")==0){
|
||||
op->set_error_info_from_response(belle_sip_response_event_get_response(event));
|
||||
op->root->callbacks.on_notify_response(op);
|
||||
op->setErrorInfoFromResponse(belle_sip_response_event_get_response(event));
|
||||
op->mRoot->mCallbacks.on_notify_response(op);
|
||||
}
|
||||
}
|
||||
|
||||
void SalSubscribeOp::subscribe_process_timeout_cb(void *user_ctx, const belle_sip_timeout_event_t *event) {
|
||||
void SalSubscribeOp::subscribeProcessTimeoutCb(void *user_ctx, const belle_sip_timeout_event_t *event) {
|
||||
SalSubscribeOp *op = (SalSubscribeOp *)user_ctx;
|
||||
belle_sip_request_t * req;
|
||||
const char *method;
|
||||
|
|
@ -66,33 +66,33 @@ void SalSubscribeOp::subscribe_process_timeout_cb(void *user_ctx, const belle_si
|
|||
method = belle_sip_request_get_method(req);
|
||||
|
||||
if (strcmp(method,"NOTIFY")==0){
|
||||
SalErrorInfo *ei=&op->error_info;
|
||||
SalErrorInfo *ei=&op->mErrorInfo;
|
||||
sal_error_info_set(ei,SalReasonRequestTimeout, "SIP", 0,NULL,NULL);
|
||||
op->root->callbacks.on_notify_response(op);
|
||||
op->mRoot->mCallbacks.on_notify_response(op);
|
||||
}
|
||||
}
|
||||
|
||||
void SalSubscribeOp::handle_notify(belle_sip_request_t *req, const char *eventname, SalBodyHandler* body_handler){
|
||||
void SalSubscribeOp::handleNotify(belle_sip_request_t *req, const char *eventname, SalBodyHandler* body_handler){
|
||||
SalSubscribeStatus sub_state;
|
||||
belle_sip_header_subscription_state_t* subscription_state_header=belle_sip_message_get_header_by_type(req,belle_sip_header_subscription_state_t);
|
||||
belle_sip_response_t* resp;
|
||||
belle_sip_server_transaction_t* server_transaction = this->pending_server_trans;
|
||||
belle_sip_server_transaction_t* server_transaction = mPendingServerTransaction;
|
||||
|
||||
if (!subscription_state_header || strcasecmp(BELLE_SIP_SUBSCRIPTION_STATE_TERMINATED,belle_sip_header_subscription_state_get_state(subscription_state_header)) ==0) {
|
||||
sub_state=SalSubscribeTerminated;
|
||||
ms_message("Outgoing subscription terminated by remote [%s]",get_to());
|
||||
ms_message("Outgoing subscription terminated by remote [%s]",getTo());
|
||||
} else
|
||||
sub_state=SalSubscribeActive;
|
||||
ref();
|
||||
this->root->callbacks.notify(this,sub_state,eventname,body_handler);
|
||||
resp=create_response_from_request(req,200);
|
||||
mRoot->mCallbacks.notify(this,sub_state,eventname,body_handler);
|
||||
resp=createResponseFromRequest(req,200);
|
||||
belle_sip_server_transaction_send_response(server_transaction,resp);
|
||||
unref();
|
||||
}
|
||||
|
||||
void SalSubscribeOp::subscribe_process_request_event_cb(void *op_base, const belle_sip_request_event_t *event) {
|
||||
void SalSubscribeOp::subscribeProcessRequestEventCb(void *op_base, const belle_sip_request_event_t *event) {
|
||||
SalSubscribeOp * op = (SalSubscribeOp *)op_base;
|
||||
belle_sip_server_transaction_t* server_transaction = belle_sip_provider_create_server_transaction(op->root->prov,belle_sip_request_event_get_request(event));
|
||||
belle_sip_server_transaction_t* server_transaction = belle_sip_provider_create_server_transaction(op->mRoot->mProvider,belle_sip_request_event_get_request(event));
|
||||
belle_sip_request_t* req = belle_sip_request_event_get_request(event);
|
||||
belle_sip_dialog_state_t dialog_state;
|
||||
belle_sip_header_expires_t* expires = belle_sip_message_get_header_by_type(req,belle_sip_header_expires_t);
|
||||
|
|
@ -104,68 +104,68 @@ void SalSubscribeOp::subscribe_process_request_event_cb(void *op_base, const bel
|
|||
belle_sip_dialog_t *dialog = NULL;
|
||||
|
||||
belle_sip_object_ref(server_transaction);
|
||||
if (op->pending_server_trans) belle_sip_object_unref(op->pending_server_trans);
|
||||
op->pending_server_trans=server_transaction;
|
||||
if (op->mPendingServerTransaction) belle_sip_object_unref(op->mPendingServerTransaction);
|
||||
op->mPendingServerTransaction=server_transaction;
|
||||
|
||||
event_header=belle_sip_message_get_header_by_type(req,belle_sip_header_event_t);
|
||||
body_handler = BELLE_SIP_BODY_HANDLER(op->get_body_handler(BELLE_SIP_MESSAGE(req)));
|
||||
body_handler = BELLE_SIP_BODY_HANDLER(op->getBodyHandler(BELLE_SIP_MESSAGE(req)));
|
||||
|
||||
if (event_header==NULL){
|
||||
ms_warning("No event header in incoming SUBSCRIBE.");
|
||||
resp=op->create_response_from_request(req,400);
|
||||
resp=op->createResponseFromRequest(req,400);
|
||||
belle_sip_server_transaction_send_response(server_transaction,resp);
|
||||
if (!op->dialog) op->release();
|
||||
if (!op->mDialog) op->release();
|
||||
return;
|
||||
}
|
||||
if (op->event==NULL) {
|
||||
op->event=event_header;
|
||||
belle_sip_object_ref(op->event);
|
||||
if (op->mEvent==NULL) {
|
||||
op->mEvent=event_header;
|
||||
belle_sip_object_ref(op->mEvent);
|
||||
}
|
||||
eventname=belle_sip_header_event_get_package_name(event_header);
|
||||
|
||||
if (!op->dialog) {
|
||||
if (!op->mDialog) {
|
||||
if (strcmp(method,"SUBSCRIBE")==0){
|
||||
dialog = belle_sip_provider_create_dialog(op->root->prov,BELLE_SIP_TRANSACTION(server_transaction));
|
||||
dialog = belle_sip_provider_create_dialog(op->mRoot->mProvider,BELLE_SIP_TRANSACTION(server_transaction));
|
||||
if (!dialog){
|
||||
resp=op->create_response_from_request(req,481);
|
||||
resp=op->createResponseFromRequest(req,481);
|
||||
belle_sip_server_transaction_send_response(server_transaction,resp);
|
||||
op->release();
|
||||
return;
|
||||
}
|
||||
op->set_or_update_dialog(dialog);
|
||||
ms_message("new incoming subscription from [%s] to [%s]",op->get_from(),op->get_to());
|
||||
op->setOrUpdateDialog(dialog);
|
||||
ms_message("new incoming subscription from [%s] to [%s]",op->getFrom(),op->getTo());
|
||||
}else{ /*this is a NOTIFY*/
|
||||
op->handle_notify(req, eventname, (SalBodyHandler *)body_handler);
|
||||
op->handleNotify(req, eventname, (SalBodyHandler *)body_handler);
|
||||
return;
|
||||
}
|
||||
}
|
||||
dialog_state=belle_sip_dialog_get_state(op->dialog);
|
||||
dialog_state=belle_sip_dialog_get_state(op->mDialog);
|
||||
switch(dialog_state) {
|
||||
|
||||
case BELLE_SIP_DIALOG_NULL: {
|
||||
const char *type = NULL;
|
||||
belle_sip_header_content_type_t *content_type = belle_sip_message_get_header_by_type(BELLE_SIP_MESSAGE(req), belle_sip_header_content_type_t);
|
||||
if (content_type) type = belle_sip_header_content_type_get_type(content_type);
|
||||
op->root->callbacks.subscribe_received(op, eventname, type ? (SalBodyHandler *)body_handler : NULL);
|
||||
op->mRoot->mCallbacks.subscribe_received(op, eventname, type ? (SalBodyHandler *)body_handler : NULL);
|
||||
break;
|
||||
}
|
||||
case BELLE_SIP_DIALOG_EARLY:
|
||||
ms_error("unexpected method [%s] for dialog [%p] in state BELLE_SIP_DIALOG_EARLY ",belle_sip_request_get_method(req),op->dialog);
|
||||
ms_error("unexpected method [%s] for dialog [%p] in state BELLE_SIP_DIALOG_EARLY ",belle_sip_request_get_method(req),op->mDialog);
|
||||
break;
|
||||
|
||||
case BELLE_SIP_DIALOG_CONFIRMED:
|
||||
if (strcmp("NOTIFY",method)==0) {
|
||||
op->handle_notify(req, eventname, (SalBodyHandler *)body_handler);
|
||||
op->handleNotify(req, eventname, (SalBodyHandler *)body_handler);
|
||||
} else if (strcmp("SUBSCRIBE",method)==0) {
|
||||
/*either a refresh of an unsubscribe*/
|
||||
if (expires && belle_sip_header_expires_get_expires(expires)>0) {
|
||||
resp=op->create_response_from_request(req,200);
|
||||
resp=op->createResponseFromRequest(req,200);
|
||||
belle_sip_server_transaction_send_response(server_transaction,resp);
|
||||
} else if(expires) {
|
||||
ms_message("Unsubscribe received from [%s]",op->get_from());
|
||||
resp=op->create_response_from_request(req,200);
|
||||
ms_message("Unsubscribe received from [%s]",op->getFrom());
|
||||
resp=op->createResponseFromRequest(req,200);
|
||||
belle_sip_server_transaction_send_response(server_transaction,resp);
|
||||
op->root->callbacks.incoming_subscribe_closed(op);
|
||||
op->mRoot->mCallbacks.incoming_subscribe_closed(op);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -175,52 +175,52 @@ void SalSubscribeOp::subscribe_process_request_event_cb(void *op_base, const bel
|
|||
}
|
||||
}
|
||||
|
||||
void SalSubscribeOp::subscribe_process_dialog_terminated_cb(void *ctx, const belle_sip_dialog_terminated_event_t *event) {
|
||||
void SalSubscribeOp::subscribeProcessDialogTerminatedCb(void *ctx, const belle_sip_dialog_terminated_event_t *event) {
|
||||
belle_sip_dialog_t *dialog = belle_sip_dialog_terminated_event_get_dialog(event);
|
||||
SalSubscribeOp * op= (SalSubscribeOp *)ctx;
|
||||
if (op->dialog) {
|
||||
if (op->mDialog) {
|
||||
if (belle_sip_dialog_terminated_event_is_expired(event)){
|
||||
if (!belle_sip_dialog_is_server(dialog)){
|
||||
/*notify the app that our subscription is dead*/
|
||||
const char *eventname = NULL;
|
||||
if (op->event){
|
||||
eventname = belle_sip_header_event_get_package_name(op->event);
|
||||
if (op->mEvent){
|
||||
eventname = belle_sip_header_event_get_package_name(op->mEvent);
|
||||
}
|
||||
op->root->callbacks.notify(op, SalSubscribeTerminated, eventname, NULL);
|
||||
op->mRoot->mCallbacks.notify(op, SalSubscribeTerminated, eventname, NULL);
|
||||
}else{
|
||||
op->root->callbacks.incoming_subscribe_closed(op);
|
||||
op->mRoot->mCallbacks.incoming_subscribe_closed(op);
|
||||
}
|
||||
}
|
||||
op->set_or_update_dialog(NULL);
|
||||
op->setOrUpdateDialog(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void SalSubscribeOp::_release_cb(SalOp *op_base) {
|
||||
void SalSubscribeOp::releaseCb(SalOp *op_base) {
|
||||
auto *op =reinterpret_cast<SalSubscribeOp *>(op_base);
|
||||
if(op->refresher) {
|
||||
belle_sip_refresher_stop(op->refresher);
|
||||
belle_sip_object_unref(op->refresher);
|
||||
op->refresher=NULL;
|
||||
op->set_or_update_dialog(NULL); /*only if we have refresher. else dialog terminated event will remove association*/
|
||||
if(op->mRefresher) {
|
||||
belle_sip_refresher_stop(op->mRefresher);
|
||||
belle_sip_object_unref(op->mRefresher);
|
||||
op->mRefresher=NULL;
|
||||
op->setOrUpdateDialog(NULL); /*only if we have refresher. else dialog terminated event will remove association*/
|
||||
}
|
||||
}
|
||||
|
||||
void SalSubscribeOp::fill_cbs() {
|
||||
void SalSubscribeOp::fillCallbacks() {
|
||||
static belle_sip_listener_callbacks_t op_subscribe_callbacks={0};
|
||||
if (op_subscribe_callbacks.process_io_error==NULL){
|
||||
op_subscribe_callbacks.process_io_error=subscribe_process_io_error_cb;
|
||||
op_subscribe_callbacks.process_response_event=subscribe_response_event_cb;
|
||||
op_subscribe_callbacks.process_timeout=subscribe_process_timeout_cb;
|
||||
op_subscribe_callbacks.process_transaction_terminated=subscribe_process_transaction_terminated_cb;
|
||||
op_subscribe_callbacks.process_request_event=subscribe_process_request_event_cb;
|
||||
op_subscribe_callbacks.process_dialog_terminated=subscribe_process_dialog_terminated_cb;
|
||||
op_subscribe_callbacks.process_io_error=subscribeProcessIoErrorCb;
|
||||
op_subscribe_callbacks.process_response_event=subscribeResponseEventCb;
|
||||
op_subscribe_callbacks.process_timeout=subscribeProcessTimeoutCb;
|
||||
op_subscribe_callbacks.process_transaction_terminated=subscribeProcessTransactionTerminatedCb;
|
||||
op_subscribe_callbacks.process_request_event=subscribeProcessRequestEventCb;
|
||||
op_subscribe_callbacks.process_dialog_terminated=subscribeProcessDialogTerminatedCb;
|
||||
}
|
||||
this->callbacks=&op_subscribe_callbacks;
|
||||
this->type=Type::Subscribe;
|
||||
this->release_cb=_release_cb;
|
||||
mCallbacks=&op_subscribe_callbacks;
|
||||
mType=Type::Subscribe;
|
||||
mReleaseCb=releaseCb;
|
||||
}
|
||||
|
||||
void SalSubscribeOp::subscribe_refresher_listener_cb (belle_sip_refresher_t* refresher,void* user_pointer,unsigned int status_code,const char* reason_phrase, int will_retry) {
|
||||
void SalSubscribeOp::subscribeRefresherListenerCb (belle_sip_refresher_t* refresher,void* user_pointer,unsigned int status_code,const char* reason_phrase, int will_retry) {
|
||||
SalSubscribeOp * op = (SalSubscribeOp *)user_pointer;
|
||||
belle_sip_transaction_t *tr=BELLE_SIP_TRANSACTION(belle_sip_refresher_get_transaction(refresher));
|
||||
/*belle_sip_response_t* response=belle_sip_transaction_get_response(tr);*/
|
||||
|
|
@ -230,17 +230,17 @@ void SalSubscribeOp::subscribe_refresher_listener_cb (belle_sip_refresher_t* ref
|
|||
if (status_code>=200 && status_code<300){
|
||||
if (status_code==200) sss=SalSubscribeActive;
|
||||
else if (status_code==202) sss=SalSubscribePending;
|
||||
op->set_or_update_dialog(belle_sip_transaction_get_dialog(tr));
|
||||
op->root->callbacks.subscribe_response(op,sss, will_retry);
|
||||
op->setOrUpdateDialog(belle_sip_transaction_get_dialog(tr));
|
||||
op->mRoot->mCallbacks.subscribe_response(op,sss, will_retry);
|
||||
} else if (status_code >= 300) {
|
||||
SalReason reason = SalReasonUnknown;
|
||||
if (status_code == 503) { /*refresher returns 503 for IO error*/
|
||||
reason = SalReasonIOError;
|
||||
}
|
||||
sal_error_info_set(&op->error_info, reason, "SIP", (int)status_code, reason_phrase, NULL);
|
||||
op->root->callbacks.subscribe_response(op,sss, will_retry);
|
||||
sal_error_info_set(&op->mErrorInfo, reason, "SIP", (int)status_code, reason_phrase, NULL);
|
||||
op->mRoot->mCallbacks.subscribe_response(op,sss, will_retry);
|
||||
}else if (status_code==0){
|
||||
op->root->callbacks.on_expire(op);
|
||||
op->mRoot->mCallbacks.on_expire(op);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -249,63 +249,63 @@ int SalSubscribeOp::subscribe(const char *from, const char *to, const char *even
|
|||
belle_sip_request_t *req=NULL;
|
||||
|
||||
if (from)
|
||||
set_from(from);
|
||||
setFrom(from);
|
||||
if (to)
|
||||
set_to(to);
|
||||
setTo(to);
|
||||
|
||||
if (!this->dialog){
|
||||
fill_cbs();
|
||||
req=build_request("SUBSCRIBE");
|
||||
if (!mDialog){
|
||||
fillCallbacks();
|
||||
req=buildRequest("SUBSCRIBE");
|
||||
if( req == NULL ) {
|
||||
return -1;
|
||||
}
|
||||
set_event(eventname);
|
||||
belle_sip_message_add_header(BELLE_SIP_MESSAGE(req),BELLE_SIP_HEADER(this->event));
|
||||
setEvent(eventname);
|
||||
belle_sip_message_add_header(BELLE_SIP_MESSAGE(req),BELLE_SIP_HEADER(mEvent));
|
||||
belle_sip_message_add_header(BELLE_SIP_MESSAGE(req),BELLE_SIP_HEADER(belle_sip_header_expires_create(expires)));
|
||||
belle_sip_message_set_body_handler(BELLE_SIP_MESSAGE(req), BELLE_SIP_BODY_HANDLER(body_handler));
|
||||
return send_and_create_refresher(req,expires,subscribe_refresher_listener_cb);
|
||||
}else if (this->refresher){
|
||||
const belle_sip_transaction_t *tr=(const belle_sip_transaction_t*) belle_sip_refresher_get_transaction(this->refresher);
|
||||
return sendRequestAndCreateRefresher(req,expires,subscribeRefresherListenerCb);
|
||||
}else if (mRefresher){
|
||||
const belle_sip_transaction_t *tr=(const belle_sip_transaction_t*) belle_sip_refresher_get_transaction(mRefresher);
|
||||
belle_sip_request_t *last_req=belle_sip_transaction_get_request(tr);
|
||||
/* modify last request to update body*/
|
||||
belle_sip_message_set_body_handler(BELLE_SIP_MESSAGE(last_req), BELLE_SIP_BODY_HANDLER(body_handler));
|
||||
return belle_sip_refresher_refresh(this->refresher,expires);
|
||||
return belle_sip_refresher_refresh(mRefresher,expires);
|
||||
}
|
||||
ms_warning("sal_subscribe(): no dialog and no refresher ?");
|
||||
return -1;
|
||||
}
|
||||
|
||||
int SalSubscribeOp::accept() {
|
||||
belle_sip_request_t* req=belle_sip_transaction_get_request(BELLE_SIP_TRANSACTION(this->pending_server_trans));
|
||||
belle_sip_request_t* req=belle_sip_transaction_get_request(BELLE_SIP_TRANSACTION(mPendingServerTransaction));
|
||||
belle_sip_header_expires_t* expires = belle_sip_message_get_header_by_type(req,belle_sip_header_expires_t);
|
||||
belle_sip_response_t* resp = create_response_from_request(req,200);
|
||||
belle_sip_response_t* resp = createResponseFromRequest(req,200);
|
||||
belle_sip_message_add_header(BELLE_SIP_MESSAGE(resp),BELLE_SIP_HEADER(expires));
|
||||
belle_sip_server_transaction_send_response(this->pending_server_trans,resp);
|
||||
belle_sip_server_transaction_send_response(mPendingServerTransaction,resp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int SalSubscribeOp::decline(SalReason reason) {
|
||||
belle_sip_response_t* resp = belle_sip_response_create_from_request(belle_sip_transaction_get_request(BELLE_SIP_TRANSACTION(this->pending_server_trans)),
|
||||
belle_sip_response_t* resp = belle_sip_response_create_from_request(belle_sip_transaction_get_request(BELLE_SIP_TRANSACTION(mPendingServerTransaction)),
|
||||
to_sip_code(reason));
|
||||
belle_sip_server_transaction_send_response(this->pending_server_trans,resp);
|
||||
belle_sip_server_transaction_send_response(mPendingServerTransaction,resp);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int SalSubscribeOp::notify_pending_state() {
|
||||
int SalSubscribeOp::notifyPendingState() {
|
||||
|
||||
if (this->dialog != NULL && this->pending_server_trans) {
|
||||
if (mDialog != NULL && mPendingServerTransaction) {
|
||||
belle_sip_request_t* notify;
|
||||
belle_sip_header_subscription_state_t* sub_state;
|
||||
ms_message("Sending NOTIFY with subscription state pending for op [%p]", this);
|
||||
if (!(notify=belle_sip_dialog_create_request(this->dialog,"NOTIFY"))) {
|
||||
if (!(notify=belle_sip_dialog_create_request(mDialog,"NOTIFY"))) {
|
||||
ms_error("Cannot create NOTIFY on op [%p]", this);
|
||||
return -1;
|
||||
}
|
||||
if (this->event) belle_sip_message_add_header(BELLE_SIP_MESSAGE(notify),BELLE_SIP_HEADER(this->event));
|
||||
if (mEvent) belle_sip_message_add_header(BELLE_SIP_MESSAGE(notify),BELLE_SIP_HEADER(mEvent));
|
||||
sub_state=belle_sip_header_subscription_state_new();
|
||||
belle_sip_header_subscription_state_set_state(sub_state,BELLE_SIP_SUBSCRIPTION_STATE_PENDING);
|
||||
belle_sip_message_add_header(BELLE_SIP_MESSAGE(notify), BELLE_SIP_HEADER(sub_state));
|
||||
return send_request(notify);
|
||||
return sendRequest(notify);
|
||||
} else {
|
||||
ms_warning("NOTIFY with subscription state pending for op [%p] not implemented in this case (either dialog pending trans does not exist", this);
|
||||
}
|
||||
|
|
@ -316,101 +316,101 @@ int SalSubscribeOp::notify_pending_state() {
|
|||
int SalSubscribeOp::notify(const SalBodyHandler *body_handler) {
|
||||
belle_sip_request_t* notify;
|
||||
|
||||
if (this->dialog){
|
||||
if (!(notify=belle_sip_dialog_create_queued_request(this->dialog,"NOTIFY"))) return -1;
|
||||
if (mDialog){
|
||||
if (!(notify=belle_sip_dialog_create_queued_request(mDialog,"NOTIFY"))) return -1;
|
||||
}else{
|
||||
fill_cbs();
|
||||
notify = build_request("NOTIFY");
|
||||
fillCallbacks();
|
||||
notify = buildRequest("NOTIFY");
|
||||
}
|
||||
|
||||
if (this->event) belle_sip_message_add_header(BELLE_SIP_MESSAGE(notify),BELLE_SIP_HEADER(this->event));
|
||||
if (mEvent) belle_sip_message_add_header(BELLE_SIP_MESSAGE(notify),BELLE_SIP_HEADER(mEvent));
|
||||
|
||||
belle_sip_message_add_header(BELLE_SIP_MESSAGE(notify)
|
||||
, this->dialog ?
|
||||
, mDialog ?
|
||||
BELLE_SIP_HEADER(belle_sip_header_subscription_state_create(BELLE_SIP_SUBSCRIPTION_STATE_ACTIVE,600)) :
|
||||
BELLE_SIP_HEADER(belle_sip_header_subscription_state_create(BELLE_SIP_SUBSCRIPTION_STATE_TERMINATED,0))
|
||||
);
|
||||
belle_sip_message_set_body_handler(BELLE_SIP_MESSAGE(notify), BELLE_SIP_BODY_HANDLER(body_handler));
|
||||
return send_request(notify);
|
||||
return sendRequest(notify);
|
||||
}
|
||||
|
||||
int SalSubscribeOp::close_notify() {
|
||||
int SalSubscribeOp::closeNotify() {
|
||||
belle_sip_request_t* notify;
|
||||
if (!this->dialog) return -1;
|
||||
if (!(notify=belle_sip_dialog_create_queued_request(this->dialog,"NOTIFY"))) return -1;
|
||||
if (this->event) belle_sip_message_add_header(BELLE_SIP_MESSAGE(notify),BELLE_SIP_HEADER(this->event));
|
||||
if (!mDialog) return -1;
|
||||
if (!(notify=belle_sip_dialog_create_queued_request(mDialog,"NOTIFY"))) return -1;
|
||||
if (mEvent) belle_sip_message_add_header(BELLE_SIP_MESSAGE(notify),BELLE_SIP_HEADER(mEvent));
|
||||
belle_sip_message_add_header(BELLE_SIP_MESSAGE(notify)
|
||||
,BELLE_SIP_HEADER(belle_sip_header_subscription_state_create(BELLE_SIP_SUBSCRIPTION_STATE_TERMINATED,-1)));
|
||||
return send_request(notify);
|
||||
return sendRequest(notify);
|
||||
}
|
||||
|
||||
void SalPublishOp::publish_response_event_cb(void *userctx, const belle_sip_response_event_t *event) {
|
||||
void SalPublishOp::publishResponseEventCb(void *userctx, const belle_sip_response_event_t *event) {
|
||||
SalPublishOp *op=(SalPublishOp *)userctx;
|
||||
op->set_error_info_from_response(belle_sip_response_event_get_response(event));
|
||||
if (op->error_info.protocol_code>=200){
|
||||
op->root->callbacks.on_publish_response(op);
|
||||
op->setErrorInfoFromResponse(belle_sip_response_event_get_response(event));
|
||||
if (op->mErrorInfo.protocol_code>=200){
|
||||
op->mRoot->mCallbacks.on_publish_response(op);
|
||||
}
|
||||
}
|
||||
|
||||
void SalPublishOp::fill_cbs() {
|
||||
void SalPublishOp::fillCallbacks() {
|
||||
static belle_sip_listener_callbacks_t op_publish_callbacks={0};
|
||||
if (op_publish_callbacks.process_response_event==NULL){
|
||||
op_publish_callbacks.process_response_event=publish_response_event_cb;
|
||||
op_publish_callbacks.process_response_event=publishResponseEventCb;
|
||||
}
|
||||
|
||||
this->callbacks=&op_publish_callbacks;
|
||||
this->type=Type::Publish;
|
||||
mCallbacks=&op_publish_callbacks;
|
||||
mType=Type::Publish;
|
||||
}
|
||||
|
||||
void SalPublishOp::publish_refresher_listener_cb (belle_sip_refresher_t* refresher,void* user_pointer,unsigned int status_code,const char* reason_phrase, int will_retry) {
|
||||
void SalPublishOp::publishRefresherListenerCb (belle_sip_refresher_t* refresher,void* user_pointer,unsigned int status_code,const char* reason_phrase, int will_retry) {
|
||||
SalPublishOp * op = (SalPublishOp *)user_pointer;
|
||||
const belle_sip_client_transaction_t* last_publish_trans=belle_sip_refresher_get_transaction(op->refresher);
|
||||
const belle_sip_client_transaction_t* last_publish_trans=belle_sip_refresher_get_transaction(op->mRefresher);
|
||||
belle_sip_response_t *response=belle_sip_transaction_get_response(BELLE_SIP_TRANSACTION(last_publish_trans));
|
||||
ms_message("Publish refresher [%i] reason [%s] for proxy [%s]",status_code,reason_phrase?reason_phrase:"none",op->get_proxy());
|
||||
ms_message("Publish refresher [%i] reason [%s] for proxy [%s]",status_code,reason_phrase?reason_phrase:"none",op->getProxy());
|
||||
if (status_code==0){
|
||||
op->root->callbacks.on_expire(op);
|
||||
op->mRoot->mCallbacks.on_expire(op);
|
||||
}else if (status_code>=200){
|
||||
belle_sip_header_t *sip_etag;
|
||||
const char *sip_etag_string = NULL;
|
||||
if (response && (sip_etag = belle_sip_message_get_header(BELLE_SIP_MESSAGE(response), "SIP-ETag"))) {
|
||||
sip_etag_string = belle_sip_header_get_unparsed_value(sip_etag);
|
||||
}
|
||||
op->set_entity_tag(sip_etag_string);
|
||||
sal_error_info_set(&op->error_info,SalReasonUnknown, "SIP", (int)status_code, reason_phrase, NULL);
|
||||
op->assign_recv_headers((belle_sip_message_t*)response);
|
||||
op->root->callbacks.on_publish_response(op);
|
||||
op->setEntityTag(sip_etag_string);
|
||||
sal_error_info_set(&op->mErrorInfo,SalReasonUnknown, "SIP", (int)status_code, reason_phrase, NULL);
|
||||
op->assignRecvHeaders((belle_sip_message_t*)response);
|
||||
op->mRoot->mCallbacks.on_publish_response(op);
|
||||
}
|
||||
}
|
||||
|
||||
int SalPublishOp::publish(const char *from, const char *to, const char *eventname, int expires, const SalBodyHandler *body_handler) {
|
||||
belle_sip_request_t *req=NULL;
|
||||
if(!this->refresher || !belle_sip_refresher_get_transaction(this->refresher)) {
|
||||
if(!mRefresher || !belle_sip_refresher_get_transaction(mRefresher)) {
|
||||
if (from)
|
||||
set_from(from);
|
||||
setFrom(from);
|
||||
if (to)
|
||||
set_to(to);
|
||||
setTo(to);
|
||||
|
||||
fill_cbs();
|
||||
req=build_request("PUBLISH");
|
||||
fillCallbacks();
|
||||
req=buildRequest("PUBLISH");
|
||||
if( req == NULL ){
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (get_entity_tag()) {
|
||||
belle_sip_message_add_header(BELLE_SIP_MESSAGE(req),belle_sip_header_create("SIP-If-Match", get_entity_tag()));
|
||||
if (getEntityTag()) {
|
||||
belle_sip_message_add_header(BELLE_SIP_MESSAGE(req),belle_sip_header_create("SIP-If-Match", getEntityTag()));
|
||||
}
|
||||
|
||||
if (get_contact_address()){
|
||||
belle_sip_message_add_header(BELLE_SIP_MESSAGE(req),BELLE_SIP_HEADER(create_contact()));
|
||||
if (getContactAddress()){
|
||||
belle_sip_message_add_header(BELLE_SIP_MESSAGE(req),BELLE_SIP_HEADER(createContact()));
|
||||
}
|
||||
belle_sip_message_add_header(BELLE_SIP_MESSAGE(req),belle_sip_header_create("Event",eventname));
|
||||
belle_sip_message_set_body_handler(BELLE_SIP_MESSAGE(req), BELLE_SIP_BODY_HANDLER(body_handler));
|
||||
if (expires!=-1)
|
||||
return send_and_create_refresher(req,expires,publish_refresher_listener_cb);
|
||||
else return send_request(req);
|
||||
return sendRequestAndCreateRefresher(req,expires,publishRefresherListenerCb);
|
||||
else return sendRequest(req);
|
||||
} else {
|
||||
/*update status*/
|
||||
const belle_sip_client_transaction_t* last_publish_trans=belle_sip_refresher_get_transaction(this->refresher);
|
||||
const belle_sip_client_transaction_t* last_publish_trans=belle_sip_refresher_get_transaction(mRefresher);
|
||||
belle_sip_request_t* last_publish=belle_sip_transaction_get_request(BELLE_SIP_TRANSACTION(last_publish_trans));
|
||||
/*update body*/
|
||||
if (expires == 0) {
|
||||
|
|
@ -418,16 +418,16 @@ int SalPublishOp::publish(const char *from, const char *to, const char *eventnam
|
|||
} else {
|
||||
belle_sip_message_set_body_handler(BELLE_SIP_MESSAGE(last_publish), BELLE_SIP_BODY_HANDLER(body_handler));
|
||||
}
|
||||
return belle_sip_refresher_refresh(this->refresher,expires==-1 ? BELLE_SIP_REFRESHER_REUSE_EXPIRES : expires);
|
||||
return belle_sip_refresher_refresh(mRefresher,expires==-1 ? BELLE_SIP_REFRESHER_REUSE_EXPIRES : expires);
|
||||
}
|
||||
}
|
||||
|
||||
int SalPublishOp::unpublish() {
|
||||
if (this->refresher){
|
||||
const belle_sip_transaction_t *tr=(const belle_sip_transaction_t*) belle_sip_refresher_get_transaction(this->refresher);
|
||||
if (mRefresher){
|
||||
const belle_sip_transaction_t *tr=(const belle_sip_transaction_t*) belle_sip_refresher_get_transaction(mRefresher);
|
||||
belle_sip_request_t *last_req=belle_sip_transaction_get_request(tr);
|
||||
belle_sip_message_set_body(BELLE_SIP_MESSAGE(last_req), NULL, 0);
|
||||
belle_sip_refresher_refresh(this->refresher,0);
|
||||
belle_sip_refresher_refresh(mRefresher,0);
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
|
|
|
|||
|
|
@ -24,49 +24,49 @@
|
|||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
class SalEventOp: public SalOp {
|
||||
class SalEventOp : public SalOp {
|
||||
public:
|
||||
SalEventOp(Sal *sal): SalOp(sal) {}
|
||||
SalEventOp (Sal *sal) : SalOp(sal) {}
|
||||
};
|
||||
|
||||
class SalSubscribeOp: public SalEventOp {
|
||||
public:
|
||||
SalSubscribeOp(Sal *sal): SalEventOp(sal) {}
|
||||
SalSubscribeOp (Sal *sal): SalEventOp(sal) {}
|
||||
|
||||
int subscribe(const char *from, const char *to, const char *eventname, int expires, const SalBodyHandler *body_handler);
|
||||
int unsubscribe() {return SalOp::unsubscribe();}
|
||||
int accept();
|
||||
int decline(SalReason reason);
|
||||
int notify_pending_state();
|
||||
int notify(const SalBodyHandler *body_handler);
|
||||
int close_notify();
|
||||
int subscribe (const char *from, const char *to, const char *eventName, int expires, const SalBodyHandler *bodyHandler);
|
||||
int unsubscribe () { return SalOp::unsubscribe(); }
|
||||
int accept ();
|
||||
int decline (SalReason reason);
|
||||
int notifyPendingState ();
|
||||
int notify (const SalBodyHandler *bodyHandler);
|
||||
int closeNotify ();
|
||||
|
||||
private:
|
||||
virtual void fill_cbs() override;
|
||||
void handle_notify(belle_sip_request_t *req, const char *eventname, SalBodyHandler* body_handler);
|
||||
virtual void fillCallbacks () override;
|
||||
void handleNotify (belle_sip_request_t *request, const char *eventName, SalBodyHandler *bodyHandler);
|
||||
|
||||
static void subscribe_process_io_error_cb(void *user_ctx, const belle_sip_io_error_event_t *event);
|
||||
static void subscribe_response_event_cb(void *op_base, const belle_sip_response_event_t *event);
|
||||
static void subscribe_process_timeout_cb(void *user_ctx, const belle_sip_timeout_event_t *event);
|
||||
static void subscribe_process_transaction_terminated_cb(void *user_ctx, const belle_sip_transaction_terminated_event_t *event) {}
|
||||
static void subscribe_process_request_event_cb(void *op_base, const belle_sip_request_event_t *event);
|
||||
static void subscribe_process_dialog_terminated_cb(void *ctx, const belle_sip_dialog_terminated_event_t *event);
|
||||
static void _release_cb(SalOp *op_base);
|
||||
static void subscribe_refresher_listener_cb (belle_sip_refresher_t* refresher,void* user_pointer,unsigned int status_code,const char* reason_phrase, int will_retry);
|
||||
static void subscribeProcessIoErrorCb (void *userCtx, const belle_sip_io_error_event_t *event);
|
||||
static void subscribeResponseEventCb (void *userCtx, const belle_sip_response_event_t *event);
|
||||
static void subscribeProcessTimeoutCb (void *userCtx, const belle_sip_timeout_event_t *event);
|
||||
static void subscribeProcessTransactionTerminatedCb (void *userCtx, const belle_sip_transaction_terminated_event_t *event) {}
|
||||
static void subscribeProcessRequestEventCb (void *userCtx, const belle_sip_request_event_t *event);
|
||||
static void subscribeProcessDialogTerminatedCb (void *userCtx, const belle_sip_dialog_terminated_event_t *event);
|
||||
static void releaseCb (SalOp *op);
|
||||
static void subscribeRefresherListenerCb (belle_sip_refresher_t *refresher, void *userCtx, unsigned int statusCode, const char *reasonPhrase, int willRetry);
|
||||
};
|
||||
|
||||
class SalPublishOp: public SalEventOp {
|
||||
class SalPublishOp : public SalEventOp {
|
||||
public:
|
||||
SalPublishOp(Sal *sal): SalEventOp(sal) {}
|
||||
SalPublishOp (Sal *sal) : SalEventOp(sal) {}
|
||||
|
||||
int publish(const char *from, const char *to, const char *eventname, int expires, const SalBodyHandler *body_handler);
|
||||
int unpublish();
|
||||
int publish (const char *from, const char *to, const char *eventName, int expires, const SalBodyHandler *bodyHandler);
|
||||
int unpublish ();
|
||||
|
||||
private:
|
||||
virtual void fill_cbs() override;
|
||||
virtual void fillCallbacks () override;
|
||||
|
||||
static void publish_response_event_cb(void *userctx, const belle_sip_response_event_t *event);
|
||||
static void publish_refresher_listener_cb (belle_sip_refresher_t* refresher,void* user_pointer,unsigned int status_code,const char* reason_phrase, int will_retry);
|
||||
static void publishResponseEventCb (void *userCtx, const belle_sip_response_event_t *event);
|
||||
static void publishRefresherListenerCb (belle_sip_refresher_t *refresher, void *userCtx, unsigned int statusCode, const char *reasonPhrase, int willRetry);
|
||||
};
|
||||
|
||||
LINPHONE_END_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ public:
|
|||
virtual ~SalMessageOpInterface() = default;
|
||||
|
||||
virtual int sendMessage (const Content &content) = 0;
|
||||
virtual int reply(SalReason reason) = 0;
|
||||
virtual int reply (SalReason reason) = 0;
|
||||
|
||||
protected:
|
||||
void prepareMessageRequest (belle_sip_request_t *req, const Content &content) {
|
||||
|
|
|
|||
|
|
@ -23,26 +23,26 @@ using namespace std;
|
|||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
void SalMessageOp::process_error() {
|
||||
if (this->dir == Dir::Outgoing) {
|
||||
this->root->callbacks.message_delivery_update(this, SalMessageDeliveryFailed);
|
||||
void SalMessageOp::processError() {
|
||||
if (mDir == Dir::Outgoing) {
|
||||
mRoot->mCallbacks.message_delivery_update(this, SalMessageDeliveryFailed);
|
||||
} else {
|
||||
ms_warning("unexpected io error for incoming message on op [%p]", this);
|
||||
}
|
||||
this->state=State::Terminated;
|
||||
mState=State::Terminated;
|
||||
}
|
||||
|
||||
void SalMessageOp::process_io_error_cb(void *user_ctx, const belle_sip_io_error_event_t *event) {
|
||||
void SalMessageOp::processIoErrorCb(void *user_ctx, const belle_sip_io_error_event_t *event) {
|
||||
SalMessageOp * op = (SalMessageOp *)user_ctx;
|
||||
sal_error_info_set(&op->error_info,SalReasonIOError, "SIP", 503,"IO Error",NULL);
|
||||
op->process_error();
|
||||
sal_error_info_set(&op->mErrorInfo,SalReasonIOError, "SIP", 503,"IO Error",NULL);
|
||||
op->processError();
|
||||
}
|
||||
|
||||
void SalMessageOp::process_response_event_cb(void *op_base, const belle_sip_response_event_t *event) {
|
||||
void SalMessageOp::processResponseEventCb(void *op_base, const belle_sip_response_event_t *event) {
|
||||
SalMessageOp * op = (SalMessageOp *)op_base;
|
||||
int code = belle_sip_response_get_status_code(belle_sip_response_event_get_response(event));
|
||||
SalMessageDeliveryStatus status;
|
||||
op->set_error_info_from_response(belle_sip_response_event_get_response(event));
|
||||
op->setErrorInfoFromResponse(belle_sip_response_event_get_response(event));
|
||||
|
||||
if (code>=100 && code <200)
|
||||
status=SalMessageDeliveryInProgress;
|
||||
|
|
@ -51,40 +51,40 @@ void SalMessageOp::process_response_event_cb(void *op_base, const belle_sip_resp
|
|||
else
|
||||
status=SalMessageDeliveryFailed;
|
||||
|
||||
op->root->callbacks.message_delivery_update(op,status);
|
||||
op->mRoot->mCallbacks.message_delivery_update(op,status);
|
||||
}
|
||||
|
||||
void SalMessageOp::process_timeout_cb(void *user_ctx, const belle_sip_timeout_event_t *event) {
|
||||
void SalMessageOp::processTimeoutCb(void *user_ctx, const belle_sip_timeout_event_t *event) {
|
||||
SalMessageOp * op=(SalMessageOp *)user_ctx;
|
||||
sal_error_info_set(&op->error_info,SalReasonRequestTimeout, "SIP", 408,"Request timeout",NULL);
|
||||
op->process_error();
|
||||
sal_error_info_set(&op->mErrorInfo,SalReasonRequestTimeout, "SIP", 408,"Request timeout",NULL);
|
||||
op->processError();
|
||||
}
|
||||
|
||||
void SalMessageOp::process_request_event_cb(void *op_base, const belle_sip_request_event_t *event) {
|
||||
void SalMessageOp::processRequestEventCb(void *op_base, const belle_sip_request_event_t *event) {
|
||||
SalMessageOp * op = (SalMessageOp *)op_base;
|
||||
op->process_incoming_message(event);
|
||||
op->processIncomingMessage(event);
|
||||
}
|
||||
|
||||
void SalMessageOp::fill_cbs() {
|
||||
void SalMessageOp::fillCallbacks() {
|
||||
static belle_sip_listener_callbacks_t op_message_callbacks = {0};
|
||||
if (op_message_callbacks.process_io_error==NULL) {
|
||||
op_message_callbacks.process_io_error=process_io_error_cb;
|
||||
op_message_callbacks.process_response_event=process_response_event_cb;
|
||||
op_message_callbacks.process_timeout=process_timeout_cb;
|
||||
op_message_callbacks.process_request_event=process_request_event_cb;
|
||||
op_message_callbacks.process_io_error=processIoErrorCb;
|
||||
op_message_callbacks.process_response_event=processResponseEventCb;
|
||||
op_message_callbacks.process_timeout=processTimeoutCb;
|
||||
op_message_callbacks.process_request_event=processRequestEventCb;
|
||||
}
|
||||
this->callbacks=&op_message_callbacks;
|
||||
this->type=Type::Message;
|
||||
mCallbacks=&op_message_callbacks;
|
||||
mType=Type::Message;
|
||||
}
|
||||
|
||||
int SalMessageOp::sendMessage (const Content &content) {
|
||||
fill_cbs();
|
||||
this->dir = Dir::Outgoing;
|
||||
belle_sip_request_t *req = build_request("MESSAGE");
|
||||
fillCallbacks();
|
||||
mDir = Dir::Outgoing;
|
||||
belle_sip_request_t *req = buildRequest("MESSAGE");
|
||||
if (!req)
|
||||
return -1;
|
||||
prepareMessageRequest(req, content);
|
||||
return send_request(req);
|
||||
return sendRequest(req);
|
||||
}
|
||||
|
||||
LINPHONE_END_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -25,21 +25,21 @@
|
|||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
class SalMessageOp: public SalOp, public SalMessageOpInterface {
|
||||
class SalMessageOp : public SalOp, public SalMessageOpInterface {
|
||||
public:
|
||||
SalMessageOp(Sal *sal): SalOp(sal) {}
|
||||
SalMessageOp (Sal *sal) : SalOp(sal) {}
|
||||
|
||||
int sendMessage (const Content &content) override;
|
||||
int reply(SalReason reason) override {return SalOp::reply_message(reason);}
|
||||
int reply (SalReason reason) override { return SalOp::replyMessage(reason); }
|
||||
|
||||
private:
|
||||
virtual void fill_cbs() override;
|
||||
void process_error();
|
||||
virtual void fillCallbacks () override;
|
||||
void processError ();
|
||||
|
||||
static void process_io_error_cb(void *user_ctx, const belle_sip_io_error_event_t *event);
|
||||
static void process_response_event_cb(void *op_base, const belle_sip_response_event_t *event);
|
||||
static void process_timeout_cb(void *user_ctx, const belle_sip_timeout_event_t *event);
|
||||
static void process_request_event_cb(void *op_base, const belle_sip_request_event_t *event);
|
||||
static void processIoErrorCb (void *userCtx, const belle_sip_io_error_event_t *event);
|
||||
static void processResponseEventCb (void *userCtx, const belle_sip_response_event_t *event);
|
||||
static void processTimeoutCb (void *userCtx, const belle_sip_timeout_event_t *event);
|
||||
static void processRequestEventCb (void *userCtx, const belle_sip_request_event_t *event);
|
||||
};
|
||||
|
||||
LINPHONE_END_NAMESPACE
|
||||
|
|
|
|||
695
src/sal/op.cpp
695
src/sal/op.cpp
File diff suppressed because it is too large
Load diff
327
src/sal/op.h
327
src/sal/op.h
|
|
@ -26,107 +26,118 @@
|
|||
|
||||
#include "c-wrapper/internal/c-sal.h"
|
||||
#include "content/content.h"
|
||||
#include "logger/logger.h"
|
||||
#include "sal/sal.h"
|
||||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
class SalOp {
|
||||
public:
|
||||
SalOp(Sal *sal);
|
||||
virtual ~SalOp();
|
||||
SalOp (Sal *sal);
|
||||
virtual ~SalOp ();
|
||||
|
||||
SalOp *ref();
|
||||
void *unref();
|
||||
SalOp *ref ();
|
||||
void *unref ();
|
||||
|
||||
Sal *get_sal() const {return this->root;}
|
||||
Sal *getSal () const { return mRoot; }
|
||||
|
||||
void set_user_pointer(void *up) {this->user_pointer=up;}
|
||||
void *get_user_pointer() const {return this->user_pointer;}
|
||||
void setUserPointer (void *value) { mUserPointer = value; }
|
||||
void *getUserPointer () const { return mUserPointer; }
|
||||
|
||||
void set_subject (const char *subject);
|
||||
const char *get_subject () const { return this->subject; }
|
||||
void setSubject (const char *value);
|
||||
const char *getSubject () const { return mSubject; }
|
||||
|
||||
void set_from(const char *from);
|
||||
void set_from_address(const SalAddress *from);
|
||||
const char *get_from() const {return this->from;}
|
||||
const SalAddress *get_from_address() const {return this->from_address;}
|
||||
void setFrom (const char *value);
|
||||
void setFromAddress (const SalAddress *value);
|
||||
const char *getFrom () const { return mFrom; }
|
||||
const SalAddress *getFromAddress () const { return mFromAddress; }
|
||||
|
||||
void set_to(const char *to);
|
||||
void set_to_address(const SalAddress *to);
|
||||
const char *get_to() const {return this->to;}
|
||||
const SalAddress *get_to_address() const {return this->to_address;}
|
||||
void setTo (const char *value);
|
||||
void setToAddress (const SalAddress *value);
|
||||
const char *getTo () const { return mTo; }
|
||||
const SalAddress *getToAddress () const { return mToAddress; }
|
||||
|
||||
void set_contact_address(const SalAddress* address);
|
||||
const SalAddress *get_contact_address() const {return this->contact_address;}
|
||||
void setContactAddress (const SalAddress* value);
|
||||
const SalAddress *getContactAddress() const { return mContactAddress; }
|
||||
|
||||
void set_route(const char *route);
|
||||
void set_route_address(const SalAddress* address);
|
||||
const bctbx_list_t *get_route_addresses() const {return this->route_addresses;}
|
||||
void add_route_address(const SalAddress* address);
|
||||
void setRoute (const char *value);
|
||||
void setRouteAddress (const SalAddress *value);
|
||||
const bctbx_list_t *getRouteAddresses () const { return mRouteAddresses; }
|
||||
void addRouteAddress (const SalAddress *address);
|
||||
|
||||
void set_diversion_address(const SalAddress *diversion);
|
||||
const SalAddress *get_diversion_address() const {return this->diversion_address;}
|
||||
void setDiversionAddress (const SalAddress *value);
|
||||
const SalAddress *getDiversionAddress () const { return mDiversionAddress; }
|
||||
|
||||
void set_service_route(const SalAddress* service_route);
|
||||
const SalAddress *get_service_route() const {return this->service_route;}
|
||||
void setServiceRoute (const SalAddress *value);
|
||||
const SalAddress *getServiceRoute () const { return mServiceRoute; }
|
||||
|
||||
void set_manual_refresher_mode(bool_t enabled) {this->manual_refresher=enabled;}
|
||||
void setManualRefresherMode (bool_t value) { mManualRefresher = value; }
|
||||
|
||||
void set_entity_tag(const char* entity_tag);
|
||||
const char *get_entity_tag() const {return this->entity_tag;}
|
||||
void setEntityTag (const char *value);
|
||||
const char *getEntityTag() const { return mEntityTag; }
|
||||
|
||||
void set_event(const char *eventname);
|
||||
void setEvent (const char *eventName);
|
||||
|
||||
void set_privacy(SalPrivacyMask privacy) {this->privacy=privacy;}
|
||||
SalPrivacyMask get_privacy() const {return this->privacy;}
|
||||
void setPrivacy (SalPrivacyMask value) { mPrivacy = value; }
|
||||
SalPrivacyMask getPrivacy() const { return mPrivacy; }
|
||||
|
||||
void set_realm(const char *realm);
|
||||
void setRealm (const char *value);
|
||||
|
||||
void set_sent_custom_header(SalCustomHeader* ch);
|
||||
void setSentCustomHeaders (SalCustomHeader *ch);
|
||||
|
||||
void enable_cnx_ip_to_0000_if_sendonly(bool_t yesno) {this->_cnx_ip_to_0000_if_sendonly_enabled = yesno;}
|
||||
bool_t cnx_ip_to_0000_if_sendonly_enabled() const {return this->_cnx_ip_to_0000_if_sendonly_enabled;}
|
||||
void enableCnxIpTo0000IfSendOnly (bool_t value) { mCnxIpTo0000IfSendOnlyEnabled = value; }
|
||||
bool_t cnxIpTo0000IfSendOnlyEnabled () const { return mCnxIpTo0000IfSendOnlyEnabled; }
|
||||
|
||||
const char *get_proxy() const {return this->route;}
|
||||
const char *get_network_origin() const {return this->origin;}
|
||||
const char* get_call_id() const {return this->call_id;}
|
||||
char* get_dialog_id() const;
|
||||
int get_address_family() const;
|
||||
const SalCustomHeader *get_recv_custom_header() const {return this->recv_custom_headers;}
|
||||
const char *get_remote_contact() const {return this->remote_contact;}
|
||||
const SalAddress *get_remote_contact_address() const {return this->remote_contact_address;}
|
||||
const char *get_remote_ua() const {return this->remote_ua;}
|
||||
const char *getProxy () const { return mRoute; }
|
||||
const char *getNetworkOrigin () const { return mOrigin; }
|
||||
const char *getCallId () const { return mCallId; }
|
||||
char *getDialogId () const;
|
||||
int getAddressFamily () const;
|
||||
const SalCustomHeader *getRecvCustomHeaders () const { return mRecvCustomHeaders; }
|
||||
const char *getRemoteContact () const { return mRemoteContact; }
|
||||
const SalAddress *getRemoteContactAddress () const { return mRemoteContactAddress; }
|
||||
const char *getRemoteUserAgent () const { return mRemoteUserAgent; }
|
||||
|
||||
const char *get_public_address(int *port) {return this->refresher ? belle_sip_refresher_get_public_address(this->refresher, port) : NULL;}
|
||||
const char *get_local_address(int *port) {return this->refresher ? belle_sip_refresher_get_local_address(this->refresher, port) : NULL;}
|
||||
const char *getPublicAddress (int *port) {
|
||||
return mRefresher ? belle_sip_refresher_get_public_address(mRefresher, port) : nullptr;
|
||||
}
|
||||
const char *getLocalAddress (int *port) {
|
||||
return mRefresher ? belle_sip_refresher_get_local_address(mRefresher, port) : nullptr;
|
||||
}
|
||||
|
||||
const SalErrorInfo *get_error_info() const {return &this->error_info;}
|
||||
const SalErrorInfo *get_reason_error_info() const {return &this->reason_error_info;}
|
||||
const SalErrorInfo *getErrorInfo () const { return &mErrorInfo; }
|
||||
const SalErrorInfo *getReasonErrorInfo () const { return &mReasonErrorInfo; }
|
||||
|
||||
bool_t is_forked_of(const SalOp *op2) const {return this->call_id && op2->call_id && strcmp(this->call_id, op2->call_id) == 0;}
|
||||
bool_t is_idle() const ;
|
||||
bool_t isForkedOf (const SalOp *op) const {
|
||||
return mCallId && op->mCallId && strcmp(mCallId, op->mCallId) == 0;
|
||||
}
|
||||
bool_t isIdle () const;
|
||||
|
||||
void stop_refreshing() {if (this->refresher) belle_sip_refresher_stop(this->refresher);}
|
||||
int refresh();
|
||||
void kill_dialog();
|
||||
void release();
|
||||
void stopRefreshing () {
|
||||
if (mRefresher)
|
||||
belle_sip_refresher_stop(mRefresher);
|
||||
}
|
||||
int refresh ();
|
||||
void killDialog ();
|
||||
void release ();
|
||||
|
||||
virtual void authenticate(const SalAuthInfo *info) {process_authentication();}
|
||||
void cancel_authentication() {ms_fatal("sal_op_cancel_authentication not implemented yet");}
|
||||
SalAuthInfo *get_auth_requested() {return this->auth_info;}
|
||||
virtual void authenticate (const SalAuthInfo *info) {
|
||||
processAuthentication(); }
|
||||
void cancelAuthentication () { lFatal() << "SalOp::cancelAuthentication not implemented yet"; }
|
||||
SalAuthInfo *getAuthRequested () { return mAuthInfo; }
|
||||
|
||||
int ping(const char *from, const char *to);
|
||||
int send_info(const char *from, const char *to, const SalBodyHandler *body_handler);
|
||||
int ping (const char *from, const char *to);
|
||||
int sendInfo (const char *from, const char *to, const SalBodyHandler *bodyHandler);
|
||||
|
||||
protected:
|
||||
enum class State {
|
||||
Early = 0,
|
||||
Active,
|
||||
Terminating, /*this state is used to wait until a proceeding state, so we can send the cancel*/
|
||||
Terminating, // This state is used to wait until a proceeding state, so we can send the cancel
|
||||
Terminated
|
||||
};
|
||||
|
||||
static const char* to_string(const State value);
|
||||
static const char *toString (const State value);
|
||||
|
||||
enum class Dir {
|
||||
Incoming = 0,
|
||||
|
|
@ -141,118 +152,120 @@ protected:
|
|||
Presence,
|
||||
Publish,
|
||||
Subscribe,
|
||||
Refer /*for out of dialog refer only*/
|
||||
Refer // For out of dialog refer only
|
||||
};
|
||||
|
||||
static const char *to_string(const SalOp::Type type);
|
||||
static const char *toString (const Type type);
|
||||
|
||||
typedef void (*ReleaseCb)(SalOp *op);
|
||||
using ReleaseCb = void (*) (SalOp *op);
|
||||
|
||||
virtual void fill_cbs() {}
|
||||
void release_impl();
|
||||
void process_authentication();
|
||||
int process_redirect();
|
||||
virtual void fillCallbacks () {}
|
||||
void releaseImpl ();
|
||||
void processAuthentication ();
|
||||
int processRedirect ();
|
||||
|
||||
belle_sip_request_t* build_request(const char* method);
|
||||
int send_request(belle_sip_request_t* request);
|
||||
int send_request_with_contact(belle_sip_request_t* request, bool_t add_contact);
|
||||
int send_request_with_expires(belle_sip_request_t* request,int expires);
|
||||
void resend_request(belle_sip_request_t* request);
|
||||
int send_and_create_refresher(belle_sip_request_t* req, int expires,belle_sip_refresher_listener_t listener);
|
||||
belle_sip_request_t *buildRequest (const char *method);
|
||||
int sendRequest (belle_sip_request_t *request);
|
||||
int sendRequestWithContact (belle_sip_request_t *request, bool_t addContact);
|
||||
int sendRequestWithExpires (belle_sip_request_t *request, int expires);
|
||||
void resendRequest (belle_sip_request_t *request);
|
||||
int sendRequestAndCreateRefresher (belle_sip_request_t *request, int expires, belle_sip_refresher_listener_t listener);
|
||||
|
||||
void set_reason_error_info(belle_sip_message_t *msg);
|
||||
void set_error_info_from_response(belle_sip_response_t *response);
|
||||
void setReasonErrorInfo (belle_sip_message_t *message);
|
||||
void setErrorInfoFromResponse (belle_sip_response_t *response);
|
||||
|
||||
void set_referred_by(belle_sip_header_referred_by_t* referred_by);
|
||||
void set_replaces(belle_sip_header_replaces_t* replaces);
|
||||
void setReferredBy (belle_sip_header_referred_by_t *referredByHeader);
|
||||
void setReplaces (belle_sip_header_replaces_t *replacesHeader);
|
||||
|
||||
void set_remote_contact(const char* remote_contact);
|
||||
void set_network_origin(const char *origin);
|
||||
void set_network_origin_address(SalAddress *origin);
|
||||
void set_privacy_from_message(belle_sip_message_t* msg);
|
||||
void set_remote_ua(belle_sip_message_t* message);
|
||||
void setRemoteContact (const char *value);
|
||||
void setNetworkOrigin (const char *value);
|
||||
void setNetworkOriginAddress (SalAddress *value);
|
||||
void setPrivacyFromMessage (belle_sip_message_t *message);
|
||||
void setRemoteUserAgent (belle_sip_message_t *message);
|
||||
|
||||
belle_sip_response_t *create_response_from_request(belle_sip_request_t *req, int code) {return this->root->create_response_from_request(req,code);}
|
||||
belle_sip_header_contact_t *create_contact();
|
||||
belle_sip_response_t *createResponseFromRequest (belle_sip_request_t *request, int code) {
|
||||
return mRoot->createResponseFromRequest(request, code);
|
||||
}
|
||||
belle_sip_header_contact_t *createContact ();
|
||||
|
||||
void set_or_update_dialog(belle_sip_dialog_t* dialog);
|
||||
belle_sip_dialog_t *link_op_with_dialog(belle_sip_dialog_t* dialog);
|
||||
void unlink_op_with_dialog(belle_sip_dialog_t* dialog);
|
||||
void setOrUpdateDialog (belle_sip_dialog_t *dialog);
|
||||
belle_sip_dialog_t *linkOpWithDialog (belle_sip_dialog_t *dialog);
|
||||
void unlinkOpFromDialog (belle_sip_dialog_t *dialog);
|
||||
|
||||
SalBodyHandler *get_body_handler(belle_sip_message_t *msg);
|
||||
SalBodyHandler *getBodyHandler (belle_sip_message_t *message);
|
||||
|
||||
void assign_recv_headers(belle_sip_message_t *incoming);
|
||||
void assignRecvHeaders (belle_sip_message_t *message);
|
||||
|
||||
bool_t is_secure() const;
|
||||
void add_headers(belle_sip_header_t *h, belle_sip_message_t *msg);
|
||||
void add_custom_headers(belle_sip_message_t *msg);
|
||||
int unsubscribe();
|
||||
bool_t isSecure () const;
|
||||
void addHeaders (belle_sip_header_t *h, belle_sip_message_t *message);
|
||||
void addCustomHeaders (belle_sip_message_t *message);
|
||||
int unsubscribe ();
|
||||
|
||||
void process_incoming_message(const belle_sip_request_event_t *event);
|
||||
int reply_message(SalReason reason);
|
||||
void add_message_accept(belle_sip_message_t *msg);
|
||||
static bool_t is_external_body(belle_sip_header_content_type_t* content_type);
|
||||
void processIncomingMessage (const belle_sip_request_event_t *event);
|
||||
int replyMessage (SalReason reason);
|
||||
void addMessageAccept (belle_sip_message_t *message);
|
||||
|
||||
static void assign_address(SalAddress** address, const char *value);
|
||||
static void assign_string(char **str, const char *arg);
|
||||
static void add_initial_route_set(belle_sip_request_t *request, const MSList *list);
|
||||
static bool_t isExternalBody (belle_sip_header_content_type_t* contentType);
|
||||
|
||||
static void assignAddress (SalAddress **address, const char *value);
|
||||
static void assignString (char **str, const char *arg);
|
||||
static void addInitialRouteSet (belle_sip_request_t *request, const MSList *list);
|
||||
|
||||
// SalOpBase
|
||||
Sal *root = NULL;
|
||||
char *route = NULL; /*or request-uri for REGISTER*/
|
||||
MSList* route_addresses = NULL; /*list of SalAddress* */
|
||||
SalAddress* contact_address = NULL;
|
||||
char *subject = NULL;
|
||||
char *from = NULL;
|
||||
SalAddress* from_address = NULL;
|
||||
char *to = NULL;
|
||||
SalAddress* to_address = NULL;
|
||||
char *origin = NULL;
|
||||
SalAddress* origin_address = NULL;
|
||||
SalAddress* diversion_address = NULL;
|
||||
char *remote_ua = NULL;
|
||||
SalAddress* remote_contact_address = NULL;
|
||||
char *remote_contact = NULL;
|
||||
void *user_pointer = NULL;
|
||||
char* call_id = NULL;
|
||||
char* realm = NULL;
|
||||
SalAddress* service_route = NULL; /*as defined by rfc3608, might be a list*/
|
||||
SalCustomHeader *sent_custom_headers = NULL;
|
||||
SalCustomHeader *recv_custom_headers = NULL;
|
||||
char* entity_tag = NULL; /*as defined by rfc3903 (I.E publih)*/
|
||||
ReleaseCb release_cb = NULL;
|
||||
Sal *mRoot = nullptr;
|
||||
char *mRoute = nullptr; // Or request-uri for REGISTER
|
||||
MSList *mRouteAddresses = nullptr; // List of SalAddress *
|
||||
SalAddress *mContactAddress = nullptr;
|
||||
char *mSubject = nullptr;
|
||||
char *mFrom = nullptr;
|
||||
SalAddress* mFromAddress = nullptr;
|
||||
char *mTo = nullptr;
|
||||
SalAddress *mToAddress = nullptr;
|
||||
char *mOrigin = nullptr;
|
||||
SalAddress *mOriginAddress = nullptr;
|
||||
SalAddress *mDiversionAddress = nullptr;
|
||||
char *mRemoteUserAgent = nullptr;
|
||||
SalAddress *mRemoteContactAddress = nullptr;
|
||||
char *mRemoteContact = nullptr;
|
||||
void *mUserPointer = nullptr;
|
||||
char *mCallId = nullptr;
|
||||
char *mRealm = nullptr;
|
||||
SalAddress *mServiceRoute = nullptr; // As defined by rfc3608, might be a list
|
||||
SalCustomHeader *mSentCustomHeaders = nullptr;
|
||||
SalCustomHeader *mRecvCustomHeaders = nullptr;
|
||||
char *mEntityTag = nullptr; // As defined by rfc3903 (I.E publih)
|
||||
ReleaseCb mReleaseCb = nullptr;
|
||||
|
||||
// BelleSip implementation
|
||||
const belle_sip_listener_callbacks_t *callbacks = NULL;
|
||||
SalErrorInfo error_info;
|
||||
SalErrorInfo reason_error_info;
|
||||
belle_sip_client_transaction_t *pending_auth_transaction = NULL;
|
||||
belle_sip_server_transaction_t* pending_server_trans = NULL;
|
||||
belle_sip_server_transaction_t* pending_update_server_trans = NULL;
|
||||
belle_sip_client_transaction_t* pending_client_trans = NULL;
|
||||
SalAuthInfo* auth_info = NULL;
|
||||
belle_sip_dialog_t* dialog = NULL;
|
||||
belle_sip_header_replaces_t *replaces = NULL;
|
||||
belle_sip_header_referred_by_t *referred_by = NULL;
|
||||
SalMediaDescription *result = NULL;
|
||||
belle_sdp_session_description_t *sdp_answer = NULL;
|
||||
State state = State::Early;
|
||||
Dir dir = Dir::Incoming;
|
||||
belle_sip_refresher_t* refresher = NULL;
|
||||
int _ref = 0;
|
||||
Type type = Type::Unknown;
|
||||
SalPrivacyMask privacy = SalPrivacyNone;
|
||||
belle_sip_header_event_t *event = NULL; /*used by SalOpSubscribe kinds*/
|
||||
SalOpSDPHandling sdp_handling = SalOpSDPNormal;
|
||||
int auth_requests = 0; /*number of auth requested for this op*/
|
||||
bool_t _cnx_ip_to_0000_if_sendonly_enabled = FALSE;
|
||||
bool_t auto_answer_asked = FALSE;
|
||||
bool_t sdp_offering = FALSE;
|
||||
bool_t call_released = FALSE;
|
||||
bool_t manual_refresher = FALSE;
|
||||
bool_t has_auth_pending = FALSE;
|
||||
bool_t supports_session_timers = FALSE;
|
||||
bool_t op_released = FALSE;
|
||||
const belle_sip_listener_callbacks_t *mCallbacks = nullptr;
|
||||
SalErrorInfo mErrorInfo;
|
||||
SalErrorInfo mReasonErrorInfo;
|
||||
belle_sip_client_transaction_t *mPendingAuthTransaction = nullptr;
|
||||
belle_sip_server_transaction_t *mPendingServerTransaction = nullptr;
|
||||
belle_sip_server_transaction_t *mPendingUpdateServerTransaction = nullptr;
|
||||
belle_sip_client_transaction_t *mPendingClientTransaction = nullptr;
|
||||
SalAuthInfo *mAuthInfo = nullptr;
|
||||
belle_sip_dialog_t *mDialog = nullptr;
|
||||
belle_sip_header_replaces_t *mReplaces = nullptr;
|
||||
belle_sip_header_referred_by_t *mReferredBy = nullptr;
|
||||
SalMediaDescription *mResult = nullptr;
|
||||
belle_sdp_session_description_t *mSdpAnswer = nullptr;
|
||||
State mState = State::Early;
|
||||
Dir mDir = Dir::Incoming;
|
||||
belle_sip_refresher_t *mRefresher = nullptr;
|
||||
int mRef = 0;
|
||||
Type mType = Type::Unknown;
|
||||
SalPrivacyMask mPrivacy = SalPrivacyNone;
|
||||
belle_sip_header_event_t *mEvent = nullptr; // Used by SalOpSubscribe kinds
|
||||
SalOpSDPHandling mSdpHandling = SalOpSDPNormal;
|
||||
int mAuthRequests = 0; // number of auth requested for this op
|
||||
bool_t mCnxIpTo0000IfSendOnlyEnabled = FALSE;
|
||||
bool_t mAutoAnswerAsked = FALSE;
|
||||
bool_t mSdpOffering = FALSE;
|
||||
bool_t mCallReleased = FALSE;
|
||||
bool_t mManualRefresher = FALSE;
|
||||
bool_t mHasAuthPending = FALSE;
|
||||
bool_t mSupportsSessionTimers = FALSE;
|
||||
bool_t mOpReleased = FALSE;
|
||||
|
||||
friend class Sal;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ using namespace std;
|
|||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
void SalPresenceOp::presence_process_io_error_cb(void *user_ctx, const belle_sip_io_error_event_t *event) {
|
||||
void SalPresenceOp::presenceProcessIoErrorCb(void *user_ctx, const belle_sip_io_error_event_t *event) {
|
||||
SalPresenceOp * op = (SalPresenceOp *)user_ctx;
|
||||
belle_sip_request_t* request;
|
||||
belle_sip_client_transaction_t* client_transaction = NULL;
|
||||
|
|
@ -38,32 +38,32 @@ void SalPresenceOp::presence_process_io_error_cb(void *user_ctx, const belle_sip
|
|||
request = belle_sip_transaction_get_request(BELLE_SIP_TRANSACTION(client_transaction));
|
||||
|
||||
if (strcmp("SUBSCRIBE",belle_sip_request_get_method(request))==0){
|
||||
if (op->refresher){
|
||||
if (op->mRefresher){
|
||||
ms_warning("presence_process_io_error() refresher is present, should not happen");
|
||||
return;
|
||||
}
|
||||
ms_message("subscription to [%s] io error",op->get_to());
|
||||
if (!op->op_released){
|
||||
op->root->callbacks.notify_presence(op,SalSubscribeTerminated, NULL,NULL); /*NULL = offline*/
|
||||
ms_message("subscription to [%s] io error",op->getTo());
|
||||
if (!op->mOpReleased){
|
||||
op->mRoot->mCallbacks.notify_presence(op,SalSubscribeTerminated, NULL,NULL); /*NULL = offline*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SalPresenceOp::presence_refresher_listener_cb(belle_sip_refresher_t* refresher, void* user_pointer, unsigned int status_code, const char* reason_phrase, int will_retry) {
|
||||
void SalPresenceOp::presenceRefresherListenerCb(belle_sip_refresher_t* refresher, void* user_pointer, unsigned int status_code, const char* reason_phrase, int will_retry) {
|
||||
SalPresenceOp * op = (SalPresenceOp *)user_pointer;
|
||||
if (status_code >= 300) {
|
||||
ms_message("The SUBSCRIBE dialog no longer works. Let's restart a new one.");
|
||||
belle_sip_refresher_stop(op->refresher);
|
||||
if (op->dialog) { /*delete previous dialog if any*/
|
||||
op->set_or_update_dialog(NULL);
|
||||
belle_sip_refresher_stop(op->mRefresher);
|
||||
if (op->mDialog) { /*delete previous dialog if any*/
|
||||
op->setOrUpdateDialog(NULL);
|
||||
}
|
||||
|
||||
if (op->get_contact_address()) {
|
||||
if (op->getContactAddress()) {
|
||||
/*contact is also probably not good*/
|
||||
SalAddress* contact=sal_address_clone(op->get_contact_address());
|
||||
SalAddress* contact=sal_address_clone(op->getContactAddress());
|
||||
sal_address_set_port(contact,-1);
|
||||
sal_address_set_domain(contact,NULL);
|
||||
op->set_contact_address(contact);
|
||||
op->setContactAddress(contact);
|
||||
sal_address_destroy(contact);
|
||||
}
|
||||
/*send a new SUBSCRIBE, that will attempt to establish a new dialog*/
|
||||
|
|
@ -71,13 +71,13 @@ void SalPresenceOp::presence_refresher_listener_cb(belle_sip_refresher_t* refres
|
|||
}
|
||||
if (status_code == 0 || status_code == 503){
|
||||
/*timeout or io error: the remote doesn't seem reachable.*/
|
||||
if (!op->op_released){
|
||||
op->root->callbacks.notify_presence(op,SalSubscribeActive, NULL,NULL); /*NULL = offline*/
|
||||
if (!op->mOpReleased){
|
||||
op->mRoot->mCallbacks.notify_presence(op,SalSubscribeActive, NULL,NULL); /*NULL = offline*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SalPresenceOp::presence_response_event_cb(void *op_base, const belle_sip_response_event_t *event) {
|
||||
void SalPresenceOp::presenceResponseEventCb(void *op_base, const belle_sip_response_event_t *event) {
|
||||
SalPresenceOp * op = (SalPresenceOp *)op_base;
|
||||
belle_sip_dialog_state_t dialog_state;
|
||||
belle_sip_client_transaction_t* client_transaction = belle_sip_response_event_get_client_transaction(event);
|
||||
|
|
@ -86,23 +86,23 @@ void SalPresenceOp::presence_response_event_cb(void *op_base, const belle_sip_re
|
|||
int code = belle_sip_response_get_status_code(response);
|
||||
belle_sip_header_expires_t* expires;
|
||||
|
||||
op->set_error_info_from_response(response);
|
||||
op->setErrorInfoFromResponse(response);
|
||||
|
||||
if (code>=300) {
|
||||
if (strcmp("SUBSCRIBE",belle_sip_request_get_method(request))==0){
|
||||
ms_message("subscription to [%s] rejected",op->get_to());
|
||||
if (!op->op_released){
|
||||
op->root->callbacks.notify_presence(op,SalSubscribeTerminated, NULL,NULL); /*NULL = offline*/
|
||||
ms_message("subscription to [%s] rejected",op->getTo());
|
||||
if (!op->mOpReleased){
|
||||
op->mRoot->mCallbacks.notify_presence(op,SalSubscribeTerminated, NULL,NULL); /*NULL = offline*/
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
op->set_or_update_dialog(belle_sip_response_event_get_dialog(event));
|
||||
if (!op->dialog) {
|
||||
op->setOrUpdateDialog(belle_sip_response_event_get_dialog(event));
|
||||
if (!op->mDialog) {
|
||||
ms_message("presence op [%p] receive out of dialog answer [%i]",op,code);
|
||||
return;
|
||||
}
|
||||
dialog_state=belle_sip_dialog_get_state(op->dialog);
|
||||
dialog_state=belle_sip_dialog_get_state(op->mDialog);
|
||||
|
||||
switch(dialog_state) {
|
||||
case BELLE_SIP_DIALOG_NULL:
|
||||
|
|
@ -113,15 +113,15 @@ void SalPresenceOp::presence_response_event_cb(void *op_base, const belle_sip_re
|
|||
case BELLE_SIP_DIALOG_CONFIRMED: {
|
||||
if (strcmp("SUBSCRIBE",belle_sip_request_get_method(request))==0) {
|
||||
expires=belle_sip_message_get_header_by_type(request,belle_sip_header_expires_t);
|
||||
if(op->refresher) {
|
||||
belle_sip_refresher_stop(op->refresher);
|
||||
belle_sip_object_unref(op->refresher);
|
||||
op->refresher=NULL;
|
||||
if(op->mRefresher) {
|
||||
belle_sip_refresher_stop(op->mRefresher);
|
||||
belle_sip_object_unref(op->mRefresher);
|
||||
op->mRefresher=NULL;
|
||||
}
|
||||
if ((expires != NULL) && (belle_sip_header_expires_get_expires(expires) > 0)) {
|
||||
op->refresher=belle_sip_client_transaction_create_refresher(client_transaction);
|
||||
belle_sip_refresher_set_listener(op->refresher,presence_refresher_listener_cb,op);
|
||||
belle_sip_refresher_set_realm(op->refresher,op->realm);
|
||||
op->mRefresher=belle_sip_client_transaction_create_refresher(client_transaction);
|
||||
belle_sip_refresher_set_listener(op->mRefresher,presenceRefresherListenerCb,op);
|
||||
belle_sip_refresher_set_realm(op->mRefresher,op->mRealm);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -133,7 +133,7 @@ void SalPresenceOp::presence_response_event_cb(void *op_base, const belle_sip_re
|
|||
}
|
||||
}
|
||||
|
||||
void SalPresenceOp::presence_process_timeout_cb(void *user_ctx, const belle_sip_timeout_event_t *event) {
|
||||
void SalPresenceOp::presenceProcessTimeoutCb(void *user_ctx, const belle_sip_timeout_event_t *event) {
|
||||
SalPresenceOp * op = (SalPresenceOp *)user_ctx;
|
||||
belle_sip_client_transaction_t* client_transaction = belle_sip_timeout_event_get_client_transaction(event);
|
||||
belle_sip_request_t* request;
|
||||
|
|
@ -143,18 +143,18 @@ void SalPresenceOp::presence_process_timeout_cb(void *user_ctx, const belle_sip_
|
|||
request = belle_sip_transaction_get_request(BELLE_SIP_TRANSACTION(client_transaction));
|
||||
|
||||
if (strcmp("SUBSCRIBE",belle_sip_request_get_method(request))==0){
|
||||
ms_message("subscription to [%s] timeout",op->get_to());
|
||||
if (!op->op_released){
|
||||
op->root->callbacks.notify_presence(op,SalSubscribeTerminated, NULL,NULL); /*NULL = offline*/
|
||||
ms_message("subscription to [%s] timeout",op->getTo());
|
||||
if (!op->mOpReleased){
|
||||
op->mRoot->mCallbacks.notify_presence(op,SalSubscribeTerminated, NULL,NULL); /*NULL = offline*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SalPresenceOp::presence_process_transaction_terminated_cb(void *user_ctx, const belle_sip_transaction_terminated_event_t *event) {
|
||||
void SalPresenceOp::presenceProcessTransactionTerminatedCb(void *user_ctx, const belle_sip_transaction_terminated_event_t *event) {
|
||||
ms_message("presence_process_transaction_terminated not implemented yet");
|
||||
}
|
||||
|
||||
SalPresenceModel *SalPresenceOp::process_presence_notification(belle_sip_request_t *req) {
|
||||
SalPresenceModel *SalPresenceOp::processPresenceNotification(belle_sip_request_t *req) {
|
||||
belle_sip_header_content_type_t *content_type = belle_sip_message_get_header_by_type(BELLE_SIP_MESSAGE(req), belle_sip_header_content_type_t);
|
||||
belle_sip_header_content_length_t *content_length = belle_sip_message_get_header_by_type(BELLE_SIP_MESSAGE(req), belle_sip_header_content_length_t);
|
||||
const char *body = belle_sip_message_get_body(BELLE_SIP_MESSAGE(req));
|
||||
|
|
@ -166,8 +166,8 @@ SalPresenceModel *SalPresenceOp::process_presence_notification(belle_sip_request
|
|||
return NULL;
|
||||
|
||||
if (body==NULL) return NULL;
|
||||
if (!this->op_released){
|
||||
this->root->callbacks.parse_presence_requested(this,
|
||||
if (!mOpReleased){
|
||||
mRoot->mCallbacks.parse_presence_requested(this,
|
||||
belle_sip_header_content_type_get_type(content_type),
|
||||
belle_sip_header_content_type_get_subtype(content_type),
|
||||
body,
|
||||
|
|
@ -177,9 +177,9 @@ SalPresenceModel *SalPresenceOp::process_presence_notification(belle_sip_request
|
|||
return result;
|
||||
}
|
||||
|
||||
void SalPresenceOp::handle_notify(belle_sip_request_t *req, belle_sip_dialog_t *dialog) {
|
||||
void SalPresenceOp::handleNotify(belle_sip_request_t *req, belle_sip_dialog_t *dialog) {
|
||||
belle_sip_response_t* resp=NULL;
|
||||
belle_sip_server_transaction_t* server_transaction= this->pending_server_trans;
|
||||
belle_sip_server_transaction_t* server_transaction= mPendingServerTransaction;
|
||||
belle_sip_header_subscription_state_t* subscription_state_header=belle_sip_message_get_header_by_type(req,belle_sip_header_subscription_state_t);
|
||||
SalSubscribeStatus sub_state;
|
||||
|
||||
|
|
@ -187,100 +187,100 @@ void SalPresenceOp::handle_notify(belle_sip_request_t *req, belle_sip_dialog_t *
|
|||
SalPresenceModel *presence_model = NULL;
|
||||
const char* body = belle_sip_message_get_body(BELLE_SIP_MESSAGE(req));
|
||||
|
||||
if (this->dialog !=NULL && dialog != this->dialog){
|
||||
ms_warning("Receiving a NOTIFY from a dialog we haven't stored (op->dialog=%p dialog=%p)", this->dialog, dialog);
|
||||
if (mDialog !=NULL && dialog != mDialog){
|
||||
ms_warning("Receiving a NOTIFY from a dialog we haven't stored (op->dialog=%p dialog=%p)", mDialog, dialog);
|
||||
}
|
||||
if (!subscription_state_header || strcasecmp(BELLE_SIP_SUBSCRIPTION_STATE_TERMINATED,belle_sip_header_subscription_state_get_state(subscription_state_header)) ==0) {
|
||||
sub_state=SalSubscribeTerminated;
|
||||
ms_message("Outgoing subscription terminated by remote [%s]",get_to());
|
||||
ms_message("Outgoing subscription terminated by remote [%s]",getTo());
|
||||
} else {
|
||||
sub_state=belle_sip_message_get_subscription_state(BELLE_SIP_MESSAGE(req));
|
||||
sub_state=getSubscriptionState(BELLE_SIP_MESSAGE(req));
|
||||
}
|
||||
presence_model = process_presence_notification(req);
|
||||
presence_model = processPresenceNotification(req);
|
||||
if (presence_model != NULL || body==NULL) {
|
||||
/* Presence notification body parsed successfully. */
|
||||
|
||||
resp = create_response_from_request(req, 200); /*create first because the op may be destroyed by notify_presence */
|
||||
if (!this->op_released){
|
||||
this->root->callbacks.notify_presence(this, sub_state, presence_model, NULL);
|
||||
resp = createResponseFromRequest(req, 200); /*create first because the op may be destroyed by notify_presence */
|
||||
if (!mOpReleased){
|
||||
mRoot->mCallbacks.notify_presence(this, sub_state, presence_model, NULL);
|
||||
}
|
||||
} else if (body){
|
||||
/* Formatting error in presence notification body. */
|
||||
ms_warning("Wrongly formatted presence document.");
|
||||
resp = create_response_from_request(req, 488);
|
||||
resp = createResponseFromRequest(req, 488);
|
||||
}
|
||||
if (resp) belle_sip_server_transaction_send_response(server_transaction,resp);
|
||||
}
|
||||
}
|
||||
|
||||
void SalPresenceOp::presence_process_request_event_cb(void *op_base, const belle_sip_request_event_t *event) {
|
||||
void SalPresenceOp::presenceProcessRequestEventCb(void *op_base, const belle_sip_request_event_t *event) {
|
||||
SalPresenceOp * op = (SalPresenceOp *)op_base;
|
||||
belle_sip_server_transaction_t* server_transaction = belle_sip_provider_create_server_transaction(op->root->prov,belle_sip_request_event_get_request(event));
|
||||
belle_sip_server_transaction_t* server_transaction = belle_sip_provider_create_server_transaction(op->mRoot->mProvider,belle_sip_request_event_get_request(event));
|
||||
belle_sip_request_t* req = belle_sip_request_event_get_request(event);
|
||||
belle_sip_dialog_state_t dialog_state;
|
||||
belle_sip_response_t* resp;
|
||||
const char *method=belle_sip_request_get_method(req);
|
||||
belle_sip_header_event_t *event_header;
|
||||
belle_sip_object_ref(server_transaction);
|
||||
if (op->pending_server_trans) belle_sip_object_unref(op->pending_server_trans);
|
||||
op->pending_server_trans=server_transaction;
|
||||
if (op->mPendingServerTransaction) belle_sip_object_unref(op->mPendingServerTransaction);
|
||||
op->mPendingServerTransaction=server_transaction;
|
||||
event_header=belle_sip_message_get_header_by_type(req,belle_sip_header_event_t);
|
||||
|
||||
if (event_header==NULL){
|
||||
ms_warning("No event header in incoming SUBSCRIBE.");
|
||||
resp=op->create_response_from_request(req,400);
|
||||
resp=op->createResponseFromRequest(req,400);
|
||||
belle_sip_server_transaction_send_response(server_transaction,resp);
|
||||
if (!op->dialog) op->release();
|
||||
if (!op->mDialog) op->release();
|
||||
return;
|
||||
}
|
||||
if (op->event==NULL) {
|
||||
op->event=event_header;
|
||||
belle_sip_object_ref(op->event);
|
||||
if (op->mEvent==NULL) {
|
||||
op->mEvent=event_header;
|
||||
belle_sip_object_ref(op->mEvent);
|
||||
}
|
||||
|
||||
|
||||
if (!op->dialog) {
|
||||
if (!op->mDialog) {
|
||||
if (strcmp(method,"SUBSCRIBE")==0){
|
||||
belle_sip_dialog_t *dialog = belle_sip_provider_create_dialog(op->root->prov,BELLE_SIP_TRANSACTION(server_transaction));
|
||||
belle_sip_dialog_t *dialog = belle_sip_provider_create_dialog(op->mRoot->mProvider,BELLE_SIP_TRANSACTION(server_transaction));
|
||||
if (!dialog){
|
||||
resp=op->create_response_from_request(req,481);
|
||||
resp=op->createResponseFromRequest(req,481);
|
||||
belle_sip_server_transaction_send_response(server_transaction,resp);
|
||||
op->release();
|
||||
return;
|
||||
}
|
||||
op->set_or_update_dialog(dialog);
|
||||
ms_message("new incoming subscription from [%s] to [%s]",op->get_from(),op->get_to());
|
||||
op->setOrUpdateDialog(dialog);
|
||||
ms_message("new incoming subscription from [%s] to [%s]",op->getFrom(),op->getTo());
|
||||
}else if (strcmp(method,"NOTIFY")==0 && belle_sip_request_event_get_dialog(event)) {
|
||||
/*special case of dialog created by notify matching subscribe*/
|
||||
op->set_or_update_dialog(belle_sip_request_event_get_dialog(event));
|
||||
op->setOrUpdateDialog(belle_sip_request_event_get_dialog(event));
|
||||
} else {/* this is a NOTIFY */
|
||||
ms_message("Receiving out of dialog notify");
|
||||
op->handle_notify(req, belle_sip_request_event_get_dialog(event));
|
||||
op->handleNotify(req, belle_sip_request_event_get_dialog(event));
|
||||
return;
|
||||
}
|
||||
}
|
||||
dialog_state=belle_sip_dialog_get_state(op->dialog);
|
||||
dialog_state=belle_sip_dialog_get_state(op->mDialog);
|
||||
switch(dialog_state) {
|
||||
case BELLE_SIP_DIALOG_NULL: {
|
||||
if (strcmp("NOTIFY",method)==0) {
|
||||
op->handle_notify(req, belle_sip_request_event_get_dialog(event));
|
||||
op->handleNotify(req, belle_sip_request_event_get_dialog(event));
|
||||
} else if (strcmp("SUBSCRIBE",method)==0) {
|
||||
op->root->callbacks.subscribe_presence_received(op,op->get_from());
|
||||
op->mRoot->mCallbacks.subscribe_presence_received(op,op->getFrom());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case BELLE_SIP_DIALOG_EARLY:
|
||||
ms_error("unexpected method [%s] for dialog [%p] in state BELLE_SIP_DIALOG_EARLY ",method,op->dialog);
|
||||
ms_error("unexpected method [%s] for dialog [%p] in state BELLE_SIP_DIALOG_EARLY ",method,op->mDialog);
|
||||
break;
|
||||
|
||||
case BELLE_SIP_DIALOG_CONFIRMED:
|
||||
if (strcmp("NOTIFY",method)==0) {
|
||||
op->handle_notify(req, belle_sip_request_event_get_dialog(event));
|
||||
op->handleNotify(req, belle_sip_request_event_get_dialog(event));
|
||||
} else if (strcmp("SUBSCRIBE",method)==0) {
|
||||
/*either a refresh or an unsubscribe.
|
||||
If it is a refresh there is nothing to notify to the app. If it is an unSUBSCRIBE, then the dialog
|
||||
will be terminated shortly, and this will be notified to the app through the dialog_terminated callback.*/
|
||||
resp=op->create_response_from_request(req,200);
|
||||
resp=op->createResponseFromRequest(req,200);
|
||||
belle_sip_server_transaction_send_response(server_transaction,resp);
|
||||
}
|
||||
break;
|
||||
|
|
@ -290,78 +290,78 @@ void SalPresenceOp::presence_process_request_event_cb(void *op_base, const belle
|
|||
}
|
||||
}
|
||||
|
||||
void SalPresenceOp::presence_process_dialog_terminated_cb(void *ctx, const belle_sip_dialog_terminated_event_t *event) {
|
||||
void SalPresenceOp::presenceProcessDialogTerminatedCb(void *ctx, const belle_sip_dialog_terminated_event_t *event) {
|
||||
SalPresenceOp * op= (SalPresenceOp *)ctx;
|
||||
if (op->dialog && belle_sip_dialog_is_server(op->dialog)) {
|
||||
ms_message("Incoming subscribtion from [%s] terminated",op->get_from());
|
||||
if (!op->op_released){
|
||||
op->root->callbacks.subscribe_presence_closed(op, op->get_from());
|
||||
if (op->mDialog && belle_sip_dialog_is_server(op->mDialog)) {
|
||||
ms_message("Incoming subscribtion from [%s] terminated",op->getFrom());
|
||||
if (!op->mOpReleased){
|
||||
op->mRoot->mCallbacks.subscribe_presence_closed(op, op->getFrom());
|
||||
}
|
||||
op->set_or_update_dialog(NULL);
|
||||
op->setOrUpdateDialog(NULL);
|
||||
}/* else client dialog is managed by refresher*/
|
||||
}
|
||||
|
||||
void SalPresenceOp::_release_cb(SalOp *op_base) {
|
||||
void SalPresenceOp::releaseCb(SalOp *op_base) {
|
||||
SalPresenceOp *op =(SalPresenceOp *)op_base;
|
||||
if(op->refresher) {
|
||||
belle_sip_refresher_stop(op->refresher);
|
||||
belle_sip_object_unref(op->refresher);
|
||||
op->refresher=NULL;
|
||||
op->set_or_update_dialog(NULL); /*only if we have refresher. else dialog terminated event will remove association*/
|
||||
if(op->mRefresher) {
|
||||
belle_sip_refresher_stop(op->mRefresher);
|
||||
belle_sip_object_unref(op->mRefresher);
|
||||
op->mRefresher=NULL;
|
||||
op->setOrUpdateDialog(NULL); /*only if we have refresher. else dialog terminated event will remove association*/
|
||||
}
|
||||
}
|
||||
|
||||
void SalPresenceOp::fill_cbs() {
|
||||
void SalPresenceOp::fillCallbacks() {
|
||||
static belle_sip_listener_callbacks_t op_presence_callbacks={0};
|
||||
if (op_presence_callbacks.process_request_event==NULL){
|
||||
op_presence_callbacks.process_io_error=presence_process_io_error_cb;
|
||||
op_presence_callbacks.process_response_event=presence_response_event_cb;
|
||||
op_presence_callbacks.process_timeout= presence_process_timeout_cb;
|
||||
op_presence_callbacks.process_transaction_terminated=presence_process_transaction_terminated_cb;
|
||||
op_presence_callbacks.process_request_event=presence_process_request_event_cb;
|
||||
op_presence_callbacks.process_dialog_terminated=presence_process_dialog_terminated_cb;
|
||||
op_presence_callbacks.process_io_error=presenceProcessIoErrorCb;
|
||||
op_presence_callbacks.process_response_event=presenceResponseEventCb;
|
||||
op_presence_callbacks.process_timeout= presenceProcessTimeoutCb;
|
||||
op_presence_callbacks.process_transaction_terminated=presenceProcessTransactionTerminatedCb;
|
||||
op_presence_callbacks.process_request_event=presenceProcessRequestEventCb;
|
||||
op_presence_callbacks.process_dialog_terminated=presenceProcessDialogTerminatedCb;
|
||||
}
|
||||
this->callbacks=&op_presence_callbacks;
|
||||
this->type=Type::Presence;
|
||||
this->release_cb=_release_cb;
|
||||
mCallbacks=&op_presence_callbacks;
|
||||
mType=Type::Presence;
|
||||
mReleaseCb=releaseCb;
|
||||
}
|
||||
|
||||
int SalPresenceOp::subscribe(const char *from, const char *to, int expires) {
|
||||
belle_sip_request_t *req=NULL;
|
||||
if (from)
|
||||
set_from(from);
|
||||
setFrom(from);
|
||||
if (to)
|
||||
set_to(to);
|
||||
setTo(to);
|
||||
|
||||
fill_cbs();
|
||||
fillCallbacks();
|
||||
|
||||
if (expires==-1){
|
||||
if (this->refresher){
|
||||
expires=belle_sip_refresher_get_expires(this->refresher);
|
||||
belle_sip_object_unref(this->refresher);
|
||||
this->refresher=NULL;
|
||||
if (mRefresher){
|
||||
expires=belle_sip_refresher_get_expires(mRefresher);
|
||||
belle_sip_object_unref(mRefresher);
|
||||
mRefresher=NULL;
|
||||
}else{
|
||||
ms_error("sal_subscribe_presence(): cannot guess expires from previous refresher.");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if (!this->event){
|
||||
this->event=belle_sip_header_event_create("presence");
|
||||
belle_sip_object_ref(this->event);
|
||||
if (!mEvent){
|
||||
mEvent=belle_sip_header_event_create("presence");
|
||||
belle_sip_object_ref(mEvent);
|
||||
}
|
||||
belle_sip_parameters_remove_parameter(BELLE_SIP_PARAMETERS(this->from_address),"tag");
|
||||
belle_sip_parameters_remove_parameter(BELLE_SIP_PARAMETERS(this->to_address),"tag");
|
||||
req=build_request("SUBSCRIBE");
|
||||
belle_sip_parameters_remove_parameter(BELLE_SIP_PARAMETERS(mFromAddress),"tag");
|
||||
belle_sip_parameters_remove_parameter(BELLE_SIP_PARAMETERS(mToAddress),"tag");
|
||||
req=buildRequest("SUBSCRIBE");
|
||||
if( req ){
|
||||
belle_sip_message_add_header(BELLE_SIP_MESSAGE(req),BELLE_SIP_HEADER(this->event));
|
||||
belle_sip_message_add_header(BELLE_SIP_MESSAGE(req),BELLE_SIP_HEADER(mEvent));
|
||||
belle_sip_message_add_header(BELLE_SIP_MESSAGE(req),BELLE_SIP_HEADER(belle_sip_header_expires_create(expires)));
|
||||
}
|
||||
|
||||
return send_request(req);
|
||||
return sendRequest(req);
|
||||
}
|
||||
|
||||
int SalPresenceOp::check_dialog_state() {
|
||||
belle_sip_dialog_state_t state= this->dialog?belle_sip_dialog_get_state(this->dialog): BELLE_SIP_DIALOG_NULL;
|
||||
int SalPresenceOp::checkDialogState() {
|
||||
belle_sip_dialog_state_t state= mDialog?belle_sip_dialog_get_state(mDialog): BELLE_SIP_DIALOG_NULL;
|
||||
if (state != BELLE_SIP_DIALOG_CONFIRMED) {
|
||||
ms_warning("Cannot notify presence for op [%p] because dialog in state [%s]", this, belle_sip_dialog_state_to_string(state));
|
||||
return -1;
|
||||
|
|
@ -369,15 +369,15 @@ int SalPresenceOp::check_dialog_state() {
|
|||
return 0;
|
||||
}
|
||||
|
||||
belle_sip_request_t *SalPresenceOp::create_presence_notify() {
|
||||
belle_sip_request_t* notify=belle_sip_dialog_create_queued_request(this->dialog,"NOTIFY");
|
||||
belle_sip_request_t *SalPresenceOp::createPresenceNotify() {
|
||||
belle_sip_request_t* notify=belle_sip_dialog_create_queued_request(mDialog,"NOTIFY");
|
||||
if (!notify) return NULL;
|
||||
|
||||
belle_sip_message_add_header((belle_sip_message_t*)notify,belle_sip_header_create("Event","presence"));
|
||||
return notify;
|
||||
}
|
||||
|
||||
void SalPresenceOp::add_presence_info(belle_sip_message_t *notify, SalPresenceModel *presence) {
|
||||
void SalPresenceOp::addPresenceInfo(belle_sip_message_t *notify, SalPresenceModel *presence) {
|
||||
char *contact_info;
|
||||
char *content = NULL;
|
||||
size_t content_length;
|
||||
|
|
@ -385,7 +385,7 @@ void SalPresenceOp::add_presence_info(belle_sip_message_t *notify, SalPresenceMo
|
|||
if (presence){
|
||||
belle_sip_header_from_t *from=belle_sip_message_get_header_by_type(notify,belle_sip_header_from_t);
|
||||
contact_info=belle_sip_uri_to_string(belle_sip_header_address_get_uri(BELLE_SIP_HEADER_ADDRESS(from)));
|
||||
this->root->callbacks.convert_presence_to_xml_requested(this, presence, contact_info, &content);
|
||||
mRoot->mCallbacks.convert_presence_to_xml_requested(this, presence, contact_info, &content);
|
||||
belle_sip_free(contact_info);
|
||||
if (content == NULL) return;
|
||||
}
|
||||
|
|
@ -404,38 +404,38 @@ void SalPresenceOp::add_presence_info(belle_sip_message_t *notify, SalPresenceMo
|
|||
}
|
||||
}
|
||||
|
||||
int SalPresenceOp::notify_presence(SalPresenceModel *presence) {
|
||||
int SalPresenceOp::notifyPresence(SalPresenceModel *presence) {
|
||||
belle_sip_request_t* notify=NULL;
|
||||
if (check_dialog_state()) {
|
||||
if (checkDialogState()) {
|
||||
return -1;
|
||||
}
|
||||
notify=create_presence_notify();
|
||||
notify=createPresenceNotify();
|
||||
if (!notify) return-1;
|
||||
|
||||
add_presence_info(BELLE_SIP_MESSAGE(notify),presence); /*FIXME, what about expires ??*/
|
||||
addPresenceInfo(BELLE_SIP_MESSAGE(notify),presence); /*FIXME, what about expires ??*/
|
||||
belle_sip_message_add_header(BELLE_SIP_MESSAGE(notify)
|
||||
,BELLE_SIP_HEADER(belle_sip_header_subscription_state_create(BELLE_SIP_SUBSCRIPTION_STATE_ACTIVE,600)));
|
||||
return send_request(notify);
|
||||
return sendRequest(notify);
|
||||
}
|
||||
|
||||
int SalPresenceOp::notify_presence_close() {
|
||||
int SalPresenceOp::notifyPresenceClose() {
|
||||
belle_sip_request_t* notify=NULL;
|
||||
int status;
|
||||
if (check_dialog_state()) {
|
||||
if (checkDialogState()) {
|
||||
return -1;
|
||||
}
|
||||
notify=create_presence_notify();
|
||||
notify=createPresenceNotify();
|
||||
if (!notify) return-1;
|
||||
|
||||
add_presence_info(BELLE_SIP_MESSAGE(notify),NULL); /*FIXME, what about expires ??*/
|
||||
addPresenceInfo(BELLE_SIP_MESSAGE(notify),NULL); /*FIXME, what about expires ??*/
|
||||
belle_sip_message_add_header(BELLE_SIP_MESSAGE(notify)
|
||||
,BELLE_SIP_HEADER(belle_sip_header_subscription_state_create(BELLE_SIP_SUBSCRIPTION_STATE_TERMINATED,-1)));
|
||||
status = send_request(notify);
|
||||
set_or_update_dialog(NULL); /*because we may be chalanged for the notify, so we must release dialog right now*/
|
||||
status = sendRequest(notify);
|
||||
setOrUpdateDialog(NULL); /*because we may be chalanged for the notify, so we must release dialog right now*/
|
||||
return status;
|
||||
}
|
||||
|
||||
SalSubscribeStatus SalPresenceOp::belle_sip_message_get_subscription_state(const belle_sip_message_t *msg) {
|
||||
SalSubscribeStatus SalPresenceOp::getSubscriptionState(const belle_sip_message_t *msg) {
|
||||
belle_sip_header_subscription_state_t* subscription_state_header=belle_sip_message_get_header_by_type(msg,belle_sip_header_subscription_state_t);
|
||||
SalSubscribeStatus sss=SalSubscribeNone;
|
||||
if (subscription_state_header){
|
||||
|
|
|
|||
|
|
@ -24,33 +24,33 @@
|
|||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
class SalPresenceOp: public SalSubscribeOp {
|
||||
class SalPresenceOp : public SalSubscribeOp {
|
||||
public:
|
||||
SalPresenceOp(Sal *sal): SalSubscribeOp(sal) {}
|
||||
SalPresenceOp (Sal *sal) : SalSubscribeOp(sal) {}
|
||||
|
||||
int subscribe(const char *from, const char *to, int expires);
|
||||
int unsubscribe() {return SalOp::unsubscribe();}
|
||||
int notify_presence(SalPresenceModel *presence);
|
||||
int notify_presence_close();
|
||||
int subscribe (const char *from, const char *to, int expires);
|
||||
int unsubscribe () { return SalOp::unsubscribe(); }
|
||||
int notifyPresence (SalPresenceModel *presence);
|
||||
int notifyPresenceClose ();
|
||||
|
||||
private:
|
||||
virtual void fill_cbs() override;
|
||||
void handle_notify(belle_sip_request_t *req, belle_sip_dialog_t *dialog);
|
||||
SalPresenceModel * process_presence_notification(belle_sip_request_t *req);
|
||||
int check_dialog_state();
|
||||
belle_sip_request_t *create_presence_notify();
|
||||
void add_presence_info(belle_sip_message_t *notify, SalPresenceModel *presence);
|
||||
virtual void fillCallbacks () override;
|
||||
void handleNotify (belle_sip_request_t *request, belle_sip_dialog_t *dialog);
|
||||
SalPresenceModel *processPresenceNotification (belle_sip_request_t *request);
|
||||
int checkDialogState ();
|
||||
belle_sip_request_t *createPresenceNotify ();
|
||||
void addPresenceInfo (belle_sip_message_t *notify, SalPresenceModel *presence);
|
||||
|
||||
static SalSubscribeStatus belle_sip_message_get_subscription_state(const belle_sip_message_t *msg);
|
||||
static SalSubscribeStatus getSubscriptionState (const belle_sip_message_t *message);
|
||||
|
||||
static void presence_process_io_error_cb(void *user_ctx, const belle_sip_io_error_event_t *event);
|
||||
static void presence_response_event_cb(void *op_base, const belle_sip_response_event_t *event);
|
||||
static void presence_refresher_listener_cb(belle_sip_refresher_t* refresher, void* user_pointer, unsigned int status_code, const char* reason_phrase, int will_retry);
|
||||
static void presence_process_timeout_cb(void *user_ctx, const belle_sip_timeout_event_t *event);
|
||||
static void presence_process_transaction_terminated_cb(void *user_ctx, const belle_sip_transaction_terminated_event_t *event);
|
||||
static void presence_process_request_event_cb(void *op_base, const belle_sip_request_event_t *event);
|
||||
static void presence_process_dialog_terminated_cb(void *ctx, const belle_sip_dialog_terminated_event_t *event);
|
||||
static void _release_cb(SalOp *op_base);
|
||||
static void presenceProcessIoErrorCb (void *userCtx, const belle_sip_io_error_event_t *event);
|
||||
static void presenceResponseEventCb (void *userCtx, const belle_sip_response_event_t *event);
|
||||
static void presenceRefresherListenerCb (belle_sip_refresher_t *refresher, void *userCtx, unsigned int statusCode, const char *reasonPhrase, int willRetry);
|
||||
static void presenceProcessTimeoutCb (void *userCtx, const belle_sip_timeout_event_t *event);
|
||||
static void presenceProcessTransactionTerminatedCb (void *userCtx, const belle_sip_transaction_terminated_event_t *event);
|
||||
static void presenceProcessRequestEventCb (void *userCtx, const belle_sip_request_event_t *event);
|
||||
static void presenceProcessDialogTerminatedCb (void *userCtx, const belle_sip_dialog_terminated_event_t *event);
|
||||
static void releaseCb (SalOp *op);
|
||||
};
|
||||
|
||||
LINPHONE_END_NAMESPACE
|
||||
|
|
|
|||
|
|
@ -23,38 +23,38 @@ using namespace std;
|
|||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
void SalReferOp::process_error() {
|
||||
this->state=State::Terminated;
|
||||
void SalReferOp::processError() {
|
||||
mState=State::Terminated;
|
||||
}
|
||||
|
||||
void SalReferOp::process_io_error_cb(void *user_ctx, const belle_sip_io_error_event_t *event) {
|
||||
void SalReferOp::processIoErrorCb(void *user_ctx, const belle_sip_io_error_event_t *event) {
|
||||
SalReferOp * op = (SalReferOp *)user_ctx;
|
||||
sal_error_info_set(&op->error_info,SalReasonIOError, "SIP", 503,"IO Error",NULL);
|
||||
op->process_error();
|
||||
sal_error_info_set(&op->mErrorInfo,SalReasonIOError, "SIP", 503,"IO Error",NULL);
|
||||
op->processError();
|
||||
}
|
||||
|
||||
void SalReferOp::process_response_event_cb(void *op_base, const belle_sip_response_event_t *event) {
|
||||
void SalReferOp::processResponseEventCb(void *op_base, const belle_sip_response_event_t *event) {
|
||||
SalReferOp * op = (SalReferOp *)op_base;
|
||||
op->set_error_info_from_response(belle_sip_response_event_get_response(event));
|
||||
op->setErrorInfoFromResponse(belle_sip_response_event_get_response(event));
|
||||
/*the response is not notified to the app*/
|
||||
/*To be done when necessary*/
|
||||
}
|
||||
|
||||
void SalReferOp::process_timeout_cb(void *user_ctx, const belle_sip_timeout_event_t *event) {
|
||||
void SalReferOp::processTimeoutCb(void *user_ctx, const belle_sip_timeout_event_t *event) {
|
||||
SalReferOp * op=(SalReferOp *)user_ctx;
|
||||
sal_error_info_set(&op->error_info,SalReasonRequestTimeout, "SIP", 408,"Request timeout",NULL);
|
||||
op->process_error();
|
||||
sal_error_info_set(&op->mErrorInfo,SalReasonRequestTimeout, "SIP", 408,"Request timeout",NULL);
|
||||
op->processError();
|
||||
}
|
||||
|
||||
void SalReferOp::process_request_event_cb(void *op_base, const belle_sip_request_event_t *event) {
|
||||
void SalReferOp::processRequestEventCb(void *op_base, const belle_sip_request_event_t *event) {
|
||||
SalReferOp * op = (SalReferOp *)op_base;
|
||||
belle_sip_request_t *req = belle_sip_request_event_get_request(event);
|
||||
belle_sip_header_refer_to_t *refer_to= belle_sip_message_get_header_by_type(BELLE_SIP_MESSAGE(req),belle_sip_header_refer_to_t);
|
||||
belle_sip_server_transaction_t *server_transaction = belle_sip_provider_create_server_transaction(op->root->prov,belle_sip_request_event_get_request(event));
|
||||
belle_sip_server_transaction_t *server_transaction = belle_sip_provider_create_server_transaction(op->mRoot->mProvider,belle_sip_request_event_get_request(event));
|
||||
|
||||
belle_sip_object_ref(server_transaction);
|
||||
belle_sip_transaction_set_application_data(BELLE_SIP_TRANSACTION(server_transaction),op->ref());
|
||||
op->pending_server_trans = server_transaction;
|
||||
op->mPendingServerTransaction = server_transaction;
|
||||
|
||||
if (!refer_to){
|
||||
ms_warning("cannot do anything with the refer without destination");
|
||||
|
|
@ -63,49 +63,49 @@ void SalReferOp::process_request_event_cb(void *op_base, const belle_sip_request
|
|||
return;
|
||||
}
|
||||
SalAddress *referToAddr = sal_address_new(belle_sip_header_get_unparsed_value(BELLE_SIP_HEADER(refer_to)));
|
||||
op->root->callbacks.refer_received(op, referToAddr);
|
||||
op->mRoot->mCallbacks.refer_received(op, referToAddr);
|
||||
/*the app is expected to reply in the callback*/
|
||||
sal_address_unref(referToAddr);
|
||||
op->unref();
|
||||
}
|
||||
|
||||
void SalReferOp::fill_cbs() {
|
||||
void SalReferOp::fillCallbacks() {
|
||||
static belle_sip_listener_callbacks_t op_refer_callbacks = {0};
|
||||
if (op_refer_callbacks.process_io_error==NULL) {
|
||||
op_refer_callbacks.process_io_error=process_io_error_cb;
|
||||
op_refer_callbacks.process_response_event=process_response_event_cb;
|
||||
op_refer_callbacks.process_timeout=process_timeout_cb;
|
||||
op_refer_callbacks.process_request_event=process_request_event_cb;
|
||||
op_refer_callbacks.process_io_error=processIoErrorCb;
|
||||
op_refer_callbacks.process_response_event=processResponseEventCb;
|
||||
op_refer_callbacks.process_timeout=processTimeoutCb;
|
||||
op_refer_callbacks.process_request_event=processRequestEventCb;
|
||||
}
|
||||
this->callbacks=&op_refer_callbacks;
|
||||
this->type=Type::Refer;
|
||||
mCallbacks=&op_refer_callbacks;
|
||||
mType=Type::Refer;
|
||||
}
|
||||
|
||||
SalReferOp::SalReferOp(Sal *sal) : SalOp(sal){
|
||||
fill_cbs();
|
||||
fillCallbacks();
|
||||
}
|
||||
|
||||
int SalReferOp::send_refer(const SalAddress *refer_to) {
|
||||
this->dir=Dir::Outgoing;
|
||||
int SalReferOp::sendRefer(const SalAddress *refer_to) {
|
||||
mDir=Dir::Outgoing;
|
||||
|
||||
belle_sip_request_t* req=build_request("REFER");
|
||||
belle_sip_request_t* req=buildRequest("REFER");
|
||||
if (req == NULL ) return -1;
|
||||
if (get_contact_address()) belle_sip_message_add_header(BELLE_SIP_MESSAGE(req),BELLE_SIP_HEADER(create_contact()));
|
||||
if (getContactAddress()) belle_sip_message_add_header(BELLE_SIP_MESSAGE(req),BELLE_SIP_HEADER(createContact()));
|
||||
belle_sip_header_address_t *address = BELLE_SIP_HEADER_ADDRESS(refer_to);
|
||||
belle_sip_uri_t *uri = belle_sip_header_address_get_uri(address);
|
||||
if (!belle_sip_uri_get_host(uri))
|
||||
belle_sip_header_address_set_automatic(address, true);
|
||||
belle_sip_header_refer_to_t *refer_to_header = belle_sip_header_refer_to_create(address);
|
||||
belle_sip_message_add_header(BELLE_SIP_MESSAGE(req), BELLE_SIP_HEADER(refer_to_header));
|
||||
return send_request(req);
|
||||
return sendRequest(req);
|
||||
}
|
||||
|
||||
int SalReferOp::reply(SalReason reason){
|
||||
if (this->pending_server_trans){
|
||||
if (mPendingServerTransaction){
|
||||
int code=to_sip_code(reason);
|
||||
belle_sip_response_t *resp = belle_sip_response_create_from_request(
|
||||
belle_sip_transaction_get_request((belle_sip_transaction_t*)this->pending_server_trans),code);
|
||||
belle_sip_server_transaction_send_response(this->pending_server_trans,resp);
|
||||
belle_sip_transaction_get_request((belle_sip_transaction_t*)mPendingServerTransaction),code);
|
||||
belle_sip_server_transaction_send_response(mPendingServerTransaction,resp);
|
||||
return 0;
|
||||
}else ms_error("SalReferOp::reply: no server transaction");
|
||||
return -1;
|
||||
|
|
|
|||
|
|
@ -24,23 +24,23 @@
|
|||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
class SalReferOp: public SalOp{
|
||||
class SalReferOp : public SalOp {
|
||||
public:
|
||||
SalReferOp(Sal *sal);
|
||||
SalReferOp (Sal *sal);
|
||||
|
||||
int send_refer(const SalAddress *refer_to);
|
||||
int reply(SalReason reason);
|
||||
int sendRefer (const SalAddress *referTo);
|
||||
int reply (SalReason reason);
|
||||
|
||||
private:
|
||||
virtual void fill_cbs() override;
|
||||
void process_error();
|
||||
virtual void fillCallbacks () override;
|
||||
void processError ();
|
||||
|
||||
static void process_io_error_cb(void *user_ctx, const belle_sip_io_error_event_t *event);
|
||||
static void process_response_event_cb(void *op_base, const belle_sip_response_event_t *event);
|
||||
static void process_timeout_cb(void *user_ctx, const belle_sip_timeout_event_t *event);
|
||||
static void process_request_event_cb(void *op_base, const belle_sip_request_event_t *event);
|
||||
static void processIoErrorCb (void *userCtx, const belle_sip_io_error_event_t *event);
|
||||
static void processResponseEventCb (void *userCtx, const belle_sip_response_event_t *event);
|
||||
static void processTimeoutCb (void *userCtx, const belle_sip_timeout_event_t *event);
|
||||
static void processRequestEventCb (void *userCtx, const belle_sip_request_event_t *event);
|
||||
};
|
||||
|
||||
LINPHONE_END_NAMESPACE
|
||||
|
||||
#endif // ifndef _L_SAL_MESSAGE_OP_H_
|
||||
#endif // ifndef _L_SAL_REFER_OP_H_
|
||||
|
|
|
|||
|
|
@ -24,31 +24,31 @@ using namespace std;
|
|||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
int SalRegisterOp::register_(const char *proxy, const char *from, int expires, const SalAddress* old_contact) {
|
||||
int SalRegisterOp::sendRegister(const char *proxy, const char *from, int expires, const SalAddress* old_contact) {
|
||||
belle_sip_request_t *req;
|
||||
belle_sip_uri_t* req_uri;
|
||||
belle_sip_header_t* accept_header;
|
||||
|
||||
if (this->refresher){
|
||||
belle_sip_refresher_stop(this->refresher);
|
||||
belle_sip_object_unref(this->refresher);
|
||||
this->refresher=NULL;
|
||||
if (mRefresher){
|
||||
belle_sip_refresher_stop(mRefresher);
|
||||
belle_sip_object_unref(mRefresher);
|
||||
mRefresher=NULL;
|
||||
}
|
||||
|
||||
this->type=Type::Register;
|
||||
set_from(from);
|
||||
set_to(from);
|
||||
set_route(proxy);
|
||||
req = build_request("REGISTER");
|
||||
mType=Type::Register;
|
||||
setFrom(from);
|
||||
setTo(from);
|
||||
setRoute(proxy);
|
||||
req = buildRequest("REGISTER");
|
||||
req_uri = belle_sip_request_get_uri(req);
|
||||
belle_sip_uri_set_user(req_uri,NULL); /*remove userinfo if any*/
|
||||
if (this->root->_use_dates) {
|
||||
if (mRoot->mUseDates) {
|
||||
time_t curtime=time(NULL);
|
||||
belle_sip_message_add_header(BELLE_SIP_MESSAGE(req),BELLE_SIP_HEADER(belle_sip_header_date_create_from_time(&curtime)));
|
||||
}
|
||||
accept_header = belle_sip_header_create("Accept", "application/sdp, text/plain, application/vnd.gsma.rcs-ft-http+xml");
|
||||
belle_sip_message_add_header(BELLE_SIP_MESSAGE(req), accept_header);
|
||||
belle_sip_message_set_header(BELLE_SIP_MESSAGE(req),(belle_sip_header_t*)create_contact());
|
||||
belle_sip_message_set_header(BELLE_SIP_MESSAGE(req),(belle_sip_header_t*)createContact());
|
||||
if (old_contact) {
|
||||
belle_sip_header_contact_t *contact=belle_sip_header_contact_create((const belle_sip_header_address_t *)old_contact);
|
||||
if (contact) {
|
||||
|
|
@ -62,22 +62,22 @@ int SalRegisterOp::register_(const char *proxy, const char *from, int expires, c
|
|||
ms_error("Cannot add old contact header to op [%p]",this);
|
||||
}
|
||||
}
|
||||
return send_and_create_refresher(req,expires,register_refresher_listener);
|
||||
return sendRequestAndCreateRefresher(req,expires,registerRefresherListener);
|
||||
}
|
||||
|
||||
void SalRegisterOp::register_refresher_listener(belle_sip_refresher_t* refresher, void* user_pointer, unsigned int status_code, const char* reason_phrase, int will_retry) {
|
||||
void SalRegisterOp::registerRefresherListener(belle_sip_refresher_t* refresher, void* user_pointer, unsigned int status_code, const char* reason_phrase, int will_retry) {
|
||||
SalRegisterOp * op = (SalRegisterOp *)user_pointer;
|
||||
belle_sip_response_t* response=belle_sip_transaction_get_response(BELLE_SIP_TRANSACTION(belle_sip_refresher_get_transaction(refresher)));
|
||||
ms_message("Register refresher [%i] reason [%s] for proxy [%s]",status_code,reason_phrase,op->get_proxy());
|
||||
ms_message("Register refresher [%i] reason [%s] for proxy [%s]",status_code,reason_phrase,op->getProxy());
|
||||
|
||||
if (belle_sip_refresher_get_auth_events(refresher)) {
|
||||
if (op->auth_info) sal_auth_info_delete(op->auth_info);
|
||||
if (op->mAuthInfo) sal_auth_info_delete(op->mAuthInfo);
|
||||
/*only take first one for now*/
|
||||
op->auth_info=sal_auth_info_create((belle_sip_auth_event_t*)(belle_sip_refresher_get_auth_events(refresher)->data));
|
||||
op->mAuthInfo=sal_auth_info_create((belle_sip_auth_event_t*)(belle_sip_refresher_get_auth_events(refresher)->data));
|
||||
}
|
||||
sal_error_info_set(&op->error_info,SalReasonUnknown, "SIP", (int)status_code, reason_phrase, NULL);
|
||||
sal_error_info_set(&op->mErrorInfo,SalReasonUnknown, "SIP", (int)status_code, reason_phrase, NULL);
|
||||
if (status_code>=200){
|
||||
op->assign_recv_headers((belle_sip_message_t*)response);
|
||||
op->assignRecvHeaders((belle_sip_message_t*)response);
|
||||
}
|
||||
if(status_code == 200) {
|
||||
/*check service route rfc3608*/
|
||||
|
|
@ -87,24 +87,24 @@ void SalRegisterOp::register_refresher_listener(belle_sip_refresher_t* refresher
|
|||
if ((service_route=belle_sip_message_get_header_by_type(response,belle_sip_header_service_route_t))) {
|
||||
service_route_address=belle_sip_header_address_create(NULL,belle_sip_header_address_get_uri(BELLE_SIP_HEADER_ADDRESS(service_route)));
|
||||
}
|
||||
op->set_service_route((const SalAddress*)service_route_address);
|
||||
op->setServiceRoute((const SalAddress*)service_route_address);
|
||||
if (service_route_address) belle_sip_object_unref(service_route_address);
|
||||
|
||||
op->root->remove_pending_auth(op); /*just in case*/
|
||||
op->mRoot->removePendingAuth(op); /*just in case*/
|
||||
|
||||
if (contact) {
|
||||
const char *gruu;
|
||||
belle_sip_parameters_t* p = (BELLE_SIP_PARAMETERS(contact));
|
||||
if((gruu = belle_sip_parameters_get_parameter(p, "pub-gruu"))) {
|
||||
char *unquoted = belle_sip_unquote_strdup(gruu);
|
||||
op->set_contact_address((SalAddress*)belle_sip_header_address_parse(unquoted));
|
||||
op->setContactAddress((SalAddress*)belle_sip_header_address_parse(unquoted));
|
||||
bctbx_free(unquoted);
|
||||
belle_sip_parameters_remove_parameter(p, "pub-gruu");
|
||||
} else {
|
||||
op->set_contact_address((SalAddress*)(BELLE_SIP_HEADER_ADDRESS(contact))); /*update contact with real value*/
|
||||
op->setContactAddress((SalAddress*)(BELLE_SIP_HEADER_ADDRESS(contact))); /*update contact with real value*/
|
||||
}
|
||||
}
|
||||
op->root->callbacks.register_success(op,belle_sip_refresher_get_expires(op->refresher)>0);
|
||||
op->mRoot->mCallbacks.register_success(op,belle_sip_refresher_get_expires(op->mRefresher)>0);
|
||||
} else if (status_code>=400) {
|
||||
/* from rfc3608, 6.1.
|
||||
If the UA refreshes the registration, the stored value of the Service-
|
||||
|
|
@ -115,14 +115,14 @@ void SalRegisterOp::register_refresher_listener(belle_sip_refresher_t* refresher
|
|||
request is refused or if an existing registration expires and the UA
|
||||
chooses not to re-register, the UA SHOULD discard any stored service
|
||||
route for that address-of-record. */
|
||||
op->set_service_route(NULL);
|
||||
op->setServiceRoute(NULL);
|
||||
op->ref(); /*take a ref while invoking the callback to make sure the operations done after are valid*/
|
||||
op->root->callbacks.register_failure(op);
|
||||
if (op->state!=State::Terminated && op->auth_info) {
|
||||
op->mRoot->mCallbacks.register_failure(op);
|
||||
if (op->mState!=State::Terminated && op->mAuthInfo) {
|
||||
/*add pending auth*/
|
||||
op->root->add_pending_auth(op);
|
||||
op->mRoot->addPendingAuth(op);
|
||||
if (status_code==403 || status_code==401 || status_code==407 )
|
||||
op->root->callbacks.auth_failure(op,op->auth_info);
|
||||
op->mRoot->mCallbacks.auth_failure(op,op->mAuthInfo);
|
||||
}
|
||||
op->unref();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,19 +24,22 @@
|
|||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
class SalRegisterOp: public SalOp {
|
||||
class SalRegisterOp : public SalOp {
|
||||
public:
|
||||
SalRegisterOp(Sal *sal): SalOp(sal) {}
|
||||
SalRegisterOp(Sal *sal) : SalOp(sal) {}
|
||||
|
||||
int register_(const char *proxy, const char *from, int expires, const SalAddress* old_contact);
|
||||
int register_refresh(int expires) {return this->refresher ? belle_sip_refresher_refresh(this->refresher,expires) : -1;}
|
||||
int unregister() {return register_refresh(0);}
|
||||
int sendRegister (const char *proxy, const char *from, int expires, const SalAddress *oldContact);
|
||||
int refreshRegister (int expires) {
|
||||
return mRefresher ? belle_sip_refresher_refresh(mRefresher, expires) : -1;
|
||||
}
|
||||
int unregister() { return refreshRegister(0); }
|
||||
|
||||
virtual void authenticate(const SalAuthInfo *info) override {register_refresh(-1);}
|
||||
void authenticate (const SalAuthInfo *info) override {
|
||||
refreshRegister(-1); }
|
||||
|
||||
private:
|
||||
virtual void fill_cbs() override {};
|
||||
static void register_refresher_listener(belle_sip_refresher_t* refresher, void* user_pointer, unsigned int status_code, const char* reason_phrase, int will_retry);
|
||||
virtual void fillCallbacks () override {};
|
||||
static void registerRefresherListener (belle_sip_refresher_t *refresher, void *userCtx, unsigned int statusCode, const char *reasonPhrase, int willRetry);
|
||||
};
|
||||
|
||||
LINPHONE_END_NAMESPACE
|
||||
|
|
|
|||
608
src/sal/sal.cpp
608
src/sal/sal.cpp
File diff suppressed because it is too large
Load diff
448
src/sal/sal.h
448
src/sal/sal.h
|
|
@ -20,9 +20,11 @@
|
|||
#ifndef _L_SAL_H_
|
||||
#define _L_SAL_H_
|
||||
|
||||
#include "c-wrapper/internal/c-sal.h"
|
||||
#include "linphone/utils/general.h"
|
||||
|
||||
#include "c-wrapper/internal/c-sal.h"
|
||||
#include "logger/logger.h"
|
||||
|
||||
LINPHONE_BEGIN_NAMESPACE
|
||||
|
||||
class SalOp;
|
||||
|
|
@ -34,42 +36,42 @@ class SalReferOp;
|
|||
|
||||
class Sal{
|
||||
public:
|
||||
typedef void (*OnCallReceivedCb)(SalCallOp *op);
|
||||
typedef void (*OnCallRingingCb)(SalOp *op);
|
||||
typedef void (*OnCallAcceptedCb)(SalOp *op);
|
||||
typedef void (*OnCallAckReceivedCb)(SalOp *op, SalCustomHeader *ack);
|
||||
typedef void (*OnCallAckBeingSentCb)(SalOp *op, SalCustomHeader *ack);
|
||||
typedef void (*OnCallUpdatingCb)(SalOp *op, bool_t is_update);/* Called when a reINVITE/UPDATE is received*/
|
||||
typedef void (*OnCallTerminatedCb)(SalOp *op, const char *from);
|
||||
typedef void (*OnCallFailureCb)(SalOp *op);
|
||||
typedef void (*OnCallReleasedCb)(SalOp *salop);
|
||||
typedef void (*OnCallCancelDoneCb)(SalOp *salop);
|
||||
typedef void (*OnAuthRequestedLegacyCb)(SalOp *op, const char *realm, const char *username);
|
||||
typedef bool_t (*OnAuthRequestedCb)(Sal *sal,SalAuthInfo* info);
|
||||
typedef void (*OnAuthFailureCb)(SalOp *op, SalAuthInfo* info);
|
||||
typedef void (*OnRegisterSuccessCb)(SalOp *op, bool_t registered);
|
||||
typedef void (*OnRegisterFailureCb)(SalOp *op);
|
||||
typedef void (*OnVfuRequestCb)(SalOp *op);
|
||||
typedef void (*OnDtmfReceivedCb)(SalOp *op, char dtmf);
|
||||
typedef void (*OnCallReferCb)(SalOp *op, const SalAddress *referto);
|
||||
typedef void (*OnReferCb)(SalOp *op, const SalAddress *referto);
|
||||
typedef void (*OnMessageReceivedCb)(SalOp *op, const SalMessage *msg);
|
||||
typedef void (*OnMessageDeliveryUpdateCb)(SalOp *op, SalMessageDeliveryStatus);
|
||||
typedef void (*OnNotifyReferCb)(SalOp *op, SalReferStatus state);
|
||||
typedef void (*OnSubscribeResponseCb)(SalOp *op, SalSubscribeStatus status, int will_retry);
|
||||
typedef void (*OnNotifyCb)(SalSubscribeOp *op, SalSubscribeStatus status, const char *event, SalBodyHandler *body);
|
||||
typedef void (*OnSubscribeReceivedCb)(SalSubscribeOp *salop, const char *event, const SalBodyHandler *body);
|
||||
typedef void (*OnIncomingSubscribeClosedCb)(SalOp *salop);
|
||||
typedef void (*OnParsePresenceRequestedCb)(SalOp *salop, const char *content_type, const char *content_subtype, const char *content, SalPresenceModel **result);
|
||||
typedef void (*OnConvertPresenceToXMLRequestedCb)(SalOp *salop, SalPresenceModel *presence, const char *contact, char **content);
|
||||
typedef void (*OnNotifyPresenceCb)(SalOp *op, SalSubscribeStatus ss, SalPresenceModel *model, const char *msg);
|
||||
typedef void (*OnSubscribePresenceReceivedCb)(SalPresenceOp *salop, const char *from);
|
||||
typedef void (*OnSubscribePresenceClosedCb)(SalPresenceOp *salop, const char *from);
|
||||
typedef void (*OnPingReplyCb)(SalOp *salop);
|
||||
typedef void (*OnInfoReceivedCb)(SalOp *salop, SalBodyHandler *body);
|
||||
typedef void (*OnPublishResponseCb)(SalOp *salop);
|
||||
typedef void (*OnNotifyResponseCb)(SalOp *salop);
|
||||
typedef void (*OnExpireCb)(SalOp *salop);
|
||||
using OnCallReceivedCb = void (*) (SalCallOp *op);
|
||||
using OnCallRingingCb = void (*) (SalOp *op);
|
||||
using OnCallAcceptedCb = void (*) (SalOp *op);
|
||||
using OnCallAckReceivedCb = void (*) (SalOp *op, SalCustomHeader *ack);
|
||||
using OnCallAckBeingSentCb = void (*) (SalOp *op, SalCustomHeader *ack);
|
||||
using OnCallUpdatingCb = void (*) (SalOp *op, bool_t isUpdate); // Called when a reINVITE/UPDATE is received
|
||||
using OnCallTerminatedCb = void (*) (SalOp *op, const char *from);
|
||||
using OnCallFailureCb = void (*) (SalOp *op);
|
||||
using OnCallReleasedCb = void (*) (SalOp *op);
|
||||
using OnCallCancelDoneCb = void (*) (SalOp *op);
|
||||
using OnAuthRequestedLegacyCb = void (*) (SalOp *op, const char *realm, const char *username);
|
||||
using OnAuthRequestedCb = bool_t (*) (Sal *sal, SalAuthInfo *info);
|
||||
using OnAuthFailureCb = void (*) (SalOp *op, SalAuthInfo *info);
|
||||
using OnRegisterSuccessCb = void (*) (SalOp *op, bool_t registered);
|
||||
using OnRegisterFailureCb = void (*) (SalOp *op);
|
||||
using OnVfuRequestCb = void (*) (SalOp *op);
|
||||
using OnDtmfReceivedCb = void (*) (SalOp *op, char dtmf);
|
||||
using OnCallReferCb = void (*) (SalOp *op, const SalAddress *referTo);
|
||||
using OnReferCb = void (*) (SalOp *op, const SalAddress *referTo);
|
||||
using OnMessageReceivedCb = void (*) (SalOp *op, const SalMessage *msg);
|
||||
using OnMessageDeliveryUpdateCb = void (*) (SalOp *op, SalMessageDeliveryStatus status);
|
||||
using OnNotifyReferCb = void (*) (SalOp *op, SalReferStatus status);
|
||||
using OnSubscribeResponseCb = void (*) (SalOp *op, SalSubscribeStatus status, int willRetry);
|
||||
using OnNotifyCb = void (*) (SalSubscribeOp *op, SalSubscribeStatus status, const char *event, SalBodyHandler *body);
|
||||
using OnSubscribeReceivedCb = void (*) (SalSubscribeOp *op, const char *event, const SalBodyHandler *body);
|
||||
using OnIncomingSubscribeClosedCb = void (*) (SalOp *op);
|
||||
using OnParsePresenceRequestedCb = void (*) (SalOp *op, const char *contentType, const char *contentSubtype, const char *content, SalPresenceModel **result);
|
||||
using OnConvertPresenceToXMLRequestedCb = void (*) (SalOp *op, SalPresenceModel *presence, const char *contact, char **content);
|
||||
using OnNotifyPresenceCb = void (*) (SalOp *op, SalSubscribeStatus ss, SalPresenceModel *model, const char *msg);
|
||||
using OnSubscribePresenceReceivedCb = void (*) (SalPresenceOp *op, const char *from);
|
||||
using OnSubscribePresenceClosedCb = void (*) (SalPresenceOp *op, const char *from);
|
||||
using OnPingReplyCb = void (*) (SalOp *op);
|
||||
using OnInfoReceivedCb = void (*) (SalOp *op, SalBodyHandler *body);
|
||||
using OnPublishResponseCb = void (*) (SalOp *op);
|
||||
using OnNotifyResponseCb = void (*) (SalOp *op);
|
||||
using OnExpireCb = void (*) (SalOp *op);
|
||||
|
||||
struct Callbacks {
|
||||
OnCallReceivedCb call_received;
|
||||
|
|
@ -108,148 +110,153 @@ public:
|
|||
OnPublishResponseCb on_publish_response;
|
||||
OnExpireCb on_expire;
|
||||
OnNotifyResponseCb on_notify_response;
|
||||
OnReferCb refer_received; /*for out of dialog refer*/
|
||||
OnReferCb refer_received; // For out of dialog refer
|
||||
};
|
||||
|
||||
Sal(MSFactory *factory);
|
||||
~Sal();
|
||||
|
||||
void set_factory(MSFactory *factory) {
|
||||
this->factory = factory;
|
||||
void setFactory (MSFactory *value) { mFactory = value; }
|
||||
|
||||
void setUserPointer (void *value) { mUserPointer = value; }
|
||||
void *getUserPointer () const { return mUserPointer; }
|
||||
|
||||
void setCallbacks (const Callbacks *cbs);
|
||||
|
||||
void *getStackImpl() const { return mStack; }
|
||||
|
||||
int iterate () { belle_sip_stack_sleep(mStack, 0); return 0; }
|
||||
|
||||
void setSendError (int value) { belle_sip_stack_set_send_error(mStack, value); }
|
||||
void setRecvError (int value) { belle_sip_provider_set_recv_error(mProvider, value); }
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// SIP parameters
|
||||
// ---------------------------------------------------------------------------
|
||||
void setSupportedTags (const char *tags);
|
||||
const char *getSupportedTags () const {
|
||||
return mSupported ? belle_sip_header_get_unparsed_value(mSupported) : nullptr;
|
||||
}
|
||||
void addSupportedTag (const char *tag);
|
||||
void removeSupportedTag (const char *tag);
|
||||
|
||||
void setUserAgent (const char *userAgent);
|
||||
const char *getUserAgent() const;
|
||||
void appendStackStringToUserAgent ();
|
||||
|
||||
bool_t isContentEncodingAvailable (const char *contentEncoding) {
|
||||
return (bool_t)belle_sip_stack_content_encoding_available(mStack, contentEncoding);
|
||||
}
|
||||
bool_t isContentTypeSupported (const char *contentType) const;
|
||||
void addContentTypeSupport (const char *contentType);
|
||||
void removeContentTypeSupport (const char *contentType);
|
||||
|
||||
void setDefaultSdpHandling (SalOpSDPHandling sdpHandlingMethod);
|
||||
|
||||
void setUuid (const char *uuid);
|
||||
int createUuid (char *uuid, size_t len);
|
||||
static int generateUuid (char *uuid, size_t len);
|
||||
|
||||
void enableNatHelper (bool_t enable);
|
||||
bool_t natHelperEnabled () const { return mNatHelperEnabled; }
|
||||
|
||||
bool_t pendingTransactionCheckingEnabled () const { return mPendingTransactionChecking; }
|
||||
int enablePendingTransactionChecking (bool_t value) { mPendingTransactionChecking = value; return 0; }
|
||||
|
||||
void setRefresherRetryAfter (int value) { mRefresherRetryAfter = value; }
|
||||
int getRefresherRetryAfter () const { return mRefresherRetryAfter; }
|
||||
|
||||
void enableSipUpdateMethod (bool_t value) { mEnableSipUpdate = value; }
|
||||
void useSessionTimers (int expires) { mSessionExpires = expires; }
|
||||
void useDates (bool_t value) { mUseDates = value; }
|
||||
void useOneMatchingCodecPolicy (bool_t value) { mOneMatchingCodec = value; }
|
||||
void useRport (bool_t value);
|
||||
void enableAutoContacts (bool_t value) { mAutoContacts = value; }
|
||||
void enableTestFeatures (bool_t value) { mEnableTestFeatures = value; }
|
||||
void useNoInitialRoute (bool_t value) { mNoInitialRoute = value; }
|
||||
void enableUnconditionalAnswer (int value) { belle_sip_provider_enable_unconditional_answer(mProvider, value); }
|
||||
void enableReconnectToPrimaryAsap (bool_t value) { belle_sip_stack_enable_reconnect_to_primary_asap(mStack, value); }
|
||||
|
||||
bctbx_list_t *getPendingAuths () const { return bctbx_list_copy(mPendingAuths); }
|
||||
|
||||
void setContactLinphoneSpecs (const char *specs);
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Network parameters
|
||||
// ---------------------------------------------------------------------------
|
||||
int setListenPort (const char *addr, int port, SalTransport tr, bool_t isTunneled);
|
||||
int getListeningPort (SalTransport tr);
|
||||
int isTransportAvailable (SalTransport t);
|
||||
|
||||
void getDefaultLocalIp (int addressFamily, char *ip, size_t ipLen);
|
||||
|
||||
void setTransportTimeout (int value) { belle_sip_stack_set_transport_timeout(mStack, value); }
|
||||
int getTransportTimeout () const { return belle_sip_stack_get_transport_timeout(mStack); }
|
||||
|
||||
void setKeepAlivePeriod (unsigned int value);
|
||||
unsigned int getKeepAlivePeriod () const { return mKeepAlive; }
|
||||
void useTcpTlsKeepAlive (bool_t value) { mUseTcpTlsKeepAlive = value; }
|
||||
|
||||
void setDscp (int dscp) { belle_sip_stack_set_default_dscp(mStack, dscp); }
|
||||
|
||||
int setTunnel (void *tunnelClient);
|
||||
|
||||
void setHttpProxyHost (const char *value) { belle_sip_stack_set_http_proxy_host(mStack, value); }
|
||||
const char *getHttpProxyHost () const { return belle_sip_stack_get_http_proxy_host(mStack); }
|
||||
|
||||
void setHttpProxyPort (int value) { belle_sip_stack_set_http_proxy_port(mStack, value); }
|
||||
int getHttpProxyPort () const { return belle_sip_stack_get_http_proxy_port(mStack); }
|
||||
|
||||
ortp_socket_t getSocket () const;
|
||||
|
||||
int unlistenPorts ();
|
||||
int resetTransports ();
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// TLS parameters
|
||||
// ---------------------------------------------------------------------------
|
||||
void setSslConfig (void *sslConfig);
|
||||
void setRootCa (const char *value);
|
||||
void setRootCaData (const char *data);
|
||||
const char *getRootCa () const { return mRootCa; }
|
||||
|
||||
void verifyServerCertificates (bool_t value);
|
||||
void verifyServerCn (bool_t value);
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// DNS resolution
|
||||
// ---------------------------------------------------------------------------
|
||||
void setDnsTimeout (int value) { belle_sip_stack_set_dns_timeout(mStack, value); }
|
||||
int getDnsTimeout () const { return belle_sip_stack_get_dns_timeout(mStack); }
|
||||
|
||||
void setDnsServers (const bctbx_list_t *servers);
|
||||
|
||||
void enableDnsSearch (bool_t value) { belle_sip_stack_enable_dns_search(mStack, (unsigned char)value); }
|
||||
bool_t dnsSearchEnabled () const { return (bool_t)belle_sip_stack_dns_search_enabled(mStack); }
|
||||
|
||||
void enableDnsSrv (bool_t value) { belle_sip_stack_enable_dns_srv(mStack, (unsigned char)value); }
|
||||
bool_t dnsSrvEnabled () const { return (bool_t)belle_sip_stack_dns_srv_enabled(mStack); }
|
||||
|
||||
void setDnsUserHostsFile (const char *value) { belle_sip_stack_set_dns_user_hosts_file(mStack, value); }
|
||||
const char *getDnsUserHostsFile () const { return belle_sip_stack_get_dns_user_hosts_file(mStack); }
|
||||
|
||||
belle_sip_resolver_context_t *resolveA (const char *name, int port, int family, belle_sip_resolver_callback_t cb, void *data) {
|
||||
return belle_sip_stack_resolve_a(mStack, name, port, family, cb, data);
|
||||
}
|
||||
belle_sip_resolver_context_t *resolve (const char *service, const char *transport, const char *name, int port, int family, belle_sip_resolver_callback_t cb, void *data) {
|
||||
return belle_sip_stack_resolve(mStack, service, transport, name, port, family, cb, data);
|
||||
}
|
||||
|
||||
void set_user_pointer(void *user_data) {this->up=user_data;}
|
||||
void *get_user_pointer() const {return this->up;}
|
||||
|
||||
void set_callbacks(const Callbacks *cbs);
|
||||
|
||||
void *get_stack_impl() {return this->stack;}
|
||||
|
||||
int iterate() {belle_sip_stack_sleep(this->stack,0); return 0;}
|
||||
|
||||
void set_send_error(int value) {belle_sip_stack_set_send_error(this->stack,value);}
|
||||
void set_recv_error(int value) {belle_sip_provider_set_recv_error(this->prov,value);}
|
||||
|
||||
|
||||
/******************/
|
||||
/* SIP parameters */
|
||||
/******************/
|
||||
void set_supported_tags(const char* tags);
|
||||
const char *get_supported_tags() const {return this->supported ? belle_sip_header_get_unparsed_value(this->supported) : NULL;}
|
||||
void add_supported_tag(const char* tag);
|
||||
void remove_supported_tag(const char* tag);
|
||||
|
||||
void set_user_agent(const char *user_agent);
|
||||
const char* get_user_agent() const;
|
||||
void append_stack_string_to_user_agent();
|
||||
|
||||
bool_t content_encoding_available(const char *content_encoding) {return (bool_t)belle_sip_stack_content_encoding_available(this->stack, content_encoding);}
|
||||
bool_t is_content_type_supported(const char *content_type) const;
|
||||
void add_content_type_support(const char *content_type);
|
||||
void remove_content_type_support(const char *content_type);
|
||||
|
||||
void set_default_sdp_handling(SalOpSDPHandling sdp_handling_method);
|
||||
|
||||
void set_uuid(const char *uuid);
|
||||
int create_uuid(char *uuid, size_t len);
|
||||
static int generate_uuid(char *uuid, size_t len);
|
||||
|
||||
void enable_nat_helper(bool_t enable);
|
||||
bool_t nat_helper_enabled() const {return this->_nat_helper_enabled;}
|
||||
|
||||
bool_t pending_trans_checking_enabled() const {return this->pending_trans_checking;}
|
||||
int enable_pending_trans_checking(bool_t value) {this->pending_trans_checking = value; return 0;}
|
||||
|
||||
void set_refresher_retry_after(int value) {this->refresher_retry_after=value;}
|
||||
int get_refresher_retry_after() const {return this->refresher_retry_after;}
|
||||
|
||||
void enable_sip_update_method(bool_t value) {this->enable_sip_update=value;}
|
||||
void use_session_timers(int expires) {this->session_expires=expires;}
|
||||
void use_dates(bool_t enabled) {this->_use_dates=enabled;}
|
||||
void use_one_matching_codec_policy(bool_t one_matching_codec) {this->one_matching_codec=one_matching_codec;}
|
||||
void use_rport(bool_t use_rports);
|
||||
void enable_auto_contacts(bool_t enabled) {this->auto_contacts=enabled;}
|
||||
void enable_test_features(bool_t enabled) {this->_enable_test_features=enabled;}
|
||||
void use_no_initial_route(bool_t enabled) {this->no_initial_route=enabled;}
|
||||
void enable_unconditional_answer(int value) {belle_sip_provider_enable_unconditional_answer(this->prov,value);}
|
||||
void enable_reconnect_to_primary_asap(bool_t enabled) {belle_sip_stack_enable_reconnect_to_primary_asap(this->stack,enabled);}
|
||||
|
||||
bctbx_list_t *get_pending_auths() const {return bctbx_list_copy(this->pending_auths);}
|
||||
|
||||
void set_contact_linphone_specs(const char *specs);
|
||||
|
||||
/**********************/
|
||||
/* Network parameters */
|
||||
/**********************/
|
||||
int set_listen_port(const char *addr, int port, SalTransport tr, bool_t is_tunneled);
|
||||
int get_listening_port(SalTransport tr);
|
||||
int transport_available(SalTransport t);
|
||||
|
||||
void get_default_local_ip(int address_family, char *ip, size_t iplen);
|
||||
|
||||
void set_transport_timeout(int timeout) {belle_sip_stack_set_transport_timeout(this->stack, timeout);}
|
||||
int get_transport_timeout() const {return belle_sip_stack_get_transport_timeout(this->stack);}
|
||||
|
||||
void set_keepalive_period(unsigned int value);
|
||||
unsigned int get_keepalive_period() const {return this->keep_alive;}
|
||||
void use_tcp_tls_keepalive(bool_t enabled) {this->use_tcp_tls_keep_alive=enabled;}
|
||||
|
||||
void set_dscp(int dscp) {belle_sip_stack_set_default_dscp(this->stack,dscp);}
|
||||
|
||||
int set_tunnel(void *tunnelclient);
|
||||
|
||||
void set_http_proxy_host(const char *host) {belle_sip_stack_set_http_proxy_host(this->stack, host);}
|
||||
const char *get_http_proxy_host() const {return belle_sip_stack_get_http_proxy_host(this->stack);}
|
||||
|
||||
void set_http_proxy_port(int port) {belle_sip_stack_set_http_proxy_port(this->stack, port);}
|
||||
int get_http_proxy_port() const {return belle_sip_stack_get_http_proxy_port(this->stack);}
|
||||
|
||||
ortp_socket_t get_socket() const;
|
||||
|
||||
int unlisten_ports();
|
||||
int reset_transports();
|
||||
|
||||
|
||||
/******************/
|
||||
/* TLS parameters */
|
||||
/******************/
|
||||
void set_ssl_config(void *ssl_config);
|
||||
void set_root_ca(const char* rootCa);
|
||||
void set_root_ca_data(const char* data);
|
||||
const char *get_root_ca() const {return this->root_ca;}
|
||||
|
||||
void verify_server_certificates(bool_t verify);
|
||||
void verify_server_cn(bool_t verify);
|
||||
|
||||
|
||||
/******************/
|
||||
/* DNS resolution */
|
||||
/******************/
|
||||
void set_dns_timeout(int timeout) {belle_sip_stack_set_dns_timeout(this->stack, timeout);}
|
||||
int get_dns_timeout() const {return belle_sip_stack_get_dns_timeout(this->stack);}
|
||||
|
||||
void set_dns_servers(const bctbx_list_t *servers);
|
||||
|
||||
void enable_dns_search(bool_t enable) {belle_sip_stack_enable_dns_search(this->stack, (unsigned char)enable);}
|
||||
bool_t dns_search_enabled() const {return (bool_t)belle_sip_stack_dns_search_enabled(this->stack);}
|
||||
|
||||
void enable_dns_srv(bool_t enable) {belle_sip_stack_enable_dns_srv(this->stack, (unsigned char)enable);}
|
||||
bool_t dns_srv_enabled() const {return (bool_t)belle_sip_stack_dns_srv_enabled(this->stack);}
|
||||
|
||||
void set_dns_user_hosts_file(const char *hosts_file) {belle_sip_stack_set_dns_user_hosts_file(this->stack, hosts_file);}
|
||||
const char *get_dns_user_hosts_file() const {return belle_sip_stack_get_dns_user_hosts_file(this->stack);}
|
||||
|
||||
belle_sip_resolver_context_t *resolve_a(const char *name, int port, int family, belle_sip_resolver_callback_t cb, void *data)
|
||||
{return belle_sip_stack_resolve_a(this->stack,name,port,family,cb,data);}
|
||||
belle_sip_resolver_context_t *resolve(const char *service, const char *transport, const char *name, int port, int family, belle_sip_resolver_callback_t cb, void *data)
|
||||
{return belle_sip_stack_resolve(this->stack, service, transport, name, port, family, cb, data);}
|
||||
|
||||
|
||||
/**********/
|
||||
/* Timers */
|
||||
/**********/
|
||||
belle_sip_source_t *create_timer(belle_sip_source_func_t func, void *data, unsigned int timeout_value_ms, const char* timer_name);
|
||||
void cancel_timer(belle_sip_source_t *timer);
|
||||
// ---------------------------------------------------------------------------
|
||||
// Timers
|
||||
// ---------------------------------------------------------------------------
|
||||
belle_sip_source_t *createTimer (belle_sip_source_func_t func, void *data, unsigned int timeoutValueMs, const char *timerName);
|
||||
void cancelTimer (belle_sip_source_t *timer);
|
||||
|
||||
|
||||
private:
|
||||
|
|
@ -262,57 +269,59 @@ private:
|
|||
unsigned char node[6];
|
||||
};
|
||||
|
||||
void set_tls_properties();
|
||||
int add_listen_port(SalAddress* addr, bool_t is_tunneled);
|
||||
void make_supported_header();
|
||||
void add_pending_auth(SalOp *op);
|
||||
void remove_pending_auth(SalOp *op);
|
||||
belle_sip_response_t* create_response_from_request (belle_sip_request_t* req, int code );
|
||||
void setTlsProperties ();
|
||||
int addListenPort (SalAddress *addr, bool_t isTunneled);
|
||||
void makeSupportedHeader ();
|
||||
void addPendingAuth (SalOp *op);
|
||||
void removePendingAuth (SalOp *op);
|
||||
belle_sip_response_t *createResponseFromRequest (belle_sip_request_t *req, int code);
|
||||
|
||||
static void unimplemented_stub() {ms_warning("Unimplemented SAL callback");}
|
||||
static void remove_listening_point(belle_sip_listening_point_t* lp,belle_sip_provider_t* prov) {belle_sip_provider_remove_listening_point(prov,lp);}
|
||||
static void unimplementedStub() { lWarning() << "Unimplemented SAL callback"; }
|
||||
static void removeListeningPoint (belle_sip_listening_point_t *lp,belle_sip_provider_t *prov) {
|
||||
belle_sip_provider_remove_listening_point(prov, lp);
|
||||
}
|
||||
|
||||
/* Internal callbacks */
|
||||
static void process_dialog_terminated_cb(void *sal, const belle_sip_dialog_terminated_event_t *event);
|
||||
static void process_io_error_cb(void *user_ctx, const belle_sip_io_error_event_t *event);
|
||||
static void process_request_event_cb(void *ud, const belle_sip_request_event_t *event);
|
||||
static void process_response_event_cb(void *user_ctx, const belle_sip_response_event_t *event);
|
||||
static void process_timeout_cb(void *user_ctx, const belle_sip_timeout_event_t *event);
|
||||
static void process_transaction_terminated_cb(void *user_ctx, const belle_sip_transaction_terminated_event_t *event);
|
||||
static void process_auth_requested_cb(void *sal, belle_sip_auth_event_t *event);
|
||||
// Internal callbacks
|
||||
static void processDialogTerminatedCb (void *userCtx, const belle_sip_dialog_terminated_event_t *event);
|
||||
static void processIoErrorCb (void *userCtx, const belle_sip_io_error_event_t *event);
|
||||
static void processRequestEventCb (void *userCtx, const belle_sip_request_event_t *event);
|
||||
static void processResponseEventCb (void *userCtx, const belle_sip_response_event_t *event);
|
||||
static void processTimeoutCb (void *userCtx, const belle_sip_timeout_event_t *event);
|
||||
static void processTransactionTerminatedCb (void *userCtx, const belle_sip_transaction_terminated_event_t *event);
|
||||
static void processAuthRequestedCb (void *userCtx, belle_sip_auth_event_t *event);
|
||||
|
||||
MSFactory *factory = NULL;
|
||||
Callbacks callbacks = {0};
|
||||
MSList *pending_auths = NULL;/*MSList of SalOp */
|
||||
belle_sip_stack_t* stack = NULL;
|
||||
belle_sip_provider_t *prov = NULL;
|
||||
belle_sip_header_user_agent_t* user_agent = NULL;
|
||||
belle_sip_listener_t *listener = NULL;
|
||||
void *tunnel_client = NULL;
|
||||
void *up = NULL; /*user pointer*/
|
||||
int session_expires = 0;
|
||||
unsigned int keep_alive = 0;
|
||||
char *root_ca = NULL;
|
||||
char *root_ca_data = NULL;
|
||||
char *uuid = NULL;
|
||||
int refresher_retry_after = 60000; /*retry after value for refresher*/
|
||||
MSList *supported_tags = NULL;/*list of char * */
|
||||
belle_sip_header_t *supported = NULL;
|
||||
bool_t one_matching_codec = FALSE;
|
||||
bool_t use_tcp_tls_keep_alive = FALSE;
|
||||
bool_t _nat_helper_enabled = FALSE;
|
||||
bool_t tls_verify = TRUE;
|
||||
bool_t tls_verify_cn = TRUE;
|
||||
bool_t _use_dates = FALSE;
|
||||
bool_t auto_contacts = TRUE;
|
||||
bool_t _enable_test_features = FALSE;
|
||||
bool_t no_initial_route = FALSE;
|
||||
bool_t enable_sip_update = TRUE; /*true by default*/
|
||||
SalOpSDPHandling default_sdp_handling = SalOpSDPNormal;
|
||||
bool_t pending_trans_checking = TRUE; /*testing purpose*/
|
||||
void *ssl_config = NULL;
|
||||
bctbx_list_t *supported_content_types = NULL; /* list of char* */
|
||||
char *linphone_specs = NULL;
|
||||
MSFactory *mFactory = nullptr;
|
||||
Callbacks mCallbacks = { 0 };
|
||||
MSList *mPendingAuths = nullptr; // List of SalOp
|
||||
belle_sip_stack_t *mStack = nullptr;
|
||||
belle_sip_provider_t *mProvider = nullptr;
|
||||
belle_sip_header_user_agent_t *mUserAgent = nullptr;
|
||||
belle_sip_listener_t *mListener = nullptr;
|
||||
void *mTunnelClient = nullptr;
|
||||
void *mUserPointer = nullptr; // User pointer
|
||||
int mSessionExpires = 0;
|
||||
unsigned int mKeepAlive = 0;
|
||||
char *mRootCa = nullptr;
|
||||
char *mRootCaData = nullptr;
|
||||
char *mUuid = nullptr;
|
||||
int mRefresherRetryAfter = 60000; // Retry after value for refresher
|
||||
MSList *mSupportedTags = nullptr; // List of char *
|
||||
belle_sip_header_t *mSupported = nullptr;
|
||||
bool_t mOneMatchingCodec = FALSE;
|
||||
bool_t mUseTcpTlsKeepAlive = FALSE;
|
||||
bool_t mNatHelperEnabled = FALSE;
|
||||
bool_t mTlsVerify = TRUE;
|
||||
bool_t mTlsVerifyCn = TRUE;
|
||||
bool_t mUseDates = FALSE;
|
||||
bool_t mAutoContacts = TRUE;
|
||||
bool_t mEnableTestFeatures = FALSE;
|
||||
bool_t mNoInitialRoute = FALSE;
|
||||
bool_t mEnableSipUpdate = TRUE; // true by default
|
||||
SalOpSDPHandling mDefaultSdpHandling = SalOpSDPNormal;
|
||||
bool_t mPendingTransactionChecking = TRUE; // For testing purposes
|
||||
void *mSslConfig = nullptr;
|
||||
bctbx_list_t *mSupportedContentTypes = nullptr; // List of char *
|
||||
char *mLinphoneSpecs = nullptr;
|
||||
|
||||
friend class SalOp;
|
||||
friend class SalCallOp;
|
||||
|
|
@ -329,3 +338,4 @@ int to_sip_code(SalReason r);
|
|||
LINPHONE_END_NAMESPACE
|
||||
|
||||
#endif // ifndef _L_SAL_H_
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ void BackgroundTask::start (const shared_ptr<Core> &core, int maxDurationSeconds
|
|||
mId = newId;
|
||||
if (maxDurationSeconds > 0) {
|
||||
mSal = core->getCCore()->sal;
|
||||
mTimeout = mSal->create_timer(sHandleSalTimeout, this, (unsigned int)maxDurationSeconds * 1000, mName.c_str());
|
||||
mTimeout = mSal->createTimer(sHandleSalTimeout, this, (unsigned int)maxDurationSeconds * 1000, mName.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -72,7 +72,7 @@ void BackgroundTask::stop () {
|
|||
lInfo() << "Ending background task [" << mId << "] with name: [" << mName << "]";
|
||||
sal_end_background_task(mId);
|
||||
if (mTimeout) {
|
||||
mSal->cancel_timer(mTimeout);
|
||||
mSal->cancelTimer(mTimeout);
|
||||
belle_sip_object_unref(mTimeout);
|
||||
mTimeout = nullptr;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue