Hello,
My trunk provider fails a lot (PJSIP 407 error only with Asterisk). One of the issues is that when calling outside, it may fail to establish the call. Right now my only way to handle it is by retrying multiple times (usually, each second during 1min) in order to finally be able to make the call.
However, I would like to play some music during this process. Right now, if I try to use a MusicOnHold (MOH), it gets interrupted when I Dial()
same => n,Answer()
same => n,StartMusicOnHold(mymusic)
;same => n,Wait(10) ; Wait to make sure that music is playing
same => n,Dial(PJSIP/${ARG2}@sfr-out,,)
same => n,Log(NOTICE, Call result: ${DIALSTATUS})
same => n,Wait(12) ; simulate the loop retrying the call
same => n,StopMusicOnHold() ; once I'm able to call, stop music
same => n,Hangup()
My idea is to later implement some loop of retrying based on DIALSTATUS
My main problem is that the MOH automatically stop when Dial is executed. Do I have some alternative to it?
If I use Parking, it will be blocked in the Park()
step, so I will not be able to do the retries. And using the RetryDial()
only plays music before doing the Dial attempt, which is not acceptable for my case.
Thank you in advance