Commit ccfe762f authored by Gabriel Margiani's avatar Gabriel Margiani
Browse files

Add mute and hold state to call list.

parent 5d220d23
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -114,8 +114,8 @@ p3::callState p3::call::get_state() {
	return state;
}

char p3::call::get_state_char() {
	return static_cast<char>(state);
std::string p3::call::get_state_string() {
	return std::string() + static_cast<char>(state) + (mute ? "m" : " ") + (isOnHold ? "h" : " ") ;
}

void p3::call::hold_toggle() {
+1 −1
Original line number Diff line number Diff line
@@ -68,7 +68,7 @@ namespace p3 {
			std::string get_nr();

			callState get_state();
			char get_state_char();
			std::string get_state_string();

			void hold_toggle();
			void mute_toggle();
+3 −3
Original line number Diff line number Diff line
@@ -437,14 +437,14 @@ int p3::sipphone::get_call_count(p3::callState filter) {
	return co;
}

std::map<int, std::pair<std::string, char> > p3::sipphone::get_call_list(p3::callState filter) {
	std::map<int, std::pair<std::string, char> > s;
std::map<int, std::pair<std::string, std::string> > p3::sipphone::get_call_list(p3::callState filter) {
	std::map<int, std::pair<std::string, std::string> > s;
	std::lock_guard<std::recursive_mutex> g(calls_mutex);
	for (auto a : calls) {
		if (filter != p3::callState::NONE && a.second->get_state() != filter) {
			continue;
		}
		s[a.first] = { a.second->get_nr(), a.second->get_state_char() };
		s[a.first] = { a.second->get_nr(), a.second->get_state_string() };
	}
	return s;
}
+1 −1
Original line number Diff line number Diff line
@@ -110,7 +110,7 @@ namespace p3 {
			void dial_dtmf(int id, const std::string& digits);

			int get_call_count(callState filter = callState::NONE);
			std::map<int, std::pair<std::string, char> > get_call_list(callState filter = callState::NONE);
			std::map<int, std::pair<std::string, std::string> > get_call_list(callState filter = callState::NONE);

			int get_id_by_nr(const std::string& nr);
			std::string get_nr_by_id(int id = -1);