Exhibit 5.1 July 23, 1999 Excel Switching Corporation 255 Independence Drive Hyannis, Massachusetts 02601 Re: Registration Statement on Form S-8 Relating to each of the Amended and Restated 1997 Stock Option Plan, the Stock Option Program and the Rascom, Inc. 1996 Stock Plan (collectively, the "Plans") Ladies and Gentlemen: Reference is made to the above-captioned Registration Statement on Form S-8 (the "Registration Statement") filed by Excel Switching Corporation (the "Company") with the Securities and Exchange Commission under the Securities Act of 1933, as amended, relating to an aggregate of 2,453,791 shares of Common Stock, $.01 par value, of the Company to be issued pursuant to the Plans (the "Shares"). In rendering this opinion, we have examined original or certified copies of the Company's Restated Articles of Organization, the Company's Restated By-Laws, the corporate records of the Company, and such other certificates, documents, records and materials as we have deemed necessary for the purpose of rendering this opinion. We are members only of the Bar of the Commonwealth of Massachusetts and are not experts in, and express no opinion regarding, the laws of any jurisdiction other than the Commonwealth of Massachusetts and the United States of America. Based upon and subject to the foregoing, we are of the opinion that the Shares issued or proposed to be issued by the Company pursuant to the Plans have been duly authorized and will be, upon receipt of the consideration provided for in the Plans, validly issued, fully paid and nonassessable. We hereby consent to the filing of this opinion as Exhibit 5.1 to the Registration Statement. Very truly yours, /s/ Testa, Hurwitz & Thibeault, LLP TESTA, HURWITZ & THIBEAULT, LLP