AT&T Inc., Verizon Communications Inc. and 10 other large phone companies have struck an agreement with 51 attorneys general to enact technology to block robocalls before they reach consumers.