Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: baresip/baresip
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: edvinanet/baresip
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.
  • 1 commit
  • 3 files changed
  • 1 contributor

Commits on Apr 28, 2020

  1. Copy the full SHA
    efbb876 View commit details
Showing with 24 additions and 2 deletions.
  1. +9 −1 include/baresip.h
  2. +2 −0 src/config.c
  3. +13 −1 src/ua.c
10 changes: 9 additions & 1 deletion include/baresip.h
Original file line number Diff line number Diff line change
@@ -248,13 +248,21 @@ enum audio_mode {
AUDIO_MODE_THREAD, /**< Use dedicated thread */
};

/** TLS Min/Max versions */
struct config_tlsversion {
int min_version;
int max_version;
};

/** SIP User-Agent */
struct config_sip {
char uuid[64]; /**< Universally Unique Identifier */
char local[64]; /**< Local SIP Address */
char cert[256]; /**< SIP Certificate */
char cert[256]; /**< SIP client Certificate */
char tlsmethod[32]; /**< SIP client TLS method */
char key[256]; /**< SIP client private Key */
char cafile[256]; /**< SIP CA-file */
struct config_tlsversion client; /**< SIP TLS versions */
};

/** Call config */
2 changes: 2 additions & 0 deletions src/config.c
Original file line number Diff line number Diff line change
@@ -224,6 +224,8 @@ int config_parse_conf(struct config *cfg, const struct conf *conf)
sizeof(cfg->sip.cert));
(void)conf_get_str(conf, "sip_cafile", cfg->sip.cafile,
sizeof(cfg->sip.cafile));
(void)conf_get_str(conf, "sip_tlsmethod", cfg->sip.tlsmethod,
sizeof(cfg->sip.tlsmethod));

/* Call */
(void)conf_get_u32(conf, "call_local_timeout",
14 changes: 13 additions & 1 deletion src/ua.c
Original file line number Diff line number Diff line change
@@ -1287,13 +1287,25 @@ static int add_transp_af(const struct sa *laddr)
/* Build our SSL context*/
if (!uag.tls) {
const char *cert = NULL;
int tls_method = TLS_METHOD_SSLV23; /* The old default */

if (str_isset(uag.cfg->cert)) {
cert = uag.cfg->cert;
info("SIP Certificate: %s\n", cert);
}
if (str_isset(uag.cfg->tlsmethod)) {
if (strncasecmp(uag.cfg->tlsmethod, "tls1.0", sizeof(uag.cfg->tlsmethod)) == 0) {
tls_method = TLS_METHOD_TLS10;
} else if (strncasecmp(uag.cfg->tlsmethod, "tls1.1", sizeof(uag.cfg->tlsmethod)) == 0) {
tls_method = TLS_METHOD_TLS11;
} else if (strncasecmp(uag.cfg->tlsmethod, "tls1.2", sizeof(uag.cfg->tlsmethod)) == 0) {
tls_method = TLS_METHOD_TLS12;
} else {
warning("ua: unknown TLS method %s\n", uag.cfg->tlsmethod);
}
}

err = tls_alloc(&uag.tls, TLS_METHOD_SSLV23,
err = tls_alloc(&uag.tls, tls_method,
cert, NULL);
if (err) {
warning("ua: tls_alloc() failed: %m\n", err);