优化sip协议栈调用

This commit is contained in:
648540858 2023-07-21 19:57:49 +08:00
parent 7d7528cc27
commit 97fef952ee
2 changed files with 3 additions and 3 deletions

View File

@ -63,7 +63,7 @@ public class SipLayer implements CommandLineRunner {
private void addListeningPoint(String monitorIp, int port){ private void addListeningPoint(String monitorIp, int port){
SipStackImpl sipStack; SipStackImpl sipStack;
try { try {
sipStack = (SipStackImpl)SipFactory.getInstance().createSipStack(DefaultProperties.getProperties(monitorIp, userSetting.getSipLog())); sipStack = (SipStackImpl)SipFactory.getInstance().createSipStack(DefaultProperties.getProperties( userSetting.getSipLog()));
sipStack.setMessageParserFactory(new GbStringMsgParserFactory()); sipStack.setMessageParserFactory(new GbStringMsgParserFactory());
} catch (PeerUnavailableException e) { } catch (PeerUnavailableException e) {
logger.error("[SIP SERVER] SIP服务启动失败 监听地址{}失败,请检查ip是否正确", monitorIp); logger.error("[SIP SERVER] SIP服务启动失败 监听地址{}失败,请检查ip是否正确", monitorIp);

View File

@ -12,10 +12,10 @@ import java.util.Properties;
*/ */
public class DefaultProperties { public class DefaultProperties {
public static Properties getProperties(String ip, boolean sipLog) { public static Properties getProperties(boolean sipLog) {
Properties properties = new Properties(); Properties properties = new Properties();
properties.setProperty("javax.sip.STACK_NAME", "GB28181_SIP"); properties.setProperty("javax.sip.STACK_NAME", "GB28181_SIP");
properties.setProperty("javax.sip.IP_ADDRESS", ip); // properties.setProperty("javax.sip.IP_ADDRESS", ip);
// 关闭自动会话 // 关闭自动会话
properties.setProperty("javax.sip.AUTOMATIC_DIALOG_SUPPORT", "off"); properties.setProperty("javax.sip.AUTOMATIC_DIALOG_SUPPORT", "off");
/** /**