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

Fix busyall and add options for default busyall and mute.

parent 41ac7f44
......@@ -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();
}
......
......@@ -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);
}
}
}
......@@ -165,7 +169,7 @@ void p3::sipphone::start_ringing() {
if (ring_index == 0) {
try {
pj::AudioMedia& play_med = endpoint->audDevManager().getPlaybackDevMedia();
pj::AudioMedia& play_med = endpoint->audDevManager().getPlaybackDevMedia();
ringtone->startTransmit(play_med);
ringtone->adjustTxLevel(2);
} catch (pj::Error& err) {
......
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