The first you need to call or chat online with an AT&T representative and request an unlock code for your iPhone 4/4S. You can only do this if your iDevice is currently out of contract.
If your iDevice is out of contract, AT&T will agree to unlock your handset. This process will take anywhere from a few hours to a few days for the unlock code to be issued by Apple. Once this has happened you will receive an email from AT&T for further instructions.
After you receive email notification from AT&T the next process will work for all iPhone models except the iPhone 4S.
To save your Jailbreak while unlocking your iPhone via AT&T you will need to download the latest version of Redsn0w for Windows or Mac, extract the files and run the executable file.
Once you’ve done this select Jailbreak and then put your iPhone in DFU mode.
Click this link if you are unfamiliar with how to put your iPhone in DFU mode
Once your iPhone is in DFU mode and Redsn0w has detected it, you’re ready to proceed.
Uncheck Install Cydia and check Deactivate then click Next. You’re not actually carrying out a jailbreak here, just preparing the handset to receive the activation and unlock code from iTunes.
Once that is done, connect your iPhone to iTunes via a cable and activate it. This will unlock your iPhone while keeping your jailbreak intact.
That’s it you did it!!!!!!!!!!