From 4937fe4d40e83a2c018e398c693c9f4ab9696675 Mon Sep 17 00:00:00 2001 From: "Alfred E. Heggestad" Date: Sat, 21 Jan 2017 15:27:42 +0100 Subject: account: expose STUN credentials --- src/account.c | 47 +++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 43 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/account.c b/src/account.c index 40875f5..0e84eef 100644 --- a/src/account.c +++ b/src/account.c @@ -383,11 +383,11 @@ int account_alloc(struct account **accp, const char *sipaddr) goto out; } - if (acc->mnatid) { - err = stunsrv_decode(acc, &acc->laddr); - if (err) - goto out; + err = stunsrv_decode(acc, &acc->laddr); + if (err) + goto out; + if (acc->mnatid) { acc->mnat = mnat_find(baresip_mnatl(), acc->mnatid); if (!acc->mnat) { warning("account: medianat not found: `%s'\n", @@ -543,6 +543,45 @@ uint32_t account_ptime(const struct account *acc) } +/** + * Get the STUN username of an account + * + * @param acc User-Agent account + * + * @return STUN username + */ +const char *account_stun_user(const struct account *acc) +{ + return acc ? acc->stun_user : NULL; +} + + +/** + * Get the STUN password of an account + * + * @param acc User-Agent account + * + * @return STUN password + */ +const char *account_stun_pass(const struct account *acc) +{ + return acc ? acc->stun_pass : NULL; +} + + +/** + * Get the STUN hostname of an account + * + * @param acc User-Agent account + * + * @return STUN hostname + */ +const char *account_stun_host(const struct account *acc) +{ + return acc ? acc->stun_host : NULL; +} + + static const char *answermode_str(enum answermode mode) { switch (mode) { -- cgit v1.2.3