We investigate theoretically the steady incompressible viscoelastic flow in a rigid axisymmetric cylindrical pipe with varying cross-section. We use the Oldroyd-B viscoelastic constitutive equation to model the fluid viscoelasticity. First, we derive exact general formulae: for the total average pressure-drop as a function of the wall shear rate and the viscoelastic axial normal extra-stress; for the viscoelastic extra-stress tensor and the Trouton ratio as functions of the fluid velocity on the axis of symmetry; and for the viscoelastic extra-stress tensor along the wall in terms of the shear rate at the wall. Then we exploit the classic lubrication approximation, valid for small values of the square of the aspect ratio of the pipe, to simplify the original governing equations. The final equations are solved analytically using a regular perturbation scheme in terms of the Deborah number, De, up to eighth order in De. For a hyperbolically shaped pipe, we reveal that the reduced pressure-drop and the Trouton ratio can be recast in terms of a modified Deborah number, Dem, and the polymer viscosity ratio, η, only. Furthermore, we enhance the convergence and accuracy of the eighth-order solutions by deriving transformed analytical formulae using Padé diagonal approximants. The results show the decrease of the pressure drop and the enhancement of the Trouton ratio with increasing Dem and/or increasing η. Comparison of the transformed solutions with numerical simulations of the lubrication equations using pseudospectral methods shows excellent agreement between the results, even for high values of Dem and all values of η, revealing the robustness, validity and efficiency of the theoretical methods and techniques developed in this work. Last, it is shown that the exact solution for the Trouton ratio gives a well-defined and finite solution for any value of Dem and reveals the reason for the failure of the corresponding high-order perturbation series for Dem > 1/2.