|  |  | 
 |  |  | import org.springframework.stereotype.Component; | 
 |  |  | import org.springframework.util.StringUtils; | 
 |  |  |  | 
 |  |  | import javax.sip.ListeningPoint; | 
 |  |  | import javax.sip.ObjectInUseException; | 
 |  |  | import javax.sip.RequestEvent; | 
 |  |  | import javax.sip.SipProvider; | 
 |  |  | import javax.sip.*; | 
 |  |  | import javax.sip.address.SipURI; | 
 |  |  | import javax.sip.header.HeaderAddress; | 
 |  |  | import javax.sip.header.ToHeader; | 
 |  |  | import javax.sip.message.Response; | 
 |  |  | import java.text.ParseException; | 
 |  |  | import java.util.Iterator; | 
 |  |  |  | 
 |  |  | import static com.genersoft.iot.vmp.gb28181.utils.XmlUtil.getText; | 
 |  |  | 
 |  |  |         if (!StringUtils.isEmpty(getText(rootElement,"PTZCmd")) && !parentPlatform.getServerGBId().equals(targetGBId)) { | 
 |  |  |             String cmdString = getText(rootElement,"PTZCmd"); | 
 |  |  |             Device deviceForPlatform = storager.queryVideoDeviceByPlatformIdAndChannelId(parentPlatform.getServerGBId(), channelId); | 
 |  |  |             cmder.fronEndCmd(deviceForPlatform, channelId, cmdString); | 
 |  |  |             if (deviceForPlatform == null) { | 
 |  |  |                 try { | 
 |  |  |                     responseAck(evt, Response.NOT_FOUND); | 
 |  |  |                     return; | 
 |  |  |                 } catch (SipException e) { | 
 |  |  |                     e.printStackTrace(); | 
 |  |  |                 } catch (InvalidArgumentException e) { | 
 |  |  |                     e.printStackTrace(); | 
 |  |  |                 } catch (ParseException e) { | 
 |  |  |                     e.printStackTrace(); | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |             cmder.fronEndCmd(deviceForPlatform, channelId, cmdString, eventResult -> { | 
 |  |  |                 // 失败的回复 | 
 |  |  |                 try { | 
 |  |  |                     responseAck(evt, eventResult.statusCode, eventResult.msg); | 
 |  |  |                 } catch (SipException e) { | 
 |  |  |                     e.printStackTrace(); | 
 |  |  |                 } catch (InvalidArgumentException e) { | 
 |  |  |                     e.printStackTrace(); | 
 |  |  |                 } catch (ParseException e) { | 
 |  |  |                     e.printStackTrace(); | 
 |  |  |                 } | 
 |  |  |             }, eventResult -> { | 
 |  |  |                 // 成功的回复 | 
 |  |  |                 try { | 
 |  |  |                     responseAck(evt, eventResult.statusCode); | 
 |  |  |                 } catch (SipException e) { | 
 |  |  |                     e.printStackTrace(); | 
 |  |  |                 } catch (InvalidArgumentException e) { | 
 |  |  |                     e.printStackTrace(); | 
 |  |  |                 } catch (ParseException e) { | 
 |  |  |                     e.printStackTrace(); | 
 |  |  |                 } | 
 |  |  |             }); | 
 |  |  |         } | 
 |  |  |     } | 
 |  |  | } |