- Fix Update conference from existing calls.

- Show conferences only for the current account.
- Accept call with the requested account (test)
This commit is contained in:
Julien Wadel 2022-01-19 14:22:21 +01:00
parent 9029c33215
commit dc997150ce
4 changed files with 106 additions and 12 deletions

View file

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
version="1.1"
id="svg2"
width="80"
height="80"
viewBox="0 0 80 80"
sodipodi:docname="calendar_participants_custom.svg"
inkscape:version="1.1.1 (3bf5ae0d25, 2021-09-20)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs6" />
<sodipodi:namedview
id="namedview4"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
showgrid="false"
inkscape:zoom="16.361665"
inkscape:cx="35.112563"
inkscape:cy="39.054705"
inkscape:window-width="1920"
inkscape:window-height="1043"
inkscape:window-x="1920"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="g8" />
<g
inkscape:groupmode="layer"
inkscape:label="Image"
id="g8">
<ellipse
style="fill:#000000;fill-opacity:0.00214251;fill-rule:evenodd;stroke:#000000;stroke-width:4.912;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.829898;paint-order:stroke fill markers"
id="path1021"
cx="40.049999"
cy="29.935541"
rx="8.3143759"
ry="8.3581972" />
<path
style="fill:none;stroke:#000000;stroke-width:5.019;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 22.625379,59.537559 C 20.852602,42.5342 34.990346,45.364885 38.035408,45.118993 c 0.862155,-0.0059 0.856369,0.0053 1.982855,0.0175 4.052775,0.04406 19.276663,-1.075963 17.436412,14.344184"
id="path2356"
sodipodi:nodetypes="ccsc" />
<rect
style="fill:#000000;fill-opacity:0.00214251;fill-rule:evenodd;stroke:#000000;stroke-width:3.841;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:normal"
id="rect4364"
width="35.325611"
height="0.065393761"
x="22.402658"
y="57.667183" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.2 KiB

View file

@ -464,7 +464,15 @@ void CallModel::accept (bool withVideo) {
shared_ptr<linphone::CallParams> params = core->createCallParams(mCall);
params->enableVideo(withVideo);
setRecordFile(params);
auto localAddress = mCall->getCallLog()->getLocalAddress();
std::list<std::shared_ptr<linphone::ProxyConfig>> proxies = core->getProxyConfigList() ;
for(auto proxy : proxies){
if(proxy->getIdentityAddress()->weakEqual(localAddress)) {
params->setProxyConfig(proxy);
break;
}
}
mCall->acceptWithParams(params);
}
}

View file

@ -147,29 +147,46 @@ bool ConferenceHelperModel::ConferenceAddModel::removeFromConference (const QStr
void ConferenceHelperModel::ConferenceAddModel::update () {
shared_ptr<linphone::Conference> conference = mConferenceHelperModel->mCore->getConference();
bool enablingVideo = true;// Video is not yet fully supported by the application in conference
if(!conference){
auto parameters = mConferenceHelperModel->mCore->createConferenceParams(conference);
parameters->enableVideo(false);// Video is not yet fully supported by the application in conference
parameters->enableVideo(enablingVideo);
conference = mConferenceHelperModel->mCore->createConferenceWithParams(parameters);
}
auto currentCalls = CoreManager::getInstance()->getCore()->getCalls();
list<shared_ptr<linphone::Address>> allLinphoneAddresses;
list<shared_ptr<linphone::Address>> newCalls;
list<shared_ptr<linphone::Call>> runningCallsToAdd;
//1) Invite participants first to avoid removing conference if empty
for (const auto &map : mRefs) {
shared_ptr<linphone::Address> linphoneAddress = map->value("__linphoneAddress").value<shared_ptr<linphone::Address>>();
Q_CHECK_PTR(linphoneAddress);
allLinphoneAddresses.push_back(linphoneAddress);
auto haveCall = std::find_if(currentCalls.begin(), currentCalls.end(), [linphoneAddress](const std::shared_ptr<linphone::Call>& call){
return call->getRemoteAddress()->weakEqual(linphoneAddress);
});
if( haveCall == currentCalls.end())
newCalls.push_back(linphoneAddress);
else
runningCallsToAdd.push_back(*haveCall);
}
if( allLinphoneAddresses.size() > 0){
// 1) Add running calls
if( runningCallsToAdd.size() > 0){
conference->addParticipants(runningCallsToAdd);
}
//1) Invite participants
if( newCalls.size() > 0){
auto parameters = CoreManager::getInstance()->getCore()->createCallParams(nullptr);
parameters->enableVideo(false);
parameters->enableVideo(enablingVideo);
conference->inviteParticipants(
allLinphoneAddresses,
newCalls,
parameters
);
}
// 2) Put in pause and remove all calls that are not in the conference list
// 3) Put in pause and remove all calls that are not in the conference list
for(const auto &call : CoreManager::getInstance()->getCore()->getCalls()){
const std::string callAddress = call->getRemoteAddress()->asStringUriOnly();
auto address = allLinphoneAddresses.begin();

View file

@ -39,12 +39,21 @@
ConferenceInfoMapModel::ConferenceInfoMapModel (QObject *parent) : QAbstractListModel(parent) {
auto conferenceInfos = CoreManager::getInstance()->getCore()->getConferenceInformationList();
auto me = CoreManager::getInstance()->getCore()->getDefaultAccount()->getParams()->getIdentityAddress();
for(auto conferenceInfo : conferenceInfos){
auto conferenceInfoModel = ConferenceInfoModel::create( conferenceInfo );
QDate t = conferenceInfoModel->getDateTime().date();
if( !mMappedList.contains(t))
mMappedList[t] = new ConferenceInfoListModel();
mMappedList[t]->add(conferenceInfoModel);
std::list<std::shared_ptr<linphone::Address>> participants = conferenceInfo->getParticipants();
bool haveMe = conferenceInfo->getOrganizer()->weakEqual(me);
if(!haveMe)
haveMe = (std::find_if(participants.begin(), participants.end(), [me](const std::shared_ptr<linphone::Address>& address){
return me->weakEqual(address);
}) != participants.end());
if(haveMe){
auto conferenceInfoModel = ConferenceInfoModel::create( conferenceInfo );
QDate t = conferenceInfoModel->getDateTime().date();
if( !mMappedList.contains(t))
mMappedList[t] = new ConferenceInfoListModel();
mMappedList[t]->add(conferenceInfoModel);
}
}
}