You will need to write a script that installs Opensips on the Elastix machine then develop a module that will configure Opensips. The module will grab all the extensions from FreePBX to be the sip extensions in Opensips. In the configuration of Opensips it will use asterisk as a gateway for incoming and outgoing calls to PSTN, ringroups, call queuing and the other features provided by FreePBX. All internal calls between sip extensions will stay within opensips.