Hamas in Gaza says it has reached an agreement with other militant groups to stop firing rockets into Israeli territory.