| | |
| | | import org.dom4j.Element; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.scheduling.annotation.Async; |
| | | |
| | | import javax.sip.Dialog; |
| | | import javax.sip.DialogState; |
| | |
| | | this.sipCommander = sipCommander; |
| | | } |
| | | |
| | | @Async |
| | | @Override |
| | | public void run() { |
| | | sipCommander.mobilePositionSubscribe(device, dialog, eventResult -> { |
| | |
| | | * COMPLETED-> Completed Dialog状态-已完成 |
| | | * TERMINATED-> Terminated Dialog状态-终止 |
| | | */ |
| | | logger.info("取消移动订阅时dialog状态为{}", dialog.getState()); |
| | | if (dialog != null && dialog.getState().equals(DialogState.CONFIRMED)) { |
| | | logger.info("取消移动订阅时dialog状态为{}", dialog.getState()); |
| | | device.setSubscribeCycleForMobilePosition(0); |
| | | sipCommander.mobilePositionSubscribe(device, dialog, eventResult -> { |
| | | ResponseEvent event = (ResponseEvent) eventResult.event; |
| | |
| | | }); |
| | | } |
| | | } |
| | | @Override |
| | | public DialogState getDialogState() { |
| | | if (dialog == null) return null; |
| | | return dialog.getState(); |
| | | } |
| | | } |