Commit 69c2410e authored by Gabriel Margiani's avatar Gabriel Margiani

added reregister command

parent 54ad7c18
......@@ -41,6 +41,8 @@ std::map<std::string, std::string> p3::client::command_shorthands {
{"t", "transfer"},
{"join", "conference"},
{"d", "dtmf"},
{"rr", "reregister"},
{"rl", "reload"},
{"q", "quit"},
{"x", "exit"}
};
......
......@@ -39,6 +39,7 @@ void print_usage() {
<< "p3 quit, stop - terminate server" << std::endl
<< "p3 restart - restart server" << std::endl
<< "p3 reload - reload phonebook and some parts of the configuration." << std::endl
<< "p3 reregister - renew registration on sip server." << 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
......@@ -52,7 +53,6 @@ void print_usage() {
<< "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
<< "-v for verbose output (not with serve)" << std::endl;
}
......
......@@ -186,6 +186,8 @@ void p3::clientHandler::parse_command(const std::string& c) {
handle_transfer();
} else if ("list" == c) {
handle_list();
} else if ("reregister" == c) {
handle_reregister();
} else if ("reload" == c) {
handle_reload();
} else if ("dtmf" == c) {
......@@ -280,6 +282,11 @@ void p3::clientHandler::handle_reload() {
connection.send(p3::protocol::OK, "reload OK");
}
void p3::clientHandler::handle_reregister() {
phone.renew_registration();
connection.send(p3::protocol::OK, "reregister OK");
}
void p3::clientHandler::handle_dtmf() {
connection.send(p3::protocol::ASK, "Digits to send");
p3::mQueueMessage n = connection.receive(listenTimeout);
......
......@@ -119,6 +119,7 @@ namespace p3 {
void handle_busy();
void handle_busy_all();
void handle_reload();
void handle_reregister();
void handle_conference();
void handle_transfer();
void handle_dtmf();
......
......@@ -180,6 +180,10 @@ void p3::sipphone::stop_ringing() {
ring_index--;
}
void p3::sipphone::renew_registration() {
acc->setRegistration(true);
}
p3::call* p3::sipphone::register_new_call(int pjid) {
std::lock_guard<std::recursive_mutex> g(calls_mutex);
if (calls.empty()) {
......
......@@ -91,6 +91,8 @@ namespace p3 {
void register_thread(const std::string& id);
void unregister_thread(const std::string& id);
void renew_registration();
void call(const std::string& nr);
void hangup(int id = -1);
void hangup_all();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment