| | |
| | | import javax.sip.SipFactory;
|
| | | import javax.sip.address.Address;
|
| | | import javax.sip.address.SipURI;
|
| | | import javax.sip.header.ContentTypeHeader;
|
| | | import javax.sip.header.FromHeader;
|
| | | import javax.sip.header.HeaderFactory;
|
| | | import javax.sip.header.SubjectHeader;
|
| | | import javax.sip.header.*;
|
| | | import javax.sip.message.Request;
|
| | | import javax.sip.message.Response;
|
| | |
|
| | | import com.alibaba.fastjson.JSONObject;
|
| | | import com.genersoft.iot.vmp.conf.MediaServerConfig;
|
| | | import com.genersoft.iot.vmp.gb28181.bean.Device;
|
| | | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
|
| | |
| | | import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
|
| | | import com.genersoft.iot.vmp.vmanager.play.bean.PlayResult;
|
| | | import com.genersoft.iot.vmp.vmanager.service.IPlayService;
|
| | | import gov.nist.javax.sdp.fields.SDPFormat;
|
| | | import gov.nist.javax.sip.address.AddressImpl;
|
| | | import gov.nist.javax.sip.address.SipUri;
|
| | | import org.slf4j.Logger;
|
| | | import org.slf4j.LoggerFactory;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | |
|
| | | import java.io.IOException;
|
| | | import java.text.ParseException;
|
| | | import java.util.List;
|
| | | import java.util.UUID;
|
| | | import java.util.Vector;
|
| | |
|
| | | /**
|
| | |
| | | * @author: panll
|
| | | * @date: 2021年1月14日
|
| | | */
|
| | | @SuppressWarnings("rawtypes")
|
| | | public class InviteRequestProcessor extends SIPRequestAbstractProcessor {
|
| | |
|
| | | private final static Logger logger = LoggerFactory.getLogger(MessageRequestProcessor.class);
|
| | |
| | |
|
| | | // jainSip不支持y=字段, 移除移除以解析。
|
| | | int ssrcIndex = contentString.indexOf("y=");
|
| | | String ssrc = contentString.substring(ssrcIndex + 2, contentString.length())
|
| | | .replace("\r\n", "").replace("\n", "");
|
| | | String ssrc = contentString.substring(ssrcIndex + 2, ssrcIndex + 12);
|
| | | //ssrc规定长度为10字节,不取余下长度以避免后续还有“f=”字段
|
| | | // String ssrc = contentString.substring(ssrcIndex + 2, contentString.length())
|
| | | // .replace("\r\n", "").replace("\n", "");
|
| | |
|
| | | String substring = contentString.substring(0, contentString.indexOf("y="));
|
| | | SessionDescription sdp = SdpFactory.getInstance().createSessionDescription(substring);
|
| | |
| | | // 获取支持的格式
|
| | | Vector mediaDescriptions = sdp.getMediaDescriptions(true);
|
| | | // 查看是否支持PS 负载96
|
| | | String ip = null;
|
| | | //String ip = null;
|
| | | int port = -1;
|
| | | boolean recvonly = false;
|
| | | //boolean recvonly = false;
|
| | | boolean mediaTransmissionTCP = false;
|
| | | Boolean tcpActive = null;
|
| | | for (int i = 0; i < mediaDescriptions.size(); i++) {
|
| | |
| | | Vector mediaFormats = media.getMediaFormats(false);
|
| | | if (mediaFormats.contains("96")) {
|
| | | port = media.getMediaPort();
|
| | | String mediaType = media.getMediaType();
|
| | | //String mediaType = media.getMediaType();
|
| | | String protocol = media.getProtocol();
|
| | |
|
| | | // 区分TCP发流还是udp, 当前默认udp
|
| | |
| | | }
|
| | | String username = sdp.getOrigin().getUsername();
|
| | | String addressStr = sdp.getOrigin().getAddress();
|
| | | String sessionName = sdp.getSessionName().getValue();
|
| | | //String sessionName = sdp.getSessionName().getValue();
|
| | | logger.info("[上级点播]用户:{}, 地址:{}:{}, ssrc:{}", username, addressStr, port, ssrc);
|
| | |
|
| | | Device device = storager.queryVideoDeviceByPlatformIdAndChannelId(platformId, channelId);
|
| | |
| | | responseAck(evt, Response.SERVER_INTERNAL_ERROR);
|
| | | return;
|
| | | }
|
| | | SendRtpItem sendRtpItem = zlmrtpServerFactory.createSendRtpItem(ip, port, platformId, ssrc, channelId,
|
| | | SendRtpItem sendRtpItem = zlmrtpServerFactory.createSendRtpItem(addressStr, port, ssrc, platformId, device.getDeviceId(), channelId,
|
| | | mediaTransmissionTCP);
|
| | | if (tcpActive != null) {
|
| | | sendRtpItem.setTcpActive(tcpActive);
|