I am trying to execute an AGI script BEFORE a call is dialled out (to download Sound assets on to the server from an AWS S3 bucket), so far it seems that ‘pre-dial handler’ is the route I should be going down and certainly appears to work BUT I am having issues with ARI (where the call is originated externally) - the number appears to dial twice??
Yep, this appears to be the issue I have, in order to use ARI, it will originate a call using the POST /channels (not /channels/{channelId} although the outcome is the same (originating a call and then executing the dealing plan - thus two calls).
This means: Call Local/{NUMBER} and once answered send it into the dialplan at extension start in context test. If these end up doing the same thing, then you’ll have it in the same dialplan twice doing the same thing.
This means Dial PJSIP/{NUMBER}. If the call is answered, then the channel will remain inside of Dial() as it is bridged. It will not go to the next part of the dialplan.
What you LIKELY want to do is have the Playback and such happen on the extension you pass to the originate - this would cause the audio to be played back to the called endpoint.