Is there a formula for the calculation of a MBS scheduled payment (if there is a prepayment)?

I know that if there is no prepayment the calculation is

Mortgage_Pmt=Mortgage_Obal(i(1+i)^n/[(1+i)^n-1]) where i = WAC/12

(The reference in the notes refers to a Fabozzi’s text Chapter 19 for the mathermatics but this is not available on the web)

I’ve tried unsuccessfully to derive the formula from a known SMM but without success.

The Mock exam afternoon B (Richter) has an answer set which I cannot determine without a formula.

Any suggestions?

Thanks