After dial-peer matches on gateway for Destination pattern on CUCM.
CUCM has this number configured as DN on CTI RP,
and CTI RP is associated to application User(JTAPI User). UCCE and UCCX are actually applications which logs into CUCM using Application user and can control device associated to that user.
In our case CTI RP is associated to application user, so UCCE and UCCX can see calls coming on CTI RP and can instruct CUCM to transfer call to target based on scripting techniques.
regards
Chintan