修复级联注册消息回复的空指针异常
This commit is contained in:
parent
1981876f5d
commit
22bf3c04b4
@ -6,6 +6,8 @@ import org.springframework.scheduling.annotation.Scheduled;
|
|||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import javax.sip.*;
|
import javax.sip.*;
|
||||||
|
import javax.sip.header.CallIdHeader;
|
||||||
|
import javax.sip.message.Response;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -23,6 +25,7 @@ public class SipSubscribe {
|
|||||||
private Map<String, Date> timeSubscribes = new ConcurrentHashMap<>();
|
private Map<String, Date> timeSubscribes = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
// @Scheduled(cron="*/5 * * * * ?") //每五秒执行一次
|
// @Scheduled(cron="*/5 * * * * ?") //每五秒执行一次
|
||||||
|
// @Scheduled(fixedRate= 100 * 60 * 60 )
|
||||||
@Scheduled(cron="0 0 * * * ?") //每小时执行一次, 每个整点
|
@Scheduled(cron="0 0 * * * ?") //每小时执行一次, 每个整点
|
||||||
public void execute(){
|
public void execute(){
|
||||||
logger.info("[定时任务] 清理过期的订阅信息");
|
logger.info("[定时任务] 清理过期的订阅信息");
|
||||||
@ -58,11 +61,15 @@ public class SipSubscribe {
|
|||||||
this.event = event;
|
this.event = event;
|
||||||
if (event instanceof ResponseEvent) {
|
if (event instanceof ResponseEvent) {
|
||||||
ResponseEvent responseEvent = (ResponseEvent)event;
|
ResponseEvent responseEvent = (ResponseEvent)event;
|
||||||
this.type = "response";
|
Response response = responseEvent.getResponse();
|
||||||
this.msg = responseEvent.getResponse().getReasonPhrase();
|
|
||||||
this.statusCode = responseEvent.getResponse().getStatusCode();
|
|
||||||
this.callId = responseEvent.getDialog().getCallId().getCallId();
|
|
||||||
this.dialog = responseEvent.getDialog();
|
this.dialog = responseEvent.getDialog();
|
||||||
|
this.type = "response";
|
||||||
|
if (response != null) {
|
||||||
|
this.msg = response.getReasonPhrase();
|
||||||
|
this.statusCode = response.getStatusCode();
|
||||||
|
}
|
||||||
|
this.callId = ((CallIdHeader)response.getHeader(CallIdHeader.NAME)).getCallId();
|
||||||
|
|
||||||
}else if (event instanceof TimeoutEvent) {
|
}else if (event instanceof TimeoutEvent) {
|
||||||
TimeoutEvent timeoutEvent = (TimeoutEvent)event;
|
TimeoutEvent timeoutEvent = (TimeoutEvent)event;
|
||||||
this.type = "timeout";
|
this.type = "timeout";
|
||||||
|
Loading…
Reference in New Issue
Block a user