|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import javax.sip.InvalidArgumentException; | 
|---|
|  |  |  | import javax.sip.RequestEvent; | 
|---|
|  |  |  | import javax.sip.ServerTransaction; | 
|---|
|  |  |  | import javax.sip.SipException; | 
|---|
|  |  |  | import javax.sip.message.Request; | 
|---|
|  |  |  | import javax.sip.message.Response; | 
|---|
|  |  |  | 
|---|
|  |  |  | Element rootElement = getRootElement(evt); | 
|---|
|  |  |  | Element deviceIdElement = rootElement.element("DeviceID"); | 
|---|
|  |  |  | String deviceId = deviceIdElement.getText(); | 
|---|
|  |  |  | Device device = storager.queryVideoDevice(deviceId); | 
|---|
|  |  |  | Element deviceListElement = rootElement.element("DeviceList"); | 
|---|
|  |  |  | if (deviceListElement == null) { | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Iterator<Element> deviceListIterator = deviceListElement.elementIterator(); | 
|---|
|  |  |  | if (deviceListIterator != null) { | 
|---|
|  |  |  | Device device = storager.queryVideoDevice(deviceId); | 
|---|
|  |  |  | if (device == null) { | 
|---|
|  |  |  | return; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | // 回复200 OK | 
|---|
|  |  |  | response200Ok(evt); | 
|---|
|  |  |  | if (offLineDetector.isOnline(deviceId)) { | 
|---|
|  |  |  | publisher.onlineEventPublish(deviceId, VideoManagerConstants.EVENT_ONLINE_KEEPLIVE); | 
|---|
|  |  |  | publisher.onlineEventPublish(device, VideoManagerConstants.EVENT_ONLINE_MESSAGE); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } catch (DocumentException | SipException | InvalidArgumentException | ParseException e) { | 
|---|
|  |  |  | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | private void response200Ok(RequestEvent evt) throws SipException, InvalidArgumentException, ParseException { | 
|---|
|  |  |  | Response response = getMessageFactory().createResponse(Response.OK, evt.getRequest()); | 
|---|
|  |  |  | getServerTransaction(evt).sendResponse(response); | 
|---|
|  |  |  | ServerTransaction serverTransaction = getServerTransaction(evt); | 
|---|
|  |  |  | serverTransaction.sendResponse(response); | 
|---|
|  |  |  | if (serverTransaction.getDialog() != null) serverTransaction.getDialog().delete(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | private Element getRootElement(RequestEvent evt) throws DocumentException { | 
|---|