Loading src/client.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ std::map<std::string, std::string> p3::client::command_shorthands { {"j", "conference"}, {"t", "transfer"}, {"join", "conference"}, {"d", "dtmf"}, {"q", "quit"}, {"x", "exit"} }; Loading Loading @@ -112,6 +113,9 @@ void p3::client::run() { p3::mQueueMessage m = connection->receive(-1); bool print_list = true; switch (m.get_command()) { case p3::protocol::ASK: connection->send(p3::protocol::ANSWER, get_input(m.get_value(), WORD)); continue; case p3::protocol::ASK_NUMBER: connection->send(p3::protocol::ANSWER, get_input(m.get_value(), NUMBER)); continue; Loading src/client.h +2 −1 Original line number Diff line number Diff line Loading @@ -49,7 +49,8 @@ namespace p3 { enum inputType { COMMAND, NUMBER, ID ID, WORD }; bool interactive; Loading src/main.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ void print_usage() { << "p3 ma muteall - mute microphone for all calls." << std::endl << "p3 j oin - conference current calls" << std::endl << "p3 t ransfer [id] [nr] - forward call" << std::endl << "p3 d tmf [dgts] [id] - dial dtfm digits" << std::endl << "p3 r ecord [file] - record" << std::endl << "-I for an interactive shell" << std::endl; } Loading src/server.cpp +12 −0 Original line number Diff line number Diff line Loading @@ -170,6 +170,8 @@ void p3::clientHandler::parse_command(const std::string& c) { handle_list(); } else if ("reload" == c) { handle_reload(); } else if ("dtmf" == c) { handle_dtmf(); } else { std::cout << "Unknown command received: " << c << std::endl; connection.send(p3::protocol::ERROR, "Invalid Command '" + c + "'"); Loading Loading @@ -247,6 +249,16 @@ void p3::clientHandler::handle_reload() { connection.send(p3::protocol::OK, "reload OK"); } void p3::clientHandler::handle_dtmf() { connection.send(p3::protocol::ASK, "Digits to send"); p3::mQueueMessage n = connection.receive(listenTimeout); phone.dial_dtmf( get_call_id("Call do dial on (id)", p3::callState::RUNNING), n.get_value() ); connection.send(p3::protocol::OK, "dtmf OK"); } int p3::clientHandler::get_call_id(const std::string& q, p3::callState filter) { int nr = phone.get_call_count(filter); if (nr == 1) { Loading src/server.h +1 −0 Original line number Diff line number Diff line Loading @@ -116,6 +116,7 @@ namespace p3 { void handle_reload(); void handle_conference(); void handle_transfer(); void handle_dtmf(); void send_calls_list( callState filter = callState::NONE, Loading Loading
src/client.cpp +4 −0 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ std::map<std::string, std::string> p3::client::command_shorthands { {"j", "conference"}, {"t", "transfer"}, {"join", "conference"}, {"d", "dtmf"}, {"q", "quit"}, {"x", "exit"} }; Loading Loading @@ -112,6 +113,9 @@ void p3::client::run() { p3::mQueueMessage m = connection->receive(-1); bool print_list = true; switch (m.get_command()) { case p3::protocol::ASK: connection->send(p3::protocol::ANSWER, get_input(m.get_value(), WORD)); continue; case p3::protocol::ASK_NUMBER: connection->send(p3::protocol::ANSWER, get_input(m.get_value(), NUMBER)); continue; Loading
src/client.h +2 −1 Original line number Diff line number Diff line Loading @@ -49,7 +49,8 @@ namespace p3 { enum inputType { COMMAND, NUMBER, ID ID, WORD }; bool interactive; Loading
src/main.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,7 @@ void print_usage() { << "p3 ma muteall - mute microphone for all calls." << std::endl << "p3 j oin - conference current calls" << std::endl << "p3 t ransfer [id] [nr] - forward call" << std::endl << "p3 d tmf [dgts] [id] - dial dtfm digits" << std::endl << "p3 r ecord [file] - record" << std::endl << "-I for an interactive shell" << std::endl; } Loading
src/server.cpp +12 −0 Original line number Diff line number Diff line Loading @@ -170,6 +170,8 @@ void p3::clientHandler::parse_command(const std::string& c) { handle_list(); } else if ("reload" == c) { handle_reload(); } else if ("dtmf" == c) { handle_dtmf(); } else { std::cout << "Unknown command received: " << c << std::endl; connection.send(p3::protocol::ERROR, "Invalid Command '" + c + "'"); Loading Loading @@ -247,6 +249,16 @@ void p3::clientHandler::handle_reload() { connection.send(p3::protocol::OK, "reload OK"); } void p3::clientHandler::handle_dtmf() { connection.send(p3::protocol::ASK, "Digits to send"); p3::mQueueMessage n = connection.receive(listenTimeout); phone.dial_dtmf( get_call_id("Call do dial on (id)", p3::callState::RUNNING), n.get_value() ); connection.send(p3::protocol::OK, "dtmf OK"); } int p3::clientHandler::get_call_id(const std::string& q, p3::callState filter) { int nr = phone.get_call_count(filter); if (nr == 1) { Loading
src/server.h +1 −0 Original line number Diff line number Diff line Loading @@ -116,6 +116,7 @@ namespace p3 { void handle_reload(); void handle_conference(); void handle_transfer(); void handle_dtmf(); void send_calls_list( callState filter = callState::NONE, Loading