优化代码
parent
a71063dd1f
commit
8a00a036c4
|
@ -4,7 +4,10 @@ import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.sip.*;
|
import javax.sip.*;
|
||||||
//import javax.sip.message.Request;
|
import javax.sip.address.SipURI;
|
||||||
|
import javax.sip.header.FromHeader;
|
||||||
|
import javax.sip.header.HeaderAddress;
|
||||||
|
import javax.sip.header.ToHeader;
|
||||||
|
|
||||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||||
import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem;
|
import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem;
|
||||||
|
@ -12,14 +15,11 @@ import com.genersoft.iot.vmp.gb28181.transmit.request.SIPRequestAbstractProcesso
|
||||||
import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory;
|
import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory;
|
||||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||||
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description:ACK请求处理器
|
* @Description:ACK请求处理器
|
||||||
* @author: swwheihei
|
* @author: swwheihei
|
||||||
* @date: 2020年5月3日 下午5:31:45
|
* @date: 2020年5月3日 下午5:31:45
|
||||||
*/
|
*/
|
||||||
@Component
|
|
||||||
public class AckRequestProcessor extends SIPRequestAbstractProcessor {
|
public class AckRequestProcessor extends SIPRequestAbstractProcessor {
|
||||||
|
|
||||||
private IRedisCatchStorage redisCatchStorage;
|
private IRedisCatchStorage redisCatchStorage;
|
||||||
|
@ -38,10 +38,8 @@ public class AckRequestProcessor extends SIPRequestAbstractProcessor {
|
||||||
if (dialog == null) return;
|
if (dialog == null) return;
|
||||||
//DialogState state = dialog.getState();
|
//DialogState state = dialog.getState();
|
||||||
if (/*request.getMethod().equals(Request.INVITE) &&*/ dialog.getState()== DialogState.CONFIRMED) {
|
if (/*request.getMethod().equals(Request.INVITE) &&*/ dialog.getState()== DialogState.CONFIRMED) {
|
||||||
String remoteUri = dialog.getRemoteParty().getURI().toString();
|
String platformGbId = ((SipURI) ((HeaderAddress) evt.getRequest().getHeader(FromHeader.NAME)).getAddress().getURI()).getUser();
|
||||||
String localUri = dialog.getLocalParty().getURI().toString();
|
String channelId = ((SipURI) ((HeaderAddress) evt.getRequest().getHeader(ToHeader.NAME)).getAddress().getURI()).getUser();
|
||||||
String platformGbId = remoteUri.substring(remoteUri.indexOf(":") + 1, remoteUri.indexOf("@"));
|
|
||||||
String channelId = localUri.substring(remoteUri.indexOf(":") + 1, remoteUri.indexOf("@"));
|
|
||||||
SendRtpItem sendRtpItem = redisCatchStorage.querySendRTPServer(platformGbId, channelId);
|
SendRtpItem sendRtpItem = redisCatchStorage.querySendRTPServer(platformGbId, channelId);
|
||||||
String is_Udp = sendRtpItem.isTcp() ? "0" : "1";
|
String is_Udp = sendRtpItem.isTcp() ? "0" : "1";
|
||||||
String deviceId = sendRtpItem.getDeviceId();
|
String deviceId = sendRtpItem.getDeviceId();
|
||||||
|
|
|
@ -75,20 +75,6 @@ public class InviteRequestProcessor extends SIPRequestAbstractProcessor {
|
||||||
SipURI sipURI = (SipURI) request.getRequestURI();
|
SipURI sipURI = (SipURI) request.getRequestURI();
|
||||||
String channelId = sipURI.getUser();
|
String channelId = sipURI.getUser();
|
||||||
String platformId = null;
|
String platformId = null;
|
||||||
// SubjectHeader subjectHeader = (SubjectHeader)request.getHeader(SubjectHeader.NAME);
|
|
||||||
// // 查询通道是否存在 不存在回复404
|
|
||||||
// if (subjectHeader != null) { // 存在则从subjectHeader 获取平台信息
|
|
||||||
// String subject = subjectHeader.getSubject();
|
|
||||||
// if (subject != null) {
|
|
||||||
// String[] info1 = subject.split(",");
|
|
||||||
// if (info1 != null && info1 .length == 2) {
|
|
||||||
// String[] info2 = info1[1].split(":");
|
|
||||||
// if (info2 != null && info2.length == 2) {
|
|
||||||
// platformId = info2[0];
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
FromHeader fromHeader = (FromHeader)request.getHeader(FromHeader.NAME);
|
FromHeader fromHeader = (FromHeader)request.getHeader(FromHeader.NAME);
|
||||||
AddressImpl address = (AddressImpl) fromHeader.getAddress();
|
AddressImpl address = (AddressImpl) fromHeader.getAddress();
|
||||||
|
@ -224,7 +210,9 @@ public class InviteRequestProcessor extends SIPRequestAbstractProcessor {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
playResult.getResult();
|
if (logger.isDebugEnabled()) {
|
||||||
|
logger.debug(playResult.getResult().toString());
|
||||||
|
}
|
||||||
|
|
||||||
} catch (SipException | InvalidArgumentException | ParseException e) {
|
} catch (SipException | InvalidArgumentException | ParseException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
Loading…
Reference in New Issue