PJ_DEF(void) pjsua_turn_config_from_media_config(pj_pool_t *pool,
                                                 pjsua_turn_config *dst,
                                                 const pjsua_media_config *src)
{
    dst->enable_turn = src->enable_turn;
    dst->turn_conn_type = src->turn_conn_type;
    if (pool == NULL) {
	dst->turn_server = src->turn_server;
	dst->turn_auth_cred = src->turn_auth_cred;

#if PJ_HAS_SSL_SOCK
	pj_memcpy(&dst->turn_tls_setting, &src->turn_tls_setting,
		  sizeof(src->turn_tls_setting));
#endif
    } else {
	if (pj_stricmp(&dst->turn_server, &src->turn_server))
	    pj_strdup(pool, &dst->turn_server, &src->turn_server);
	pj_stun_auth_cred_dup(pool, &dst->turn_auth_cred,
	                      &src->turn_auth_cred);

#if PJ_HAS_SSL_SOCK
	pj_turn_sock_tls_cfg_dup(pool, &dst->turn_tls_setting,
				 &src->turn_tls_setting);
#endif
    }
}
PJ_DEF(void) pjsua_turn_config_from_media_config(pj_pool_t *pool,
                                                 pjsua_turn_config *dst,
                                                 const pjsua_media_config *src)
{
    dst->enable_turn = src->enable_turn;
    dst->turn_conn_type = src->turn_conn_type;
    if (pool == NULL) {
	dst->turn_server = src->turn_server;
	dst->turn_auth_cred = src->turn_auth_cred;

#if PJ_HAS_SSL_SOCK
	pj_memcpy(&dst->turn_tls_setting, &src->turn_tls_setting,
		  sizeof(src->turn_tls_setting));
#endif
    } else {
	if (pj_stricmp(&dst->turn_server, &src->turn_server))
	    pj_strdup(pool, &dst->turn_server, &src->turn_server);
	pj_stun_auth_cred_dup(pool, &dst->turn_auth_cred,
	                      &src->turn_auth_cred);

#if PJ_HAS_SSL_SOCK
	pj_turn_sock_tls_cfg_dup(pool, &dst->turn_tls_setting,
				 &src->turn_tls_setting);
#endif
    }
}