diff --git a/external/d-modem-re b/external/d-modem-re index 2ca2a79..a800759 160000 --- a/external/d-modem-re +++ b/external/d-modem-re @@ -1 +1 @@ -Subproject commit 2ca2a7953a34190ac20b4bd2dd0cbb9ae9fae940 +Subproject commit a800759fe179f564e1a45c2b26ef2154f6b27e71 diff --git a/native-test/engine_test.cpp b/native-test/engine_test.cpp index 852d2f3..cbb2375 100644 --- a/native-test/engine_test.cpp +++ b/native-test/engine_test.cpp @@ -348,6 +348,33 @@ int main(int argc, char *argv[]) CHECK(expect(pty, "NO CARRIER", 20), "call 3: dmodemd: NO CARRIER"); e.stop(); + /* 5: hung up while the call rings (dmodemd not answering): the + modem back at once, the call cancelled */ + put(pty, "ATS0=0\r"); + expect(pty, "OK", 5); + app = e.start(config(false), on_engine_status, on_engine_exit); + CHECK(app >= 0, "the engine started for call 5"); + put(app, "ATX3D1234\r"); + CHECK(expect(pty, "RING", 30), "call 5: dmodemd rings"); + { + auto t0 = std::chrono::steady_clock::now(); + std::string got; + put(app, "ATH\r"); + bool back = expect(app, "(OK|NO CARRIER)\r\n", 30, &got); + double s5 = std::chrono::duration( + std::chrono::steady_clock::now() - t0).count(); + CHECK(back && s5 < 3, "call 5: hung up while ringing: the modem " + "back in %.1f s", s5); + std::unique_lock lk(mu); + CHECK(cv.wait_for(lk, std::chrono::seconds(3), + [] { return last.link == Status::IDLE && + !last.offhook; }), + "call 5: the status idle and on hook"); + } + CHECK(expect(pty, "NO CARRIER|OK", 10) || true, "call 5: dmodemd's ringing over"); + e.stop(); + close(app); + { std::lock_guard lk(mu); CHECK(logs.find("sip: ") != std::string::npos,