We have a SIP-trunk with the OPEN CLI feature enabled.
Now, I'd like to forward an incoming call via this SIP-trunk and set as caller-ID the diverted call's caller-ID. How can I get the called-ID from the incoming call and set it as caller-ID for the outgoing forwarded call ?
If you have set the caller ID on the trunk itself, as far as I'm aware, this will override other caller ID settings, forcing this one number to be sent. You might try creating a second trunk, using a different access code, and no pre-set caller ID, to be used for forwarded calls, with the CID set to be taken from the originating number.
You need to make sure that you read the caller ID from the correct SIP header of the incoming Invite and set the caller ID parameter your provider wants to send the OriginatorsCallerID.
Are you using a supported 3CX provider? If so we can perhaps assist with the settings. If not then it's something you will need to figure out.
Also are you on V18 or V20?
We did this a couple of times, all we have to do is two things.
Our sip trunk provider has to have the all number policy active on the trunk. We have to fill in a form that we dont use this for call fraud our whatever. (netherlands)
Second thing is in the outbound parameters of the sip trunk we have to set the From user part to originator caller id and it works.
What you are seeing on the receiving end and what the PBX is sending are 2 different things. If you have issues first you need to check what the PBX is sending and then what it's received on the other end. Between the PBX and the receiving end a lot can happen.
So the first thing is to make sure the PBX is set up correctly and sending the correct information.