Re: why I recieived error message befor getting code?
If you're entering your phone number into your phone (to tell it what it's number is), you shouldn't. The SIM tells it what its phone number is. (Actually, the database your carrier maintains associates the SIM's number with your phone number. The number is shown in your phone just for your reference.)
If you're entering it to call your phone from another cellphone, if it's also an Iranian phone, the +98 is assumed, and should be ignored, but try entering the number without it. If it's a non-Iranian cellphone (so some other country code is assumed), enter 98, not +98. If it's a non-Iranian landline phone, you may have yo call the operator to place the call for you. (Some countries are still in the mid 20th century when it comes to landline infrastructure.)
If it still doesn't work, it's the carrier's problem, or the cellphone you're using is on a plan that can't be used to call Iran.