Commit 4efc809c authored by jpbl's avatar jpbl

We have line actions now

parent 8e25bc10
......@@ -50,6 +50,16 @@ PhoneLine::setLineStatus(const QString &status)
void
PhoneLine::setAction(const QString &status)
{
mActionTimer->stop();
mAction = status;
if(mSelected) {
emit actionChanged(mAction);
}
}
void
PhoneLine::setTempAction(const QString &status)
{
mActionTimer->stop();
mActionTimer->start(3000);
......@@ -98,6 +108,7 @@ PhoneLine::select(bool hardselect)
}
else {
setLineStatus("Ready.");
setAction("");
}
}
......@@ -226,7 +237,7 @@ void
PhoneLine::hold()
{
if(mCall) {
setAction("Holded.");
setAction("Holding...");
_debug("PhoneLine %d: Trying to Hold.\n", mLine);
mCall->hold();
}
......
......@@ -63,6 +63,7 @@ public:
public slots:
void setLineStatus(const QString &);
void setAction(const QString &);
void setTempAction(const QString &);
void resetAction();
void incomming(const Call &call);
......
......@@ -25,11 +25,11 @@ SFLPhoneApp::SFLPhoneApp(int argc, char **argv)
Requester::instance().registerObject< PermanentRequest >(QString("answer"));
Requester::instance().registerObject< PermanentRequest >(QString("notavailable"));
Requester::instance().registerObject< PermanentRequest >(QString("refuse"));
Requester::instance().registerObject< TemporaryRequest >(QString("senddtmf"));
Requester::instance().registerObject< PermanentRequest >(QString("call"));
Requester::instance().registerObject< PermanentRequest >(QString("hangup"));
Requester::instance().registerObject< TemporaryRequest >(QString("hold"));
Requester::instance().registerObject< TemporaryRequest >(QString("unhold"));
Requester::instance().registerObject< PermanentRequest >(QString("hangup"));
Requester::instance().registerObject< TemporaryRequest >(QString("senddtmf"));
}
void
......
......@@ -151,52 +151,32 @@ TemporaryRequest::TemporaryRequest(const QString &sequenceId,
void
TemporaryRequest::onError(Call call,
const QString &,
const QString &code,
const QString &message)
{
PhoneLine *line = PhoneLineManager::instance().getLine(call);
if(line) {
PhoneLineLocker guard(line, false);
line->setAction(message);
}
else {
_debug("We received an error on a temporary call "
"related request that doesn't have a phone "
"line (%s).\n",
call.id().toStdString().c_str());
}
onSuccess(call, code, message);
}
void
TemporaryRequest::onEntry(Call call,
const QString &,
const QString &code,
const QString &message)
{
PhoneLine *line = PhoneLineManager::instance().getLine(call);
if(line) {
PhoneLineLocker guard(line, false);
line->setAction(message);
}
else {
_debug("We received a status on a temporary call "
"related request that doesn't have a phone "
"line (%s).\n",
call.id().toStdString().c_str());
}
onSuccess(call, code, message);
}
void
TemporaryRequest::onSuccess(Call call,
const QString &,
const QString &,
const QString &message)
{
PhoneLine *line = PhoneLineManager::instance().getLine(call);
if(line) {
PhoneLineLocker guard(line, false);
line->setAction(message);
line->setTempAction(message);
}
else {
_debug("We received a success on a temporary call "
_debug("We received an answer on a temporary call "
"related request that doesn't have a phone "
"line (%s).\n",
call.id().toStdString().c_str());
......
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