The quick'n dirty solution is creating dialplan injection that is launched before the ring group:
GotoIf($[ "${DEVICE_STATE(SIP/432)}" = "NOT_INUSE" ]?num435)
Macro(hangupcall,)
(num435),GotoIf($[ "${DEVICE_STATE(SIP/435)}" = "NOT_INUSE" ]?num436)
Macro(hangupcall,)
(num436),GotoIf($[ "${DEVICE_STATE(SIP/436)}" = "NOT_INUSE" ]?kontynuacja)
Macro(hangupcall,)
(kontynuacja),NoOp()
432, 435, 436 are extensions in objective RG.
Have you any remarks on this code?