void MainWindow::voipCStateChanged() { const QString state = voipc.state(); if(state.compare("INCOMING") == 0) { incommingCall(); } else if (state.compare("CONNECTING") == 0) { setStatus(trUtf8("Estableciendo..."), SS_WAIT); } else if (state.compare("CONFIRMED") == 0) { confirmCall(); } else if (state.compare("DISCONNCTD") == 0) { disconnctdCall(); } }
/** * Parses CID and CIDLOG lines with the following format: * CID: *DATE*18052012*TIME*1743*LINE*0123456789*NMBR*0987654321*MESG*NONE*NAME*NO NAME* * CIDLOG: *DATE*11052012*TIME*1331*LINE*0123456789*NMBR*Anonym*MESG*NONE*NAME*NO NAME* * * @param line The line to parse */ void QNcidSocket::parseCID(QString line) { LogEntry entry; QDate date = QDate(0,0,0); QTime time = QTime(0,0); QStringList f = line.split("*"); for (int i=1; i<f.length()-1; i+=2) { if (f[i].compare("DATE",Qt::CaseInsensitive) == 0) { date.setDate(f[i+1].right(4).toInt(),f[i+1].mid(2,2).toInt(),f[i+1].left(2).toInt()); } else if (f[i].compare("TIME",Qt::CaseInsensitive) == 0) { time = QTime::fromString(f[i+1],"hhmm"); } else if (f[i].compare("LINE",Qt::CaseInsensitive) == 0) { entry.phoneLine = f[i+1]; } else if (f[i].compare("NMBR",Qt::CaseInsensitive) == 0) { entry.callerId = f[i+1]; } else if (f[i].compare("NAME",Qt::CaseInsensitive) == 0) { entry.name = f[i+1]; } else if (f[i].compare("MESG",Qt::CaseInsensitive) == 0) { entry.msg = f[i+1]; } else { qDebug() << "parseCID(): Unkown part:" << f[i+1]; } } entry.date = QDateTime(date, time); emit newLogEntry(entry); qDebug() << "parseCID(): Number:" << entry.callerId << "Time:" << entry.date.toString(); if (line.startsWith("CID:",Qt::CaseInsensitive)) emit incommingCall(entry); }