One of the biggest headaches with VoIP is caller ID. There is some confusion on what you can do with caller id. For the most part its very simple.
For outgoing caller id (the person you are calling gets to see)
1. If you are using a gateway SIP to PSTN - Your PSTN carrier controls this - you cannot overwrite. It doesn't matter what you put in any caller id settings for your phone or gateway.
2. If you are using a VoIP Carrier (SIP trunk) - You may be able to change your caller id from either the SIP PBX or through a control panel interface provided by the carrier. Or in some cases the Carrier will need to change this manually for you.
It all depends how the carrier wants to do this. Some carriers are very strict about this because they don't want you spoofing your caller id which could result illegal activity and leave them liable for damages. eg. you could impersonate a popular charity and start calling for donations
For incoming caller id (what you see)
1. Generally any caller provided by PSTN is sent between first and second ring. If you are not seeing the caller id it may be due to:
a) You do not have Caller ID service - check with your carrier - i spent an hour once trying to get caller id working on a PBX because the client insisted he had caller id
b) Your PSTN TO SIP gateway or your FXO Analog card is answering the call too quickly. Increase the delay before the call is answered
c) You are using the wrong Caller ID detection method for your region - make sure you specify what part of the world you are trying to detect caller id
2. Caller ID provided by a SIP carrier should show up instantly if connected to a phone. if it is going through a gateway you may need to verify the caller id is passed as it is received. Gateways or PBX's allow you to manipulate the caller id before being passed to another gateway or end point.