Electron capture decay of cosmic rays: A model of the inhomogeneous interstellar medium