diff options
author | Juha Heinanen <jh@tutpro.com> | 2016-06-07 21:24:40 +0300 |
---|---|---|
committer | Juha Heinanen <jh@tutpro.com> | 2016-06-07 21:24:40 +0300 |
commit | 44bca9a3fcb5d500f4f1c8ae922423b40140c1fe (patch) | |
tree | 91f08362b9637dda1f51279499825a7c713b2cb0 | |
parent | 291332d58c3bc67eb3f937704e1005aeee673d7e (diff) |
config: added 'audio_path' config variable
-rw-r--r-- | include/baresip.h | 1 | ||||
-rw-r--r-- | src/config.c | 6 | ||||
-rw-r--r-- | src/main.c | 9 |
3 files changed, 15 insertions, 1 deletions
diff --git a/include/baresip.h b/include/baresip.h index 54eee5e..3a45ddf 100644 --- a/include/baresip.h +++ b/include/baresip.h @@ -162,6 +162,7 @@ struct config_call { /** Audio */ struct config_audio { + char audio_path[256]; /**< Audio file directory */ char src_mod[16]; /**< Audio source module */ char src_dev[128]; /**< Audio source device */ char play_mod[16]; /**< Audio playback module */ 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" @@ -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. |