Best Way To Do Auto Dialing

I’m trying to work out the following scenario…to build a power dialer.

Agent clicks a button and their SIP extension is dialed. The SIP extension line is held open, till they click the hangup button.

While the SIP extension for the agent is open, the server will start dialing numbers through the FXO port. As soon as a number is “connected” (not “answered”) the SIP and the FXO line is joined. Once the FXO call is over, the server dials again - all the while holding the SIP line open.

What is the best way to do this?

I have so far been able to do this by 1) setting up a conference room 2) having a thread running in the background checking for numbers

Both don’t seem like that would be the best way.

Please let me know.

Thanks in advance