Call File Without Specifiying The Trunk

Asterisk 14

I have a test call file I am using for callbacks. It calls the (external, random phone numbers) caller back and sends them to an IVR. The file is not working and the CLI is showing the following error:

purely numeric hostname and not a peer rejecting asterisk call file

I think this is because I am not defining the trunk in the channel field (Channel: SIP/${CALLERID(num)}).

My question is, do I have to define a trunk? I would prefer not to as if the defined trunk failed, the app would fail instead of using the next available trunk.

Any ideas on where to go from here?

Thanks in advance!

Yes.

You can’t just dial SIP/TELEPHONENUMBER unless you have an endpoint defined with that name.

You likely want to use a local channel to redirect your call through dialplan that will route the call in a manner that you want.

So for example you have

[MyTrunks]
exten => _nxxnxxxxxx,1,Dial(PJSIP/${EXTEN}@MyFirstTrunk,30)
 same => n,Dial(PJSIP/${EXTEN}@MySecondTrunk,30)
 same => n,Playtones(busy)
 same => n,Busy(8)
 same => n,Hangup()

Then you could use a channel of

LOCAL/5551234567@MyTrunks and if the call failed on MyFirstTrunk then it would dial out MySecondTrunk.

This is the simplest example In production you likely will want to determine why the call failed and only retry when you need to like If you have a unavailable trunk vs a busy where you don’t need to dial a second time.

You need to use Local channel in order to be able to continue on the dialplan execution and use the next trunk, follow the John example

My suggestion would be to encapsulate all logic in a Local channel (so you have everything in the dialplan and can maybe use a GUI to build it) and keep the callfile to a bare minimum.