Commit 3b10f8da authored by Ghislain MARY's avatar Ghislain MARY

Include the body containing the list of addresses to invite when sending the...

Include the body containing the list of addresses to invite when sending the INVITE to create a client group chat room.
parent 14311c87
......@@ -76,6 +76,7 @@ belle_sip_header_allow_t *SalCallOp::create_allow(bool_t enable_update) {
int SalCallOp::set_custom_body(belle_sip_message_t *msg, const Content &body) {
ContentType contentType = body.getContentType();
string contentDisposition = body.getContentDisposition();
size_t bodySize = body.getBody().size();
if (bodySize > SIP_MESSAGE_BODY_LIMIT) {
......@@ -87,6 +88,10 @@ int SalCallOp::set_custom_body(belle_sip_message_t *msg, const Content &body) {
belle_sip_header_content_type_t *content_type = belle_sip_header_content_type_create(contentType.getType().c_str(), contentType.getSubType().c_str());
belle_sip_message_add_header(msg, BELLE_SIP_HEADER(content_type));
}
if (!contentDisposition.empty()) {
belle_sip_header_content_disposition_t *contentDispositionHeader = belle_sip_header_content_disposition_create(contentDisposition.c_str());
belle_sip_message_add_header(msg, BELLE_SIP_HEADER(contentDispositionHeader));
}
belle_sip_header_content_length_t *content_length = belle_sip_header_content_length_create(bodySize);
belle_sip_message_add_header(msg, BELLE_SIP_HEADER(content_length));
......
......@@ -63,7 +63,6 @@ void ClientGroupChatRoom::addParticipants (const list<Address> &addresses, const
content.setBody(getResourceLists(sortedAddresses));
content.setContentType("application/resource-lists+xml");
content.setContentDisposition("recipient-list");
lInfo() << "Body size: " << content.getSize() << endl << "Body:" << endl << content.getBodyAsString();
CallSessionParams csp;
if (params)
csp = *params;
......@@ -74,7 +73,7 @@ void ClientGroupChatRoom::addParticipants (const list<Address> &addresses, const
Address addr = me->getAddress();
addr.setParam("text");
session->getPrivate()->getOp()->set_contact_address(addr.getPrivate()->getInternalAddress());
session->startInvite(nullptr, subject);
session->startInvite(nullptr, subject, &content);
d->setState(ChatRoom::State::CreationPending);
}
// TODO
......
......@@ -867,7 +867,7 @@ void CallSession::startIncomingNotification () {
}
}
int CallSession::startInvite (const Address *destination, const string &subject) {
int CallSession::startInvite (const Address *destination, const string &subject, const Content *content) {
L_D();
d->subject = subject;
/* Try to be best-effort in giving real local or routable contact address */
......@@ -884,6 +884,8 @@ int CallSession::startInvite (const Address *destination, const string &subject)
char *from = linphone_address_as_string(d->log->from);
/* 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);
int result = d->op->call(from, destinationStr.c_str(), subject.empty() ? nullptr : subject.c_str());
ms_free(from);
if (result < 0) {
......
......@@ -32,6 +32,7 @@ LINPHONE_BEGIN_NAMESPACE
class CallPrivate;
class CallSessionPrivate;
class Content;
class LINPHONE_PUBLIC CallSession : public Object {
friend class CallPrivate;
......@@ -53,7 +54,7 @@ public:
LinphoneStatus redirect (const std::string &redirectUri);
LinphoneStatus redirect (const Address &redirectAddr);
virtual void startIncomingNotification ();
virtual int startInvite (const Address *destination, const std::string &subject = "");
virtual int startInvite (const Address *destination, const std::string &subject = "", const Content *content = nullptr);
LinphoneStatus terminate (const LinphoneErrorInfo *ei = nullptr);
LinphoneStatus update (const CallSessionParams *csp, const std::string &subject = "");
......
......@@ -4249,7 +4249,7 @@ void MediaSession::startIncomingNotification () {
CallSession::startIncomingNotification();
}
int MediaSession::startInvite (const Address *destination, const string &subject) {
int MediaSession::startInvite (const Address *destination, const string &subject, const Content *content) {
L_D();
linphone_core_stop_dtmf_stream(d->core);
d->makeLocalMediaDescription();
......@@ -4265,7 +4265,7 @@ int MediaSession::startInvite (const Address *destination, const string &subject
d->op->set_local_media_description(d->localDesc);
}
int result = CallSession::startInvite(destination, subject);
int result = CallSession::startInvite(destination, subject, content);
if (result < 0) {
if (d->state == LinphoneCallError)
d->stopStreams();
......
......@@ -48,7 +48,7 @@ public:
LinphoneStatus resume ();
void sendVfuRequest ();
void startIncomingNotification () override;
int startInvite (const Address *destination, const std::string &subject = "") override;
int startInvite (const Address *destination, const std::string &subject = "", const Content *content = nullptr) override;
void startRecording ();
void stopRecording ();
LinphoneStatus update (const MediaSessionParams *msp, const std::string &subject = "");
......
......@@ -42,12 +42,14 @@ Content::Content (const Content &src) : ClonableObject(*new ContentPrivate) {
L_D();
d->body = src.getBody();
d->contentType = src.getContentType();
d->contentDisposition = src.getContentDisposition();
}
Content::Content (Content &&src) : ClonableObject(*new ContentPrivate) {
L_D();
d->body = move(src.getPrivate()->body);
d->contentType = move(src.getPrivate()->contentType);
d->contentDisposition = move(src.getPrivate()->contentDisposition);
}
Content &Content::operator= (const Content &src) {
......@@ -55,6 +57,7 @@ Content &Content::operator= (const Content &src) {
if (this != &src) {
d->body = src.getBody();
d->contentType = src.getContentType();
d->contentDisposition = src.getContentDisposition();
}
return *this;
......@@ -64,6 +67,7 @@ Content &Content::operator= (Content &&src) {
L_D();
d->body = move(src.getPrivate()->body);
d->contentType = move(src.getPrivate()->contentType);
d->contentDisposition = move(src.getPrivate()->contentDisposition);
return *this;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment