diff options
author | Alfred E. Heggestad <alfred.heggestad@gmail.com> | 2017-01-21 15:27:42 +0100 |
---|---|---|
committer | Alfred E. Heggestad <alfred.heggestad@gmail.com> | 2017-01-21 15:27:42 +0100 |
commit | 4937fe4d40e83a2c018e398c693c9f4ab9696675 (patch) | |
tree | 1162a2cfe83a02c5702ff0ccca95685e78e9b212 /src | |
parent | a5d4cf8631e140a2224e4b73712c8b2c2251b6e6 (diff) |
account: expose STUN credentials
Diffstat (limited to 'src')
-rw-r--r-- | src/account.c | 47 |
1 files changed, 43 insertions, 4 deletions
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) { |