How to avoid errors and warning when dailing an unreachable endpoint

Hello

So, in my system everthing IS working fine.

My question is rather how to avoid Error and Warning messages when dialing an unreachable extension. Unreachable because it is unplugged, asleep or turned off (e.g. soft clients).
Now of course asterisk has all the right to throw errors and warnings, my question is can I avoid this?

For example:

in extensions.conf

exten => 200,1,NoOp(call to Joe)
same => n,Dial(PJSIP/joe1 & PJSIP/joe4)
same => n,Hangup

when dialing 200, and logged in (asterisk -rvvvv), one gets

ERROR: chan_pjsip.c: request: Failed to create outgoing session to endpoint ‘joe4’
WARNING: app_dial.c: dial_exec_full: Unable to create channel of type ‘PJSIP’ (cause 3 - No route to destination)
ERROR: res_pjsip.c: ast_sip_create_dialog_uac: Endpoint ‘joe4’: Could not create dialog to invalid URI ‘buddyboy’. Is endpoint registered and reachable?

I guess, is there a better way to only call endpoint IF it is reachable?
Or, should i just not worry about it?

There is no ability to turn just those messages off. You could use DEVICE_STATE before dialing to see if the endpoint is reachable, or just call them and live with it.

DEVICE_STATE doesn’t do a silent connectivity test. It will report the last state from qualify tests. I think those tests will, themselves, log warnings, and possibly errors, when they fail.

Those get logged as verbose messages.

Dear @jcolp, dear @david551

Thank you so much for your replies. This helps me a lot.

Wish you a nice day.

DEVICE_STATE doesn’t work with DAHDI connections. I have a Sangoma A102 Card and a A200 Card. Both report DEVICE_STATE as UNKNOWN. Also, IAX2 has the same Results: UNKNOWN. But it works just fine with PJSIP.

I on Asterisk 22.4.0 with the DAHDI Drivers and wanpipe.