Commit 546a0a33 authored by Gabriel Margiani's avatar Gabriel Margiani
Browse files

Fix busyall and add options for default busyall and mute.

parent 41ac7f44
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -43,7 +43,9 @@ std::map<std::string, std::string> p3::server::default_config {
	{"phone:ringtone", "/usr/share/3phone/rt.wav"},
	{"phone:holdmusic", "none"},
	{"phone:busy_on_busy", "true"},
	{"phone:busyall_exceptions", "none"}
	{"phone:busyall_exceptions", "none"},
	{"phone:default_busyall", "false"},
	{"phone:default_mute", "false"}

};

@@ -59,6 +61,7 @@ p3::server::server(bool& r) :
	p3::phonebook::set_config(conf);
	book.set_hook(hook);
	book.load();
	phone.load_busyall_exceptions();
}


+9 −5
Original line number Diff line number Diff line
@@ -28,11 +28,10 @@ p3::sipphone::sipphone(p3::config& c, p3::eventHook& e, p3::phonebook& b) :
	book(b),
	id_counter(0),
	active_call(-1),
	mute(false),
	always_busy(false),
	ring_index(0) 
{
	load_busyall_exceptions();
	always_busy = conf.get_bool("phone:default_busyall");
	mute = conf.get_bool("phone:default_mute");

	// Initiate pj
	endpoint = new pj::Endpoint;
@@ -156,7 +155,12 @@ void p3::sipphone::unregister_thread(const std::string& id) {

void p3::sipphone::load_busyall_exceptions() {
	for (const std::string &n : conf.get_string_list("phone:busyall_exceptions")) {
		busyall_exceptions.push_back(book.find_nr(n));
		std::string p = book.find_nr(n);
		if (p == "") {
			std::cout << "WARNING: No phone book entry found for busyall_exception '" << n << "'" << std::endl;
		} else {
			busyall_exceptions.push_back(p);
		}
	}
}