| | |
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | @Override
|
| | | public void playbackControlCmd(Device device, StreamInfo streamInfo, String content,SipSubscribe.Event errorEvent, SipSubscribe.Event okEvent) {
|
| | | try {
|
| | | Request request = headerProvider.createInfoRequest(device, streamInfo, content);
|
| | | if (request == null) {
|
| | | return;
|
| | | }
|
| | | logger.info(request.toString());
|
| | | ClientTransaction clientTransaction = null;
|
| | | if ("TCP".equals(device.getTransport())) {
|
| | | clientTransaction = tcpSipProvider.getNewClientTransaction(request);
|
| | | } else if ("UDP".equals(device.getTransport())) {
|
| | | clientTransaction = udpSipProvider.getNewClientTransaction(request);
|
| | | }
|
| | | CallIdHeader callIdHeader = (CallIdHeader)request.getHeader(CallIdHeader.NAME);
|
| | | if(errorEvent != null) {
|
| | | sipSubscribe.addErrorSubscribe(callIdHeader.getCallId(), (eventResult -> {
|
| | | errorEvent.response(eventResult);
|
| | | sipSubscribe.removeErrorSubscribe(eventResult.callId);
|
| | | sipSubscribe.removeOkSubscribe(eventResult.callId);
|
| | | }));
|
| | | }
|
| | | |
| | | if(okEvent != null) {
|
| | | sipSubscribe.addOkSubscribe(callIdHeader.getCallId(), eventResult -> {
|
| | | okEvent.response(eventResult);
|
| | | sipSubscribe.removeOkSubscribe(eventResult.callId);
|
| | | sipSubscribe.removeErrorSubscribe(eventResult.callId);
|
| | | });
|
| | | }
|
| | | clientTransaction.sendRequest();
|
| | | |
| | | } catch (SipException | ParseException | InvalidArgumentException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public boolean sendAlarmMessage(Device device, DeviceAlarm deviceAlarm) {
|