Check for available Trunk

Hi,
Is there a way to check which SIP Trunk is available before making an outbound call using the first available SIP Trunk?

Hello,

You can try to use PJSIP_CONTACT(,status) function
https://wiki.asterisk.org/wiki/display/AST/Asterisk+19+Function_PJSIP_CONTACT

Cheers,
Ihor

Just Dial. If it can’t be used, then Dial won’t dial it and will return a CHANAVAIL DIALSTATUS and you can try the next one.

Thanks @jcolp currently doing this. I just thought that there is better option

There isn’t, and even checking before dialing can have an issue because it could change between when you checked, and when you dialed. It’s best to just dial and deal with it because you have to handle that anyway.