enke视频会议

This commit is contained in:
lizhicheng 2022-10-24 13:59:40 +08:00
parent 6feb229b22
commit 08a2af2b8b
4 changed files with 110 additions and 0 deletions

Binary file not shown.

Binary file not shown.

View File

@ -229,6 +229,20 @@
<systemPath>${project.basedir}/lib/yawei-pso-2.0.2.jar</systemPath> <systemPath>${project.basedir}/lib/yawei-pso-2.0.2.jar</systemPath>
<version>${yawei-pso.version}</version> <version>${yawei-pso.version}</version>
</dependency> </dependency>
<!-- en ke video -->
<dependency>
<groupId>sw.vc3term</groupId>
<artifactId>contingencyplan</artifactId>
<version>1.1.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/contingencyplan-1.1.0.jar</systemPath>
</dependency>
<!-- en ke video -->
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20180130</version>
</dependency>
<dependency> <dependency>
<groupId>com.belerweb</groupId> <groupId>com.belerweb</groupId>
<artifactId>pinyin4j</artifactId> <artifactId>pinyin4j</artifactId>

View File

@ -0,0 +1,96 @@
package io.renren.modules.enke;
import io.renren.modules.activiti.service.ActHistoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import sw.vc3term.contingencyplan.ContingencyPlanUtil;
import java.net.Inet4Address;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
/**
* @Auther:lizhicheng2@hisense.com
* @date:2022/10/22
* @des
*/
@RestController
@RequestMapping("/enke")
@Api(tags = "enke视频会议")
public class EnkeController {
private static final String videoConfernceIp = "35.1.190.62";
private static final int videoConferncePort = 8756;
private static final ContingencyPlanUtil cp;
private static final Logger logger = LoggerFactory.getLogger(ActHistoryService.class);
static {
cp = ContingencyPlanUtil.getInstance();
// 初始化会议
cp.init(videoConfernceIp, videoConferncePort);
List<String> ips = getLocalIP();
cp.setLocalAddress(CollectionUtils.isEmpty(ips) ? "0.0.0.0" : ips.get(0), ContingencyPlanUtil.LOCAL_PORT);
}
@ApiOperation(value = "正式启动会议")
@PostMapping("/initiateMeet")
public boolean initiateMeet(@RequestBody String attender) {
logger.info("视频会议的请求内容为:" + attender);
if (attender != null) {
String confName = "MCU";
logger.info("发起会议的会议名称为:" + confName + ";" + "参会人员:" + attender);
cp.startContingencyPlan(confName, attender);
return true;
} else {
return false;
}
}
/**
* 获取本机IP
*
* @author wanglu 2017年10月18日 下午3:33:49
*/
@SuppressWarnings("rawtypes")
public static List<String> getLocalIP() {
List<String> ips = new ArrayList<>();
Enumeration allNetInterfaces;
try {
allNetInterfaces = NetworkInterface.getNetworkInterfaces();
} catch (SocketException e) {
logger.error("获取本机ip异常", e);
return ips;
}
InetAddress ip;
while (allNetInterfaces.hasMoreElements()) {
NetworkInterface netInterface = (NetworkInterface) allNetInterfaces.nextElement();
Enumeration addresses = netInterface.getInetAddresses();
while (addresses.hasMoreElements()) {
ip = (InetAddress) addresses.nextElement();
if (ip instanceof Inet4Address) {
String ipAddress = ip.getHostAddress();
if (StringUtils.equals(ipAddress, "127.0.0.1") || ipAddress.startsWith("0")) {
continue;
}
ips.add(ipAddress);
}
}
}
return ips;
}
}