CallerID cid;
CallType ctype = ClassModem::CALLTYPE_UNKNOWN;
-again:
- if (modemWaitForRings(1, ctype, cid)) {
- if (cid.number != "" || cid.name != "") {
- received_cid = cid; // CNID is only sent once. Store it
- // for answering after later RINGs.
- traceServer("ANSWER: CID NUMBER \"%s\" NAME \"%s\"",
- (const char*) received_cid.number, (const char*) received_cid.name);
- faxApp::sendModemStatus(getModemDeviceID(), "C\"%s\"%s\"",
- (const char*) received_cid.number, (const char*) received_cid.name);
- }
- ++ringsHeard;
- if (ringsBeforeAnswer && ringsHeard >= ringsBeforeAnswer)
- answerPhone(ClassModem::ANSTYPE_ANY, ctype, received_cid);
- else if (isModemInput())
- goto again;
- else
- // NB: 10 second timeout should be plenty
- Dispatcher::instance().startTimer(10, 0, &answerHandler);
- } else
- answerCleanup();
+ bool again;
+
+ do {
+ again = false;
+
+ if (modemWaitForRings(1, ctype, cid)) {
+ if (cid.number != "" || cid.name != "") {
+ received_cid = cid; // CNID is only sent once. Store it
+ // for answering after later RINGs.
+ traceServer("ANSWER: CID NUMBER \"%s\" NAME \"%s\"",
+ (const char*) received_cid.number, (const char*) received_cid.name);
+ faxApp::sendModemStatus(getModemDeviceID(), "C\"%s\"%s\"",
+ (const char*) received_cid.number, (const char*) received_cid.name);
+ }
+ ++ringsHeard;
+ if (ringsBeforeAnswer && ringsHeard >= ringsBeforeAnswer)
+ answerPhone(ClassModem::ANSTYPE_ANY, ctype, received_cid);
+ else if (isModemInput())
+ again = true;
+ else
+ // NB: 10 second timeout should be plenty
+ Dispatcher::instance().startTimer(10, 0, &answerHandler);
+ } else
+ answerCleanup();
+ } while (again);
}
/*