mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-31 02:49:21 +00:00
- Make a call only if the requested configuration have been successfully fetched
- Add callbacks to follow remote provisioning fetching Current behaviour on URI: * 'sip:name@domain?method=call&fetch-config=dG90by54bWw=' will call only if the configuration have been fetched * 'sip:name@domain?method=call' will call with the current registered proxy
This commit is contained in:
parent
ab4741fb1e
commit
67a509f5df
6 changed files with 43 additions and 5 deletions
|
|
@ -191,12 +191,18 @@ bool App::setFetchConfig (QCommandLineParser *parser) {
|
|||
auto core = instance->getCore();
|
||||
if(core){
|
||||
filePath.replace('\\','/');
|
||||
core->setProvisioningUri(Utils::appStringToCoreString(filePath));
|
||||
parser->process(cleanParserKeys(parser, QStringList("fetch-config")));// Remove this parameter from the parser
|
||||
fetched = true;
|
||||
if(core->setProvisioningUri(Utils::appStringToCoreString(filePath)) == 0){
|
||||
parser->process(cleanParserKeys(parser, QStringList("fetch-config")));// Remove this parameter from the parser
|
||||
fetched = true;
|
||||
}else
|
||||
fetched = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!fetched){
|
||||
qWarning() <<"Remote provisionning cannot be retrieved. Command have beend cleaned";
|
||||
createParser();
|
||||
}
|
||||
}
|
||||
return fetched;
|
||||
}
|
||||
|
|
@ -891,7 +897,7 @@ void App::openAppAfterInit (bool mustBeIconified) {
|
|||
restart();
|
||||
else{
|
||||
// Launch call if wanted and clean parser
|
||||
if( mParser->isSet("call")){
|
||||
if( mParser->isSet("call") && coreManager->isLastRemoteProvisioningGood()){
|
||||
QString sipAddress = mParser->value("call");
|
||||
mParser->parse(cleanParserKeys(mParser, QStringList("call")));// Clean call from parser
|
||||
if(coreManager->started()){
|
||||
|
|
|
|||
|
|
@ -333,7 +333,7 @@ void Cli::Command::executeUri (const shared_ptr<linphone::Address> &address) con
|
|||
QStringList parameters = query.split('&');
|
||||
for(int i = 0 ; i < parameters.size() ; ++i){
|
||||
QStringList parameter = parameters[i].split('=');
|
||||
if( parameter[0] != "method"){
|
||||
if( parameter[0]!="" && parameter[0] != "method"){
|
||||
if(parameter.size() > 1)
|
||||
args[parameter[0]] = QByteArray::fromBase64(parameter[1].toUtf8() );
|
||||
else
|
||||
|
|
|
|||
|
|
@ -100,6 +100,18 @@ void CoreHandlers::onCallCreated(const shared_ptr<linphone::Core> &,
|
|||
emit callCreated(call);
|
||||
}
|
||||
|
||||
void CoreHandlers::onConfiguringStatus(
|
||||
const std::shared_ptr<linphone::Core> & core,
|
||||
linphone::ConfiguringState status,
|
||||
const std::string & message){
|
||||
Q_UNUSED(core)
|
||||
emit setLastRemoteProvisioningState(status);
|
||||
if(status == linphone::ConfiguringState::Failed){
|
||||
qWarning() << "Remote provisioning has failed and was removed : "<< QString::fromStdString(message);
|
||||
core->setProvisioningUri("");
|
||||
}
|
||||
}
|
||||
|
||||
void CoreHandlers::onDtmfReceived(
|
||||
const std::shared_ptr<linphone::Core> & lc,
|
||||
const std::shared_ptr<linphone::Call> & call,
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ signals:
|
|||
void presenceReceived (const QString &sipAddress, const std::shared_ptr<const linphone::PresenceModel> &presenceModel);
|
||||
void registrationStateChanged (const std::shared_ptr<linphone::ProxyConfig> &proxyConfig, linphone::RegistrationState state);
|
||||
void ecCalibrationResult(linphone::EcCalibratorStatus status, int delayMs);
|
||||
void setLastRemoteProvisioningState(const linphone::ConfiguringState &state);
|
||||
|
||||
private:
|
||||
|
||||
|
|
@ -92,6 +93,11 @@ private:
|
|||
const std::shared_ptr<linphone::Call> & call
|
||||
) override;
|
||||
|
||||
void onConfiguringStatus(
|
||||
const std::shared_ptr<linphone::Core> & core,
|
||||
linphone::ConfiguringState status,
|
||||
const std::string & message) override;
|
||||
|
||||
void onDtmfReceived(
|
||||
const std::shared_ptr<linphone::Core> & lc,
|
||||
const std::shared_ptr<linphone::Call> & call,
|
||||
|
|
|
|||
|
|
@ -76,8 +76,10 @@ CoreManager *CoreManager::mInstance;
|
|||
CoreManager::CoreManager (QObject *parent, const QString &configPath) :
|
||||
QObject(parent), mHandlers(make_shared<CoreHandlers>(this)) {
|
||||
mCore = nullptr;
|
||||
mLastRemoteProvisioningState = linphone::ConfiguringState::Skipped;
|
||||
CoreHandlers *coreHandlers = mHandlers.get();
|
||||
QObject::connect(coreHandlers, &CoreHandlers::coreStarting, this, &CoreManager::startIterate, Qt::QueuedConnection);
|
||||
QObject::connect(coreHandlers, &CoreHandlers::setLastRemoteProvisioningState, this, &CoreManager::setLastRemoteProvisioningState);
|
||||
QObject::connect(coreHandlers, &CoreHandlers::coreStarted, this, &CoreManager::initCoreManager, Qt::QueuedConnection);
|
||||
QObject::connect(coreHandlers, &CoreHandlers::coreStopped, this, &CoreManager::stopIterate, Qt::QueuedConnection);
|
||||
QObject::connect(coreHandlers, &CoreHandlers::logsUploadStateChanged, this, &CoreManager::handleLogsUploadStateChanged);
|
||||
|
|
@ -378,3 +380,11 @@ void CoreManager::handleLogsUploadStateChanged (linphone::Core::LogCollectionUpl
|
|||
QString CoreManager::getDownloadUrl () {
|
||||
return DownloadUrl;
|
||||
}
|
||||
|
||||
void CoreManager::setLastRemoteProvisioningState(const linphone::ConfiguringState& state){
|
||||
mLastRemoteProvisioningState = state;
|
||||
}
|
||||
|
||||
bool CoreManager::isLastRemoteProvisioningGood(){
|
||||
return mLastRemoteProvisioningState != linphone::ConfiguringState::Failed;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -145,10 +145,13 @@ public:
|
|||
|
||||
static bool isInstanciated(){return mInstance!=nullptr;}
|
||||
|
||||
bool isLastRemoteProvisioningGood();
|
||||
|
||||
public slots:
|
||||
void initCoreManager();
|
||||
void startIterate();
|
||||
void stopIterate();
|
||||
void setLastRemoteProvisioningState(const linphone::ConfiguringState& state);
|
||||
|
||||
signals:
|
||||
void coreManagerInitialized ();
|
||||
|
|
@ -185,6 +188,7 @@ private:
|
|||
std::shared_ptr<CoreHandlers> mHandlers;
|
||||
|
||||
bool mStarted = false;
|
||||
linphone::ConfiguringState mLastRemoteProvisioningState;
|
||||
|
||||
CallsListModel *mCallsListModel = nullptr;
|
||||
ContactsListModel *mContactsListModel = nullptr;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue