summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/config.c6
-rw-r--r--src/main.c9
2 files changed, 14 insertions, 1 deletions
diff --git a/src/config.c b/src/config.c
index d7d0b06..a6fcd26 100644
--- a/src/config.c
+++ b/src/config.c
@@ -38,6 +38,7 @@ static struct config core_config = {
/** Audio */
{
+ "",
"","",
"","",
"","",
@@ -162,6 +163,8 @@ int config_parse_conf(struct config *cfg, const struct conf *conf)
&cfg->call.local_timeout);
/* Audio */
+ (void)conf_get_str(conf, "audio_path", cfg->audio.audio_path,
+ sizeof(cfg->audio.audio_path));
(void)conf_get_csv(conf, "audio_player",
cfg->audio.play_mod,
sizeof(cfg->audio.play_mod),
@@ -259,6 +262,7 @@ int config_print(struct re_printf *pf, const struct config *cfg)
"call_local_timeout\t%u\n"
"\n"
"# Audio\n"
+ "audio_path\t\t%s\n"
"audio_player\t\t%s,%s\n"
"audio_source\t\t%s,%s\n"
"audio_alert\t\t%s,%s\n"
@@ -301,6 +305,7 @@ int config_print(struct re_printf *pf, const struct config *cfg)
cfg->call.local_timeout,
+ cfg->audio.audio_path,
cfg->audio.play_mod, cfg->audio.play_dev,
cfg->audio.src_mod, cfg->audio.src_dev,
cfg->audio.alert_mod, cfg->audio.alert_dev,
@@ -419,6 +424,7 @@ static int core_config_template(struct re_printf *pf, const struct config *cfg)
"call_local_timeout\t%u\n"
"\n"
"# Audio\n"
+ "#audio_path\t\t/usr/share/baresip\n"
"audio_player\t\t%s\n"
"audio_source\t\t%s\n"
"audio_alert\t\t%s\n"
diff --git a/src/main.c b/src/main.c
index 418fdc8..85e768b 100644
--- a/src/main.c
+++ b/src/main.c
@@ -70,6 +70,7 @@ int main(int argc, char *argv[])
bool prefer_ipv6 = false, run_daemon = false, test = false;
const char *ua_eprm = NULL;
const char *exec = NULL;
+ const char *audio_path = NULL;
const char *modv[16];
size_t modc = 0;
int err;
@@ -127,7 +128,7 @@ int main(int argc, char *argv[])
break;
case 'p':
- play_set_path(optarg);
+ audio_path = optarg;
break;
case 't':
@@ -157,6 +158,12 @@ int main(int argc, char *argv[])
goto out;
}
+ /* Set audio path preferring the one given in -p argument (if any) */
+ if (audio_path)
+ play_set_path(audio_path);
+ else if (str_isset(conf_config()->audio.audio_path))
+ play_set_path(conf_config()->audio.audio_path);
+
/*
* Initialise the top-level baresip struct, must be
* done AFTER configuration is complete.