mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-05-06 21:33:08 +00:00
Some fixes for call handling.
This commit is contained in:
parent
5069a4a508
commit
9a8181ee31
15 changed files with 51 additions and 33 deletions
|
|
@ -940,14 +940,20 @@ void linphone_call_update_ice_from_remote_media_description(LinphoneCall *call,
|
|||
void linphone_core_report_call_log(LinphoneCore *lc, LinphoneCallLog *call_log){
|
||||
bool_t call_logs_sqlite_db_found = FALSE;
|
||||
|
||||
// TODO: This is a workaround that has to be removed ASAP
|
||||
// Do not add calls made to the conference factory in the history
|
||||
char *to = linphone_address_as_string(call_log->to);
|
||||
const char *conference_factory_uri = linphone_core_get_conference_factory_uri(lc);
|
||||
if (strcmp(conference_factory_uri, to) == 0) {
|
||||
ms_free(to);
|
||||
if (conference_factory_uri && (strcmp(conference_factory_uri, to) == 0)) {
|
||||
bctbx_free(to);
|
||||
return;
|
||||
}
|
||||
ms_free(to);
|
||||
if (strstr(to, "chatroom-") == to) {
|
||||
bctbx_free(to);
|
||||
return;
|
||||
}
|
||||
bctbx_free(to);
|
||||
// End of workaround
|
||||
|
||||
#ifdef SQLITE_STORAGE_ENABLED
|
||||
if (lc->logs_db) {
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ private:
|
|||
void onChatMessageReceived (const std::shared_ptr<ChatMessage> &chatMessage) override;
|
||||
|
||||
std::string subject;
|
||||
std::list<std::shared_ptr<Participant>> participants;
|
||||
|
||||
L_DECLARE_PUBLIC(BasicChatRoom);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -42,7 +42,10 @@ BasicChatRoom::BasicChatRoom (
|
|||
BasicChatRoomPrivate &p,
|
||||
const std::shared_ptr<Core> &core,
|
||||
const ChatRoomId &chatRoomId
|
||||
) : ChatRoom(p, core, chatRoomId) {}
|
||||
) : ChatRoom(p, core, chatRoomId) {
|
||||
L_D();
|
||||
d->participants.push_back(make_shared<Participant>(getPeerAddress()));
|
||||
}
|
||||
|
||||
BasicChatRoom::CapabilitiesMask BasicChatRoom::getCapabilities () const {
|
||||
return static_cast<CapabilitiesMask>(Capabilities::Basic);
|
||||
|
|
@ -87,8 +90,9 @@ int BasicChatRoom::getNbParticipants () const {
|
|||
return 1;
|
||||
}
|
||||
|
||||
list<shared_ptr<Participant>> BasicChatRoom::getParticipants () const {
|
||||
return { make_shared<Participant>(getPeerAddress()) };
|
||||
const list<shared_ptr<Participant>> &BasicChatRoom::getParticipants () const {
|
||||
L_D();
|
||||
return d->participants;
|
||||
}
|
||||
|
||||
void BasicChatRoom::setParticipantAdminStatus (shared_ptr<Participant> &, bool) {
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public:
|
|||
|
||||
std::shared_ptr<Participant> getMe () const override;
|
||||
int getNbParticipants () const override;
|
||||
std::list<std::shared_ptr<Participant>> getParticipants () const override;
|
||||
const std::list<std::shared_ptr<Participant>> &getParticipants () const override;
|
||||
|
||||
void setParticipantAdminStatus (std::shared_ptr<Participant> &participant, bool isAdmin) override;
|
||||
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ int ClientGroupChatRoom::getNbParticipants () const {
|
|||
return RemoteConference::getNbParticipants();
|
||||
}
|
||||
|
||||
list<shared_ptr<Participant>> ClientGroupChatRoom::getParticipants () const {
|
||||
const list<shared_ptr<Participant>> &ClientGroupChatRoom::getParticipants () const {
|
||||
return RemoteConference::getParticipants();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ public:
|
|||
|
||||
std::shared_ptr<Participant> getMe () const override;
|
||||
int getNbParticipants () const override;
|
||||
std::list<std::shared_ptr<Participant>> getParticipants () const override;
|
||||
const std::list<std::shared_ptr<Participant>> &getParticipants () const override;
|
||||
|
||||
void setParticipantAdminStatus (std::shared_ptr<Participant> &participant, bool isAdmin) override;
|
||||
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ int ServerGroupChatRoom::getNbParticipants () const {
|
|||
return 0;
|
||||
}
|
||||
|
||||
list<shared_ptr<Participant>> ServerGroupChatRoom::getParticipants () const {
|
||||
const list<shared_ptr<Participant>> &ServerGroupChatRoom::getParticipants () const {
|
||||
return LocalConference::getParticipants();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ public:
|
|||
|
||||
std::shared_ptr<Participant> getMe () const override;
|
||||
int getNbParticipants () const override;
|
||||
std::list<std::shared_ptr<Participant>> getParticipants () const override;
|
||||
const std::list<std::shared_ptr<Participant>> &getParticipants () const override;
|
||||
|
||||
void setParticipantAdminStatus (std::shared_ptr<Participant> &participant, bool isAdmin) override;
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ public:
|
|||
virtual const IdentityAddress &getConferenceAddress () const = 0;
|
||||
virtual std::shared_ptr<Participant> getMe () const = 0;
|
||||
virtual int getNbParticipants () const = 0;
|
||||
virtual std::list<std::shared_ptr<Participant>> getParticipants () const = 0;
|
||||
virtual const std::list<std::shared_ptr<Participant>> &getParticipants () const = 0;
|
||||
virtual const std::string &getSubject () const = 0;
|
||||
virtual void join () = 0;
|
||||
virtual void leave () = 0;
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ int Conference::getNbParticipants () const {
|
|||
return static_cast<int>(d->participants.size());
|
||||
}
|
||||
|
||||
list<shared_ptr<Participant>> Conference::getParticipants () const {
|
||||
const list<shared_ptr<Participant>> &Conference::getParticipants () const {
|
||||
L_D();
|
||||
return d->participants;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ public:
|
|||
const IdentityAddress &getConferenceAddress () const override;
|
||||
std::shared_ptr<Participant> getMe () const override;
|
||||
int getNbParticipants () const override;
|
||||
std::list<std::shared_ptr<Participant>> getParticipants () const override;
|
||||
const std::list<std::shared_ptr<Participant>> &getParticipants () const override;
|
||||
const std::string &getSubject () const override;
|
||||
void join () override;
|
||||
void leave () override;
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ void LocalConference::addParticipant (const IdentityAddress &addr, const CallSes
|
|||
if (participant)
|
||||
return;
|
||||
participant = make_shared<Participant>(addr);
|
||||
participant->getPrivate()->createSession(*this, params, hasMedia, this);
|
||||
d->participants.push_back(participant);
|
||||
if (!d->activeParticipant)
|
||||
d->activeParticipant = participant;
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ public:
|
|||
int computeDuration () const;
|
||||
virtual void initializeParamsAccordingToIncomingCallParams ();
|
||||
virtual void setState (LinphoneCallState newState, const std::string &message);
|
||||
void startIncomingNotification ();
|
||||
bool startPing ();
|
||||
void setPingTime (int value) { pingTime = value; }
|
||||
|
||||
|
|
|
|||
|
|
@ -177,6 +177,27 @@ void CallSessionPrivate::setState(LinphoneCallState newState, const string &mess
|
|||
}
|
||||
}
|
||||
|
||||
void CallSessionPrivate::startIncomingNotification () {
|
||||
L_Q();
|
||||
if (listener)
|
||||
listener->onIncomingCallSessionStarted(q->getSharedFromThis());
|
||||
|
||||
setState(LinphoneCallIncomingReceived, "Incoming CallSession");
|
||||
|
||||
/* From now on, the application is aware of the call and supposed to take background task or already submitted notification to the user.
|
||||
* We can then drop our background task. */
|
||||
#if 0
|
||||
if (call->bg_task_id!=0) {
|
||||
sal_end_background_task(call->bg_task_id);
|
||||
call->bg_task_id=0;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (state == LinphoneCallIncomingReceived) {
|
||||
handleIncomingReceivedStateInIncomingNotification();
|
||||
}
|
||||
}
|
||||
|
||||
bool CallSessionPrivate::startPing () {
|
||||
if (core->sip_conf.ping_with_options) {
|
||||
/* Defer the start of the call after the OPTIONS ping for outgoing call or
|
||||
|
|
@ -850,23 +871,7 @@ void CallSession::startIncomingNotification () {
|
|||
return;
|
||||
}
|
||||
|
||||
if (d->listener)
|
||||
d->listener->onIncomingCallSessionStarted(getSharedFromThis());
|
||||
|
||||
d->setState(LinphoneCallIncomingReceived, "Incoming CallSession");
|
||||
|
||||
/* From now on, the application is aware of the call and supposed to take background task or already submitted notification to the user.
|
||||
* We can then drop our background task. */
|
||||
#if 0
|
||||
if (call->bg_task_id!=0) {
|
||||
sal_end_background_task(call->bg_task_id);
|
||||
call->bg_task_id=0;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (d->state == LinphoneCallIncomingReceived) {
|
||||
d->handleIncomingReceivedStateInIncomingNotification();
|
||||
}
|
||||
d->startIncomingNotification();
|
||||
}
|
||||
|
||||
int CallSession::startInvite (const Address *destination, const string &subject, const Content *content) {
|
||||
|
|
|
|||
|
|
@ -610,7 +610,7 @@ float MediaSessionPrivate::aggregateQualityRatings (float audioRating, float vid
|
|||
void MediaSessionPrivate::setState (LinphoneCallState newState, const string &message) {
|
||||
L_Q();
|
||||
/* Take a ref on the session otherwise it might get destroyed during the call to setState */
|
||||
shared_ptr<CallSession> session = q->getSharedFromThis();
|
||||
shared_ptr<CallSession> sessionRef = q->getSharedFromThis();
|
||||
CallSessionPrivate::setState(newState, message);
|
||||
updateReportingCallState();
|
||||
}
|
||||
|
|
@ -2092,7 +2092,7 @@ void MediaSessionPrivate::handleIceEvents (OrtpEvent *ev) {
|
|||
updateLocalMediaDescriptionFromIce();
|
||||
op->set_local_media_description(localDesc);
|
||||
deferIncomingNotification = false;
|
||||
static_cast<CallSession *>(q)->startIncomingNotification();
|
||||
startIncomingNotification();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue