Check Endpoint DEVICE_STATE before Dial()

I am development a new Dialplan for my PBX and get the question:

I should validate the DEVICE_STATE for the endpoint before Dial or not? My doubt is because in my tests when the endpoint is unreachable the Asterisk 18.2.0 return ERROR message as bellow:

    -- Executing [543132462222@incoming:14] Dial("PJSIP/ALGAR-ULA-0000007d", "PJSIP/10101,20,tT") in new stack
[Jun 25 09:15:27] **ERROR**[76430]: res_pjsip.c:3938 ast_sip_create_dialog_uac: Endpoint '10101': Could not create dialog to invalid URI '10101'.  Is endpoint registered and reachable?
[Jun 25 09:15:27] **ERROR**[76430]: chan_pjsip.c:2645 request: Failed to create outgoing session to endpoint '10101'
[Jun 25 09:15:27] WARNING[78028][C-0000004d]: app_dial.c:2596 dial_exec_full: Unable to create channel of type 'PJSIP' (cause 3 - No route to destination)

How Asterisk treat it as an error, should I check the status before Dial, or just ignore this error and leave Asterisk follow with the Dialplan?

What is your opinion?

I would say most administrators don’t check, and just dial. Even if you do check there’s still a race condition where between you checking and dialing their state could change.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.