Running 2 dialplan threads

I have to find a way to do some AGI requests in parallel with interacting with the caller. Basically I need to run a normal dialplan, while looking every N seconds into an external DB for a result to happen. I don’t want to fragment the dialplan every N seconds, but to do the checks in a different thread.

I explored the park functionality, but I have few things that are unclear:

  1. Once I park the call, It seems that the dialplan execution pause till timeout
  2. How can I fetch the allocated parking slot, to know exactly what call to unpark
  3. How can I control the content of the parkedcalls context?

Thank you for the patience and replies! Also, I apologize if this topic already exists and I was not able to find it.

No suggestion?

Anybody? I would appreciate any hint or opinion…