In case the parties to any such foreclosure action shall agree in writing upon terms of compromise settlement thereof, or of composition of the mortgage indebtedness, or both, the court shall have jurisdiction and may by its order confirm and approve such settlement or composition, or both, as the case may be.