We consider the calculation of electromagnetic fields generated by an electron bunch passing through an anisotropic transversally non-homogeneous vacuum chamber of round or rectangular cross-section with translational symmetry in the beam direction. The described algorithms are implemented in a numerical code and cross-checked on several examples.