add call hangup
This commit is contained in:
parent
4b0fbfcff2
commit
819db3ad4b
@ -16,7 +16,7 @@ spring:
|
|||||||
max-file-size: 256MB
|
max-file-size: 256MB
|
||||||
max-request-size: 256MB
|
max-request-size: 256MB
|
||||||
redis:
|
redis:
|
||||||
host: 192.168.3.5
|
host: 172.16.4.6
|
||||||
port: 6379
|
port: 6379
|
||||||
password: 123456
|
password: 123456
|
||||||
|
|
||||||
@ -26,12 +26,12 @@ site:
|
|||||||
# Datasource
|
# Datasource
|
||||||
yo:
|
yo:
|
||||||
datasource:
|
datasource:
|
||||||
url: jdbc:mysql://192.168.3.5/yoqw?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
|
url: jdbc:mysql://172.16.4.6/yoqw?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
|
||||||
username: yoqw
|
username: yoqw
|
||||||
password: yoqw_query!
|
password: yoqw_query!
|
||||||
freeswitch:
|
freeswitch:
|
||||||
datasource:
|
datasource:
|
||||||
url: jdbc:mysql://192.168.3.5/fs_dev?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
|
url: jdbc:mysql://172.16.4.6/fs_dev?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
|
||||||
username: freeswitch
|
username: freeswitch
|
||||||
password: RR!h5IpirsnJ
|
password: RR!h5IpirsnJ
|
||||||
cms:
|
cms:
|
||||||
@ -65,7 +65,7 @@ tigon:
|
|||||||
## Dubbo Registry
|
## Dubbo Registry
|
||||||
dubbo:
|
dubbo:
|
||||||
registry:
|
registry:
|
||||||
address: zookeeper://192.168.3.5:2181
|
address: zookeeper://172.16.4.6:2181
|
||||||
file: ${user.home}/dubbo-cache/${spring.application.name}/dubbo.cache
|
file: ${user.home}/dubbo-cache/${spring.application.name}/dubbo.cache
|
||||||
consumer:
|
consumer:
|
||||||
check: false
|
check: false
|
||||||
|
@ -20,7 +20,7 @@ tigon:
|
|||||||
project-dir: cms
|
project-dir: cms
|
||||||
datasource:
|
datasource:
|
||||||
password: yoqw_query!
|
password: yoqw_query!
|
||||||
url: jdbc:mysql://192.168.3.5/yoqw?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
|
url: jdbc:mysql://172.16.4.6/yoqw?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
|
||||||
username: yoqw
|
username: yoqw
|
||||||
default-gen-items: model,form,mapper,service,service-impl,controller
|
default-gen-items: model,form,mapper,service,service-impl,controller
|
||||||
file-doc:
|
file-doc:
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package org.freeswitch.esl.client.transport.model;
|
package org.freeswitch.esl.client.transport.model;
|
||||||
|
|
||||||
|
import lombok.val;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
@ -218,8 +219,11 @@ public class DataWrapper implements Serializable {
|
|||||||
*
|
*
|
||||||
* @return long value of the event header "Event-Date-Timestamp"
|
* @return long value of the event header "Event-Date-Timestamp"
|
||||||
*/
|
*/
|
||||||
public long getTimestamp() {
|
public Long getTimestamp() {
|
||||||
return Long.valueOf(getVal(EventHeaderNames.EVENT_DATE_TIMESTAMP));
|
val val = getVal(EventHeaderNames.EVENT_DATE_TIMESTAMP);
|
||||||
|
return StringUtils.isNotBlank(val) ?
|
||||||
|
Long.valueOf(val.substring(0, val.length() - 3)) :
|
||||||
|
System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package org.freeswitch.esl.client.transport.util;
|
package org.freeswitch.esl.client.transport.util;
|
||||||
|
|
||||||
|
import lombok.val;
|
||||||
import java.net.URLDecoder;
|
import java.net.URLDecoder;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
@ -25,7 +26,7 @@ public class UrlDecodeUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final String decVal = URLDecoder.decode(
|
val decVal = URLDecoder.decode(
|
||||||
val.replace("+", "%2B"),
|
val.replace("+", "%2B"),
|
||||||
StandardCharsets.UTF_8.name())
|
StandardCharsets.UTF_8.name())
|
||||||
.replace("%2B", "+");
|
.replace("%2B", "+");
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package org.freeswitch.esl.client;
|
package org.freeswitch.esl.client;
|
||||||
|
|
||||||
|
import lombok.val;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.freeswitch.esl.client.transport.util.UrlDecodeUtils;
|
import org.freeswitch.esl.client.transport.util.UrlDecodeUtils;
|
||||||
@ -15,4 +16,10 @@ public class TestDriver {
|
|||||||
public void testUrlDecode() {
|
public void testUrlDecode() {
|
||||||
log.info("Decode [{}].", UrlDecodeUtils.decodeUriComponent("+OK accepted"));
|
log.info("Decode [{}].", UrlDecodeUtils.decodeUriComponent("+OK accepted"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSubStr() {
|
||||||
|
val str = "1620374364903250";
|
||||||
|
log.info("[{}] -> [{}].", str, str.substring(0, str.length() - 3));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,30 @@
|
|||||||
|
package com.pudonghot.yo.mapper;
|
||||||
|
|
||||||
|
import lombok.val;
|
||||||
|
import me.chyxion.tigon.mybatis.Search;
|
||||||
|
import me.chyxion.tigon.mybatis.BaseMapper;
|
||||||
|
import com.pudonghot.yo.model.domain.CallHangup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Donghuang
|
||||||
|
* @date May 09, 2021 11:04:56
|
||||||
|
*/
|
||||||
|
public interface CallHangupMapper extends BaseMapper<Integer, CallHangup> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* update or insert
|
||||||
|
*
|
||||||
|
* @param model model
|
||||||
|
*/
|
||||||
|
default void upsert(final CallHangup model) {
|
||||||
|
val modelExisted = find(new Search(CallHangup.CONN_ID, model.getConnId()));
|
||||||
|
if (modelExisted != null) {
|
||||||
|
modelExisted.setCallerHangupStamp(model.getCallerHangupStamp());
|
||||||
|
modelExisted.setCalledHangupStamp(model.getCalledHangupStamp());
|
||||||
|
update(modelExisted);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
insert(model);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
/**
|
||||||
|
* @author Donghuang
|
||||||
|
* @date May 09, 2021 11:04:56
|
||||||
|
*/
|
||||||
|
-->
|
||||||
|
<!DOCTYPE mapper PUBLIC
|
||||||
|
"-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.pudonghot.yo.mapper.CallHangupMapper">
|
||||||
|
</mapper>
|
@ -0,0 +1,39 @@
|
|||||||
|
package com.pudonghot.yo.mapper;
|
||||||
|
|
||||||
|
import lombok.val;
|
||||||
|
import java.util.Date;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import me.chyxion.tigon.mybatis.Search;
|
||||||
|
import com.pudonghot.yo.model.domain.CallHangup;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||||
|
import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Donghuang
|
||||||
|
* @date May 09, 2021 11:04:56
|
||||||
|
*/
|
||||||
|
@RunWith(SpringJUnit4ClassRunner.class)
|
||||||
|
@SpringBootTest(classes = TestDriver.class)
|
||||||
|
public class CallHangupMapperTest {
|
||||||
|
@Autowired
|
||||||
|
private CallHangupMapper mapper;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void mapperTest() {
|
||||||
|
mapper.list(new Search().limit(8));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUpsert() {
|
||||||
|
val model = new CallHangup();
|
||||||
|
model.setTenantId(1);
|
||||||
|
model.setConnId("5f3e3cd00ed8dd5af0bb3acb");
|
||||||
|
model.setCallerHangupStamp(new Date());
|
||||||
|
mapper.upsert(model);
|
||||||
|
model.setCalledHangupStamp(new Date());
|
||||||
|
mapper.upsert(model);
|
||||||
|
}
|
||||||
|
}
|
@ -2,7 +2,6 @@ package com.pudonghot.yo.mapper;
|
|||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.mybatis.spring.annotation.MapperScan;
|
import org.mybatis.spring.annotation.MapperScan;
|
||||||
import org.springframework.boot.SpringApplication;
|
|
||||||
import org.springframework.context.annotation.ImportResource;
|
import org.springframework.context.annotation.ImportResource;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
@ -15,11 +14,4 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||||||
@MapperScan("com.pudonghot.yo.mapper")
|
@MapperScan("com.pudonghot.yo.mapper")
|
||||||
@ImportResource("classpath*:spring/spring-*.xml")
|
@ImportResource("classpath*:spring/spring-*.xml")
|
||||||
public class TestDriver {
|
public class TestDriver {
|
||||||
|
|
||||||
/**
|
|
||||||
* main
|
|
||||||
*/
|
|
||||||
public static void main(String[] args) {
|
|
||||||
SpringApplication.run(TestDriver.class, args);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -2,11 +2,11 @@ spring:
|
|||||||
application:
|
application:
|
||||||
name: yo-mapper
|
name: yo-mapper
|
||||||
redis:
|
redis:
|
||||||
host: 192.168.3.5
|
host: 172.16.4.6
|
||||||
port: 6379
|
port: 6379
|
||||||
password: 123456
|
password: 123456
|
||||||
yo:
|
yo:
|
||||||
datasource:
|
datasource:
|
||||||
password: yoqw_query!
|
password: yoqw_query!
|
||||||
url: jdbc:mysql://192.168.3.5/yoqw?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
|
url: jdbc:mysql://172.16.4.6/yoqw?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
|
||||||
username: yoqw
|
username: yoqw
|
||||||
|
@ -0,0 +1,30 @@
|
|||||||
|
package com.pudonghot.yo.model.domain;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import java.util.Date;
|
||||||
|
import me.chyxion.tigon.mybatis.Table;
|
||||||
|
import me.chyxion.tigon.mybatis.NotUpdate;
|
||||||
|
import lombok.experimental.FieldNameConstants;
|
||||||
|
import me.chyxion.tigon.mybatis.NotUpdateWhenNull;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Donghuang
|
||||||
|
* @date May 09, 2021 11:04:56
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Table("br_call_hangup")
|
||||||
|
@FieldNameConstants(prefix = "")
|
||||||
|
public class CallHangup extends BaseDomain {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@NotUpdate
|
||||||
|
private Integer tenantId;
|
||||||
|
@NotUpdate
|
||||||
|
private String connId;
|
||||||
|
@NotUpdateWhenNull
|
||||||
|
private Date callerHangupStamp;
|
||||||
|
@NotUpdateWhenNull
|
||||||
|
private Date calledHangupStamp;
|
||||||
|
}
|
@ -3,7 +3,7 @@ spring:
|
|||||||
name: yo-redis-raw
|
name: yo-redis-raw
|
||||||
redis:
|
redis:
|
||||||
database: 0
|
database: 0
|
||||||
host: 192.168.3.5
|
host: 172.16.4.6
|
||||||
password: 123456
|
password: 123456
|
||||||
port: 6379
|
port: 6379
|
||||||
redisson:
|
redisson:
|
||||||
|
@ -3,7 +3,7 @@ package ${mapperPkg};
|
|||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import ${searchFullName};
|
import ${searchFullName};
|
||||||
import org.springframework.test.context.ContextConfiguration;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||||
import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;
|
import org.springframework.test.context.junit4.AbstractTransactionalJUnit4SpringContextTests;
|
||||||
@ -12,7 +12,7 @@ import org.springframework.test.context.junit4.AbstractTransactionalJUnit4Spring
|
|||||||
${objDoc}
|
${objDoc}
|
||||||
</#if>
|
</#if>
|
||||||
@RunWith(SpringJUnit4ClassRunner.class)
|
@RunWith(SpringJUnit4ClassRunner.class)
|
||||||
@ContextConfiguration("classpath*:spring/spring-*.xml")
|
@SpringBootTest(classes = TestDriver.class)
|
||||||
public class ${ModelName}MapperTest extends AbstractTransactionalJUnit4SpringContextTests {
|
public class ${ModelName}MapperTest extends AbstractTransactionalJUnit4SpringContextTests {
|
||||||
@Autowired
|
@Autowired
|
||||||
private ${ModelName}Mapper mapper;
|
private ${ModelName}Mapper mapper;
|
||||||
|
@ -31,7 +31,7 @@ spring:
|
|||||||
write-dates-as-timestamps: true
|
write-dates-as-timestamps: true
|
||||||
time-zone: GMT+8
|
time-zone: GMT+8
|
||||||
redis:
|
redis:
|
||||||
host: 192.168.3.5
|
host: 172.16.4.6
|
||||||
port: 6379
|
port: 6379
|
||||||
password: 123456
|
password: 123456
|
||||||
redisson:
|
redisson:
|
||||||
@ -49,14 +49,14 @@ dubbo:
|
|||||||
retries: 0
|
retries: 0
|
||||||
timeout: 24000
|
timeout: 24000
|
||||||
registry:
|
registry:
|
||||||
address: zookeeper://192.168.3.5:2181
|
address: zookeeper://172.16.4.6:2181
|
||||||
file: ${user.home}/dubbo-cache/${spring.application.name}/dubbo.cache
|
file: ${user.home}/dubbo-cache/${spring.application.name}/dubbo.cache
|
||||||
scan:
|
scan:
|
||||||
base-packages: com.pudonghot.yo.fsagent.service.dubbo.impl
|
base-packages: com.pudonghot.yo.fsagent.service.dubbo.impl
|
||||||
|
|
||||||
yo:
|
yo:
|
||||||
datasource:
|
datasource:
|
||||||
url: jdbc:mysql://192.168.3.5/yoqw?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
|
url: jdbc:mysql://172.16.4.6/yoqw?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
|
||||||
username: yoqw
|
username: yoqw
|
||||||
password: yoqw_query!
|
password: yoqw_query!
|
||||||
esl:
|
esl:
|
||||||
@ -64,7 +64,7 @@ yo:
|
|||||||
host: 192.168.3.7
|
host: 192.168.3.7
|
||||||
freeswitch:
|
freeswitch:
|
||||||
datasource:
|
datasource:
|
||||||
url: jdbc:mysql://192.168.3.5/fs_dev?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
|
url: jdbc:mysql://172.16.4.6/fs_dev?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
|
||||||
username: freeswitch
|
username: freeswitch
|
||||||
password: RR!h5IpirsnJ
|
password: RR!h5IpirsnJ
|
||||||
fsagent:
|
fsagent:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user