Loading src/account.cpp +2 −12 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ **/ #include "account.h" #include "call.h" #include "sipphone.h" p3::account::account(sipphone& p) : phone(p) {}; Loading @@ -27,14 +26,5 @@ void p3::account::onRegState(pj::OnRegStateParam &prm) { } void p3::account::onIncomingCall(pj::OnIncomingCallParam &iprm) { p3::call* c = phone.register_new_call(iprm.callId); phone.register_number(c->get_nr(), c->get_id()); pj::CallOpParam o; if (phone.get_call_count() < 1) { o.statusCode = PJSIP_SC_BUSY_HERE; c->answer(o); } else { o.statusCode = PJSIP_SC_RINGING; c->answer(o); } phone.handle_incoming_call(iprm.callId); } src/client.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,8 @@ std::map<std::string, std::string> p3::client::command_shorthands { {"m", "mute"}, {"ma", "muteall"}, {"a", "answer"}, {"b", "busy"}, {"ba", "busyall"}, {"l", "list"}, {"j", "conference"}, {"t", "transfer"}, Loading src/eventhook.cpp +0 −6 Original line number Diff line number Diff line Loading @@ -27,12 +27,6 @@ p3::eventHook::eventHook(config& c, phonebook& p) : conf(c), book(p), command(co } void p3::eventHook::run_hook(std::string event, int cid, std::string nr) { // TODO: Think of a better place for this if (conf.get_bool("phonebook:auto_add_unanswered")) { book.add(nr); } int pid = fork(); if (pid == 0) { execl( Loading src/main.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,8 @@ void print_usage() { << "p3 reload - reload phonebook and some parts of the configuration." << std::endl << "p3 c all [nr] - call someone" << std::endl << "p3 a nswer - answer a currently ringing call" << std::endl << "p3 b usy - answer busy to a currently ringing call" << std::endl << "p3 b usyall - toggle: answer all incoming calls with busy" << std::endl << "p3 l ist - list current calls" << std::endl << "p3 h angup [id] - hanup" << std::endl << "p3 ha ngupall - hanup all current calls" << std::endl Loading src/server.cpp +16 −1 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ std::map<std::string, std::string> p3::server::default_config { {"hook:command", "~/.3phone/hook"}, {"phone:ringtone", "/usr/share/3phone/rt.wav"}, {"phone:holdmusic", "none"}, {"phone:busy_on_busy", "true"}, }; Loading @@ -49,7 +50,7 @@ p3::server::server() : connection(p3::mQueue::DefaultId, true), book(), hook(conf, book), phone(conf, hook) phone(conf, hook, book) { p3::phonebook::set_config(conf); book.load(); Loading Loading @@ -168,6 +169,10 @@ void p3::clientHandler::parse_command(const std::string& c) { handle_mute(); } else if ("muteall" == c) { handle_mute_all(); } else if ("busy" == c) { handle_busy(); } else if ("busyall" == c) { handle_busy_all(); } else if ("conference" == c) { handle_conference(); } else if ("transfer" == c) { Loading Loading @@ -234,6 +239,16 @@ void p3::clientHandler::handle_mute_all() { connection.send(p3::protocol::OK, "(un)mute all OK"); } void p3::clientHandler::handle_busy() { phone.busy(get_call_id("Call to reject (id)")); connection.send(p3::protocol::OK, "busy OK"); } void p3::clientHandler::handle_busy_all() { phone.busyall_toggle(); connection.send(p3::protocol::OK, "busyall OK"); } void p3::clientHandler::handle_list() { send_calls_list(); connection.send(p3::protocol::OK, "List OK"); Loading Loading
src/account.cpp +2 −12 Original line number Diff line number Diff line Loading @@ -17,7 +17,6 @@ **/ #include "account.h" #include "call.h" #include "sipphone.h" p3::account::account(sipphone& p) : phone(p) {}; Loading @@ -27,14 +26,5 @@ void p3::account::onRegState(pj::OnRegStateParam &prm) { } void p3::account::onIncomingCall(pj::OnIncomingCallParam &iprm) { p3::call* c = phone.register_new_call(iprm.callId); phone.register_number(c->get_nr(), c->get_id()); pj::CallOpParam o; if (phone.get_call_count() < 1) { o.statusCode = PJSIP_SC_BUSY_HERE; c->answer(o); } else { o.statusCode = PJSIP_SC_RINGING; c->answer(o); } phone.handle_incoming_call(iprm.callId); }
src/client.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,8 @@ std::map<std::string, std::string> p3::client::command_shorthands { {"m", "mute"}, {"ma", "muteall"}, {"a", "answer"}, {"b", "busy"}, {"ba", "busyall"}, {"l", "list"}, {"j", "conference"}, {"t", "transfer"}, Loading
src/eventhook.cpp +0 −6 Original line number Diff line number Diff line Loading @@ -27,12 +27,6 @@ p3::eventHook::eventHook(config& c, phonebook& p) : conf(c), book(p), command(co } void p3::eventHook::run_hook(std::string event, int cid, std::string nr) { // TODO: Think of a better place for this if (conf.get_bool("phonebook:auto_add_unanswered")) { book.add(nr); } int pid = fork(); if (pid == 0) { execl( Loading
src/main.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,8 @@ void print_usage() { << "p3 reload - reload phonebook and some parts of the configuration." << std::endl << "p3 c all [nr] - call someone" << std::endl << "p3 a nswer - answer a currently ringing call" << std::endl << "p3 b usy - answer busy to a currently ringing call" << std::endl << "p3 b usyall - toggle: answer all incoming calls with busy" << std::endl << "p3 l ist - list current calls" << std::endl << "p3 h angup [id] - hanup" << std::endl << "p3 ha ngupall - hanup all current calls" << std::endl Loading
src/server.cpp +16 −1 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ std::map<std::string, std::string> p3::server::default_config { {"hook:command", "~/.3phone/hook"}, {"phone:ringtone", "/usr/share/3phone/rt.wav"}, {"phone:holdmusic", "none"}, {"phone:busy_on_busy", "true"}, }; Loading @@ -49,7 +50,7 @@ p3::server::server() : connection(p3::mQueue::DefaultId, true), book(), hook(conf, book), phone(conf, hook) phone(conf, hook, book) { p3::phonebook::set_config(conf); book.load(); Loading Loading @@ -168,6 +169,10 @@ void p3::clientHandler::parse_command(const std::string& c) { handle_mute(); } else if ("muteall" == c) { handle_mute_all(); } else if ("busy" == c) { handle_busy(); } else if ("busyall" == c) { handle_busy_all(); } else if ("conference" == c) { handle_conference(); } else if ("transfer" == c) { Loading Loading @@ -234,6 +239,16 @@ void p3::clientHandler::handle_mute_all() { connection.send(p3::protocol::OK, "(un)mute all OK"); } void p3::clientHandler::handle_busy() { phone.busy(get_call_id("Call to reject (id)")); connection.send(p3::protocol::OK, "busy OK"); } void p3::clientHandler::handle_busy_all() { phone.busyall_toggle(); connection.send(p3::protocol::OK, "busyall OK"); } void p3::clientHandler::handle_list() { send_calls_list(); connection.send(p3::protocol::OK, "List OK"); Loading