mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 19:18:06 +00:00
Fix reception of INFO messages.
This commit is contained in:
parent
fec65e98d7
commit
08a2180cbc
12 changed files with 47 additions and 19 deletions
|
|
@ -640,9 +640,11 @@ static void message_delivery_update(SalOp *op, SalMessageDeliveryStatus status){
|
|||
}
|
||||
}
|
||||
|
||||
static void info_received(SalOp *op, SalBodyHandler *body_handler){
|
||||
LinphoneCore *lc=(LinphoneCore *)op->get_sal()->get_user_pointer();
|
||||
linphone_core_notify_info_message(lc,op,body_handler);
|
||||
static void info_received(SalOp *op, SalBodyHandler *body_handler) {
|
||||
LinphonePrivate::CallSession *session = reinterpret_cast<LinphonePrivate::CallSession *>(op->get_user_pointer());
|
||||
if (!session)
|
||||
return;
|
||||
L_GET_PRIVATE(session)->infoReceived(body_handler);
|
||||
}
|
||||
|
||||
static void subscribe_response(SalOp *op, SalSubscribeStatus status, int will_retry){
|
||||
|
|
|
|||
|
|
@ -84,8 +84,10 @@ const char *linphone_info_message_get_header(const LinphoneInfoMessage *im, cons
|
|||
return sal_custom_header_find(im->headers,name);
|
||||
}
|
||||
|
||||
void linphone_info_message_set_content(LinphoneInfoMessage *im, const LinphoneContent *content){
|
||||
im->content=linphone_content_copy(content);
|
||||
void linphone_info_message_set_content (LinphoneInfoMessage *im, const LinphoneContent *content) {
|
||||
if (im->content)
|
||||
linphone_content_unref(im->content);
|
||||
im->content = linphone_content_copy(content);
|
||||
}
|
||||
|
||||
const LinphoneContent * linphone_info_message_get_content(const LinphoneInfoMessage *im){
|
||||
|
|
@ -96,17 +98,11 @@ SalCustomHeader *linphone_info_message_get_headers (const LinphoneInfoMessage *i
|
|||
return im->headers;
|
||||
}
|
||||
|
||||
void linphone_core_notify_info_message (
|
||||
LinphoneCore* lc,
|
||||
LinphonePrivate::SalOp *op,
|
||||
SalBodyHandler *body_handler
|
||||
) {
|
||||
LinphoneCall *call=(LinphoneCall*)op->get_user_pointer();
|
||||
if (call){
|
||||
LinphoneInfoMessage *info=linphone_core_create_info_message(lc);
|
||||
info->headers=sal_custom_header_clone(op->get_recv_custom_header());
|
||||
if (body_handler) info->content=linphone_content_from_sal_body_handler(body_handler);
|
||||
linphone_call_notify_info_message_received(call, info);
|
||||
linphone_info_message_unref(info);
|
||||
void linphone_info_message_set_headers (LinphoneInfoMessage *im, const SalCustomHeader *headers) {
|
||||
if (im->headers) {
|
||||
sal_custom_header_free(im->headers);
|
||||
im->headers = nullptr;
|
||||
}
|
||||
if (headers)
|
||||
im->headers = sal_custom_header_clone(headers);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1152,7 +1152,6 @@ const char *linphone_core_create_uuid(LinphoneCore *lc);
|
|||
void linphone_configure_op(LinphoneCore *lc, LinphonePrivate::SalOp *op, const LinphoneAddress *dest, SalCustomHeader *headers, bool_t with_contact);
|
||||
void linphone_configure_op_with_proxy(LinphoneCore *lc, LinphonePrivate::SalOp *op, const LinphoneAddress *dest, SalCustomHeader *headers, bool_t with_contact, LinphoneProxyConfig *proxy);
|
||||
void linphone_call_create_op(LinphoneCall *call);
|
||||
void linphone_core_notify_info_message(LinphoneCore* lc,LinphonePrivate::SalOp *op, SalBodyHandler *body);
|
||||
LinphoneContent * linphone_content_new(void);
|
||||
LinphoneContent * linphone_content_copy(const LinphoneContent *ref);
|
||||
SalBodyHandler *sal_body_handler_from_content(const LinphoneContent *content);
|
||||
|
|
@ -1586,6 +1585,7 @@ LinphoneNatPolicy * linphone_config_create_nat_policy_from_section(const Linphon
|
|||
|
||||
|
||||
SalCustomHeader *linphone_info_message_get_headers (const LinphoneInfoMessage *im);
|
||||
void linphone_info_message_set_headers (LinphoneInfoMessage *im, const SalCustomHeader *headers);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ LINPHONE_PUBLIC const char *linphone_info_message_get_header(const LinphoneInfoM
|
|||
* @param content the content described as a #LinphoneContent structure.
|
||||
* All fields of the LinphoneContent are copied, thus the application can destroy/modify/recycloe the content object freely ater the function returns.
|
||||
**/
|
||||
LINPHONE_PUBLIC void linphone_info_message_set_content(LinphoneInfoMessage *im, const LinphoneContent *content);
|
||||
LINPHONE_PUBLIC void linphone_info_message_set_content(LinphoneInfoMessage *im, const LinphoneContent *content);
|
||||
|
||||
/**
|
||||
* Returns the info message's content as a #LinphoneContent structure.
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ public:
|
|||
virtual void onCheckForAcceptation () = 0;
|
||||
virtual void onIncomingCallStarted () = 0;
|
||||
virtual void onIncomingCallToBeAdded () = 0;
|
||||
virtual void onInfoReceived (const LinphoneInfoMessage *im) = 0;
|
||||
|
||||
virtual void onEncryptionChanged (bool activated, const std::string &authToken) = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@ private:
|
|||
void onCheckForAcceptation () override;
|
||||
void onIncomingCallStarted () override;
|
||||
void onIncomingCallToBeAdded () override;
|
||||
void onInfoReceived (const LinphoneInfoMessage *im) override;
|
||||
void onEncryptionChanged (bool activated, const std::string &authToken) override;
|
||||
void onStatsUpdated (const LinphoneCallStats *stats) override;
|
||||
void onResetCurrentCall () override;
|
||||
|
|
|
|||
|
|
@ -177,6 +177,11 @@ void CallPrivate::onIncomingCallToBeAdded () {
|
|||
linphone_core_add_call(core, lcall);
|
||||
}
|
||||
|
||||
void CallPrivate::onInfoReceived (const LinphoneInfoMessage *im) {
|
||||
if (lcall)
|
||||
linphone_call_notify_info_message_received(lcall, im);
|
||||
}
|
||||
|
||||
void CallPrivate::onEncryptionChanged (bool activated, const string &authToken) {
|
||||
if (lcall)
|
||||
linphone_call_notify_encryption_changed(lcall, activated, authToken.empty() ? nullptr : authToken.c_str());
|
||||
|
|
|
|||
|
|
@ -170,6 +170,12 @@ void Conference::onIncomingCallSessionStarted (const shared_ptr<const CallSessio
|
|||
d->callListener->onIncomingCallStarted();
|
||||
}
|
||||
|
||||
void Conference::onInfoReceived (const std::shared_ptr<const CallSession> &session, const LinphoneInfoMessage *im) {
|
||||
L_D();
|
||||
if (d->callListener)
|
||||
d->callListener->onInfoReceived(im);
|
||||
}
|
||||
|
||||
void Conference::onEncryptionChanged (const shared_ptr<const CallSession> &session, bool activated, const string &authToken) {
|
||||
L_D();
|
||||
if (d->callListener)
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ private:
|
|||
void onCallSessionStateChanged (const std::shared_ptr<const CallSession> &session, LinphoneCallState state, const std::string &message) override;
|
||||
void onCheckForAcceptation (const std::shared_ptr<const CallSession> &session) override;
|
||||
void onIncomingCallSessionStarted (const std::shared_ptr<const CallSession> &session) override;
|
||||
void onInfoReceived (const std::shared_ptr<const CallSession> &session, const LinphoneInfoMessage *im) override;
|
||||
void onEncryptionChanged (const std::shared_ptr<const CallSession> &session, bool activated, const std::string &authToken) override;
|
||||
void onStatsUpdated (const LinphoneCallStats *stats) override;
|
||||
void onResetCurrentSession (const std::shared_ptr<const CallSession> &session) override;
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ public:
|
|||
virtual void onCallSessionStateChanged (const std::shared_ptr<const CallSession> &session, LinphoneCallState state, const std::string &message) = 0;
|
||||
virtual void onCheckForAcceptation (const std::shared_ptr<const CallSession> &session) = 0;
|
||||
virtual void onIncomingCallSessionStarted (const std::shared_ptr<const CallSession> &session) = 0;
|
||||
virtual void onInfoReceived (const std::shared_ptr<const CallSession> &session, const LinphoneInfoMessage *im) = 0;
|
||||
|
||||
virtual void onEncryptionChanged (const std::shared_ptr<const CallSession> &session, bool activated, const std::string &authToken) = 0;
|
||||
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ public:
|
|||
void ackBeingSent (LinphoneHeaders *headers);
|
||||
virtual void ackReceived (LinphoneHeaders *headers);
|
||||
virtual bool failure ();
|
||||
void infoReceived (SalBodyHandler *bodyHandler);
|
||||
void pingReply ();
|
||||
virtual void remoteRinging ();
|
||||
virtual void terminated ();
|
||||
|
|
|
|||
|
|
@ -322,6 +322,20 @@ bool CallSessionPrivate::failure () {
|
|||
return false;
|
||||
}
|
||||
|
||||
void CallSessionPrivate::infoReceived (SalBodyHandler *bodyHandler) {
|
||||
L_Q();
|
||||
LinphoneInfoMessage *info = linphone_core_create_info_message(core);
|
||||
linphone_info_message_set_headers(info, op->get_recv_custom_header());
|
||||
if (bodyHandler) {
|
||||
LinphoneContent *content = linphone_content_from_sal_body_handler(bodyHandler);
|
||||
linphone_info_message_set_content(info, content);
|
||||
linphone_content_unref(content);
|
||||
}
|
||||
if (listener)
|
||||
listener->onInfoReceived(q->getSharedFromThis(), info);
|
||||
linphone_info_message_unref(info);
|
||||
}
|
||||
|
||||
void CallSessionPrivate::pingReply () {
|
||||
L_Q();
|
||||
if (state == LinphoneCallOutgoingInit) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue