Pakistan parties agree to extend military courts