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

added reregister command

parent 54ad7c18
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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"}
};
+1 −1
Original line number Diff line number Diff line
@@ -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;
}
+7 −0
Original line number Diff line number Diff line
@@ -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);
+1 −0
Original line number Diff line number Diff line
@@ -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();
+4 −0
Original line number Diff line number Diff line
@@ -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()) {
Loading