[get-valid-endpoints] exten => s,1,Verbose(5, Entering get-valid-endpoints gosub.) ; usage: no arguments, returns DIALGROUP object of registered and valid 050x endpoints same => n,Set(ENDPOINT_1_STATE=${DEVICE_STATE(PJSIP/0501)}) same => n,Set(ENDPOINT_2_STATE=${DEVICE_STATE(PJSIP/0502)}) same => n,Set(ENDPOINT_3_STATE=${DEVICE_STATE(PJSIP/0503)}) same => n,Set(ENDPOINT_4_STATE=${DEVICE_STATE(PJSIP/0504)}) same => n,Set(ENDPOINT_1_EXPR=$[$["${ENDPOINT_1_STATE}" = "UNAVAILABLE"] | $["${ENDPOINT_1_STATE}" = "UNKNOWN"] | $["${ENDPOINT_1_STATE}" = "INVALID"]]) same => n,Set(ENDPOINT_2_EXPR=$[$["${ENDPOINT_2_STATE}" = "UNAVAILABLE"] | $["${ENDPOINT_2_STATE}" = "UNKNOWN"] | $["${ENDPOINT_2_STATE}" = "INVALID"]]) same => n,Set(ENDPOINT_3_EXPR=$[$["${ENDPOINT_3_STATE}" = "UNAVAILABLE"] | $["${ENDPOINT_3_STATE}" = "UNKNOWN"] | $["${ENDPOINT_3_STATE}" = "INVALID"]]) same => n,Set(ENDPOINT_4_EXPR=$[$["${ENDPOINT_4_STATE}" = "UNAVAILABLE"] | $["${ENDPOINT_4_STATE}" = "UNKNOWN"] | $["${ENDPOINT_4_STATE}" = "INVALID"]]) same => n,Set(DIALGROUP(CALL_VALID_LIST)=) ; clear list same => n,ExecIf($[${ENDPOINT_1_EXPR} = 0]?Set(DIALGROUP(CALL_VALID_LIST,add)=PJSIP/0501)) same => n,ExecIf($[${ENDPOINT_2_EXPR} = 0]?Set(DIALGROUP(CALL_VALID_LIST,add)=PJSIP/0502)) same => n,ExecIf($[${ENDPOINT_3_EXPR} = 0]?Set(DIALGROUP(CALL_VALID_LIST,add)=PJSIP/0503)) same => n,ExecIf($[${ENDPOINT_4_EXPR} = 0]?Set(DIALGROUP(CALL_VALID_LIST,add)=PJSIP/0504)) same => n,Return(${DIALGROUP(CALL_VALID_LIST)}) [from-phone] exten => 0500,1,Verbose(5,${EXTEN}: Call all registered pjsips from ${CALLERID(num)}) same => n,Gosub(get-valid-endpoints,s,1()) same => n,Set(DIALGROUP(CALL_EVERYONE_LIST)=${GOSUB_RETVAL}) same => n,Set(DIALGROUP(CALL_EVERYONE_LIST,del)=PJSIP/${CALLERID(num)}) ; remove the caller same => n,Dial(${DIALGROUP(CALL_EVERYONE_LIST)}) same => n,Hangup(16) exten => _050X,1,Verbose(5,${EXTEN}: Call pjsip endpoint from ${CALLERID(num)}) same => n,Dial(PJSIP/${EXTEN}) same => n,Hangup(16) exten => _.!,1,Verbose(5,${EXTEN}: Call external number from ${CALLERID(num)}) same => n,Dial(PJSIP/${EXTEN}@volte_ims) same => n,Hangup(16) [volte_ims] exten => _.!,1,Verbose(5,${EXTEN}: Call internal number from ${CALLERID(num)}) same => n,Gosub(get-valid-endpoints,s,1()) same => n,Set(DIALGROUP(CALL_EVERYONE_LIST)=${GOSUB_RETVAL}) same => n,Set(DIALGROUP(CALL_EVERYONE_LIST,del)=PJSIP/${CALLERID(num)}) ; remove the caller same => n,Dial(${DIALGROUP(CALL_EVERYONE_LIST)}) same => n,Hangup(16)