Exhibit 5.1 May 1, 1998 Excel Switching Corporation 255 Independence Drive Hyannis, Massachusetts 02601 Re: Registration Statement on Form S-8 Relating to each of the Stock Option Program, the 1997 Stock Option Plan, the 1997 Non-Employee Director Stock Option Plan and the 1997 Employee Stock Purchase Plan of Excel Switching Corporation (all of the foregoing are hereinafter referred to collectively as the "Plans") Dear Sir or Madam: Reference is made to the above-captioned Registration Statement on Form S-8 (the "Registration Statement") to be filed by Excel Switching Corporation (the "Company") with the Securities and Exchange Commission under the Securities Act of 1933 relating to an aggregate of 14,139,480 shares of Common Stock, par value $.01 per share, of the Company issuable pursuant to the Plans (the "Shares"). We have examined, and are familiar with, and have relied as to factual matters solely upon, copies of the Plans, the Restated Articles of Organization and the Restated By-Laws of the Company, the minute books and stock records of the Company and originals of such other documents, certificates and proceedings as we have deemed necessary for the purpose of rendering this opinion. Based on the foregoing, we are of the opinion that the Shares have been duly authorized and, when issued and paid for in accordance with the terms of the related Plan and the terms of any agreement relating to any of the options granted thereunder, will be 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