Exhibit 5.1 ----------- [LETTERHEAD OF TESTA, HURWITZ & THIBEAULT, LLP APPEARS HERE] October 21, 1997 Excel Switching Corporation 255 Independence Drive Hyannis, MA 02601 Re: Registration Statement on Form S-1 Relating to 5,175,000 Shares of Common Stock -------------------------------------------- Ladies and Gentlemen: This opinion relates to an aggregate of 5,175,000 shares of Common Stock, $.01 par value per share (the "Common Stock"), of Excel Switching Corporation (the "Company"), which are the subject matter of a Registration Statement on Form S-1 filed with the Securities and Exchange Commission on even date herewith (the "Registration Statement"). The 5,175,000 shares of Common Stock covered by the Registration Statement consist of 4,500,000 shares being sold by the Company and 675,000 shares subject to an over-allotment option granted by a selling stockholder of the Company to the underwriters named in the prospectus (the "Prospectus") included in the Registration Statement. Based upon such investigation as we have deemed necessary, we are of the opinion that the shares of Common Stock being sold by the selling stockholder have been legally issued and are fully paid and non-assessable and that when the 4,500,000 shares of Common Stock to be sold by the Company pursuant to the Prospectus have been issued and paid for in accordance with the terms described in the Prospectus, such shares of Common Stock will have been validly issued and will be fully paid and nonassessable. We hereby consent to the filing of this opinion as Exhibit 5.1 to the Registration Statement and to the reference to our firm in the Prospectus under the caption "Legal Matters." Very truly yours, /s/ Testa, Hurwitz & Thibeault, LLP TESTA, HURWITZ & THIBEAULT, LLP