How to run a script, asynchronous from dialplan

Welcome!

Riffing off of suggestion from @ambiorixg12 for parallel Local channels, and this previous post, and assuming four-digit PJSIP extensions, you could try adding something like this below your [ecoville] context in extensions.conf - not sure on specifics (didn’t test it) but it might help get you a little closer to your desired outcome:

[ecoville-agent]
exten = _XXXX,1,Set(par=Local/${EXTEN}@ecoville-parallel)
 same =       n,Set(opt=G(ecoville-answered^${EXTEN}^1))
 same =       n,Set(__OG_CALLER_CHANNEL=${CHANNEL})
 same =       n,Dial(${PJSIP_DIAL_CONTACTS(${EXTEN})}&${par},60,${opt})

[ecoville-parallel]
exten = _XXXX,1,Set(res=${CURL(url-initiated)})

[ecoville-answered]
exten = _XXXX,1,Wait(10)
 same =       n,Set(res=${CURL(url-answered)})
 same =       n,Bridge(${OG_CALLER_CHANNEL})
exten = h,1,Set(res=${CURL(url-ended)})

And also modify your queues.conf like so - and possibly preload pbx_config and chan_local (see bottom of the queues.conf sample file):

[ecoville]
member => Local/5007@ecoville-agent,0,Agent 007,PJSIP/5007
member => Local/5008@ecoville-agent,0,Agent 008,PJSIP/5008

[tecnocontrol]
member => Local/5006@ecoville-agent,0,Agent 006,PJSIP/5006
member => Local/5007@ecoville-agent,0,Agent 007,PJSIP/5007

Please do let us know how it went for you and what your eventual dial plan morphed into, in order to help the next beginner. Thank you!

Edited: to add that the (url-answered) part could hang – look at the Originate() application’s async ‘a’ option to solve that part, or, another parallel Local Dial(), or, forked System() per post from @sedwards . And given all this dial plan complexity, you may find that AMI or similar is better/easier for your situation.