Diff
Modified: freeswitch/trunk/fscomm/call.cpp (16527 => 16528)
--- freeswitch/trunk/fscomm/call.cpp 2010-01-28 01:00:04 UTC (rev 16527)
+++ freeswitch/trunk/fscomm/call.cpp 2010-01-28 01:12:34 UTC (rev 16528)
@@ -78,3 +78,9 @@
QMessageBox::critical(0, QWidget::tr("DTMF Error"), QWidget::tr("There was an error sending DTMF, please report this bug."), QMessageBox::Ok);
}
}
+
+QTime Call::getCurrentStateTime()
+{
+ int now = QDateTime::fromTime_t(_answered_epoch).secsTo(QDateTime::currentDateTime());
+ return QTime::fromString(QString::number(now), "s");
+}
Modified: freeswitch/trunk/fscomm/call.h (16527 => 16528)
--- freeswitch/trunk/fscomm/call.h 2010-01-28 01:00:04 UTC (rev 16527)
+++ freeswitch/trunk/fscomm/call.h 2010-01-28 01:12:34 UTC (rev 16528)
@@ -63,6 +63,8 @@
bool isActive() { return _isActive == true; }
switch_status_t toggleRecord(bool);
void sendDTMF(QString digit);
+ void setAnsweredEpoch(qulonglong time) { _answered_epoch = time/1000000; }
+ QTime getCurrentStateTime();
private:
int _call_id;
@@ -75,6 +77,7 @@
bool _isActive;
QString _recording_filename;
fscomm_call_state_t _state;
+ qulonglong _answered_epoch;
};
Q_DECLARE_METATYPE(Call)
Modified: freeswitch/trunk/fscomm/fshost.cpp (16527 => 16528)
--- freeswitch/trunk/fscomm/fshost.cpp 2010-01-28 01:00:04 UTC (rev 16527)
+++ freeswitch/trunk/fscomm/fshost.cpp 2010-01-28 01:12:34 UTC (rev 16528)
@@ -177,6 +177,8 @@
switch(event->event_id) {
case SWITCH_EVENT_CHANNEL_ANSWER:
{
+ QString answeredEpoch = switch_event_get_header_nil(event, "Caller-Channel-Answered-Time");
+ call.data()->setAnsweredEpoch(answeredEpoch.toLong());
call.data()->setbUUID(switch_event_get_header_nil(event, "Other-Leg-Unique-ID"));
_bleg_uuids.insert(switch_event_get_header_nil(event, "Other-Leg-Unique-ID"), uuid);
call.data()->setState(FSCOMM_CALL_STATE_ANSWERED);
@@ -257,6 +259,8 @@
case SWITCH_EVENT_CHANNEL_ANSWER:
{
/* When do we get here? */
+ QString answeredEpoch = switch_event_get_header_nil(event, "Caller-Channel-Answered-Time");
+ call.data()->setAnsweredEpoch(answeredEpoch.toULongLong());
emit answered(call);
break;
}
Modified: freeswitch/trunk/fscomm/mainwindow.cpp (16527 => 16528)
--- freeswitch/trunk/fscomm/mainwindow.cpp 2010-01-28 01:00:04 UTC (rev 16527)
+++ freeswitch/trunk/fscomm/mainwindow.cpp 2010-01-28 01:12:34 UTC (rev 16528)
@@ -130,9 +130,10 @@
for(int row=0; row<ui->tableCalls->rowCount(); row++)
{
QTableWidgetItem* item = ui->tableCalls->item(row, 2);
- QTime time = QTime::fromString(item->text(),"hh:mm:ss");
- time = time.addSecs(1);
+ QSharedPointer<Call> call = g_FSHost.getCallByUUID(item->data(Qt::UserRole).toString());
+ QTime time = call.data()->getCurrentStateTime();
item->setText(time.toString("hh:mm:ss"));
+ item->setTextAlignment(Qt::AlignRight);
}
}