├── freeswitch-xml-curl ├── README.md └── src │ └── main │ └── java │ └── com │ └── atomscat │ └── freeswitch │ └── xml │ ├── package-info.java │ ├── domain │ ├── directory │ │ ├── package-info.java │ │ ├── user │ │ │ ├── Users.java │ │ │ └── User.java │ │ ├── group │ │ │ ├── Groups.java │ │ │ └── Group.java │ │ ├── param │ │ │ ├── Params.java │ │ │ ├── Param.java │ │ │ └── ParamEnum.java │ │ ├── gateway │ │ │ ├── Gateways.java │ │ │ └── Gateway.java │ │ ├── variable │ │ │ ├── Variable.java │ │ │ ├── Variables.java │ │ │ └── VariableEnum.java │ │ └── Domain.java │ ├── configuration │ │ ├── package-info.java │ │ ├── sofia │ │ │ ├── aliase │ │ │ │ ├── Aliases.java │ │ │ │ └── Alias.java │ │ │ ├── domain │ │ │ │ ├── Domains.java │ │ │ │ └── Domain.java │ │ │ ├── setting │ │ │ │ └── Settings.java │ │ │ ├── gateway │ │ │ │ ├── Gateways.java │ │ │ │ └── Gateway.java │ │ │ ├── Param.java │ │ │ ├── profile │ │ │ │ ├── Profiles.java │ │ │ │ └── Profile.java │ │ │ ├── GlobalSettings.java │ │ │ └── Sofia.java │ │ ├── ivr │ │ │ ├── Menus.java │ │ │ ├── Ivr.java │ │ │ └── Entry.java │ │ └── Configuration.java │ ├── dialplan │ │ ├── Extension.java │ │ ├── Condition.java │ │ ├── Action.java │ │ └── Context.java │ └── XmlCurl.java │ ├── service │ └── XmlCurlService.java │ ├── constant │ ├── ConfName.java │ └── SectionNames.java │ ├── handler │ └── XmlCurlHandler.java │ ├── utils │ └── BasicAuthenticationUtil.java │ ├── exception │ └── ParserException.java │ ├── annotation │ └── XmlCurlSectionName.java │ └── parser │ └── XmlCurlParser.java ├── _config.yml ├── freeswitch-xml-curl-spring-boot-starter ├── README.md ├── src │ └── main │ │ ├── resources │ │ └── META-INF │ │ │ └── spring.factories │ │ └── java │ │ └── com │ │ └── atomscat │ │ └── freeswitch │ │ └── xml │ │ ├── handler │ │ └── SimpleXmlCurlHandler.java │ │ └── config │ │ └── FreeswitchXmlCurlAutoConfiguration.java └── pom.xml ├── doc ├── img │ ├── wechat.jpg │ ├── dingding.JPG │ ├── opensips-fs.png │ ├── opensips-fs-app.png │ ├── opensips-fs-tandem.png │ ├── opensips-register-fs.png │ └── opensips-fs-rtpengine.png ├── DeploymentPlan2.md ├── README.md └── Maven.md ├── OSSRH-72998 ├── src │ └── main │ │ └── java │ │ └── com │ │ └── atomscat │ │ └── Test.java └── pom.xml ├── opensips-event-mi └── src │ └── main │ ├── java │ └── com │ │ └── atomscat │ │ └── opensips │ │ ├── event │ │ ├── package-info.java │ │ ├── EventClientCommand.java │ │ ├── EventClientService.java │ │ ├── listener │ │ │ ├── ServerEventListener.java │ │ │ └── ServerConnectionListener.java │ │ ├── service │ │ │ └── AbstractServiceCommand.java │ │ ├── handler │ │ │ ├── Context.java │ │ │ └── IEventApi.java │ │ ├── EventClient.java │ │ └── option │ │ │ └── ConnectState.java │ │ ├── mi │ │ ├── entitys │ │ │ ├── package-info.java │ │ │ ├── response │ │ │ │ └── MiEventSubscribeResp.java │ │ │ ├── MiJsonError.java │ │ │ ├── NetString.java │ │ │ ├── enums │ │ │ │ ├── MiJsonUriEnum.java │ │ │ │ └── OpenSipsEventEnum.java │ │ │ └── request │ │ │ │ ├── MiEventSubscribeReq.java │ │ │ │ └── MiUlShowContactReq.java │ │ ├── package-info.java │ │ └── service │ │ │ ├── MiUlShowContactService.java │ │ │ └── MiEventSubscribeService.java │ │ └── util │ │ ├── ArrayUtils.java │ │ ├── RandomUtils.java │ │ ├── Validate.java │ │ └── RemotingUtil.java │ └── resources │ └── META-INF │ └── spring.factories ├── spring-boot-common ├── spring-boot-common-election │ ├── src │ │ ├── main │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── atomscat │ │ │ │ └── spring │ │ │ │ └── boot │ │ │ │ └── common │ │ │ │ ├── package-info.java │ │ │ │ └── param │ │ │ │ ├── ElectionResultParam.java │ │ │ │ ├── BaseElectionConsumerParam.java │ │ │ │ └── BaseElectionProducerParam.java │ │ └── test │ │ │ └── java │ │ │ └── com │ │ │ └── atomscat │ │ │ └── spring │ │ │ └── boot │ │ │ └── common │ │ │ ├── package-info.java │ │ │ ├── param │ │ │ ├── FreeswitchProducerParam.java │ │ │ └── SoftswitchGatewayConsumerParam.java │ │ │ └── util │ │ │ └── MatchElectionTest.java │ └── pom.xml ├── spring-boot-common-core │ └── src │ │ └── main │ │ ├── resources │ │ └── META-INF │ │ │ └── spring.factories │ │ └── java │ │ └── com │ │ └── atomscat │ │ └── spring │ │ └── boot │ │ └── common │ │ ├── config │ │ └── SpringBootCommonAutoConfiguration.java │ │ ├── constant │ │ ├── NumberConstant.java │ │ └── StringConstant.java │ │ └── util │ │ ├── LocalDateTimeUtil.java │ │ └── ExecutorHelper.java ├── spring-boot-common-aop │ ├── src │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── atomscat │ │ │ └── spring │ │ │ └── boot │ │ │ └── common │ │ │ └── aop │ │ │ ├── enums │ │ │ └── LoggingLevel.java │ │ │ └── annotation │ │ │ ├── Logging.java │ │ │ └── RedisLock.java │ └── pom.xml └── pom.xml ├── owt-server-client ├── README.md ├── src │ └── main │ │ └── java │ │ └── com │ │ └── atomscat │ │ └── owt │ │ └── server │ │ └── client │ │ └── package-info.java └── pom.xml ├── freeswitch-cdr-spring-boot-starter ├── src │ └── main │ │ ├── resources │ │ └── META-INF │ │ │ └── spring.factories │ │ └── java │ │ └── com │ │ └── atomscat │ │ └── freeswitch │ │ └── cdr │ │ └── spring │ │ └── boot │ │ └── starter │ │ ├── handler │ │ └── SimpleCdrHandler.java │ │ └── config │ │ └── FreeswitchCdrAutoConfiguration.java └── pom.xml ├── opensips-event-mi-spring-boot-starter ├── src │ └── main │ │ ├── resources │ │ └── META-INF │ │ │ └── spring.factories │ │ └── java │ │ └── com │ │ └── atomscat │ │ └── opensips │ │ └── spring │ │ └── boot │ │ └── starter │ │ ├── EnableOpensipsAutoConfiguration.java │ │ ├── handler │ │ ├── AbstractClientEventHandler.java │ │ ├── AbstractClientConnectHandler.java │ │ ├── ClientEventHandler.java │ │ ├── ClientConnectHandler.java │ │ ├── DefaultClientEventHandler.java │ │ ├── DefaultClientConnectHandler.java │ │ └── EventClientOptionHandler.java │ │ ├── template │ │ └── DefaultEventClientOptionHandlerTemplate.java │ │ └── propeties │ │ └── ServerProperties.java └── pom.xml ├── freeswitch-esl-spring-boot-starter └── src │ └── main │ ├── resources │ └── META-INF │ │ └── spring.factories │ └── java │ └── com │ └── atomscat │ └── freeswitch │ └── esl │ └── spring │ └── boot │ └── starter │ ├── handler │ ├── AbstractMqEventHandler.java │ ├── AbstractMqLoggingHandler.java │ ├── MqCommandsClient.java │ ├── AbstractOutBoundEventHandler.java │ ├── AbstractOutBoundConnectHandler.java │ ├── MqEventHandler.java │ ├── MqLoggingHandler.java │ ├── DefaultMqEventHandler.java │ ├── DefaultMqLoggingHandler.java │ ├── OutBoundConnectHandler.java │ ├── OutBoundEventHandler.java │ ├── InboundClientOptionHandler.java │ ├── OutboundServerOptionHandler.java │ ├── DefaultOutBoundEventHandler.java │ ├── DefaultOutBoundConnectHandler.java │ ├── AbstractInboundEventHandler.java │ └── DefaultInboundEventHandler.java │ ├── propeties │ └── AmqpClientProperties.java │ ├── template │ ├── DefaultInboundClientOptionHandlerTemplate.java │ └── DefaultOutboundServerOptionHandlerTemplate.java │ ├── annotation │ └── EslEventName.java │ └── EnableFreeswitchEslAutoConfiguration.java ├── freeswitch-esl └── src │ ├── main │ └── java │ │ └── com │ │ └── atomscat │ │ └── freeswitch │ │ └── esl │ │ ├── OutboundServerCommand.java │ │ ├── constant │ │ ├── VariableConstant.java │ │ └── EslConstant.java │ │ ├── OutboundEventListener.java │ │ ├── outbound │ │ ├── AbstractOutboundServerCommand.java │ │ └── option │ │ │ └── ConnectState.java │ │ ├── util │ │ ├── ArrayUtils.java │ │ ├── RandomUtils.java │ │ ├── VariableUtil.java │ │ ├── Validate.java │ │ └── RemotingUtil.java │ │ ├── helper │ │ └── ChannelStateMachine.java │ │ ├── exception │ │ ├── OutboundServerException.java │ │ ├── EslDecoderException.java │ │ └── InboundTimeoutExcetion.java │ │ ├── InboundClientService.java │ │ ├── OutboundServerService.java │ │ ├── inbound │ │ ├── listener │ │ │ ├── EventListener.java │ │ │ └── ServerOptionListener.java │ │ └── option │ │ │ └── ConnectState.java │ │ ├── ServerConnectionListener.java │ │ ├── builder │ │ └── Command.java │ │ └── InboundEventListener.java │ └── test │ └── java │ └── com │ └── atomscat │ └── freeswitch │ └── esl │ ├── builder │ └── CommandTest.java │ └── transport │ └── util │ └── ByteBuilderTest.java ├── .travis.yml ├── freeswitch-cdr └── src │ └── main │ └── java │ └── com │ └── atomscat │ └── freeswitch │ └── cdr │ ├── domain │ ├── CallStats.java │ ├── HoldRecord.java │ ├── Originatee.java │ ├── Originator.java │ ├── AppLog.java │ ├── Hold.java │ ├── Origination.java │ ├── Audio.java │ ├── Application.java │ ├── Extension.java │ ├── ChannelData.java │ ├── ErrorPeriod.java │ ├── Callflow.java │ ├── Outbound.java │ ├── Times.java │ ├── ErrorLog.java │ ├── OriginateeCallerProfile.java │ ├── OriginatorCallerProfile.java │ ├── OriginationCallerProfile.java │ ├── Variables.java │ ├── Cdr.java │ ├── CallerProfile.java │ └── Inbound.java │ ├── service │ └── CdrService.java │ ├── handler │ └── CdrHandler.java │ ├── exception │ └── ParserException.java │ ├── controller │ └── CdrController.java │ └── util │ ├── NumberUtil.java │ └── CdrDecodeUtil.java ├── .gitignore ├── freeswitch-esl-example └── README.md ├── freeswitch-esl-spring-boot-starter-example ├── README.md └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── atomscat │ │ │ └── freeswitch │ │ │ └── esl │ │ │ └── spring │ │ │ └── boot │ │ │ └── starter │ │ │ └── example │ │ │ ├── udp │ │ │ ├── InitStart.java │ │ │ ├── UdpServerHandler.java │ │ │ └── UdpServerHandler2.java │ │ │ ├── config │ │ │ └── HazelcastConfiguration.java │ │ │ ├── handler │ │ │ └── InboundDetectedSpeechSendSocketHandler.java │ │ │ ├── controller │ │ │ └── FreeSwitchController.java │ │ │ ├── ExampleInboundClientOptionHandler.java │ │ │ └── ExampleApplication.java │ └── resources │ │ └── application.yml │ └── test │ └── java │ └── com │ └── atomscat │ └── freeswitch │ └── esl │ └── spring │ └── boot │ └── starter │ └── example │ └── ExampleApplicationTests.java ├── SECURITY.md ├── freeswitch-cdr-spring-boot-starter-example ├── src │ └── main │ │ └── java │ │ └── com │ │ └── atomscat │ │ └── freeswitch │ │ └── cdr │ │ └── spring │ │ └── boot │ │ └── starter │ │ └── example │ │ ├── ExampleApplication.java │ │ └── ExampleCdrHandler.java └── pom.xml └── softswitch-all-spring-boot-starter-example ├── src ├── main │ ├── java │ │ └── com │ │ │ └── atomscat │ │ │ └── freeswitch │ │ │ └── esl │ │ │ └── spring │ │ │ └── boot │ │ │ └── starter │ │ │ └── example │ │ │ ├── handler │ │ │ ├── FsCdrHandler.java │ │ │ ├── InboundChannelHangupSendSocketHandler.java │ │ │ └── FsPhrasesXmlCurlHandler.java │ │ │ ├── controller │ │ │ └── FreeSwitchController.java │ │ │ ├── ExampleInboundClientOptionHandler.java │ │ │ └── ExampleApplication.java │ └── resources │ │ └── redisson │ │ └── redisson-dev.yml └── test │ └── java │ └── com │ └── atomscat │ └── freeswitch │ └── esl │ └── spring │ └── boot │ └── starter │ └── example │ └── ExampleApplicationTests.java └── README.md /freeswitch-xml-curl/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-cayman -------------------------------------------------------------------------------- /freeswitch-xml-curl-spring-boot-starter/README.md: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /doc/img/wechat.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Atoms-Cat/softswitch-gateway/HEAD/doc/img/wechat.jpg -------------------------------------------------------------------------------- /doc/img/dingding.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Atoms-Cat/softswitch-gateway/HEAD/doc/img/dingding.JPG -------------------------------------------------------------------------------- /OSSRH-72998/src/main/java/com/atomscat/Test.java: -------------------------------------------------------------------------------- 1 | package com.atomscat; 2 | 3 | public class Test { 4 | } 5 | -------------------------------------------------------------------------------- /doc/img/opensips-fs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Atoms-Cat/softswitch-gateway/HEAD/doc/img/opensips-fs.png -------------------------------------------------------------------------------- /opensips-event-mi/src/main/java/com/atomscat/opensips/event/package-info.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.opensips.event; -------------------------------------------------------------------------------- /doc/img/opensips-fs-app.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Atoms-Cat/softswitch-gateway/HEAD/doc/img/opensips-fs-app.png -------------------------------------------------------------------------------- /freeswitch-xml-curl/src/main/java/com/atomscat/freeswitch/xml/package-info.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.xml; -------------------------------------------------------------------------------- /opensips-event-mi/src/main/java/com/atomscat/opensips/mi/entitys/package-info.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.opensips.mi.entitys; -------------------------------------------------------------------------------- /doc/img/opensips-fs-tandem.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Atoms-Cat/softswitch-gateway/HEAD/doc/img/opensips-fs-tandem.png -------------------------------------------------------------------------------- /doc/img/opensips-register-fs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Atoms-Cat/softswitch-gateway/HEAD/doc/img/opensips-register-fs.png -------------------------------------------------------------------------------- /doc/img/opensips-fs-rtpengine.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Atoms-Cat/softswitch-gateway/HEAD/doc/img/opensips-fs-rtpengine.png -------------------------------------------------------------------------------- /freeswitch-xml-curl/src/main/java/com/atomscat/freeswitch/xml/domain/directory/package-info.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.xml.domain.directory; -------------------------------------------------------------------------------- /spring-boot-common/spring-boot-common-election/src/main/java/com/atomscat/spring/boot/common/package-info.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.spring.boot.common; -------------------------------------------------------------------------------- /spring-boot-common/spring-boot-common-election/src/test/java/com/atomscat/spring/boot/common/package-info.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.spring.boot.common; -------------------------------------------------------------------------------- /freeswitch-xml-curl/src/main/java/com/atomscat/freeswitch/xml/domain/configuration/package-info.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.xml.domain.configuration; -------------------------------------------------------------------------------- /doc/DeploymentPlan2.md: -------------------------------------------------------------------------------- 1 | ## register to opensips load balancing freeswitch 2 | 3 | ![流程图](img/opensips-fs.png) 4 | 5 | ### 1. configuration opensips.cfg 6 | 7 | -------------------------------------------------------------------------------- /owt-server-client/README.md: -------------------------------------------------------------------------------- 1 | #1、management api 2 | you see request demo: 3 | https://www.apifox.cn/apidoc/shared-62d670c8-92d6-498c-9abe-7e911cb85a44/api-11520186 4 | 5 | -------------------------------------------------------------------------------- /owt-server-client/src/main/java/com/atomscat/owt/server/client/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * todo 3 | * @author howell 4 | */ 5 | package com.atomscat.owt.server.client; -------------------------------------------------------------------------------- /opensips-event-mi/src/main/java/com/atomscat/opensips/event/EventClientCommand.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.opensips.event; 2 | 3 | /** 4 | * @author th158 5 | */ 6 | public interface EventClientCommand { 7 | } 8 | -------------------------------------------------------------------------------- /freeswitch-xml-curl-spring-boot-starter/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 2 | com.atomscat.freeswitch.xml.config.FreeswitchXmlCurlAutoConfiguration -------------------------------------------------------------------------------- /opensips-event-mi/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | #org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 2 | #com.atomscat.freeswitch.esl.spring.boot.starter.config.FreeswitchEslAutoConfiguration 3 | -------------------------------------------------------------------------------- /freeswitch-cdr-spring-boot-starter/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 2 | com.atomscat.freeswitch.cdr.spring.boot.starter.config.FreeswitchCdrAutoConfiguration -------------------------------------------------------------------------------- /opensips-event-mi-spring-boot-starter/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 2 | com.atomscat.opensips.spring.boot.starter.config.OpensipsAutoConfiguration 3 | -------------------------------------------------------------------------------- /spring-boot-common/spring-boot-common-core/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 2 | com.atomscat.spring.boot.common.config.SpringBootCommonAutoConfiguration 3 | -------------------------------------------------------------------------------- /freeswitch-esl-spring-boot-starter/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 2 | com.atomscat.freeswitch.esl.spring.boot.starter.config.FreeswitchEslAutoConfiguration 3 | -------------------------------------------------------------------------------- /opensips-event-mi-spring-boot-starter/src/main/java/com/atomscat/opensips/spring/boot/starter/EnableOpensipsAutoConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.opensips.spring.boot.starter; 2 | 3 | public @interface EnableOpensipsAutoConfiguration { 4 | } 5 | -------------------------------------------------------------------------------- /freeswitch-esl/src/main/java/com/atomscat/freeswitch/esl/OutboundServerCommand.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.esl; 2 | 3 | /** 4 | * @author everyone 5 | * @since 1.6.0 6 | */ 7 | public interface OutboundServerCommand { 8 | 9 | 10 | } 11 | -------------------------------------------------------------------------------- /freeswitch-esl-spring-boot-starter/src/main/java/com/atomscat/freeswitch/esl/spring/boot/starter/handler/AbstractMqEventHandler.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.esl.spring.boot.starter.handler; 2 | 3 | 4 | public abstract class AbstractMqEventHandler implements MqEventHandler { 5 | 6 | 7 | } 8 | -------------------------------------------------------------------------------- /freeswitch-esl-spring-boot-starter/src/main/java/com/atomscat/freeswitch/esl/spring/boot/starter/handler/AbstractMqLoggingHandler.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.esl.spring.boot.starter.handler; 2 | 3 | 4 | public abstract class AbstractMqLoggingHandler implements MqLoggingHandler { 5 | 6 | } 7 | -------------------------------------------------------------------------------- /opensips-event-mi/src/main/java/com/atomscat/opensips/mi/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * http://192.168.10.109:8888/json/ul_dump?params=brief:,1006: 3 | * http://192.168.10.109:8888/json/ul_show_contact?table=location 4 | * http://192.168.10.109:8888/json/get_statistics?params=net:,uri: 5 | */ 6 | package com.atomscat.opensips.mi; -------------------------------------------------------------------------------- /spring-boot-common/spring-boot-common-aop/src/main/java/com/atomscat/spring/boot/common/aop/enums/LoggingLevel.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.spring.boot.common.aop.enums; 2 | 3 | public enum LoggingLevel { 4 | TRACE, 5 | DEBUG, 6 | INFO, 7 | WARN, 8 | ERROR; 9 | 10 | LoggingLevel() { 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /freeswitch-esl/src/test/java/com/atomscat/freeswitch/esl/builder/CommandTest.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.esl.builder; 2 | 3 | import junit.framework.TestCase; 4 | 5 | public class CommandTest extends TestCase { 6 | 7 | public void testCmd() { 8 | System.out.println(Command.cmd("").toString()); 9 | } 10 | } -------------------------------------------------------------------------------- /freeswitch-esl-spring-boot-starter/src/main/java/com/atomscat/freeswitch/esl/spring/boot/starter/handler/MqCommandsClient.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.esl.spring.boot.starter.handler; 2 | 3 | 4 | 5 | public interface MqCommandsClient { 6 | 7 | void sendCommands(String routingKey, String command, String arg) throws Exception; 8 | } 9 | -------------------------------------------------------------------------------- /freeswitch-esl/src/main/java/com/atomscat/freeswitch/esl/constant/VariableConstant.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.esl.constant; 2 | 3 | /** 4 | * @author everyone 5 | * @version 1.5.0 6 | */ 7 | public class VariableConstant { 8 | 9 | public static final String PREFIX = "variable_"; 10 | 11 | private VariableConstant() { 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /opensips-event-mi/src/main/java/com/atomscat/opensips/event/EventClientService.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.opensips.event; 2 | 3 | /** 4 | * @author th158 5 | */ 6 | public interface EventClientService { 7 | /** 8 | *

start.

9 | */ 10 | void start(); 11 | 12 | /** 13 | *

shutdown.

14 | */ 15 | void shutdown(); 16 | } 17 | -------------------------------------------------------------------------------- /spring-boot-common/spring-boot-common-election/src/test/java/com/atomscat/spring/boot/common/param/FreeswitchProducerParam.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.spring.boot.common.param; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | @Data 7 | @Accessors(chain = true) 8 | public class FreeswitchProducerParam extends BaseElectionProducerParam { 9 | } 10 | -------------------------------------------------------------------------------- /opensips-event-mi/src/main/java/com/atomscat/opensips/event/listener/ServerEventListener.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.opensips.event.listener; 2 | 3 | 4 | import com.atomscat.opensips.event.handler.Context; 5 | 6 | public interface ServerEventListener { 7 | 8 | void handleEvent(Context context, Object msg); 9 | 10 | void onConnect(Context context, Object msg); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /spring-boot-common/spring-boot-common-election/src/test/java/com/atomscat/spring/boot/common/param/SoftswitchGatewayConsumerParam.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.spring.boot.common.param; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | @Data 7 | @Accessors(chain = true) 8 | public class SoftswitchGatewayConsumerParam extends BaseElectionConsumerParam { 9 | } 10 | -------------------------------------------------------------------------------- /opensips-event-mi-spring-boot-starter/src/main/java/com/atomscat/opensips/spring/boot/starter/handler/AbstractClientEventHandler.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.opensips.spring.boot.starter.handler; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | 6 | public abstract class AbstractClientEventHandler implements ClientEventHandler { 7 | protected final Logger log = LoggerFactory.getLogger(getClass()); 8 | } 9 | -------------------------------------------------------------------------------- /opensips-event-mi-spring-boot-starter/src/main/java/com/atomscat/opensips/spring/boot/starter/handler/AbstractClientConnectHandler.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.opensips.spring.boot.starter.handler; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | 6 | public abstract class AbstractClientConnectHandler implements ClientConnectHandler { 7 | protected final Logger log = LoggerFactory.getLogger(getClass()); 8 | } 9 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | 3 | # Cobertura is not supported in JDK11 so you must downgrade the JDK that Travis uses if you want to use Cobertura with Travis. 4 | # See https://github.com/cobertura/cobertura/issues/381 5 | jdk: 6 | - openjdk8 7 | 8 | script: "mvn cobertura:cobertura" 9 | 10 | sudo: false # faster builds 11 | 12 | after_success: 13 | - bash <(curl -s https://codecov.io/bash) -t 4ed3590e-3c8c-48e5-a54e-1f14d47cc476 -------------------------------------------------------------------------------- /doc/README.md: -------------------------------------------------------------------------------- 1 | # doc index 2 | 3 | ### concept 4 | 5 | --- 6 | 7 | ### deploy 8 | 9 | #### [freeswitch 1.10.5 is installed based on Debian 10.10](softswitch/freeswitch/freeswitch-install-debian.md) 10 | 11 | --- 12 | 13 | ### actual combat 14 | 15 | #### [opensips-fs-tandem](doc/DeploymentPlan1.md) 16 | 17 | #### [opensips-register-fs](doc/DeploymentPlan3.md) 18 | 19 | #### [opensips-fs-rtpengine](doc/DeploymentPlan4.md) (recommend) -------------------------------------------------------------------------------- /freeswitch-esl-spring-boot-starter/src/main/java/com/atomscat/freeswitch/esl/spring/boot/starter/handler/AbstractOutBoundEventHandler.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.esl.spring.boot.starter.handler; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | 6 | public abstract class AbstractOutBoundEventHandler implements OutBoundEventHandler { 7 | protected final Logger log = LoggerFactory.getLogger(getClass()); 8 | } 9 | -------------------------------------------------------------------------------- /freeswitch-esl-spring-boot-starter/src/main/java/com/atomscat/freeswitch/esl/spring/boot/starter/handler/AbstractOutBoundConnectHandler.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.esl.spring.boot.starter.handler; 2 | 3 | import org.slf4j.Logger; 4 | import org.slf4j.LoggerFactory; 5 | 6 | public abstract class AbstractOutBoundConnectHandler implements OutBoundConnectHandler { 7 | protected final Logger log = LoggerFactory.getLogger(getClass()); 8 | } 9 | -------------------------------------------------------------------------------- /opensips-event-mi/src/main/java/com/atomscat/opensips/mi/entitys/response/MiEventSubscribeResp.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.opensips.mi.entitys.response; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * @author : everyone 9 | * @version 1.0.0 10 | */ 11 | @Data 12 | public class MiEventSubscribeResp implements Serializable { 13 | private static final long serialVersionUID = 1L; 14 | 15 | 16 | } 17 | -------------------------------------------------------------------------------- /freeswitch-cdr/src/main/java/com/atomscat/freeswitch/cdr/domain/CallStats.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.cdr.domain; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | /** 7 | *

CallStats class.

8 | * 9 | * @author : everyone 10 | * @version $Id: $Id 11 | */ 12 | @Data 13 | @Accessors(chain = true) 14 | public class CallStats { 15 | private Audio audio; 16 | } 17 | -------------------------------------------------------------------------------- /freeswitch-esl/src/main/java/com/atomscat/freeswitch/esl/OutboundEventListener.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.esl; 2 | 3 | import com.atomscat.freeswitch.esl.outbound.handler.Context; 4 | import com.atomscat.freeswitch.esl.transport.event.EslEvent; 5 | 6 | public interface OutboundEventListener { 7 | 8 | void handleEslEvent(Context context, EslEvent event); 9 | 10 | void onConnect(Context context, EslEvent eslEvent); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /freeswitch-esl-spring-boot-starter/src/main/java/com/atomscat/freeswitch/esl/spring/boot/starter/handler/MqEventHandler.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.esl.spring.boot.starter.handler; 2 | 3 | import com.rabbitmq.client.Channel; 4 | 5 | /** 6 | * mod_amqp TAP.Events 7 | * @author th158 8 | */ 9 | public interface MqEventHandler { 10 | 11 | void handle(Channel channel, String payload, Long tag, String contentType) throws Exception; 12 | } 13 | -------------------------------------------------------------------------------- /freeswitch-xml-curl/src/main/java/com/atomscat/freeswitch/xml/service/XmlCurlService.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.xml.service; 2 | 3 | import jakarta.servlet.http.HttpServletRequest; 4 | 5 | /** 6 | *

XmlCurlService interface.

7 | * 8 | * @author : everyone 9 | * @version $Id: $Id 10 | */ 11 | public interface XmlCurlService { 12 | 13 | String handle(HttpServletRequest request); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /freeswitch-esl-spring-boot-starter/src/main/java/com/atomscat/freeswitch/esl/spring/boot/starter/handler/MqLoggingHandler.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.esl.spring.boot.starter.handler; 2 | 3 | import com.rabbitmq.client.Channel; 4 | 5 | /** 6 | * mod_amqp TAP.Logging 7 | * @author th158 8 | */ 9 | public interface MqLoggingHandler { 10 | 11 | void handle(Channel channel, String payload, Long tag, String contentType) throws Exception; 12 | } 13 | -------------------------------------------------------------------------------- /opensips-event-mi-spring-boot-starter/src/main/java/com/atomscat/opensips/spring/boot/starter/handler/ClientEventHandler.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.opensips.spring.boot.starter.handler; 2 | 3 | 4 | import com.atomscat.opensips.event.handler.Context; 5 | 6 | /** 7 | * 8 | */ 9 | public interface ClientEventHandler { 10 | 11 | /** 12 | * @param context 13 | * @param msg 14 | */ 15 | void handler(Context context, Object msg); 16 | } 17 | -------------------------------------------------------------------------------- /opensips-event-mi/src/main/java/com/atomscat/opensips/event/service/AbstractServiceCommand.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.opensips.event.service; 2 | 3 | 4 | import com.atomscat.opensips.event.option.EventClientOption; 5 | 6 | /** 7 | * @author everyone 8 | * @since 1.6.0 9 | */ 10 | abstract class AbstractServiceCommand extends AbstractService { 11 | 12 | AbstractServiceCommand(EventClientOption option) { 13 | super(option); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /opensips-event-mi/src/main/java/com/atomscat/opensips/mi/entitys/MiJsonError.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.opensips.mi.entitys; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * @author : everyone 9 | * @version 1.0.0 10 | */ 11 | @Data 12 | public class MiJsonError implements Serializable { 13 | private static final long serialVersionUID = 1L; 14 | 15 | private String code; 16 | 17 | private String message; 18 | } 19 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | 5 | ### STS ### 6 | .apt_generated 7 | .classpath 8 | .factorypath 9 | .project 10 | .settings 11 | .springBeans 12 | .sts4-cache 13 | 14 | ### IntelliJ IDEA ### 15 | .idea 16 | *.iws 17 | *.iml 18 | *.ipr 19 | 20 | ### NetBeans ### 21 | /nbproject/private/ 22 | /nbbuild/ 23 | /dist/ 24 | /nbdist/ 25 | /.nb-gradle/ 26 | /build/ 27 | 28 | ### VS Code ### 29 | .vscode/ 30 | 31 | pom.xml.versionsBackup -------------------------------------------------------------------------------- /freeswitch-xml-curl/src/main/java/com/atomscat/freeswitch/xml/constant/ConfName.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.xml.constant; 2 | 3 | /** 4 | * @author th158 5 | */ 6 | public enum ConfName { 7 | 8 | 9 | IVR("ivr.conf"), 10 | SOFIA("sofia.conf"); 11 | 12 | public final String name; 13 | 14 | public String getName() { 15 | return name; 16 | } 17 | 18 | 19 | ConfName(String name) { 20 | this.name = name; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /spring-boot-common/spring-boot-common-election/src/main/java/com/atomscat/spring/boot/common/param/ElectionResultParam.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.spring.boot.common.param; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * @author th158 10 | */ 11 | @Data 12 | @Accessors(chain = true) 13 | public class ElectionResultParam{ 14 | 15 | private K key; 16 | 17 | private List valueList; 18 | } 19 | -------------------------------------------------------------------------------- /freeswitch-cdr/src/main/java/com/atomscat/freeswitch/cdr/domain/HoldRecord.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.cdr.domain; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | *

HoldRecord class.

10 | * 11 | * @author : everyone 12 | * @version $Id: $Id 13 | */ 14 | @Data 15 | @Accessors(chain = true) 16 | public class HoldRecord { 17 | private List holds; 18 | } 19 | -------------------------------------------------------------------------------- /freeswitch-cdr/src/main/java/com/atomscat/freeswitch/cdr/domain/Originatee.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.cdr.domain; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | /** 7 | *

Originatee class.

8 | * 9 | * @author : everyone 10 | * @version $Id: $Id 11 | */ 12 | @Data 13 | @Accessors(chain = true) 14 | public class Originatee { 15 | private OriginateeCallerProfile originateeCallerProfile; 16 | } 17 | -------------------------------------------------------------------------------- /freeswitch-cdr/src/main/java/com/atomscat/freeswitch/cdr/domain/Originator.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.cdr.domain; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | /** 7 | *

Originator class.

8 | * 9 | * @author : everyone 10 | * @version $Id: $Id 11 | */ 12 | @Data 13 | @Accessors(chain = true) 14 | public class Originator { 15 | private OriginatorCallerProfile originatorCallerProfile; 16 | } 17 | -------------------------------------------------------------------------------- /freeswitch-cdr/src/main/java/com/atomscat/freeswitch/cdr/domain/AppLog.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.cdr.domain; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | *

AppLog class.

10 | * 11 | * @author : everyone 12 | * @version $Id: $Id 13 | */ 14 | @Data 15 | @Accessors(chain = true) 16 | public class AppLog { 17 | private List applications; 18 | } 19 | -------------------------------------------------------------------------------- /freeswitch-cdr/src/main/java/com/atomscat/freeswitch/cdr/domain/Hold.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.cdr.domain; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | /** 7 | *

Hold class.

8 | * 9 | * @author : everyone 10 | * @version $Id: $Id 11 | */ 12 | @Data 13 | @Accessors(chain = true) 14 | public class Hold { 15 | private Long on; 16 | private Long off; 17 | private String bridgedTo; 18 | } 19 | -------------------------------------------------------------------------------- /freeswitch-cdr/src/main/java/com/atomscat/freeswitch/cdr/domain/Origination.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.cdr.domain; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | /** 7 | *

Origination class.

8 | * 9 | * @author : everyone 10 | * @version $Id: $Id 11 | */ 12 | @Data 13 | @Accessors(chain = true) 14 | public class Origination { 15 | private OriginationCallerProfile originationCallerProfile; 16 | } 17 | -------------------------------------------------------------------------------- /freeswitch-cdr/src/main/java/com/atomscat/freeswitch/cdr/service/CdrService.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.cdr.service; 2 | 3 | /** 4 | *

CdrService interface.

5 | * 6 | * @author : everyone 7 | * @version $Id: $Id 8 | */ 9 | public interface CdrService { 10 | 11 | /** 12 | *

handle.

13 | * 14 | * @param reqText a {@link java.lang.String} object. 15 | */ 16 | void handle(String reqText); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /freeswitch-esl/src/main/java/com/atomscat/freeswitch/esl/outbound/AbstractOutboundServerCommand.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.esl.outbound; 2 | 3 | import com.atomscat.freeswitch.esl.outbound.option.OutboundServerOption; 4 | 5 | /** 6 | * @author everyone 7 | * @since 1.6.0 8 | */ 9 | abstract class AbstractOutboundServerCommand extends AbstractOutboundServer { 10 | AbstractOutboundServerCommand(OutboundServerOption option) { 11 | super(option); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /opensips-event-mi-spring-boot-starter/src/main/java/com/atomscat/opensips/spring/boot/starter/handler/ClientConnectHandler.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.opensips.spring.boot.starter.handler; 2 | 3 | 4 | import com.atomscat.opensips.event.handler.Context; 5 | 6 | public interface ClientConnectHandler { 7 | /** 8 | * @param context a {@link Context} object. 9 | * @param msg a {@link Object} object. 10 | */ 11 | void onConnect(Context context, Object msg); 12 | } 13 | -------------------------------------------------------------------------------- /freeswitch-cdr/src/main/java/com/atomscat/freeswitch/cdr/domain/Audio.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.cdr.domain; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | /** 7 | *

Audio class.

8 | * 9 | * @author : everyone 10 | * @version $Id: $Id 11 | */ 12 | @Data 13 | @Accessors(chain = true) 14 | public class Audio { 15 | private Inbound inbound; 16 | private Outbound outbound; 17 | private ErrorLog errorLog; 18 | } 19 | -------------------------------------------------------------------------------- /freeswitch-esl-example/README.md: -------------------------------------------------------------------------------- 1 | # FreeSWITCH ESL Example 2 | 3 | [![Jdk Version](https://img.shields.io/badge/JDK-1.8-green.svg)](https://img.shields.io/badge/JDK-1.8-green.svg) 4 | [![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html) 5 | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/link.thingscloud/freeswitch-esl-example/badge.svg)](https://maven-badges.herokuapp.com/maven-central/link.thingscloud/freeswitch-esl-example/) 6 | 7 | -------------------------------------------------------------------------------- /freeswitch-cdr/src/main/java/com/atomscat/freeswitch/cdr/domain/Application.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.cdr.domain; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | /** 7 | *

Application class.

8 | * 9 | * @author : everyone 10 | * @version $Id: $Id 11 | */ 12 | @Data 13 | @Accessors(chain = true) 14 | public class Application { 15 | private String appName; 16 | private String appData; 17 | private Long appStamp; 18 | } 19 | -------------------------------------------------------------------------------- /spring-boot-common/spring-boot-common-aop/src/main/java/com/atomscat/spring/boot/common/aop/annotation/Logging.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.spring.boot.common.aop.annotation; 2 | 3 | import com.atomscat.spring.boot.common.aop.enums.LoggingLevel; 4 | 5 | import java.lang.annotation.*; 6 | 7 | @Documented 8 | @Target({ElementType.METHOD}) 9 | @Retention(RetentionPolicy.RUNTIME) 10 | public @interface Logging { 11 | LoggingLevel level() default LoggingLevel.INFO; 12 | 13 | boolean result() default true; 14 | } 15 | -------------------------------------------------------------------------------- /freeswitch-cdr/src/main/java/com/atomscat/freeswitch/cdr/handler/CdrHandler.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.cdr.handler; 2 | 3 | import com.atomscat.freeswitch.cdr.domain.Cdr; 4 | 5 | /** 6 | *

CdrHandler interface.

7 | * 8 | * @author : everyone 9 | * @version $Id: $Id 10 | */ 11 | public interface CdrHandler { 12 | 13 | /** 14 | *

handleCdr.

15 | * 16 | * @param cdr a {@link Cdr} object. 17 | */ 18 | void handleCdr(Cdr cdr); 19 | 20 | } 21 | -------------------------------------------------------------------------------- /opensips-event-mi/src/main/java/com/atomscat/opensips/mi/entitys/NetString.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.opensips.mi.entitys; 2 | 3 | /** 4 | * @author : everyone 5 | * @version 1.0.0 6 | */ 7 | public class NetString { 8 | 9 | public static String HTTP = "http://"; 10 | 11 | public static String HTTPS = "https://"; 12 | 13 | public static String UDP = "udp:"; 14 | 15 | public static String MI_JSON_PARAMS = "?params="; 16 | 17 | public static char COMMA = ','; 18 | 19 | public static char COLON = ':'; 20 | } 21 | -------------------------------------------------------------------------------- /opensips-event-mi-spring-boot-starter/src/main/java/com/atomscat/opensips/spring/boot/starter/handler/DefaultClientEventHandler.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.opensips.spring.boot.starter.handler; 2 | 3 | 4 | import com.atomscat.opensips.event.handler.Context; 5 | 6 | /** 7 | * @author th158 8 | */ 9 | public class DefaultClientEventHandler extends AbstractClientEventHandler { 10 | 11 | @Override 12 | public void handler(Context context, Object msg) { 13 | log.debug("Default Client Event handler event[{}]", msg); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /freeswitch-esl-spring-boot-starter/src/main/java/com/atomscat/freeswitch/esl/spring/boot/starter/handler/DefaultMqEventHandler.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.esl.spring.boot.starter.handler; 2 | 3 | import com.rabbitmq.client.Channel; 4 | import lombok.extern.slf4j.Slf4j; 5 | @Slf4j 6 | public class DefaultMqEventHandler extends AbstractMqEventHandler{ 7 | @Override 8 | public void handle(Channel channel, String payload, Long tag, String contentType) throws Exception { 9 | log.debug("fs.events : {}", payload); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /freeswitch-xml-curl/src/main/java/com/atomscat/freeswitch/xml/handler/XmlCurlHandler.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.xml.handler; 2 | 3 | 4 | import com.atomscat.freeswitch.xml.domain.XmlCurl; 5 | import com.fasterxml.jackson.core.JsonProcessingException; 6 | 7 | /** 8 | *

XmlCurlHandler interface.

9 | * 10 | * @author : everyone 11 | * @version $Id: $Id 12 | */ 13 | public interface XmlCurlHandler { 14 | 15 | String handleXmlCurl(XmlCurl xmlCurl) throws JsonProcessingException; 16 | 17 | } 18 | -------------------------------------------------------------------------------- /spring-boot-common/spring-boot-common-core/src/main/java/com/atomscat/spring/boot/common/config/SpringBootCommonAutoConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.spring.boot.common.config; 2 | 3 | import org.springframework.context.annotation.ComponentScan; 4 | import org.springframework.context.annotation.Configuration; 5 | 6 | @Configuration 7 | @ComponentScan( 8 | basePackages = {"com.atomscat.spring.boot.common"} 9 | ) 10 | public class SpringBootCommonAutoConfiguration { 11 | public SpringBootCommonAutoConfiguration() { 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /spring-boot-common/spring-boot-common-core/src/main/java/com/atomscat/spring/boot/common/constant/NumberConstant.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.spring.boot.common.constant; 2 | 3 | public class NumberConstant { 4 | public static final int NUM_1 = 1; 5 | public static final int NUM_10 = 10; 6 | public static final int NUM_100 = 100; 7 | public static final int NUM_1_000 = 1000; 8 | public static final int NUM_10_000 = 10000; 9 | public static final int NUM_1000_000 = 1000000; 10 | 11 | private NumberConstant() { 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /freeswitch-cdr/src/main/java/com/atomscat/freeswitch/cdr/domain/Extension.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.cdr.domain; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | *

Extension class.

10 | * 11 | * @author : everyone 12 | * @version $Id: $Id 13 | */ 14 | @Data 15 | @Accessors(chain = true) 16 | public class Extension { 17 | private String name; 18 | private String number; 19 | private List applications; 20 | } 21 | -------------------------------------------------------------------------------- /opensips-event-mi-spring-boot-starter/src/main/java/com/atomscat/opensips/spring/boot/starter/handler/DefaultClientConnectHandler.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.opensips.spring.boot.starter.handler; 2 | 3 | 4 | import com.atomscat.opensips.event.handler.Context; 5 | 6 | /** 7 | * @author th158 8 | */ 9 | public class DefaultClientConnectHandler extends AbstractClientConnectHandler { 10 | 11 | 12 | @Override 13 | public void onConnect(Context context, Object msg) { 14 | log.debug("Default Client connect handler event[{}]", msg); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /freeswitch-esl-spring-boot-starter/src/main/java/com/atomscat/freeswitch/esl/spring/boot/starter/handler/DefaultMqLoggingHandler.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.esl.spring.boot.starter.handler; 2 | 3 | import com.rabbitmq.client.Channel; 4 | import lombok.extern.slf4j.Slf4j; 5 | 6 | @Slf4j 7 | public class DefaultMqLoggingHandler extends AbstractMqLoggingHandler { 8 | @Override 9 | public void handle(Channel channel, String payload, Long tag, String contentType) throws Exception { 10 | log.debug("fs.logging : {}", payload); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /freeswitch-esl-spring-boot-starter/src/main/java/com/atomscat/freeswitch/esl/spring/boot/starter/handler/OutBoundConnectHandler.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.esl.spring.boot.starter.handler; 2 | 3 | import com.atomscat.freeswitch.esl.outbound.handler.Context; 4 | import com.atomscat.freeswitch.esl.transport.event.EslEvent; 5 | 6 | public interface OutBoundConnectHandler { 7 | /** 8 | * @param context a {@link Context} object. 9 | * @param eslEvent a {@link EslEvent} object. 10 | */ 11 | void onConnect(Context context, EslEvent eslEvent); 12 | } 13 | -------------------------------------------------------------------------------- /freeswitch-cdr/src/main/java/com/atomscat/freeswitch/cdr/domain/ChannelData.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.cdr.domain; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | /** 7 | *

ChannelData class.

8 | * 9 | * @author : everyone 10 | * @version $Id: $Id 11 | */ 12 | @Data 13 | @Accessors(chain = true) 14 | public class ChannelData { 15 | private String state; 16 | private String direction; 17 | private String stateNumber; 18 | private String flags; 19 | private String caps; 20 | } 21 | -------------------------------------------------------------------------------- /spring-boot-common/spring-boot-common-election/src/main/java/com/atomscat/spring/boot/common/param/BaseElectionConsumerParam.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.spring.boot.common.param; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | import java.io.Serializable; 7 | 8 | /** 9 | * @author th158 10 | */ 11 | @Data 12 | @Accessors(chain = true) 13 | public abstract class BaseElectionConsumerParam implements Serializable { 14 | /** 15 | * unique primary key 16 | */ 17 | private String nodeId; 18 | 19 | private T entity; 20 | 21 | } 22 | -------------------------------------------------------------------------------- /spring-boot-common/spring-boot-common-election/src/main/java/com/atomscat/spring/boot/common/param/BaseElectionProducerParam.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.spring.boot.common.param; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | import java.io.Serializable; 7 | 8 | /** 9 | * @author th158 10 | */ 11 | @Data 12 | @Accessors(chain = true) 13 | public abstract class BaseElectionProducerParam implements Serializable { 14 | /** 15 | * unique primary key 16 | */ 17 | private String nodeId; 18 | 19 | private transient T entity; 20 | } 21 | -------------------------------------------------------------------------------- /freeswitch-cdr/src/main/java/com/atomscat/freeswitch/cdr/domain/ErrorPeriod.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.cdr.domain; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | /** 7 | *

ErrorPeriod class.

8 | * 9 | * @author : everyone 10 | * @version $Id: $Id 11 | */ 12 | @Data 13 | @Accessors(chain = true) 14 | public class ErrorPeriod { 15 | private String start; 16 | private String stop; 17 | private String flaws; 18 | private String consecutiveFlaws; 19 | private String durationMsec; 20 | } 21 | -------------------------------------------------------------------------------- /freeswitch-esl-spring-boot-starter-example/README.md: -------------------------------------------------------------------------------- 1 | # FreeSWITCH ESL Spring Boot Starter Example 2 | 3 | [![Jdk Version](https://img.shields.io/badge/JDK-1.8-green.svg)](https://img.shields.io/badge/JDK-1.8-green.svg) 4 | [![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html) 5 | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/link.thingscloud/freeswitch-esl-spring-boot-starter-example/badge.svg)](https://maven-badges.herokuapp.com/maven-central/link.thingscloud/freeswitch-esl-spring-boot-starter-example/) 6 | 7 | -------------------------------------------------------------------------------- /freeswitch-esl-spring-boot-starter/src/main/java/com/atomscat/freeswitch/esl/spring/boot/starter/handler/OutBoundEventHandler.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.esl.spring.boot.starter.handler; 2 | 3 | 4 | import com.atomscat.freeswitch.esl.outbound.handler.Context; 5 | import com.atomscat.freeswitch.esl.transport.event.EslEvent; 6 | 7 | /** 8 | * 9 | */ 10 | public interface OutBoundEventHandler { 11 | 12 | /** 13 | * @param context a {@link Context} object. 14 | * @param eslEvent a {@link EslEvent} object. 15 | */ 16 | void handler(Context context, EslEvent eslEvent); 17 | } 18 | -------------------------------------------------------------------------------- /opensips-event-mi-spring-boot-starter/src/main/java/com/atomscat/opensips/spring/boot/starter/handler/EventClientOptionHandler.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.opensips.spring.boot.starter.handler; 2 | 3 | 4 | import com.atomscat.opensips.event.option.EventClientOption; 5 | 6 | /** 7 | *

InboundClientOptionHandler interface.

8 | * 9 | * @author everyone 10 | * @version 1.0.0 11 | */ 12 | public interface EventClientOptionHandler { 13 | 14 | /** 15 | *

getOption.

16 | * 17 | * @return a {@link EventClientOption} object. 18 | */ 19 | EventClientOption getOption(); 20 | 21 | } 22 | -------------------------------------------------------------------------------- /doc/Maven.md: -------------------------------------------------------------------------------- 1 | ### 部署中央仓库 2 | 3 | ``` 4 | mvn clean package -DskipTests deploy -projects freeswitch-cdr 5 | mvn clean package -DskipTests deploy -projects freeswitch-esl 6 | mvn clean package -DskipTests deploy -projects freeswitch-xml-curl 7 | mvn clean package -DskipTests deploy -projects opensips-event-mi 8 | mvn clean package -DskipTests deploy -projects spring-boot-common/spring-boot-common-aop,spring-boot-common/spring-boot-common-core 9 | mvn clean package -DskipTests deploy -projects freeswitch-cdr-spring-boot-starter,freeswitch-esl-spring-boot-starter,freeswitch-xml-curl-spring-boot-starter,opensips-event-mi-spring-boot-starter 10 | ``` -------------------------------------------------------------------------------- /freeswitch-esl-spring-boot-starter/src/main/java/com/atomscat/freeswitch/esl/spring/boot/starter/handler/InboundClientOptionHandler.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.esl.spring.boot.starter.handler; 2 | 3 | import com.atomscat.freeswitch.esl.inbound.option.InboundClientOption; 4 | 5 | /** 6 | *

InboundClientOptionHandler interface.

7 | * 8 | * @author everyone 9 | * @version 1.0.0 10 | */ 11 | public interface InboundClientOptionHandler { 12 | 13 | /** 14 | *

getOption.

15 | * 16 | * @return a {@link InboundClientOption} object. 17 | */ 18 | InboundClientOption getOption(); 19 | 20 | } 21 | -------------------------------------------------------------------------------- /freeswitch-esl-spring-boot-starter/src/main/java/com/atomscat/freeswitch/esl/spring/boot/starter/handler/OutboundServerOptionHandler.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.esl.spring.boot.starter.handler; 2 | 3 | import com.atomscat.freeswitch.esl.outbound.option.OutboundServerOption; 4 | 5 | /** 6 | *

InboundClientOptionHandler interface.

7 | * 8 | * @author everyone 9 | * @version 1.0.0 10 | */ 11 | public interface OutboundServerOptionHandler { 12 | 13 | /** 14 | *

getOption.

15 | * 16 | * @return a {@link OutboundServerOption} object. 17 | */ 18 | OutboundServerOption getOption(); 19 | 20 | } 21 | -------------------------------------------------------------------------------- /freeswitch-xml-curl/src/main/java/com/atomscat/freeswitch/xml/domain/configuration/sofia/aliase/Aliases.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.xml.domain.configuration.sofia.aliase; 2 | 3 | import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; 4 | import lombok.Data; 5 | import lombok.experimental.Accessors; 6 | 7 | import java.io.Serializable; 8 | import java.util.List; 9 | 10 | /** 11 | * @author howell 12 | */ 13 | @Data 14 | @Accessors(chain = true) 15 | public class Aliases implements Serializable { 16 | @JacksonXmlElementWrapper(localName = "alias", useWrapping = false) 17 | private List alias; 18 | } 19 | -------------------------------------------------------------------------------- /freeswitch-cdr/src/main/java/com/atomscat/freeswitch/cdr/domain/Callflow.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.cdr.domain; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | /** 7 | *

Callflow class.

8 | * 9 | * @author : everyone 10 | * @version $Id: $Id 11 | */ 12 | @Data 13 | @Accessors(chain = true) 14 | public class Callflow { 15 | private String dialplan; 16 | private String uniqueId; 17 | private String cloneOf; 18 | private String profileIndex; 19 | private Extension extension; 20 | private CallerProfile callerProfile; 21 | private Times times; 22 | } 23 | -------------------------------------------------------------------------------- /freeswitch-xml-curl/src/main/java/com/atomscat/freeswitch/xml/domain/configuration/sofia/domain/Domains.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.xml.domain.configuration.sofia.domain; 2 | 3 | import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; 4 | import lombok.Data; 5 | import lombok.experimental.Accessors; 6 | 7 | import java.io.Serializable; 8 | import java.util.List; 9 | 10 | /** 11 | * @author howell 12 | */ 13 | @Data 14 | @Accessors(chain = true) 15 | public class Domains implements Serializable { 16 | 17 | @JacksonXmlElementWrapper(localName = "domain", useWrapping = false) 18 | private List domain; 19 | } 20 | -------------------------------------------------------------------------------- /opensips-event-mi/src/main/java/com/atomscat/opensips/mi/entitys/enums/MiJsonUriEnum.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.opensips.mi.entitys.enums; 2 | 3 | import lombok.Getter; 4 | 5 | /** 6 | * @author : everyone 7 | * @version 1.0.0 8 | */ 9 | @Getter 10 | public enum MiJsonUriEnum { 11 | 12 | UL_SHOW_CONTACT("/json/ul_show_contact", "根据sip的AOR地址获取注册在opensips上的信息"), 13 | EVENT_SUBSCRIBE("/json/event_subscribe", "发送事件订阅地址给opensips"); 14 | 15 | private final String uri; 16 | 17 | private final String desc; 18 | 19 | MiJsonUriEnum(String uri, String desc) { 20 | this.uri = uri; 21 | this.desc = desc; 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /freeswitch-esl-spring-boot-starter/src/main/java/com/atomscat/freeswitch/esl/spring/boot/starter/handler/DefaultOutBoundEventHandler.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.esl.spring.boot.starter.handler; 2 | 3 | 4 | import com.atomscat.freeswitch.esl.helper.EslHelper; 5 | import com.atomscat.freeswitch.esl.outbound.handler.Context; 6 | import com.atomscat.freeswitch.esl.transport.event.EslEvent; 7 | 8 | public class DefaultOutBoundEventHandler extends AbstractOutBoundEventHandler { 9 | @Override 10 | public void handler(Context context, EslEvent eslEvent) { 11 | log.debug("Default outbound connect handler event[{}]", EslHelper.formatEslEvent(eslEvent)); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /freeswitch-xml-curl/src/main/java/com/atomscat/freeswitch/xml/domain/directory/user/Users.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.xml.domain.directory.user; 2 | 3 | import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | import lombok.experimental.Accessors; 8 | 9 | import java.io.Serializable; 10 | import java.util.List; 11 | 12 | @Data 13 | @NoArgsConstructor 14 | @AllArgsConstructor 15 | @Accessors(chain = true) 16 | public class Users implements Serializable { 17 | @JacksonXmlElementWrapper(localName = "user", useWrapping = false) 18 | private List user; 19 | } 20 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | Use this section to tell people about which versions of your project are currently being supported with security 6 | updates. 7 | 8 | | Version | Supported | 9 | | ------- | ------------------ | 10 | | 5.1.x | :white_check_mark: | 11 | | 5.0.x | :x: | 12 | | 4.0.x | :white_check_mark: | 13 | | < 4.0 | :x: | 14 | 15 | ## Reporting a Vulnerability 16 | 17 | Use this section to tell people how to report a vulnerability. 18 | 19 | Tell them where to go, how often they can expect to get an update on a reported vulnerability, what to expect if the 20 | vulnerability is accepted or declined, etc. 21 | -------------------------------------------------------------------------------- /freeswitch-xml-curl/src/main/java/com/atomscat/freeswitch/xml/domain/directory/group/Groups.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.xml.domain.directory.group; 2 | 3 | import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | import lombok.experimental.Accessors; 8 | 9 | import java.io.Serializable; 10 | import java.util.List; 11 | 12 | @Data 13 | @NoArgsConstructor 14 | @AllArgsConstructor 15 | @Accessors(chain = true) 16 | public class Groups implements Serializable { 17 | @JacksonXmlElementWrapper(localName = "group", useWrapping = false) 18 | private List group; 19 | } 20 | -------------------------------------------------------------------------------- /freeswitch-xml-curl/src/main/java/com/atomscat/freeswitch/xml/domain/directory/param/Params.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.xml.domain.directory.param; 2 | 3 | import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | import lombok.experimental.Accessors; 8 | 9 | import java.io.Serializable; 10 | import java.util.List; 11 | 12 | @Data 13 | @NoArgsConstructor 14 | @AllArgsConstructor 15 | @Accessors(chain = true) 16 | public class Params implements Serializable { 17 | @JacksonXmlElementWrapper(localName = "param", useWrapping = false) 18 | private List param; 19 | } 20 | -------------------------------------------------------------------------------- /freeswitch-xml-curl/src/main/java/com/atomscat/freeswitch/xml/domain/configuration/sofia/aliase/Alias.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.xml.domain.configuration.sofia.aliase; 2 | 3 | import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; 4 | import lombok.Data; 5 | import lombok.experimental.Accessors; 6 | 7 | import java.io.Serializable; 8 | 9 | /** 10 | * @author howell 11 | */ 12 | @Data 13 | @Accessors(chain = true) 14 | public class Alias implements Serializable { 15 | /** 16 | * aliases are other names that will work as a valid profile name for this profile 17 | */ 18 | @JacksonXmlProperty(localName = "name", isAttribute = true) 19 | private String name; 20 | } 21 | -------------------------------------------------------------------------------- /freeswitch-xml-curl/src/main/java/com/atomscat/freeswitch/xml/domain/directory/gateway/Gateways.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.xml.domain.directory.gateway; 2 | 3 | import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | import lombok.experimental.Accessors; 8 | 9 | import java.io.Serializable; 10 | import java.util.List; 11 | 12 | @Data 13 | @NoArgsConstructor 14 | @AllArgsConstructor 15 | @Accessors(chain = true) 16 | public class Gateways implements Serializable { 17 | @JacksonXmlElementWrapper(localName = "gateway", useWrapping = false) 18 | private List gateway; 19 | } 20 | -------------------------------------------------------------------------------- /freeswitch-esl-spring-boot-starter/src/main/java/com/atomscat/freeswitch/esl/spring/boot/starter/handler/DefaultOutBoundConnectHandler.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.esl.spring.boot.starter.handler; 2 | 3 | import com.atomscat.freeswitch.esl.helper.EslHelper; 4 | import com.atomscat.freeswitch.esl.outbound.handler.Context; 5 | import com.atomscat.freeswitch.esl.transport.event.EslEvent; 6 | 7 | /** 8 | * @author th158 9 | */ 10 | public class DefaultOutBoundConnectHandler extends AbstractOutBoundConnectHandler { 11 | @Override 12 | public void onConnect(Context context, EslEvent eslEvent) { 13 | log.debug("Default outbound connect handler event[{}]", EslHelper.formatEslEvent(eslEvent)); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /freeswitch-xml-curl/src/main/java/com/atomscat/freeswitch/xml/domain/configuration/sofia/setting/Settings.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.xml.domain.configuration.sofia.setting; 2 | 3 | import com.atomscat.freeswitch.xml.domain.configuration.sofia.Param; 4 | import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; 5 | import lombok.Data; 6 | import lombok.experimental.Accessors; 7 | 8 | import java.io.Serializable; 9 | import java.util.List; 10 | 11 | /** 12 | * @author howell 13 | */ 14 | @Data 15 | @Accessors(chain = true) 16 | public class Settings implements Serializable { 17 | 18 | @JacksonXmlElementWrapper(localName = "param", useWrapping = false) 19 | private List param; 20 | } 21 | -------------------------------------------------------------------------------- /opensips-event-mi/src/main/java/com/atomscat/opensips/mi/service/MiUlShowContactService.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.opensips.mi.service; 2 | 3 | 4 | import com.atomscat.opensips.mi.entitys.request.MiUlShowContactReq; 5 | import com.atomscat.opensips.mi.entitys.response.MiUlShowContactResp; 6 | 7 | /** 8 | * @author : everyone 9 | * @version 1.0.0 10 | */ 11 | public interface MiUlShowContactService { 12 | /** 13 | * @param urlBase OpenSips MI Service address base url 14 | * @param ulShowContactReq a {@link MiUlShowContactReq} request param 15 | * @return a {@link MiUlShowContactResp} response param 16 | */ 17 | MiUlShowContactResp getUlShowContact(String urlBase, MiUlShowContactReq ulShowContactReq); 18 | } 19 | -------------------------------------------------------------------------------- /freeswitch-esl-spring-boot-starter-example/src/main/java/com/atomscat/freeswitch/esl/spring/boot/starter/example/udp/InitStart.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.esl.spring.boot.starter.example.udp; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | 5 | @Configuration 6 | public class InitStart { 7 | 8 | // @Autowired 9 | // private UdpServer2 udpServer2; 10 | 11 | // @Autowired 12 | // private UdpServer udpServer; 13 | // 14 | // @Bean(initMethod = "start") 15 | // public UdpServer2 udpServer2(){ 16 | // return new UdpServer2(); 17 | // } 18 | 19 | // @Bean(initMethod = "start") 20 | // public UdpServer udpServer(){ 21 | // return new UdpServer(); 22 | // } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /freeswitch-xml-curl/src/main/java/com/atomscat/freeswitch/xml/domain/dialplan/Extension.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.xml.domain.dialplan; 2 | 3 | import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; 4 | import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | import java.util.List; 9 | 10 | /** 11 | * @author th158 12 | */ 13 | @Data 14 | public class Extension implements Serializable { 15 | 16 | @JacksonXmlProperty(localName = "name", isAttribute = true) 17 | private String name; 18 | 19 | @JacksonXmlElementWrapper(localName = "condition", useWrapping = false) 20 | private List condition; 21 | } 22 | -------------------------------------------------------------------------------- /OSSRH-72998/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | softswitch-gateway 7 | com.atomscat 8 | 2.0.0.RELEASE 9 | 10 | 4.0.0 11 | 12 | OSSRH-72998 13 | 14 | 15 | 17 16 | 17 17 | 18 | 19 | -------------------------------------------------------------------------------- /opensips-event-mi/src/main/java/com/atomscat/opensips/mi/service/MiEventSubscribeService.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.opensips.mi.service; 2 | 3 | 4 | import com.atomscat.opensips.mi.entitys.request.MiEventSubscribeReq; 5 | import com.atomscat.opensips.mi.entitys.response.MiEventSubscribeResp; 6 | 7 | /** 8 | * @author : everyone 9 | * @version 1.0.0 10 | */ 11 | public interface MiEventSubscribeService { 12 | /** 13 | * @param urlBase OpenSips MI Service address base url 14 | * @param eventSubscribeReq a {@link MiEventSubscribeReq} request param 15 | * @return a {@link MiEventSubscribeResp} response param 16 | */ 17 | MiEventSubscribeResp setEventSubscribe(String urlBase, MiEventSubscribeReq eventSubscribeReq); 18 | } 19 | -------------------------------------------------------------------------------- /freeswitch-cdr/src/main/java/com/atomscat/freeswitch/cdr/domain/Outbound.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.cdr.domain; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | /** 7 | *

Outbound class.

8 | * 9 | * @author : everyone 10 | * @version $Id: $Id 11 | */ 12 | @Data 13 | @Accessors(chain = true) 14 | public class Outbound { 15 | private String rawBytes; 16 | private String mediaBytes; 17 | private String packetCount; 18 | private String mediaPacketCount; 19 | private String skipPacketCount; 20 | private String dtmfPacketCount; 21 | private String cngPacketCount; 22 | private String rtcpPacketCount; 23 | private String rtcpOctetCount; 24 | } 25 | -------------------------------------------------------------------------------- /freeswitch-xml-curl/src/main/java/com/atomscat/freeswitch/xml/domain/configuration/ivr/Menus.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.xml.domain.configuration.ivr; 2 | 3 | import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | import lombok.experimental.Accessors; 8 | 9 | import java.io.Serializable; 10 | import java.util.List; 11 | 12 | /** 13 | * @author th158 14 | */ 15 | @Data 16 | @NoArgsConstructor 17 | @AllArgsConstructor 18 | @Accessors(chain = true) 19 | public class Menus implements Serializable { 20 | 21 | @JacksonXmlElementWrapper(localName = "menu", useWrapping = false) 22 | private List menu; 23 | } 24 | -------------------------------------------------------------------------------- /freeswitch-xml-curl/src/main/java/com/atomscat/freeswitch/xml/constant/SectionNames.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.xml.constant; 2 | 3 | /** 4 | * @author th158 5 | */ 6 | public class SectionNames { 7 | 8 | /** 9 | * configuration: 10 | * - ivr.conf 11 | * - sofia.conf 12 | */ 13 | public static final String CONFIGURATION = "CONFIGURATION"; 14 | 15 | public static final String DIALPLAN = "DIALPLAN"; 16 | 17 | public static final String DIRECTORY = "DIRECTORY"; 18 | 19 | public static final String PHRASES = "PHRASES"; 20 | 21 | public static class Configuration { 22 | public static final String IVR = "ivr.conf"; 23 | public static final String SOFIA = "sofia.conf"; 24 | 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /freeswitch-xml-curl/src/main/java/com/atomscat/freeswitch/xml/domain/directory/param/Param.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.xml.domain.directory.param; 2 | 3 | import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | import lombok.experimental.Accessors; 8 | 9 | import java.io.Serializable; 10 | 11 | @Data 12 | @NoArgsConstructor 13 | @AllArgsConstructor 14 | @Accessors(chain = true) 15 | public class Param implements Serializable { 16 | 17 | @JacksonXmlProperty(localName = "name", isAttribute = true) 18 | private String name; 19 | 20 | @JacksonXmlProperty(localName = "value", isAttribute = true) 21 | private String value; 22 | } 23 | -------------------------------------------------------------------------------- /freeswitch-xml-curl/src/main/java/com/atomscat/freeswitch/xml/domain/directory/variable/Variable.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.xml.domain.directory.variable; 2 | 3 | import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | import lombok.experimental.Accessors; 8 | 9 | import java.io.Serializable; 10 | 11 | @Data 12 | @NoArgsConstructor 13 | @AllArgsConstructor 14 | @Accessors(chain = true) 15 | public class Variable implements Serializable { 16 | 17 | @JacksonXmlProperty(localName = "name", isAttribute = true) 18 | private String name; 19 | 20 | @JacksonXmlProperty(localName = "value", isAttribute = true) 21 | private String value; 22 | } -------------------------------------------------------------------------------- /freeswitch-xml-curl/src/main/java/com/atomscat/freeswitch/xml/domain/configuration/sofia/gateway/Gateways.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.xml.domain.configuration.sofia.gateway; 2 | 3 | import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | import lombok.experimental.Accessors; 8 | 9 | import java.io.Serializable; 10 | import java.util.List; 11 | 12 | /** 13 | * @author th158 14 | */ 15 | @Data 16 | @NoArgsConstructor 17 | @AllArgsConstructor 18 | @Accessors(chain = true) 19 | public class Gateways implements Serializable { 20 | @JacksonXmlElementWrapper(localName = "gateway", useWrapping = false) 21 | private List gateway; 22 | } 23 | -------------------------------------------------------------------------------- /freeswitch-xml-curl/src/main/java/com/atomscat/freeswitch/xml/utils/BasicAuthenticationUtil.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.xml.utils; 2 | 3 | 4 | import lombok.extern.slf4j.Slf4j; 5 | import org.apache.commons.lang3.StringUtils; 6 | 7 | import java.io.IOException; 8 | import java.nio.charset.StandardCharsets; 9 | import java.util.Base64; 10 | 11 | /** 12 | * @author th158 13 | */ 14 | @Slf4j 15 | public class BasicAuthenticationUtil { 16 | @SuppressWarnings("restriction") 17 | public static String base64Decode(String str) { 18 | if (StringUtils.isBlank(str)) { 19 | return null; 20 | } 21 | byte[] base64decodedBytes = Base64.getDecoder().decode(str); 22 | return new String(base64decodedBytes, StandardCharsets.UTF_8); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /freeswitch-cdr/src/main/java/com/atomscat/freeswitch/cdr/domain/Times.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.cdr.domain; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | /** 7 | *

Times class.

8 | * 9 | * @author : everyone 10 | * @version $Id: $Id 11 | */ 12 | @Data 13 | @Accessors(chain = true) 14 | public class Times { 15 | private Long createdTime; 16 | private Long profileCreatedTime; 17 | private Long progressTime; 18 | private Long progressMediaTime; 19 | private Long answeredTime; 20 | private Long bridgedTime; 21 | private Long lastHoldTime; 22 | private Long holdAccumTime; 23 | private Long hangupTime; 24 | private Long resurrectTime; 25 | private Long transferTime; 26 | } 27 | -------------------------------------------------------------------------------- /freeswitch-xml-curl/src/main/java/com/atomscat/freeswitch/xml/domain/directory/variable/Variables.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.xml.domain.directory.variable; 2 | 3 | import com.atomscat.freeswitch.xml.domain.directory.param.Param; 4 | import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; 5 | import lombok.AllArgsConstructor; 6 | import lombok.Data; 7 | import lombok.NoArgsConstructor; 8 | import lombok.experimental.Accessors; 9 | 10 | import java.io.Serializable; 11 | import java.util.List; 12 | 13 | @Data 14 | @NoArgsConstructor 15 | @AllArgsConstructor 16 | @Accessors(chain = true) 17 | public class Variables implements Serializable { 18 | @JacksonXmlElementWrapper(localName = "variable", useWrapping = false) 19 | private List variable; 20 | 21 | } 22 | -------------------------------------------------------------------------------- /freeswitch-cdr-spring-boot-starter-example/src/main/java/com/atomscat/freeswitch/cdr/spring/boot/starter/example/ExampleApplication.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.cdr.spring.boot.starter.example; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | /** 7 | *

ExampleApplication class.

8 | * 9 | * @author : everyone 10 | * @version $Id: $Id 11 | */ 12 | @SpringBootApplication 13 | public class ExampleApplication { 14 | 15 | /** 16 | *

main.

17 | * 18 | * @param args an array of {@link java.lang.String} objects. 19 | */ 20 | public static void main(String[] args) { 21 | SpringApplication.run(ExampleApplication.class, args); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /freeswitch-xml-curl/src/main/java/com/atomscat/freeswitch/xml/domain/configuration/sofia/Param.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.xml.domain.configuration.sofia; 2 | 3 | import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | import lombok.experimental.Accessors; 8 | 9 | import java.io.Serializable; 10 | 11 | /** 12 | * @author th158 13 | */ 14 | @Data 15 | @NoArgsConstructor 16 | @AllArgsConstructor 17 | @Accessors(chain = true) 18 | public class Param implements Serializable { 19 | 20 | @JacksonXmlProperty(localName = "name", isAttribute = true) 21 | private String name; 22 | 23 | @JacksonXmlProperty(localName = "value", isAttribute = true) 24 | private String value; 25 | } 26 | -------------------------------------------------------------------------------- /freeswitch-xml-curl/src/main/java/com/atomscat/freeswitch/xml/domain/directory/group/Group.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.xml.domain.directory.group; 2 | 3 | import com.atomscat.freeswitch.xml.domain.directory.user.Users; 4 | import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; 5 | import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; 6 | import lombok.AllArgsConstructor; 7 | import lombok.Data; 8 | import lombok.NoArgsConstructor; 9 | import lombok.experimental.Accessors; 10 | 11 | import java.io.Serializable; 12 | 13 | @Data 14 | @NoArgsConstructor 15 | @AllArgsConstructor 16 | @Accessors(chain = true) 17 | public class Group implements Serializable { 18 | 19 | @JacksonXmlProperty(localName = "users", isAttribute = true) 20 | private Users users; 21 | } 22 | -------------------------------------------------------------------------------- /opensips-event-mi/src/main/java/com/atomscat/opensips/mi/entitys/request/MiEventSubscribeReq.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.opensips.mi.entitys.request; 2 | 3 | import com.alibaba.fastjson.annotation.JSONField; 4 | import lombok.Data; 5 | 6 | import java.io.Serializable; 7 | 8 | /** 9 | * @author : everyone 10 | * @version 1.0.0 11 | */ 12 | @Data 13 | public class MiEventSubscribeReq implements Serializable { 14 | private static final long serialVersionUID = 1L; 15 | 16 | @JSONField(ordinal = 1) 17 | private String eventName; 18 | 19 | @JSONField(ordinal = 2) 20 | private String externalApplicationSocket; 21 | 22 | /** 23 | * in seconds - if absent, the subscription is valid only one hour (3600 s) 24 | */ 25 | @JSONField(ordinal = 3) 26 | private String expireTime; 27 | 28 | } 29 | -------------------------------------------------------------------------------- /opensips-event-mi/src/main/java/com/atomscat/opensips/mi/entitys/request/MiUlShowContactReq.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.opensips.mi.entitys.request; 2 | 3 | import com.alibaba.fastjson.annotation.JSONField; 4 | import lombok.Data; 5 | 6 | import java.io.Serializable; 7 | 8 | /** 9 | * @author : everyone 10 | * @version 1.0.0 11 | */ 12 | @Data 13 | public class MiUlShowContactReq implements Serializable { 14 | private static final long serialVersionUID = 1L; 15 | 16 | /** 17 | * table where the AOR resides (Ex: location). 18 | */ 19 | @JSONField(ordinal = 1) 20 | private String tableName; 21 | 22 | /** 23 | * user AOR in username[@domain] format (domain must be supplied only if use_domain option is on). 24 | */ 25 | @JSONField(ordinal = 2) 26 | private String aor; 27 | } 28 | -------------------------------------------------------------------------------- /freeswitch-xml-curl/src/main/java/com/atomscat/freeswitch/xml/domain/configuration/sofia/profile/Profiles.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.xml.domain.configuration.sofia.profile; 2 | 3 | import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; 4 | import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; 5 | import lombok.Data; 6 | import lombok.experimental.Accessors; 7 | 8 | import java.io.Serializable; 9 | import java.util.List; 10 | 11 | /** 12 | * @author howell 13 | */ 14 | @Data 15 | @Accessors(chain = true) 16 | @JacksonXmlRootElement(localName = "profiles", namespace = "profiles") 17 | public class Profiles implements Serializable { 18 | 19 | @JacksonXmlElementWrapper(localName = "profile", useWrapping = false) 20 | private List profile; 21 | 22 | } 23 | -------------------------------------------------------------------------------- /spring-boot-common/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | softswitch-gateway 7 | com.atomscat 8 | 2.0.0.RELEASE 9 | 10 | 4.0.0 11 | 12 | spring-boot-common 13 | 14 | 15 | 17 16 | 17 17 | 17 18 | 19 | 20 | -------------------------------------------------------------------------------- /spring-boot-common/spring-boot-common-core/src/main/java/com/atomscat/spring/boot/common/constant/StringConstant.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.spring.boot.common.constant; 2 | 3 | public final class StringConstant { 4 | public static final String NUM_0 = "0"; 5 | public static final String NUM_1 = "1"; 6 | public static final String NUM_2 = "2"; 7 | public static final String NUM_3 = "3"; 8 | public static final String NUM_4 = "4"; 9 | public static final String NUM_5 = "5"; 10 | public static final String NUM_6 = "6"; 11 | public static final String NUM_7 = "7"; 12 | public static final String NUM_8 = "8"; 13 | public static final String NUM_9 = "9"; 14 | public static final String TRUE = "true"; 15 | public static final String FALSE = "false"; 16 | 17 | private StringConstant() { 18 | } 19 | } -------------------------------------------------------------------------------- /opensips-event-mi/src/main/java/com/atomscat/opensips/event/handler/Context.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.opensips.event.handler; 2 | 3 | import io.netty.channel.Channel; 4 | 5 | 6 | /** 7 | * @author th158 8 | */ 9 | public class Context implements IEventApi { 10 | 11 | private final EventChannelHandler handler; 12 | private final Channel channel; 13 | 14 | public Context(Channel channel, EventChannelHandler clientHandler) { 15 | this.handler = clientHandler; 16 | this.channel = channel; 17 | } 18 | 19 | @Override 20 | public boolean canSend() { 21 | return channel != null && channel.isActive(); 22 | } 23 | 24 | public Channel channel() { 25 | return channel; 26 | } 27 | 28 | public EventChannelHandler handler() { 29 | return handler; 30 | } 31 | 32 | 33 | } 34 | -------------------------------------------------------------------------------- /freeswitch-xml-curl/src/main/java/com/atomscat/freeswitch/xml/domain/configuration/ivr/Ivr.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.xml.domain.configuration.ivr; 2 | 3 | import com.atomscat.freeswitch.xml.constant.ConfName; 4 | import com.atomscat.freeswitch.xml.domain.configuration.Configuration; 5 | import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; 6 | import lombok.Data; 7 | import lombok.experimental.Accessors; 8 | 9 | import java.io.Serializable; 10 | import java.util.List; 11 | 12 | /** 13 | * @author howell 14 | */ 15 | @Data 16 | @Accessors(chain = true) 17 | public class Ivr extends Configuration implements Serializable { 18 | 19 | public Ivr() { 20 | setName(ConfName.IVR.name); 21 | } 22 | 23 | @JacksonXmlElementWrapper(localName = "menus", useWrapping = false) 24 | private Menus menus; 25 | } 26 | -------------------------------------------------------------------------------- /freeswitch-xml-curl/src/main/java/com/atomscat/freeswitch/xml/domain/dialplan/Condition.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.xml.domain.dialplan; 2 | 3 | import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; 4 | import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; 5 | import lombok.Data; 6 | 7 | import java.io.Serializable; 8 | import java.util.List; 9 | 10 | @Data 11 | public class Condition implements Serializable { 12 | 13 | @JacksonXmlProperty(localName = "field", isAttribute = true) 14 | private String field; 15 | 16 | /** 17 | * 匹配被叫分机号正则表达式 18 | */ 19 | @JacksonXmlProperty(localName = "expression", isAttribute = true) 20 | private String expression; 21 | 22 | @JacksonXmlElementWrapper(localName = "action", useWrapping = false) 23 | private List action; 24 | } 25 | -------------------------------------------------------------------------------- /freeswitch-cdr-spring-boot-starter-example/src/main/java/com/atomscat/freeswitch/cdr/spring/boot/starter/example/ExampleCdrHandler.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.cdr.spring.boot.starter.example; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | import com.atomscat.freeswitch.cdr.domain.Cdr; 5 | import com.atomscat.freeswitch.cdr.handler.CdrHandler; 6 | import lombok.extern.slf4j.Slf4j; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | *

ExampleCdrHandler class.

11 | * 12 | * @author : everyone 13 | * @version $Id: $Id 14 | */ 15 | @Slf4j 16 | @Service 17 | public class ExampleCdrHandler implements CdrHandler { 18 | /** 19 | * {@inheritDoc} 20 | */ 21 | @Override 22 | public void handleCdr(Cdr cdr) { 23 | log.info("exampel handle cdr : [{}]", JSON.toJSONString(cdr, true)); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /freeswitch-xml-curl/src/main/java/com/atomscat/freeswitch/xml/exception/ParserException.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.xml.exception; 2 | 3 | /** 4 | *

ParserException class.

5 | * 6 | * @author : everyone 7 | * @version $Id: $Id 8 | */ 9 | public class ParserException extends Exception { 10 | 11 | /** 12 | *

Constructor for ParserException.

13 | * 14 | * @param message a {@link String} object. 15 | */ 16 | public ParserException(String message) { 17 | super(message); 18 | } 19 | 20 | /** 21 | *

Constructor for ParserException.

22 | * 23 | * @param message a {@link String} object. 24 | * @param cause a {@link Throwable} object. 25 | */ 26 | public ParserException(String message, Throwable cause) { 27 | super(message, cause); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /softswitch-all-spring-boot-starter-example/src/main/java/com/atomscat/freeswitch/esl/spring/boot/starter/example/handler/FsCdrHandler.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.esl.spring.boot.starter.example.handler; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | import com.atomscat.freeswitch.cdr.domain.Cdr; 5 | import com.atomscat.freeswitch.cdr.handler.CdrHandler; 6 | import lombok.extern.slf4j.Slf4j; 7 | import org.springframework.stereotype.Service; 8 | 9 | /** 10 | *

ExampleCdrHandler class.

11 | * 12 | * @author : everyone 13 | * @version $Id: $Id 14 | */ 15 | @Slf4j 16 | @Service 17 | public class FsCdrHandler implements CdrHandler { 18 | /** 19 | * {@inheritDoc} 20 | */ 21 | @Override 22 | public void handleCdr(Cdr cdr) { 23 | log.info("exampel handle cdr : [{}]", JSON.toJSONString(cdr, true)); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /opensips-event-mi/src/main/java/com/atomscat/opensips/util/ArrayUtils.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.opensips.util; 2 | 3 | import java.lang.reflect.Array; 4 | 5 | /** 6 | *

ArrayUtils class.

7 | * 8 | * @author everyone 9 | * @version 1.0.0 10 | */ 11 | public class ArrayUtils { 12 | 13 | /** 14 | *

isEmpty.

15 | * 16 | * @param array an array of {@link Object} objects. 17 | * @return a boolean. 18 | */ 19 | public static boolean isEmpty(final Object[] array) { 20 | return getLength(array) == 0; 21 | } 22 | 23 | /** 24 | *

getLength.

25 | * 26 | * @param array a {@link Object} object. 27 | * @return a int. 28 | */ 29 | public static int getLength(final Object array) { 30 | if (array == null) { 31 | return 0; 32 | } 33 | return Array.getLength(array); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /freeswitch-cdr/src/main/java/com/atomscat/freeswitch/cdr/exception/ParserException.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.cdr.exception; 2 | 3 | /** 4 | *

ParserException class.

5 | * 6 | * @author : everyone 7 | * @version $Id: $Id 8 | */ 9 | public class ParserException extends Exception { 10 | 11 | /** 12 | *

Constructor for ParserException.

13 | * 14 | * @param message a {@link java.lang.String} object. 15 | */ 16 | public ParserException(String message) { 17 | super(message); 18 | } 19 | 20 | /** 21 | *

Constructor for ParserException.

22 | * 23 | * @param message a {@link java.lang.String} object. 24 | * @param cause a {@link java.lang.Throwable} object. 25 | */ 26 | public ParserException(String message, Throwable cause) { 27 | super(message, cause); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /freeswitch-xml-curl/src/main/java/com/atomscat/freeswitch/xml/domain/dialplan/Action.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.xml.domain.dialplan; 2 | 3 | import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | 8 | import java.io.Serializable; 9 | 10 | /** 11 | * @author th158 12 | */ 13 | @Data 14 | @NoArgsConstructor 15 | @AllArgsConstructor 16 | public class Action implements Serializable { 17 | 18 | @JacksonXmlProperty(localName = "application", isAttribute = true) 19 | private AppEnum application; 20 | 21 | @JacksonXmlProperty(localName = "data", isAttribute = true) 22 | private String data; 23 | 24 | public Action(String application, String data) { 25 | this.application = AppEnum.instance(application); 26 | this.data = data; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /freeswitch-esl/src/main/java/com/atomscat/freeswitch/esl/util/ArrayUtils.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.esl.util; 2 | 3 | import java.lang.reflect.Array; 4 | 5 | /** 6 | *

ArrayUtils class.

7 | * 8 | * @author everyone 9 | * @version 1.0.0 10 | */ 11 | public class ArrayUtils { 12 | 13 | /** 14 | *

isEmpty.

15 | * 16 | * @param array an array of {@link java.lang.Object} objects. 17 | * @return a boolean. 18 | */ 19 | public static boolean isEmpty(final Object[] array) { 20 | return getLength(array) == 0; 21 | } 22 | 23 | /** 24 | *

getLength.

25 | * 26 | * @param array a {@link java.lang.Object} object. 27 | * @return a int. 28 | */ 29 | public static int getLength(final Object array) { 30 | if (array == null) { 31 | return 0; 32 | } 33 | return Array.getLength(array); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /freeswitch-xml-curl/src/main/java/com/atomscat/freeswitch/xml/domain/configuration/sofia/GlobalSettings.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.xml.domain.configuration.sofia; 2 | 3 | import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; 4 | import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; 5 | import lombok.Data; 6 | import lombok.experimental.Accessors; 7 | 8 | import java.io.Serializable; 9 | import java.util.List; 10 | 11 | /** 12 | * @author howell 13 | */ 14 | @Data 15 | @Accessors(chain = true) 16 | @JacksonXmlRootElement(localName = "global_settings", namespace = "global_settings") 17 | public class GlobalSettings implements Serializable { 18 | 19 | /** 20 | * log-level 21 | * auto-restart 22 | * debug-presence 23 | * capture-server 24 | */ 25 | @JacksonXmlElementWrapper(localName = "param", useWrapping = false) 26 | private List param; 27 | } 28 | -------------------------------------------------------------------------------- /freeswitch-cdr/src/main/java/com/atomscat/freeswitch/cdr/domain/ErrorLog.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.cdr.domain; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | 9 | /** 10 | *

ErrorLog class.

11 | * 12 | * @author : everyone 13 | * @version $Id: $Id 14 | */ 15 | @Data 16 | @Accessors(chain = true) 17 | public class ErrorLog { 18 | private List errorPeriods; 19 | 20 | /** 21 | *

addErrorPeriod.

22 | * 23 | * @param errorPeriod a {@link ErrorPeriod} object. 24 | * @return a {@link ErrorLog} object. 25 | */ 26 | public ErrorLog addErrorPeriod(ErrorPeriod errorPeriod) { 27 | if (errorPeriods == null) { 28 | errorPeriods = new ArrayList<>(4); 29 | } 30 | errorPeriods.add(errorPeriod); 31 | return this; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /freeswitch-cdr/src/main/java/com/atomscat/freeswitch/cdr/domain/OriginateeCallerProfile.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.cdr.domain; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | /** 7 | *

OriginateeCallerProfile class.

8 | * 9 | * @author : everyone 10 | * @version $Id: $Id 11 | */ 12 | @Data 13 | @Accessors(chain = true) 14 | public class OriginateeCallerProfile { 15 | private String username; 16 | private String dialplan; 17 | private String callerIdName; 18 | private String callerIdNumber; 19 | private String calleeIdName; 20 | private String calleeIdNumber; 21 | private String ani; 22 | private String aniii; 23 | private String networkAddr; 24 | private String rdnis; 25 | private String destinationNumber; 26 | private String uuid; 27 | private String source; 28 | private String context; 29 | private String chanName; 30 | } 31 | -------------------------------------------------------------------------------- /freeswitch-cdr/src/main/java/com/atomscat/freeswitch/cdr/domain/OriginatorCallerProfile.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.cdr.domain; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | /** 7 | *

OriginatorCallerProfile class.

8 | * 9 | * @author : everyone 10 | * @version $Id: $Id 11 | */ 12 | @Data 13 | @Accessors(chain = true) 14 | public class OriginatorCallerProfile { 15 | private String username; 16 | private String dialplan; 17 | private String callerIdName; 18 | private String callerIdNumber; 19 | private String calleeIdName; 20 | private String calleeIdNumber; 21 | private String ani; 22 | private String aniii; 23 | private String networkAddr; 24 | private String rdnis; 25 | private String destinationNumber; 26 | private String uuid; 27 | private String source; 28 | private String context; 29 | private String chanName; 30 | } 31 | -------------------------------------------------------------------------------- /opensips-event-mi/src/main/java/com/atomscat/opensips/event/EventClient.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.opensips.event; 2 | 3 | 4 | import com.atomscat.opensips.event.option.EventClientOption; 5 | import io.netty.bootstrap.Bootstrap; 6 | 7 | /** 8 | * @author th158 9 | */ 10 | public interface EventClient extends EventClientService, EventClientCommand { 11 | /** 12 | *

newInstance.

13 | * 14 | * @param option a {@link EventClientOption} object. 15 | * @return a {@link EventClient} object. 16 | */ 17 | static EventClient newInstance(EventClientOption option) { 18 | return EventClientFactory.getInstance().newEventClient(option); 19 | } 20 | 21 | /** 22 | * 获取客户可配置选项 23 | * 24 | * @return this 25 | */ 26 | EventClientOption option(); 27 | 28 | /** 29 | * 获取 netty bootstrap 30 | * 31 | * @return a {@link Bootstrap} object. 32 | */ 33 | Bootstrap bootstrap(); 34 | } 35 | -------------------------------------------------------------------------------- /freeswitch-cdr/src/main/java/com/atomscat/freeswitch/cdr/domain/OriginationCallerProfile.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.cdr.domain; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | /** 7 | *

OriginationCallerProfile class.

8 | * 9 | * @author : everyone 10 | * @version $Id: $Id 11 | */ 12 | @Data 13 | @Accessors(chain = true) 14 | public class OriginationCallerProfile { 15 | private String username; 16 | private String dialplan; 17 | private String callerIdName; 18 | private String callerIdNumber; 19 | private String calleeIdName; 20 | private String calleeIdNumber; 21 | private String ani; 22 | private String aniii; 23 | private String networkAddr; 24 | private String rdnis; 25 | private String destinationNumber; 26 | private String uuid; 27 | private String source; 28 | private String context; 29 | private String chanName; 30 | } 31 | -------------------------------------------------------------------------------- /freeswitch-cdr/src/main/java/com/atomscat/freeswitch/cdr/domain/Variables.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.cdr.domain; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | import java.util.Map; 7 | import java.util.concurrent.ConcurrentHashMap; 8 | 9 | /** 10 | *

Variables class.

11 | * 12 | * @author : everyone 13 | * @version $Id: $Id 14 | */ 15 | @Data 16 | @Accessors(chain = true) 17 | public class Variables { 18 | private Map variableTable; 19 | 20 | /** 21 | *

putVariable.

22 | * 23 | * @param key a {@link java.lang.String} object. 24 | * @param value a {@link java.lang.String} object. 25 | */ 26 | public void putVariable(String key, String value) { 27 | if (variableTable == null) { 28 | variableTable = new ConcurrentHashMap<>(256); 29 | } 30 | variableTable.put(key, value); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /freeswitch-xml-curl/src/main/java/com/atomscat/freeswitch/xml/domain/directory/gateway/Gateway.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.xml.domain.directory.gateway; 2 | 3 | import com.atomscat.freeswitch.xml.domain.directory.param.Param; 4 | import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; 5 | import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; 6 | import lombok.AllArgsConstructor; 7 | import lombok.Data; 8 | import lombok.NoArgsConstructor; 9 | import lombok.experimental.Accessors; 10 | 11 | import java.io.Serializable; 12 | import java.util.List; 13 | 14 | @Data 15 | @NoArgsConstructor 16 | @AllArgsConstructor 17 | @Accessors(chain = true) 18 | public class Gateway implements Serializable { 19 | 20 | @JacksonXmlProperty(localName = "name", isAttribute = true) 21 | private String name; 22 | 23 | @JacksonXmlElementWrapper(localName = "param", useWrapping = false) 24 | private List param; 25 | } 26 | -------------------------------------------------------------------------------- /freeswitch-esl/src/main/java/com/atomscat/freeswitch/esl/helper/ChannelStateMachine.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.esl.helper; 2 | 3 | import lombok.Data; 4 | 5 | import java.io.Serializable; 6 | 7 | /** 8 | * @author th158 9 | */ 10 | @Data 11 | public class ChannelStateMachine implements Serializable { 12 | 13 | /** 14 | * inbound or outbound 15 | */ 16 | private String mode; 17 | 18 | /** 19 | * inbound mode: fs channel address 20 | */ 21 | private String address; 22 | 23 | /** 24 | * inbound mode: fs channel caller unique ID 25 | * outbound mode: 26 | */ 27 | private String callerUniqueID; 28 | 29 | /** 30 | * outbound mode: A certain one address in HA app 31 | */ 32 | private String localChannelAddress; 33 | 34 | /** 35 | * ESL event name 36 | */ 37 | private String eventName; 38 | 39 | /** 40 | * core UUID 41 | */ 42 | private String coreUUID; 43 | 44 | 45 | } 46 | -------------------------------------------------------------------------------- /freeswitch-esl-spring-boot-starter-example/src/main/java/com/atomscat/freeswitch/esl/spring/boot/starter/example/config/HazelcastConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.esl.spring.boot.starter.example.config; 2 | 3 | import com.hazelcast.config.Config; 4 | import com.hazelcast.config.NetworkConfig; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.context.annotation.Configuration; 7 | 8 | @Configuration 9 | public class HazelcastConfiguration { 10 | @Bean 11 | public Config hazelcastConfig() { 12 | Config config = new Config(); 13 | config.setInstanceName("hazelcast-instance"); 14 | NetworkConfig networkConfig = config.getNetworkConfig(); 15 | 16 | networkConfig.getJoin().getMulticastConfig().setEnabled(false); 17 | networkConfig.getJoin().getTcpIpConfig().setEnabled(true) 18 | .addMember("192.168.62.1") 19 | 20 | ; // 其他节点的 IP 地址 21 | 22 | return config; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /opensips-event-mi-spring-boot-starter/src/main/java/com/atomscat/opensips/spring/boot/starter/template/DefaultEventClientOptionHandlerTemplate.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.opensips.spring.boot.starter.template; 2 | 3 | import com.atomscat.opensips.event.option.EventClientOption; 4 | import com.atomscat.opensips.spring.boot.starter.handler.AbstractEventClientOptionHandler; 5 | import com.atomscat.opensips.spring.boot.starter.propeties.OpensipsEventProperties; 6 | 7 | /** 8 | *

DefaultInboundClientOptionHandlerTemplate class.

9 | * 10 | * @author everyone 11 | * @version 1.0.0 12 | */ 13 | public class DefaultEventClientOptionHandlerTemplate extends AbstractEventClientOptionHandler { 14 | 15 | public DefaultEventClientOptionHandlerTemplate(OpensipsEventProperties properties) { 16 | super(properties); 17 | } 18 | 19 | /** 20 | * {@inheritDoc} 21 | */ 22 | @Override 23 | protected void intercept(EventClientOption eventClientOption) { 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /spring-boot-common/spring-boot-common-aop/src/main/java/com/atomscat/spring/boot/common/aop/annotation/RedisLock.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.spring.boot.common.aop.annotation; 2 | 3 | import java.lang.annotation.*; 4 | import java.util.concurrent.TimeUnit; 5 | 6 | /** 7 | * 使用redis进行分布式锁 8 | */ 9 | @Target(ElementType.METHOD) 10 | @Retention(RetentionPolicy.RUNTIME) 11 | @Documented 12 | public @interface RedisLock { 13 | 14 | /** 15 | * redis锁 名字 16 | */ 17 | String lockName() default ""; 18 | 19 | /** 20 | * redis锁 key 支持spel表达式 21 | */ 22 | String key() default ""; 23 | 24 | /** 25 | * 过期毫秒数,默认为5000毫秒 26 | * 27 | * @return 轮询锁的时间 28 | */ 29 | int expire() default 5000; 30 | 31 | /** 32 | * 等待锁毫秒数,默认为0毫秒 33 | * 34 | * @return 等待锁的时间 35 | */ 36 | int waitTime() default 0; 37 | 38 | /** 39 | * 超时时间单位 40 | * 41 | * @return 秒 42 | */ 43 | TimeUnit timeUnit() default TimeUnit.MILLISECONDS; 44 | } 45 | -------------------------------------------------------------------------------- /freeswitch-esl-spring-boot-starter/src/main/java/com/atomscat/freeswitch/esl/spring/boot/starter/propeties/AmqpClientProperties.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.esl.spring.boot.starter.propeties; 2 | 3 | import lombok.Data; 4 | import org.springframework.boot.context.properties.ConfigurationProperties; 5 | import org.springframework.stereotype.Component; 6 | 7 | @Data 8 | @Component 9 | @ConfigurationProperties(prefix = "com.atomscat.freeswitch.amqp") 10 | public class AmqpClientProperties { 11 | 12 | private String commandsQueues; 13 | 14 | private String eventsQueues; 15 | 16 | private String loggingQueues; 17 | 18 | private String enabled; 19 | 20 | public String getCommandsQueues() { 21 | return commandsQueues; 22 | } 23 | 24 | public String getEventsQueues() { 25 | return eventsQueues; 26 | } 27 | 28 | public String getLoggingQueues() { 29 | return loggingQueues; 30 | } 31 | 32 | public String getEnabled() { 33 | return enabled; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /freeswitch-esl-spring-boot-starter/src/main/java/com/atomscat/freeswitch/esl/spring/boot/starter/template/DefaultInboundClientOptionHandlerTemplate.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.esl.spring.boot.starter.template; 2 | 3 | import com.atomscat.freeswitch.esl.inbound.option.InboundClientOption; 4 | import com.atomscat.freeswitch.esl.spring.boot.starter.handler.AbstractInboundClientOptionHandler; 5 | import com.atomscat.freeswitch.esl.spring.boot.starter.propeties.InboundClientProperties; 6 | 7 | /** 8 | *

DefaultInboundClientOptionHandlerTemplate class.

9 | * 10 | * @author everyone 11 | * @version 1.0.0 12 | */ 13 | public class DefaultInboundClientOptionHandlerTemplate extends AbstractInboundClientOptionHandler { 14 | 15 | public DefaultInboundClientOptionHandlerTemplate(InboundClientProperties properties) { 16 | super(properties); 17 | } 18 | 19 | /** 20 | * {@inheritDoc} 21 | */ 22 | @Override 23 | protected void intercept(InboundClientOption inboundClientOption) { 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /freeswitch-esl-spring-boot-starter/src/main/java/com/atomscat/freeswitch/esl/spring/boot/starter/template/DefaultOutboundServerOptionHandlerTemplate.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.esl.spring.boot.starter.template; 2 | 3 | import com.atomscat.freeswitch.esl.outbound.option.OutboundServerOption; 4 | import com.atomscat.freeswitch.esl.spring.boot.starter.handler.AbstractOutboundServerOptionHandler; 5 | import com.atomscat.freeswitch.esl.spring.boot.starter.propeties.OutboundServerProperties; 6 | 7 | /** 8 | *

DefaultInboundClientOptionHandlerTemplate class.

9 | * 10 | * @author everyone 11 | * @version 1.0.0 12 | */ 13 | public class DefaultOutboundServerOptionHandlerTemplate extends AbstractOutboundServerOptionHandler { 14 | 15 | public DefaultOutboundServerOptionHandlerTemplate(OutboundServerProperties properties) { 16 | super(properties); 17 | } 18 | 19 | /** 20 | * {@inheritDoc} 21 | */ 22 | @Override 23 | protected void intercept(OutboundServerOption inboundClientOption) { 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /opensips-event-mi/src/main/java/com/atomscat/opensips/util/RandomUtils.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.opensips.util; 2 | 3 | import java.util.Random; 4 | 5 | /** 6 | *

RandomUtils class.

7 | * 8 | * @author everyone 9 | * @version 1.0.0 10 | */ 11 | public class RandomUtils { 12 | 13 | private static final Random RANDOM = new Random(); 14 | 15 | /** 16 | *

nextInt.

17 | * 18 | * @param startInclusive a int. 19 | * @param endExclusive a int. 20 | * @return a int. 21 | */ 22 | public static int nextInt(final int startInclusive, final int endExclusive) { 23 | Validate.isTrue(endExclusive >= startInclusive, 24 | "Start value must be smaller or equal to end value."); 25 | Validate.isTrue(startInclusive >= 0, "Both range values must be non-negative."); 26 | 27 | if (startInclusive == endExclusive) { 28 | return startInclusive; 29 | } 30 | 31 | return startInclusive + RANDOM.nextInt(endExclusive - startInclusive); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /freeswitch-esl/src/main/java/com/atomscat/freeswitch/esl/util/RandomUtils.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.esl.util; 2 | 3 | import java.util.Random; 4 | 5 | /** 6 | *

RandomUtils class.

7 | * 8 | * @author everyone 9 | * @version 1.0.0 10 | */ 11 | public class RandomUtils { 12 | 13 | private static final Random RANDOM = new Random(); 14 | 15 | /** 16 | *

nextInt.

17 | * 18 | * @param startInclusive a int. 19 | * @param endExclusive a int. 20 | * @return a int. 21 | */ 22 | public static int nextInt(final int startInclusive, final int endExclusive) { 23 | Validate.isTrue(endExclusive >= startInclusive, 24 | "Start value must be smaller or equal to end value."); 25 | Validate.isTrue(startInclusive >= 0, "Both range values must be non-negative."); 26 | 27 | if (startInclusive == endExclusive) { 28 | return startInclusive; 29 | } 30 | 31 | return startInclusive + RANDOM.nextInt(endExclusive - startInclusive); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /freeswitch-xml-curl-spring-boot-starter/src/main/java/com/atomscat/freeswitch/xml/handler/SimpleXmlCurlHandler.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.xml.handler; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | import com.atomscat.freeswitch.xml.domain.XmlCurl; 5 | import lombok.extern.slf4j.Slf4j; 6 | import org.springframework.beans.factory.InitializingBean; 7 | 8 | /** 9 | *

SimpleCdrHandler class.

10 | * 11 | * @author : everyone 12 | * @version $Id: $Id 13 | */ 14 | @Slf4j 15 | public class SimpleXmlCurlHandler implements XmlCurlHandler, InitializingBean { 16 | /** 17 | * {@inheritDoc} 18 | */ 19 | @Override 20 | public String handleXmlCurl(XmlCurl xmlCurl) { 21 | log.info("simple handle cdr : [{}]", JSON.toJSONString(xmlCurl, true)); 22 | return ""; 23 | } 24 | 25 | /** 26 | * {@inheritDoc} 27 | */ 28 | @Override 29 | public void afterPropertiesSet() { 30 | log.warn("implements 'CdrHandler' can replace SimpleCdrHandler ..."); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /freeswitch-xml-curl/src/main/java/com/atomscat/freeswitch/xml/domain/configuration/sofia/gateway/Gateway.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.xml.domain.configuration.sofia.gateway; 2 | 3 | import com.atomscat.freeswitch.xml.domain.configuration.sofia.Param; 4 | import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; 5 | import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; 6 | import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; 7 | import lombok.Data; 8 | import lombok.experimental.Accessors; 9 | 10 | import java.io.Serializable; 11 | import java.util.List; 12 | 13 | /** 14 | * @author th158 15 | */ 16 | @Data 17 | @Accessors(chain = true) 18 | @JacksonXmlRootElement(localName = "gateway", namespace = "gateway") 19 | public class Gateway implements Serializable { 20 | 21 | @JacksonXmlProperty(localName = "name", isAttribute = true) 22 | private String name; 23 | 24 | @JacksonXmlElementWrapper(localName = "param", useWrapping = false) 25 | private List param; 26 | } 27 | -------------------------------------------------------------------------------- /freeswitch-esl/src/main/java/com/atomscat/freeswitch/esl/exception/OutboundServerException.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.esl.exception; 2 | 3 | public class OutboundServerException extends RuntimeException { 4 | /** 5 | *

Constructor for InboundClientException.

6 | * 7 | * @param message a {@link java.lang.String} object. 8 | */ 9 | public OutboundServerException(String message) { 10 | super(message); 11 | } 12 | 13 | /** 14 | *

Constructor for InboundClientException.

15 | * 16 | * @param message a {@link java.lang.String} object. 17 | * @param cause a {@link java.lang.Throwable} object. 18 | */ 19 | public OutboundServerException(String message, Throwable cause) { 20 | super(message, cause); 21 | } 22 | 23 | /** 24 | *

Constructor for InboundClientException.

25 | * 26 | * @param cause a {@link java.lang.Throwable} object. 27 | */ 28 | public OutboundServerException(Throwable cause) { 29 | super(cause); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /freeswitch-cdr/src/main/java/com/atomscat/freeswitch/cdr/domain/Cdr.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.cdr.domain; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | import java.util.ArrayList; 7 | import java.util.List; 8 | 9 | /** 10 | *

Cdr class.

11 | * 12 | * @author : everyone 13 | * @version $Id: $Id 14 | */ 15 | @Data 16 | @Accessors(chain = true) 17 | public class Cdr { 18 | private String coreUuid; 19 | private String switchname; 20 | private ChannelData channelData; 21 | private CallStats callStats; 22 | private Variables variables; 23 | private AppLog appLog; 24 | private HoldRecord holdRecord; 25 | private List callflows; 26 | 27 | /** 28 | *

addCallflow.

29 | * 30 | * @param callflow a {@link Callflow} object. 31 | */ 32 | public void addCallflow(Callflow callflow) { 33 | if (callflows == null) { 34 | callflows = new ArrayList<>(4); 35 | } 36 | callflows.add(callflow); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /freeswitch-cdr-spring-boot-starter/src/main/java/com/atomscat/freeswitch/cdr/spring/boot/starter/handler/SimpleCdrHandler.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.cdr.spring.boot.starter.handler; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | import com.atomscat.freeswitch.cdr.domain.Cdr; 5 | import com.atomscat.freeswitch.cdr.handler.CdrHandler; 6 | import lombok.extern.slf4j.Slf4j; 7 | import org.springframework.beans.factory.InitializingBean; 8 | 9 | /** 10 | *

SimpleCdrHandler class.

11 | * 12 | * @author : everyone 13 | * @version $Id: $Id 14 | */ 15 | @Slf4j 16 | public class SimpleCdrHandler implements CdrHandler, InitializingBean { 17 | /** 18 | * {@inheritDoc} 19 | */ 20 | @Override 21 | public void handleCdr(Cdr cdr) { 22 | log.info("simple handle cdr : [{}]", JSON.toJSONString(cdr, true)); 23 | } 24 | 25 | /** 26 | * {@inheritDoc} 27 | */ 28 | @Override 29 | public void afterPropertiesSet() { 30 | log.warn("implements 'CdrHandler' can replace SimpleCdrHandler ..."); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /freeswitch-cdr/src/main/java/com/atomscat/freeswitch/cdr/domain/CallerProfile.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.cdr.domain; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | /** 7 | *

CallerProfile class.

8 | * 9 | * @author : everyone 10 | * @version $Id: $Id 11 | */ 12 | @Data 13 | @Accessors(chain = true) 14 | public class CallerProfile { 15 | private String username; 16 | private String dialplan; 17 | private String callerIdName; 18 | private String callerIdNumber; 19 | private String calleeIdName; 20 | private String calleeIdNumber; 21 | private String ani; 22 | private String aniii; 23 | private String networkAddr; 24 | private String rdnis; 25 | private String destinationNumber; 26 | private String uuid; 27 | private String source; 28 | private String transferSource; 29 | private String context; 30 | private String chanName; 31 | private Originator originator; 32 | private Originatee originatee; 33 | private Origination origination; 34 | } 35 | -------------------------------------------------------------------------------- /freeswitch-cdr/src/main/java/com/atomscat/freeswitch/cdr/domain/Inbound.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.cdr.domain; 2 | 3 | import lombok.Data; 4 | import lombok.experimental.Accessors; 5 | 6 | /** 7 | *

Inbound class.

8 | * 9 | * @author : everyone 10 | * @version $Id: $Id 11 | */ 12 | @Data 13 | @Accessors(chain = true) 14 | public class Inbound { 15 | private String rawBytes; 16 | private String mediaBytes; 17 | private String packetCount; 18 | private String mediaPacketCount; 19 | private String skipPacketCount; 20 | private String jitterPacketCount; 21 | private String dtmfPacketCount; 22 | private String cngPacketCount; 23 | private String flushPacketCount; 24 | private String largestJbSize; 25 | private String jitterMinVariance; 26 | private String jitterMaxVariance; 27 | private String jitterLossRate; 28 | private String jitterBurstRate; 29 | private String meanInterval; 30 | private String flawTotal; 31 | private String qualityPercentage; 32 | private String mos; 33 | } 34 | -------------------------------------------------------------------------------- /opensips-event-mi/src/main/java/com/atomscat/opensips/event/handler/IEventApi.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.opensips.event.handler; 2 | 3 | 4 | public interface IEventApi { 5 | 6 | boolean canSend(); 7 | 8 | enum EventFormat { 9 | 10 | PLAIN("plain"), 11 | XML("xml"), 12 | JSON("json"); 13 | 14 | private final String text; 15 | 16 | EventFormat(String txt) { 17 | this.text = txt; 18 | } 19 | 20 | @Override 21 | public String toString() { 22 | return text; 23 | } 24 | 25 | } 26 | 27 | enum LoggingLevel { 28 | 29 | CONSOLE("console"), 30 | DEBUG("debug"), 31 | INFO("info"), 32 | NOTICE("notice"), 33 | WARNING("warning"), 34 | ERR("err"), 35 | CRIT("crit"), 36 | ALERT("alert"); 37 | 38 | private final String text; 39 | 40 | LoggingLevel(String txt) { 41 | this.text = txt; 42 | } 43 | 44 | @Override 45 | public String toString() { 46 | return text; 47 | } 48 | 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /softswitch-all-spring-boot-starter-example/src/main/resources/redisson/redisson-dev.yml: -------------------------------------------------------------------------------- 1 | clusterServersConfig: 2 | idleConnectionTimeout: 10000 3 | connectTimeout: 10000 4 | timeout: 3000 5 | retryAttempts: 3 6 | retryInterval: 1500 7 | failedSlaveReconnectionInterval: 3000 8 | failedSlaveCheckInterval: 60000 9 | password: null 10 | subscriptionsPerConnection: 5 11 | clientName: null 12 | loadBalancer: ! { } 13 | subscriptionConnectionMinimumIdleSize: 1 14 | subscriptionConnectionPoolSize: 50 15 | slaveConnectionMinimumIdleSize: 24 16 | slaveConnectionPoolSize: 64 17 | masterConnectionMinimumIdleSize: 24 18 | masterConnectionPoolSize: 64 19 | readMode: "SLAVE" 20 | subscriptionMode: "SLAVE" 21 | nodeAddresses: 22 | - "redis://127.0.0.1:7004" 23 | - "redis://127.0.0.1:7001" 24 | - "redis://127.0.0.1:7000" 25 | scanInterval: 1000 26 | pingConnectionInterval: 0 27 | keepAlive: false 28 | tcpNoDelay: false 29 | threads: 16 30 | nettyThreads: 32 31 | codec: ! { } 32 | transportMode: "NIO" -------------------------------------------------------------------------------- /freeswitch-esl-spring-boot-starter-example/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | com: 2 | atomscat: 3 | freeswitch: 4 | esl: 5 | inbound: 6 | defaultPassword: ClueCon 7 | performance: false 8 | performanceCostTime: 200 9 | servers: 10 | - host: 192.168.62.130 11 | port: 8021 12 | timeoutSeconds: 5 13 | events: 14 | - all 15 | outbound: 16 | server: 17 | host: 0.0.0.0 18 | port: 8082 19 | # opensips: 20 | # event: 21 | # server: 22 | # host: 192.168.10.116 23 | # port: 8081 24 | 25 | logging: 26 | level: 27 | link: DEBUG 28 | 29 | #nacos: 30 | # discovery: 31 | # server-addr: 192.168.10.112:8848 32 | # auto-register: true 33 | # register: 34 | # ip: 192.168.10.116 35 | # config: 36 | # server-addr: 192.168.10.112:8848 37 | # bootstrap: 38 | # enable: true 39 | # data-id: example 40 | # type: yaml 41 | 42 | spring: 43 | application: 44 | name: fs-esl 45 | 46 | management: 47 | health: 48 | rabbit: 49 | enabled: false 50 | -------------------------------------------------------------------------------- /freeswitch-xml-curl-spring-boot-starter/src/main/java/com/atomscat/freeswitch/xml/config/FreeswitchXmlCurlAutoConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.xml.config; 2 | 3 | 4 | import com.atomscat.freeswitch.xml.handler.SimpleXmlCurlHandler; 5 | import com.atomscat.freeswitch.xml.handler.XmlCurlHandler; 6 | import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; 7 | import org.springframework.context.annotation.Bean; 8 | import org.springframework.context.annotation.ComponentScan; 9 | import org.springframework.context.annotation.Configuration; 10 | 11 | /** 12 | *

FreeswitchCdrAutoConfiguration class.

13 | * 14 | * @author : everyone 15 | * @version $Id: $Id 16 | */ 17 | @Configuration 18 | @ComponentScan({"com.atomscat.freeswitch.xml"}) 19 | public class FreeswitchXmlCurlAutoConfiguration { 20 | 21 | 22 | /** 23 | *

cdrHandler.

24 | * 25 | * @return a {@link XmlCurlHandler } object. 26 | */ 27 | @Bean 28 | @ConditionalOnMissingBean(XmlCurlHandler.class) 29 | public XmlCurlHandler cdrHandler() { 30 | return new SimpleXmlCurlHandler(); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /freeswitch-cdr-spring-boot-starter/src/main/java/com/atomscat/freeswitch/cdr/spring/boot/starter/config/FreeswitchCdrAutoConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.cdr.spring.boot.starter.config; 2 | 3 | import com.atomscat.freeswitch.cdr.handler.CdrHandler; 4 | import com.atomscat.freeswitch.cdr.spring.boot.starter.handler.SimpleCdrHandler; 5 | import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.context.annotation.ComponentScan; 8 | import org.springframework.context.annotation.Configuration; 9 | 10 | /** 11 | *

FreeswitchCdrAutoConfiguration class.

12 | * 13 | * @author : everyone 14 | * @version $Id: $Id 15 | */ 16 | @Configuration 17 | @ComponentScan({"com.atomscat.freeswitch.cdr"}) 18 | public class FreeswitchCdrAutoConfiguration { 19 | 20 | 21 | /** 22 | *

cdrHandler.

23 | * 24 | * @return a {@link CdrHandler} object. 25 | */ 26 | @Bean 27 | @ConditionalOnMissingBean(CdrHandler.class) 28 | public CdrHandler cdrHandler() { 29 | return new SimpleCdrHandler(); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /freeswitch-esl-spring-boot-starter-example/src/main/java/com/atomscat/freeswitch/esl/spring/boot/starter/example/handler/InboundDetectedSpeechSendSocketHandler.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.esl.spring.boot.starter.example.handler; 2 | 3 | import com.atomscat.freeswitch.esl.constant.EventNames; 4 | import com.atomscat.freeswitch.esl.helper.EslHelper; 5 | import com.atomscat.freeswitch.esl.spring.boot.starter.annotation.EslEventName; 6 | import com.atomscat.freeswitch.esl.spring.boot.starter.handler.InboundEventHandler; 7 | import com.atomscat.freeswitch.esl.transport.event.EslEvent; 8 | import lombok.extern.slf4j.Slf4j; 9 | import org.springframework.stereotype.Component; 10 | /* 11 | dialplan xml setting : 12 | */ 13 | /** 14 | * 语音识别事件监听 15 | * @author howell 16 | */ 17 | @Slf4j 18 | @EslEventName(EventNames.DETECTED_SPEECH) 19 | @Component 20 | public class InboundDetectedSpeechSendSocketHandler implements InboundEventHandler { 21 | 22 | @Override 23 | public void handle(String address, EslEvent event, String coreUUID) { 24 | log.info("address[{}] EslEvent[{}]", address, EslHelper.formatEslEvent(event)); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /freeswitch-xml-curl/src/main/java/com/atomscat/freeswitch/xml/domain/XmlCurl.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.xml.domain; 2 | 3 | import com.alibaba.fastjson.annotation.JSONField; 4 | import lombok.Data; 5 | import lombok.experimental.Accessors; 6 | 7 | import java.io.Serializable; 8 | import java.util.Map; 9 | 10 | @Data 11 | @Accessors(chain = true) 12 | public class XmlCurl implements Serializable { 13 | 14 | String hostname; 15 | 16 | String section; 17 | 18 | @JSONField(name = "tag_name") 19 | String tagName; 20 | 21 | @JSONField(name = "key_name") 22 | String keyName; 23 | 24 | @JSONField(name = "key_value") 25 | String keyValue; 26 | 27 | @JSONField(name = "Event-Name") 28 | String eventName; 29 | 30 | @JSONField(name = "Core-UUID") 31 | String coreUuid; 32 | 33 | @JSONField(name = "FreeSWITCH-Hostname") 34 | String freeSwitchHostName; 35 | 36 | @JSONField(name = "FreeSWITCH-Switchname") 37 | String freeSwitchSwitchName; 38 | 39 | @JSONField(name = "FreeSWITCH-IPv4") 40 | String freeSwitchIPv4; 41 | 42 | @JSONField(name = "FreeSWITCH-IPv6") 43 | String freeSwitchIPv6; 44 | 45 | Map metadata; 46 | 47 | } 48 | -------------------------------------------------------------------------------- /softswitch-all-spring-boot-starter-example/src/main/java/com/atomscat/freeswitch/esl/spring/boot/starter/example/handler/InboundChannelHangupSendSocketHandler.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.esl.spring.boot.starter.example.handler; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | import com.atomscat.freeswitch.esl.constant.EventNames; 5 | import com.atomscat.freeswitch.esl.spring.boot.starter.annotation.EslEventName; 6 | import com.atomscat.freeswitch.esl.spring.boot.starter.handler.InboundEventHandler; 7 | import com.atomscat.freeswitch.esl.transport.event.EslEvent; 8 | import com.atomscat.spring.boot.common.aop.annotation.RedisLock; 9 | import lombok.extern.slf4j.Slf4j; 10 | import org.springframework.stereotype.Component; 11 | 12 | /** 13 | * @author th158 14 | */ 15 | @Slf4j 16 | @EslEventName(EventNames.CHANNEL_HANGUP_COMPLETE) 17 | @Component 18 | public class InboundChannelHangupSendSocketHandler implements InboundEventHandler { 19 | 20 | 21 | @Override 22 | @RedisLock(lockName = EventNames.CHANNEL_HANGUP_COMPLETE, key = "coreUUID") 23 | public void handle(String address, EslEvent event, String coreUUID) { 24 | log.info("CHANNEL_HANGUP: [{}]", JSON.toJSONString(event)); 25 | 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /softswitch-all-spring-boot-starter-example/src/main/java/com/atomscat/freeswitch/esl/spring/boot/starter/example/handler/FsPhrasesXmlCurlHandler.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.esl.spring.boot.starter.example.handler; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | import com.atomscat.freeswitch.xml.annotation.XmlCurlSectionName; 5 | import com.atomscat.freeswitch.xml.constant.SectionNames; 6 | import com.atomscat.freeswitch.xml.domain.XmlCurl; 7 | import com.atomscat.freeswitch.xml.handler.XmlCurlHandler; 8 | import lombok.extern.slf4j.Slf4j; 9 | import org.springframework.stereotype.Service; 10 | 11 | /** 12 | * https://freeswitch.org/confluence/display/FREESWITCH/Speech+Phrase+Management 13 | * https://freeswitch.org/confluence/display/FREESWITCH/mod_dptools%3A+phrase 14 | * https://freeswitch.org/confluence/display/FREESWITCH/Configuration 15 | * 16 | * @author th158 17 | */ 18 | @Slf4j 19 | @Service 20 | @XmlCurlSectionName(SectionNames.PHRASES) 21 | public class FsPhrasesXmlCurlHandler implements XmlCurlHandler { 22 | @Override 23 | public String handleXmlCurl(XmlCurl xmlCurl) { 24 | log.info("PHRASES exampel handle xml curl : [{}]", JSON.toJSONString(xmlCurl, true)); 25 | return null; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /freeswitch-xml-curl/src/main/java/com/atomscat/freeswitch/xml/domain/dialplan/Context.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.xml.domain.dialplan; 2 | 3 | import com.fasterxml.jackson.core.JsonProcessingException; 4 | import com.fasterxml.jackson.databind.ObjectMapper; 5 | import com.fasterxml.jackson.dataformat.xml.XmlMapper; 6 | import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper; 7 | import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; 8 | import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; 9 | import lombok.Data; 10 | 11 | import java.io.Serializable; 12 | import java.util.List; 13 | 14 | /** 15 | * @author th158 16 | */ 17 | @Data 18 | @JacksonXmlRootElement(localName = "context") 19 | public class Context implements Serializable { 20 | 21 | @JacksonXmlProperty(localName = "name", isAttribute = true) 22 | private String name; 23 | 24 | @JacksonXmlElementWrapper(localName = "extension", useWrapping = false) 25 | private List extension; 26 | 27 | public String toXmlString() throws JsonProcessingException { 28 | ObjectMapper xmlMapper = new XmlMapper(); 29 | return xmlMapper.writeValueAsString(this); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /spring-boot-common/spring-boot-common-election/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | softswitch-gateway 7 | com.atomscat 8 | 2.0.0.RELEASE 9 | ../../pom.xml 10 | 11 | 4.0.0 12 | 13 | spring-boot-common-election 14 | 15 | 16 | 17 17 | 17 18 | 19 | 20 | 21 | 22 | com.alibaba 23 | fastjson 24 | 25 | 26 | org.projectlombok 27 | lombok 28 | provided 29 | 30 | 31 | -------------------------------------------------------------------------------- /opensips-event-mi/src/main/java/com/atomscat/opensips/mi/entitys/enums/OpenSipsEventEnum.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.opensips.mi.entitys.enums; 2 | 3 | import lombok.Getter; 4 | 5 | /** 6 | * @author : everyone 7 | * @version 1.0.0 8 | */ 9 | @Getter 10 | public enum OpenSipsEventEnum { 11 | 12 | E_UL_CONTACT_INSERT("E_UL_CONTACT_INSERT", "当在任何现有 AOR 的联系人列表中插入新联系人时,将引发此事件。 对于每个新联系人,如果其 AOR 在内存中不存在,则 E_UL_AOR_CREATE 和 E_UL_CONTACT_INSERT 事件都将引发。"), 13 | E_UL_CONTACT_DELETE("E_UL_CONTACT_DELETE", "当从现有 AOR 的联系人列表中删除联系人时,将引发此事件。 如果联系人是列表中唯一的联系人,则 E_UL_AOR_DELETE 和 E_UL_CONTACT_DELETE 事件都将引发。"), 14 | E_UL_CONTACT_UPDATE("E_UL_CONTACT_UPDATE", "当通过接收另一条注册消息更新联系人信息时,将引发此事件。"), 15 | /** 16 | * hash_entry - 对话表中的条目。这与hash_id一起用于唯一标识对话框。 17 | * hash_id - 对话表中的 id。这与hash_entry一起用于唯一标识对话框。 18 | * callid - callid。 19 | * from_tag - 发件人标签。 20 | * to_tag - To 标签。 21 | * old_state - 对话的旧状态。 22 | * new_state - 对话框的新状态。 23 | */ 24 | E_DLG_STATE_CHANGED("E_DLG_STATE_CHANGED", "当对话框状态改变时引发此事件。"); 25 | 26 | private final String event; 27 | 28 | private final String desc; 29 | 30 | OpenSipsEventEnum(String event, String desc) { 31 | this.event = event; 32 | this.desc = desc; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /owt-server-client/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | softswitch-gateway 7 | com.atomscat 8 | 2.0.0.RELEASE 9 | 10 | 4.0.0 11 | 12 | owt-server-client 13 | owt-server client lib 14 | 15 | https://github.com/open-webrtc-toolkit/owt-server 16 | 17 | 17 18 | 17 19 | 20 | 21 | 22 | 23 | com.squareup.okhttp3 24 | okhttp 25 | 26 | 27 | org.projectlombok 28 | lombok 29 | provided 30 | 31 | 32 | -------------------------------------------------------------------------------- /freeswitch-xml-curl/src/main/java/com/atomscat/freeswitch/xml/domain/configuration/Configuration.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.xml.domain.configuration; 2 | 3 | import com.fasterxml.jackson.core.JsonProcessingException; 4 | import com.fasterxml.jackson.databind.ObjectMapper; 5 | import com.fasterxml.jackson.dataformat.xml.XmlMapper; 6 | import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; 7 | import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; 8 | import lombok.Data; 9 | 10 | import java.io.Serializable; 11 | 12 | /** 13 | * @author th158 14 | */ 15 | @Data 16 | @JacksonXmlRootElement(localName = "configuration") 17 | public class Configuration implements Serializable { 18 | 19 | /** 20 | * {@link com.atomscat.freeswitch.xml.constant.SectionNames.Configuration} 21 | * - ivr.conf 22 | */ 23 | @JacksonXmlProperty(localName = "name", isAttribute = true) 24 | private String name; 25 | 26 | @JacksonXmlProperty(localName = "description", isAttribute = true) 27 | private String description; 28 | 29 | public String toXmlString() throws JsonProcessingException { 30 | ObjectMapper xmlMapper = new XmlMapper(); 31 | return xmlMapper.writeValueAsString(this); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /freeswitch-xml-curl/src/main/java/com/atomscat/freeswitch/xml/domain/configuration/sofia/Sofia.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.xml.domain.configuration.sofia; 2 | 3 | import com.atomscat.freeswitch.xml.constant.ConfName; 4 | import com.atomscat.freeswitch.xml.domain.configuration.Configuration; 5 | import com.atomscat.freeswitch.xml.domain.configuration.sofia.profile.Profiles; 6 | import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; 7 | import lombok.Data; 8 | import lombok.experimental.Accessors; 9 | 10 | import java.io.Serializable; 11 | 12 | /** 13 | * @author howell 14 | */ 15 | @Data 16 | @Accessors(chain = true) 17 | public class Sofia extends Configuration implements Serializable { 18 | 19 | public Sofia() { 20 | setName(ConfName.SOFIA.name); 21 | } 22 | 23 | @JacksonXmlProperty(localName = "global_settings", isAttribute = true) 24 | private GlobalSettings globalSettings; 25 | 26 | /** 27 | * This is a sofia sip profile/user agent. This will service exactly one 28 | * ip and port. In FreeSWITCH you can run multiple sip user agents on 29 | * their own ip and port. 30 | */ 31 | @JacksonXmlProperty(localName = "profiles", isAttribute = true) 32 | private Profiles profiles; 33 | 34 | } 35 | -------------------------------------------------------------------------------- /freeswitch-xml-curl-spring-boot-starter/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | softswitch-gateway 7 | com.atomscat 8 | 2.0.0.RELEASE 9 | 10 | 4.0.0 11 | 12 | freeswitch-xml-curl-spring-boot-starter 13 | freeswitch-xml-curl-spring-boot-starter-${project.version} 14 | 15 | 16 | 17 17 | 17 18 | 19 | 20 | 21 | 22 | ${project.groupId} 23 | freeswitch-xml-curl 24 | 25 | 26 | org.projectlombok 27 | lombok 28 | provided 29 | 30 | 31 | -------------------------------------------------------------------------------- /freeswitch-esl/src/main/java/com/atomscat/freeswitch/esl/util/VariableUtil.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.esl.util; 2 | 3 | import com.atomscat.freeswitch.esl.transport.event.EslEvent; 4 | 5 | import java.util.Map; 6 | 7 | /** 8 | * @author everyone 9 | * @version 1.5.1 10 | */ 11 | public class VariableUtil { 12 | 13 | private static final String VARIABLE_PREFIX = "variable_"; 14 | 15 | private VariableUtil() { 16 | } 17 | 18 | public static String get(EslEvent event, String key) { 19 | return event.getEventHeaders().get(key); 20 | } 21 | 22 | public static long getLongVar(EslEvent event, String key) { 23 | return Long.parseLong(getVar(event.getEventHeaders(), key)); 24 | } 25 | 26 | public static int getIntVar(EslEvent event, String key) { 27 | return Integer.parseInt(getVar(event.getEventHeaders(), key)); 28 | } 29 | 30 | public static String getVar(EslEvent event, String key) { 31 | return getVar(event.getEventHeaders(), key); 32 | } 33 | 34 | public static String getVar(Map eventHeaders, String key) { 35 | if (key.startsWith(VARIABLE_PREFIX)) { 36 | return eventHeaders.get(key); 37 | } 38 | return eventHeaders.get(VARIABLE_PREFIX + key); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /freeswitch-cdr-spring-boot-starter-example/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | softswitch-gateway 7 | com.atomscat 8 | 2.0.0.RELEASE 9 | 10 | 4.0.0 11 | 12 | freeswitch-cdr-spring-boot-starter-example 13 | freeswitch-cdr-spring-boot-starter-example-${project.version} 14 | 15 | 16 | 17 17 | 17 18 | 19 | 20 | 21 | 22 | ${project.groupId} 23 | freeswitch-cdr-spring-boot-starter 24 | 25 | 26 | org.projectlombok 27 | lombok 28 | provided 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /freeswitch-xml-curl/src/main/java/com/atomscat/freeswitch/xml/domain/directory/variable/VariableEnum.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.xml.domain.directory.variable; 2 | 3 | import lombok.Getter; 4 | 5 | @Getter 6 | public enum VariableEnum { 7 | /** 8 | * domain 9 | */ 10 | RECORD_STEREO("record_stereo", ""), 11 | 12 | DEFAULT_GATEWAY("default_gateway", ""), 13 | 14 | DEFAULT_AREACODE("default_areacode", ""), 15 | 16 | TRANSFER_FALLBACK_EXTENSION("transfer_fallback_extension", ""), 17 | 18 | /** 19 | * user 20 | */ 21 | TOLL_ALLOW("toll_allow", ""), 22 | 23 | ACCOUNTCODE("accountcode", ""), 24 | 25 | USER_CONTEXT("user_context", ""), 26 | 27 | EFFECTIVE_CALLER_ID_NAME("effective_caller_id_name", ""), 28 | 29 | EFFECTIVE_CALLER_ID_NUMBER("effective_caller_id_number", ""), 30 | 31 | OUTBOUND_CALLER_ID_NAME("outbound_caller_id_name", ""), 32 | 33 | OUTBOUND_CALLER_ID_NUMBER("outbound_caller_id_number", ""), 34 | 35 | CALLGROUP("callgroup", ""), 36 | ; 37 | 38 | /** 39 | * 配置项值 40 | */ 41 | public final String key; 42 | 43 | /** 44 | * 配置项说明 45 | */ 46 | public final String msg; 47 | 48 | VariableEnum(String key, String msg) { 49 | this.key = key; 50 | this.msg = msg; 51 | } 52 | 53 | } 54 | -------------------------------------------------------------------------------- /freeswitch-xml-curl/src/main/java/com/atomscat/freeswitch/xml/domain/directory/user/User.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.xml.domain.directory.user; 2 | 3 | import com.atomscat.freeswitch.xml.domain.directory.gateway.Gateways; 4 | import com.atomscat.freeswitch.xml.domain.directory.param.Params; 5 | import com.atomscat.freeswitch.xml.domain.directory.variable.Variables; 6 | import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; 7 | import lombok.AllArgsConstructor; 8 | import lombok.Data; 9 | import lombok.NoArgsConstructor; 10 | import lombok.experimental.Accessors; 11 | 12 | import java.io.Serializable; 13 | 14 | @Data 15 | @NoArgsConstructor 16 | @AllArgsConstructor 17 | @Accessors(chain = true) 18 | public class User implements Serializable { 19 | 20 | @JacksonXmlProperty(localName = "id", isAttribute = true) 21 | private String id; 22 | 23 | @JacksonXmlProperty(localName = "type", isAttribute = true) 24 | private String type; 25 | 26 | @JacksonXmlProperty(localName = "params", isAttribute = true) 27 | private Params params; 28 | 29 | @JacksonXmlProperty(localName = "variables", isAttribute = true) 30 | private Variables variables; 31 | 32 | @JacksonXmlProperty(localName = "gateways", isAttribute = true) 33 | private Gateways gateways; 34 | 35 | // todo VCards 36 | } 37 | -------------------------------------------------------------------------------- /freeswitch-esl/src/main/java/com/atomscat/freeswitch/esl/InboundClientService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.atomscat.freeswitch.esl; 19 | 20 | /** 21 | *

InboundClientService interface.

22 | * 23 | * @author : everyone 24 | * @version 1.0.0 25 | */ 26 | public interface InboundClientService { 27 | 28 | /** 29 | *

start.

30 | */ 31 | void start(); 32 | 33 | /** 34 | *

shutdown.

35 | */ 36 | void shutdown(); 37 | 38 | } 39 | -------------------------------------------------------------------------------- /freeswitch-esl/src/main/java/com/atomscat/freeswitch/esl/OutboundServerService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.atomscat.freeswitch.esl; 19 | 20 | /** 21 | *

InboundClientService interface.

22 | * 23 | * @author : everyone 24 | * @version 1.0.0 25 | */ 26 | public interface OutboundServerService { 27 | 28 | /** 29 | *

start.

30 | */ 31 | void start(); 32 | 33 | /** 34 | *

shutdown.

35 | */ 36 | void shutdown(); 37 | 38 | } 39 | -------------------------------------------------------------------------------- /freeswitch-xml-curl/src/main/java/com/atomscat/freeswitch/xml/domain/configuration/sofia/profile/Profile.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.xml.domain.configuration.sofia.profile; 2 | 3 | import com.atomscat.freeswitch.xml.domain.configuration.sofia.aliase.Aliases; 4 | import com.atomscat.freeswitch.xml.domain.configuration.sofia.domain.Domains; 5 | import com.atomscat.freeswitch.xml.domain.configuration.sofia.gateway.Gateways; 6 | import com.atomscat.freeswitch.xml.domain.configuration.sofia.setting.Settings; 7 | import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; 8 | import lombok.Data; 9 | import lombok.experimental.Accessors; 10 | 11 | import java.io.Serializable; 12 | 13 | /** 14 | * @author howell 15 | */ 16 | @Data 17 | @Accessors(chain = true) 18 | public class Profile implements Serializable { 19 | @JacksonXmlProperty(localName = "name", isAttribute = true) 20 | private String name; 21 | 22 | @JacksonXmlProperty(localName = "gateways", isAttribute = true) 23 | private Gateways gateways; 24 | 25 | @JacksonXmlProperty(localName = "aliases", isAttribute = true) 26 | private Aliases aliases; 27 | 28 | @JacksonXmlProperty(localName = "domains", isAttribute = true) 29 | private Domains domains; 30 | 31 | @JacksonXmlProperty(localName = "settings", isAttribute = true) 32 | private Settings settings; 33 | } 34 | -------------------------------------------------------------------------------- /freeswitch-xml-curl/src/main/java/com/atomscat/freeswitch/xml/domain/directory/param/ParamEnum.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.xml.domain.directory.param; 2 | 3 | import lombok.Getter; 4 | 5 | @Getter 6 | public enum ParamEnum { 7 | /** 8 | * domain 9 | */ 10 | DIAL_STRING("dial-string", ""), 11 | 12 | JSONRPC_ALLOWED_METHODS("jsonrpc-allowed-methods", ""), 13 | 14 | JSONRPC_ALLOWED_EVENT_CHANNELS("jsonrpc-allowed-event-channels", ""), 15 | 16 | /** 17 | * user 18 | */ 19 | PASSWORD("password", "SIP password"), 20 | 21 | VM_PASSWORD("vm-password", ""), 22 | 23 | A1_HASH("a1-hash", ""), 24 | 25 | // Some endpoints require authentication for certain types of requests (ex. SIP NOTIFY for resync). You can specify the credentials used for this digest authentication. 26 | REVERSE_AUTH_USER("reverse-auth-user", ""), 27 | 28 | REVERSE_AUTH_PASS("reverse-auth-pass", ""), 29 | 30 | /** 31 | * user.gateway 32 | */ 33 | USERNAME("username", ""), 34 | 35 | REALM("realm", ""), 36 | //todo 37 | ; 38 | 39 | /** 40 | * 配置项值 41 | */ 42 | public final String key; 43 | 44 | /** 45 | * 配置项说明 46 | */ 47 | public final String msg; 48 | 49 | ParamEnum(String key, String msg) { 50 | this.key = key; 51 | this.msg = msg; 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /freeswitch-esl-spring-boot-starter/src/main/java/com/atomscat/freeswitch/esl/spring/boot/starter/annotation/EslEventName.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.atomscat.freeswitch.esl.spring.boot.starter.annotation; 19 | 20 | import java.lang.annotation.*; 21 | 22 | /** 23 | *

EslEventName class.

24 | * 25 | * @author : everyone 26 | * @version 1.0.0 27 | */ 28 | @Target({ElementType.TYPE}) 29 | @Retention(RetentionPolicy.RUNTIME) 30 | @Documented 31 | public @interface EslEventName { 32 | 33 | String[] value(); 34 | } 35 | -------------------------------------------------------------------------------- /freeswitch-esl-spring-boot-starter-example/src/main/java/com/atomscat/freeswitch/esl/spring/boot/starter/example/controller/FreeSwitchController.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.esl.spring.boot.starter.example.controller; 2 | 3 | import jakarta.servlet.http.HttpServletRequest; 4 | import lombok.RequiredArgsConstructor; 5 | import lombok.extern.slf4j.Slf4j; 6 | import org.springframework.http.MediaType; 7 | import org.springframework.web.bind.annotation.GetMapping; 8 | import org.springframework.web.bind.annotation.RestController; 9 | 10 | /** 11 | * @author th158 12 | */ 13 | @Slf4j 14 | @RestController 15 | @RequiredArgsConstructor 16 | public class FreeSwitchController { 17 | private static final String ERROR_RESULT = "\n" + 18 | "\n" + 19 | "
\n" + 20 | " \n" + 21 | "
\n" + 22 | "
"; 23 | 24 | @GetMapping(value = "/fs/api", produces = {MediaType.TEXT_XML_VALUE}) 25 | public String fsApi(HttpServletRequest request) { 26 | String section = request.getParameter("section"); 27 | String keyValue = request.getParameter("key_value"); 28 | log.info("section : {} , keyValue : {}", section, keyValue); 29 | return ERROR_RESULT; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /freeswitch-xml-curl/src/main/java/com/atomscat/freeswitch/xml/domain/configuration/ivr/Entry.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.xml.domain.configuration.ivr; 2 | 3 | import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | import lombok.experimental.Accessors; 8 | 9 | import java.io.Serializable; 10 | 11 | /** 12 | * @author th158 13 | */ 14 | @Data 15 | @NoArgsConstructor 16 | @AllArgsConstructor 17 | @Accessors(chain = true) 18 | public class Entry implements Serializable { 19 | 20 | /** 21 | * menu-exit - Exit the IVR menues. 22 | * menu-sub - Load a sub-menu. 23 | * menu-exec-app - Execute a FreeSWITCH dialplan application. 24 | * menu-play-sound - Play a sound file or speak text. 25 | * menu-back - Return to the calling menu level. 26 | * menu-top - Return to the top level menu. 27 | * menu-exec-api was previously documented on this page and is documented in the FreeSWITCH book - it is however not currently supported. 28 | */ 29 | @JacksonXmlProperty(localName = "action", isAttribute = true) 30 | private String action; 31 | 32 | @JacksonXmlProperty(localName = "digits", isAttribute = true) 33 | private String digits; 34 | 35 | @JacksonXmlProperty(localName = "param", isAttribute = true) 36 | private String param; 37 | } 38 | -------------------------------------------------------------------------------- /opensips-event-mi-spring-boot-starter/src/main/java/com/atomscat/opensips/spring/boot/starter/propeties/ServerProperties.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.atomscat.opensips.spring.boot.starter.propeties; 19 | 20 | import lombok.Data; 21 | 22 | /** 23 | *

ServerProperties class.

24 | * 25 | * @author : everyone 26 | * @version 1.0.0 27 | */ 28 | @Data 29 | public class ServerProperties { 30 | private String host; 31 | private int port = 8021; 32 | private int timeoutSeconds; 33 | private String password; 34 | } 35 | -------------------------------------------------------------------------------- /softswitch-all-spring-boot-starter-example/src/main/java/com/atomscat/freeswitch/esl/spring/boot/starter/example/controller/FreeSwitchController.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.esl.spring.boot.starter.example.controller; 2 | 3 | import jakarta.servlet.http.HttpServletRequest; 4 | import lombok.RequiredArgsConstructor; 5 | import lombok.extern.slf4j.Slf4j; 6 | import org.springframework.http.MediaType; 7 | import org.springframework.web.bind.annotation.GetMapping; 8 | import org.springframework.web.bind.annotation.RestController; 9 | 10 | /** 11 | * @author th158 12 | */ 13 | @Slf4j 14 | @RestController 15 | @RequiredArgsConstructor 16 | public class FreeSwitchController { 17 | private static final String ERROR_RESULT = "\n" + 18 | "\n" + 19 | "
\n" + 20 | " \n" + 21 | "
\n" + 22 | "
"; 23 | 24 | @GetMapping(value = "/fs/api", produces = {MediaType.TEXT_XML_VALUE}) 25 | public String fsApi(HttpServletRequest request) { 26 | String section = request.getParameter("section"); 27 | String keyValue = request.getParameter("key_value"); 28 | log.info("section : {} , keyValue : {}", section, keyValue); 29 | return ERROR_RESULT; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /spring-boot-common/spring-boot-common-core/src/main/java/com/atomscat/spring/boot/common/util/LocalDateTimeUtil.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.spring.boot.common.util; 2 | 3 | 4 | import java.time.Instant; 5 | import java.time.LocalDateTime; 6 | import java.time.ZoneId; 7 | import java.time.ZoneOffset; 8 | 9 | public class LocalDateTimeUtil { 10 | private static final ZoneId DEFAULT_ZONE_ID = ZoneId.systemDefault(); 11 | 12 | private LocalDateTimeUtil() { 13 | } 14 | 15 | public static LocalDateTime ofEpochMilli(long epochMilli) { 16 | return epochMilli <= 0L ? null : LocalDateTime.ofInstant(Instant.ofEpochMilli(epochMilli), DEFAULT_ZONE_ID); 17 | } 18 | 19 | public static LocalDateTime ofUepochMilli(long uepochMilli) { 20 | return LocalDateTime.ofInstant(Instant.ofEpochMilli(uepochMilli / 1000L), DEFAULT_ZONE_ID); 21 | } 22 | 23 | public static long toEpochMilli(long uepochMillis) { 24 | return uepochMillis / 1000L; 25 | } 26 | 27 | public static int epochToSeconds(long epochMillis) { 28 | return (int) (epochMillis / 1000L); 29 | } 30 | 31 | public static int uepochToSeconds(long uepochMillis) { 32 | return (int) (uepochMillis / 1000000L); 33 | } 34 | 35 | public static long toEpochMilli(LocalDateTime localDateTime) { 36 | return localDateTime.toInstant(ZoneOffset.of("+8")).toEpochMilli(); 37 | } 38 | } 39 | 40 | -------------------------------------------------------------------------------- /freeswitch-cdr/src/main/java/com/atomscat/freeswitch/cdr/controller/CdrController.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.cdr.controller; 2 | 3 | import com.atomscat.freeswitch.cdr.service.CdrService; 4 | import lombok.RequiredArgsConstructor; 5 | import lombok.extern.slf4j.Slf4j; 6 | import org.springframework.http.HttpHeaders; 7 | import org.springframework.web.bind.annotation.RequestBody; 8 | import org.springframework.web.bind.annotation.RequestHeader; 9 | import org.springframework.web.bind.annotation.RequestMapping; 10 | import org.springframework.web.bind.annotation.RestController; 11 | 12 | /** 13 | *

CdrController class.

14 | * 15 | * @author : everyone 16 | * @version $Id: $Id 17 | */ 18 | @Slf4j 19 | @RestController 20 | @RequestMapping("/freeswitch") 21 | @RequiredArgsConstructor 22 | public class CdrController { 23 | 24 | private final CdrService cdrService; 25 | 26 | /** 27 | *

cdr.

28 | * 29 | * @param httpHeaders a {@link org.springframework.http.HttpHeaders} object. 30 | * @param reqText a {@link java.lang.String} object. 31 | */ 32 | @RequestMapping("/cdr") 33 | public void cdr(@RequestHeader HttpHeaders httpHeaders, @RequestBody String reqText) { 34 | log.debug("cdr httpHeaders : [{}]", httpHeaders); 35 | log.debug("cdr reqText : [{}]", reqText); 36 | cdrService.handle(reqText); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /freeswitch-esl-spring-boot-starter-example/src/main/java/com/atomscat/freeswitch/esl/spring/boot/starter/example/ExampleInboundClientOptionHandler.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.esl.spring.boot.starter.example; 2 | 3 | import com.atomscat.freeswitch.esl.inbound.option.InboundClientOption; 4 | import com.atomscat.freeswitch.esl.inbound.option.ServerOption; 5 | import com.atomscat.freeswitch.esl.spring.boot.starter.handler.AbstractInboundClientOptionHandler; 6 | import com.atomscat.freeswitch.esl.spring.boot.starter.propeties.InboundClientProperties; 7 | import lombok.extern.slf4j.Slf4j; 8 | import org.springframework.stereotype.Component; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | *

ExampleInboundClientOptionHandler class.

14 | * 15 | * @author everyone 16 | * @version 1.0.0 17 | */ 18 | @Slf4j 19 | @Component 20 | public class ExampleInboundClientOptionHandler extends AbstractInboundClientOptionHandler { 21 | 22 | public ExampleInboundClientOptionHandler(InboundClientProperties properties) { 23 | super(properties); 24 | } 25 | 26 | /** 27 | * {@inheritDoc} 28 | */ 29 | @Override 30 | protected void intercept(InboundClientOption inboundClientOption) { 31 | List serverOptions = inboundClientOption.serverOptions(); 32 | log.info("serverOptions before : {}", serverOptions); 33 | log.info("serverOptions after : {}", serverOptions); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /softswitch-all-spring-boot-starter-example/src/main/java/com/atomscat/freeswitch/esl/spring/boot/starter/example/ExampleInboundClientOptionHandler.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.esl.spring.boot.starter.example; 2 | 3 | import com.atomscat.freeswitch.esl.inbound.option.InboundClientOption; 4 | import com.atomscat.freeswitch.esl.inbound.option.ServerOption; 5 | import com.atomscat.freeswitch.esl.spring.boot.starter.handler.AbstractInboundClientOptionHandler; 6 | import com.atomscat.freeswitch.esl.spring.boot.starter.propeties.InboundClientProperties; 7 | import lombok.extern.slf4j.Slf4j; 8 | import org.springframework.stereotype.Component; 9 | 10 | import java.util.List; 11 | 12 | /** 13 | *

ExampleInboundClientOptionHandler class.

14 | * 15 | * @author everyone 16 | * @version 1.0.0 17 | */ 18 | @Slf4j 19 | @Component 20 | public class ExampleInboundClientOptionHandler extends AbstractInboundClientOptionHandler { 21 | 22 | public ExampleInboundClientOptionHandler(InboundClientProperties properties) { 23 | super(properties); 24 | } 25 | 26 | /** 27 | * {@inheritDoc} 28 | */ 29 | @Override 30 | protected void intercept(InboundClientOption inboundClientOption) { 31 | List serverOptions = inboundClientOption.serverOptions(); 32 | log.info("serverOptions before : {}", serverOptions); 33 | log.info("serverOptions after : {}", serverOptions); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /opensips-event-mi/src/main/java/com/atomscat/opensips/util/Validate.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.opensips.util; 2 | 3 | import java.util.Collection; 4 | import java.util.Objects; 5 | 6 | /** 7 | *

Validate class.

8 | * 9 | * @author everyone 10 | * @version 1.0.0 11 | */ 12 | public class Validate { 13 | 14 | /** 15 | *

isTrue.

16 | * 17 | * @param expression a boolean. 18 | * @param message a {@link String} object. 19 | * @param values a {@link Object} object. 20 | */ 21 | public static void isTrue(final boolean expression, final String message, final Object... values) { 22 | if (!expression) { 23 | throw new IllegalArgumentException(String.format(message, values)); 24 | } 25 | } 26 | 27 | /** 28 | *

notEmpty.

29 | * 30 | * @param collection a T object. 31 | * @param message a {@link String} object. 32 | * @param values a {@link Object} object. 33 | * @param T 34 | * @return a T object. 35 | */ 36 | public static > T notEmpty(final T collection, final String message, final Object... values) { 37 | Objects.requireNonNull(collection, () -> String.format(message, values)); 38 | if (collection.isEmpty()) { 39 | throw new IllegalArgumentException(String.format(message, values)); 40 | } 41 | return collection; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /freeswitch-esl/src/main/java/com/atomscat/freeswitch/esl/exception/EslDecoderException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.atomscat.freeswitch.esl.exception; 19 | 20 | /** 21 | *

EslDecoderException class.

22 | * 23 | * @author : everyone 24 | * @version 1.0.0 25 | */ 26 | public class EslDecoderException extends RuntimeException { 27 | /** 28 | *

Constructor for EslDecoderException.

29 | * 30 | * @param message a {@link java.lang.String} object. 31 | */ 32 | public EslDecoderException(String message) { 33 | super(message); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /freeswitch-xml-curl/src/main/java/com/atomscat/freeswitch/xml/domain/configuration/sofia/domain/Domain.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.xml.domain.configuration.sofia.domain; 2 | 3 | import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; 4 | import lombok.AllArgsConstructor; 5 | import lombok.Data; 6 | import lombok.NoArgsConstructor; 7 | import lombok.experimental.Accessors; 8 | 9 | import java.io.Serializable; 10 | 11 | /* 12 | * indicator to parse the directory for domains with parse="true" to 13 | * get gateways 14 | * 15 | * indicator to parse the directory for domains with parse="true" to 16 | * get gateways and alias every domain to this profile 17 | * This may seem like just a configuration convenience, but 18 | * aliasing has real effects on the handling of packets. If 19 | * you're sharing a profile between multiple realms, you 20 | * want to alias all realms to the shared profile. 21 | */ 22 | /** 23 | * @author howell 24 | */ 25 | @Data 26 | @NoArgsConstructor 27 | @AllArgsConstructor 28 | @Accessors(chain = true) 29 | public class Domain implements Serializable { 30 | 31 | @JacksonXmlProperty(localName = "name", isAttribute = true) 32 | private String name; 33 | 34 | @JacksonXmlProperty(localName = "alias", isAttribute = true) 35 | private String alias; 36 | 37 | @JacksonXmlProperty(localName = "parse", isAttribute = true) 38 | private String parse; 39 | } 40 | -------------------------------------------------------------------------------- /freeswitch-esl-spring-boot-starter/src/main/java/com/atomscat/freeswitch/esl/spring/boot/starter/handler/AbstractInboundEventHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.atomscat.freeswitch.esl.spring.boot.starter.handler; 19 | 20 | import org.slf4j.Logger; 21 | import org.slf4j.LoggerFactory; 22 | 23 | /** 24 | *

Abstract AbstractInboundEventHandler class.

25 | * 26 | * @author : everyone 27 | * @version 1.0.0 28 | */ 29 | public abstract class AbstractInboundEventHandler implements InboundEventHandler { 30 | 31 | protected final Logger log = LoggerFactory.getLogger(getClass()); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /freeswitch-cdr/src/main/java/com/atomscat/freeswitch/cdr/util/NumberUtil.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.cdr.util; 2 | 3 | import lombok.extern.slf4j.Slf4j; 4 | 5 | /** 6 | *

NumberUtil class.

7 | * 8 | * @author : everyone 9 | * @version $Id: $Id 10 | */ 11 | @Slf4j 12 | public class NumberUtil { 13 | 14 | private NumberUtil() { 15 | } 16 | 17 | /** 18 | *

toLong.

19 | * 20 | * @param str a {@link java.lang.String} object. 21 | * @return a {@link java.lang.Long} object. 22 | */ 23 | public static Long toLong(String str) { 24 | if (str == null) { 25 | return null; 26 | } 27 | try { 28 | return Long.parseLong(str); 29 | } catch (final NumberFormatException nfe) { 30 | log.warn("toLong failure, str : [{}]", str, nfe); 31 | return null; 32 | } 33 | } 34 | 35 | /** 36 | *

toInteger.

37 | * 38 | * @param str a {@link java.lang.String} object. 39 | * @return a {@link java.lang.Integer} object. 40 | */ 41 | public static Integer toInteger(String str) { 42 | if (str == null) { 43 | return null; 44 | } 45 | try { 46 | return Integer.parseInt(str); 47 | } catch (final NumberFormatException nfe) { 48 | log.warn("toInteger failure, str : [{}]", str, nfe); 49 | return null; 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /freeswitch-esl/src/main/java/com/atomscat/freeswitch/esl/util/Validate.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.esl.util; 2 | 3 | import java.util.Collection; 4 | import java.util.Objects; 5 | 6 | /** 7 | *

Validate class.

8 | * 9 | * @author everyone 10 | * @version 1.0.0 11 | */ 12 | public class Validate { 13 | 14 | /** 15 | *

isTrue.

16 | * 17 | * @param expression a boolean. 18 | * @param message a {@link java.lang.String} object. 19 | * @param values a {@link java.lang.Object} object. 20 | */ 21 | public static void isTrue(final boolean expression, final String message, final Object... values) { 22 | if (!expression) { 23 | throw new IllegalArgumentException(String.format(message, values)); 24 | } 25 | } 26 | 27 | /** 28 | *

notEmpty.

29 | * 30 | * @param collection a T object. 31 | * @param message a {@link java.lang.String} object. 32 | * @param values a {@link java.lang.Object} object. 33 | * @param T 34 | * @return a T object. 35 | */ 36 | public static > T notEmpty(final T collection, final String message, final Object... values) { 37 | Objects.requireNonNull(collection, () -> String.format(message, values)); 38 | if (collection.isEmpty()) { 39 | throw new IllegalArgumentException(String.format(message, values)); 40 | } 41 | return collection; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /freeswitch-xml-curl/src/main/java/com/atomscat/freeswitch/xml/annotation/XmlCurlSectionName.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.atomscat.freeswitch.xml.annotation; 19 | 20 | import java.lang.annotation.*; 21 | 22 | /** 23 | *

EslEventName class.

24 | * 25 | * @author : everyone 26 | * @version 1.0.0 27 | */ 28 | @Target({ElementType.TYPE}) 29 | @Retention(RetentionPolicy.RUNTIME) 30 | @Documented 31 | public @interface XmlCurlSectionName { 32 | 33 | String[] value(); 34 | 35 | /* 36 | * configuration : 37 | * ivr.conf 38 | * key_value 39 | */ 40 | String key() default ""; 41 | } 42 | -------------------------------------------------------------------------------- /freeswitch-esl/src/main/java/com/atomscat/freeswitch/esl/inbound/listener/EventListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.atomscat.freeswitch.esl.inbound.listener; 19 | 20 | import java.util.List; 21 | 22 | /** 23 | *

EventListener interface.

24 | * 25 | * @author : everyone 26 | * @version 1.0.0 27 | */ 28 | public interface EventListener { 29 | 30 | /** 31 | *

addEvents.

32 | * 33 | * @param list a {@link java.util.List} object. 34 | */ 35 | void addEvents(List list); 36 | 37 | /** 38 | *

cancelEvents.

39 | */ 40 | void cancelEvents(); 41 | 42 | } 43 | -------------------------------------------------------------------------------- /freeswitch-cdr/src/main/java/com/atomscat/freeswitch/cdr/util/CdrDecodeUtil.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.cdr.util; 2 | 3 | import lombok.extern.slf4j.Slf4j; 4 | import org.apache.commons.lang3.StringUtils; 5 | 6 | import java.net.URLDecoder; 7 | 8 | 9 | /** 10 | *

CdrDecodeUtil class.

11 | * 12 | * @author : everyone 13 | * @version $Id: $Id 14 | */ 15 | @Slf4j 16 | public class CdrDecodeUtil { 17 | 18 | private CdrDecodeUtil() { 19 | } 20 | 21 | /** 22 | *

decode.

23 | * 24 | * @param strXml a {@link java.lang.String} object. 25 | * @return a {@link java.lang.String} object. 26 | */ 27 | public static String decode(String strXml) { 28 | try { 29 | return URLDecoder.decode(strXml, "UTF-8"); 30 | } catch (Exception e) { 31 | log.error("url decode failed, strXml : [{}]", strXml, e); 32 | return strXml; 33 | } 34 | } 35 | 36 | /** 37 | *

decodeLine.

38 | * 39 | * @param strXml a {@link java.lang.String} object. 40 | * @return a {@link java.lang.String} object. 41 | */ 42 | public static String decodeLine(String strXml) { 43 | String[] strs = StringUtils.split(strXml, StringUtils.LF); 44 | StringBuilder sb = new StringBuilder(); 45 | for (String str : strs) { 46 | sb.append(decode(str)).append(StringUtils.LF); 47 | } 48 | return sb.toString(); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /softswitch-all-spring-boot-starter-example/README.md: -------------------------------------------------------------------------------- 1 | # FreeSWITCH ESL Spring Boot Starter Example 2 | 3 | [![Jdk Version](https://img.shields.io/badge/JDK-1.8-green.svg)](https://img.shields.io/badge/JDK-1.8-green.svg) 4 | [![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html) 5 | [![Maven Central](https://maven-badges.herokuapp.com/maven-central/link.thingscloud/freeswitch-esl-spring-boot-starter-example/badge.svg)](https://maven-badges.herokuapp.com/maven-central/link.thingscloud/freeswitch-esl-spring-boot-starter-example/) 6 | 7 | 8 | # Dependent environment 9 | 10 | ## redis 11 | ```shell 12 | docker run -it -d -p 6379:6379 --name redis redis --requirepass "Aa123456" 13 | ``` 14 | 15 | ## rabbitmq 16 | ```shell 17 | docker run -d -p 14369:4369 -p 5671:5671 -p 5672:5672 -p 15671:15671 -p 15672:15672 -p 15691:15691 -p 15692:15692 -p 25672:25672 -e RABBITMQ_DEFAULT_USER=guest -e RABBITMQ_DEFAULT_PASS=guest --name rabbitmq rabbitmq:3-management 18 | ``` 19 | ### setting 20 | ```shell 21 | 22 | http://127.0.0.1:15672/ 23 | 24 | ``` 25 | 26 | ## nacos 27 | ```shell 28 | # download by https://github.com/alibaba/nacos/releases 29 | # unzip package 30 | ./bin/startup.sh -m standalone 31 | ``` 32 | 33 | ## postgres 34 | ```shell 35 | docker run -d \ 36 | --name postgres \ 37 | -p 5432:5432 \ 38 | -e POSTGRES_PASSWORD=Aa123456 \ 39 | -e PGDATA=/var/lib/postgresql/data/pgdata \ 40 | -v /data/postgres/mount:/var/lib/postgresql/data \ 41 | postgres:9.6 42 | ``` -------------------------------------------------------------------------------- /freeswitch-xml-curl/src/main/java/com/atomscat/freeswitch/xml/domain/directory/Domain.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.xml.domain.directory; 2 | 3 | import com.atomscat.freeswitch.xml.domain.directory.group.Groups; 4 | import com.atomscat.freeswitch.xml.domain.directory.param.Params; 5 | import com.atomscat.freeswitch.xml.domain.directory.variable.Variables; 6 | import com.fasterxml.jackson.core.JsonProcessingException; 7 | import com.fasterxml.jackson.databind.ObjectMapper; 8 | import com.fasterxml.jackson.dataformat.xml.XmlMapper; 9 | import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; 10 | import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement; 11 | import lombok.Data; 12 | import lombok.experimental.Accessors; 13 | 14 | import java.io.Serializable; 15 | 16 | @Data 17 | @Accessors(chain = true) 18 | @JacksonXmlRootElement(localName = "domain") 19 | public class Domain implements Serializable { 20 | @JacksonXmlProperty(localName = "name", isAttribute = true) 21 | private String name; 22 | 23 | @JacksonXmlProperty(localName = "params", isAttribute = true) 24 | private Params params; 25 | 26 | @JacksonXmlProperty(localName = "variables", isAttribute = true) 27 | private Variables variables; 28 | 29 | @JacksonXmlProperty(localName = "groups", isAttribute = true) 30 | private Groups groups; 31 | 32 | public String toXmlString() throws JsonProcessingException { 33 | ObjectMapper xmlMapper = new XmlMapper(); 34 | return xmlMapper.writeValueAsString(this); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /freeswitch-esl/src/main/java/com/atomscat/freeswitch/esl/ServerConnectionListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.atomscat.freeswitch.esl; 19 | 20 | import com.atomscat.freeswitch.esl.inbound.option.ServerOption; 21 | 22 | /** 23 | *

ServerConnectionListener interface.

24 | * 25 | * @author : everyone 26 | * @version 1.0.0 27 | */ 28 | public interface ServerConnectionListener { 29 | 30 | /** 31 | *

onOpened.

32 | * 33 | * @param serverOption a {@link ServerOption} object. 34 | */ 35 | void onOpened(ServerOption serverOption); 36 | 37 | /** 38 | *

onClosed.

39 | * 40 | * @param serverOption a {@link ServerOption} object. 41 | */ 42 | void onClosed(ServerOption serverOption); 43 | 44 | } 45 | -------------------------------------------------------------------------------- /freeswitch-esl/src/test/java/com/atomscat/freeswitch/esl/transport/util/ByteBuilderTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.atomscat.freeswitch.esl.transport.util; 19 | 20 | import junit.framework.TestCase; 21 | 22 | /** 23 | *

ByteBuilderTest class.

24 | * 25 | * @author everyone 26 | * @version 1.0.0 27 | * @since 1.4.0.SNAPSHOT 28 | */ 29 | public class ByteBuilderTest extends TestCase { 30 | 31 | /** 32 | *

testLength.

33 | */ 34 | public void testLength() { 35 | ByteBuilder builder = ByteBuilder.newBuilder(); 36 | System.out.println(builder.string()); 37 | System.out.println(builder.length()); 38 | } 39 | 40 | /** 41 | *

testString.

42 | */ 43 | public void testString() { 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /opensips-event-mi/src/main/java/com/atomscat/opensips/event/listener/ServerConnectionListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.atomscat.opensips.event.listener; 19 | 20 | 21 | import com.atomscat.opensips.event.option.ServerOption; 22 | 23 | /** 24 | *

ServerConnectionListener interface.

25 | * 26 | * @author : everyone 27 | * @version 1.0.0 28 | */ 29 | public interface ServerConnectionListener { 30 | 31 | /** 32 | *

onOpened.

33 | * 34 | * @param serverOption a {@link ServerOption} object. 35 | */ 36 | void onOpened(ServerOption serverOption); 37 | 38 | /** 39 | *

onClosed.

40 | * 41 | * @param serverOption a {@link ServerOption} object. 42 | */ 43 | void onClosed(ServerOption serverOption); 44 | 45 | } 46 | -------------------------------------------------------------------------------- /spring-boot-common/spring-boot-common-core/src/main/java/com/atomscat/spring/boot/common/util/ExecutorHelper.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.spring.boot.common.util; 2 | 3 | import org.springframework.scheduling.concurrent.CustomizableThreadFactory; 4 | 5 | import java.util.concurrent.*; 6 | 7 | public class ExecutorHelper { 8 | private static final ScheduledExecutorService EXECUTOR_SERVICE = new ScheduledThreadPoolExecutor(Runtime.getRuntime().availableProcessors() * 2, new CustomizableThreadFactory("pool-helper-exec-")); 9 | 10 | private ExecutorHelper() { 11 | } 12 | 13 | public static void execute(Runnable runnable) { 14 | EXECUTOR_SERVICE.execute(runnable); 15 | } 16 | 17 | public static Future submit(Runnable runnable, T result) { 18 | return EXECUTOR_SERVICE.submit(runnable, result); 19 | } 20 | 21 | public static Future submit(Callable callable) { 22 | return EXECUTOR_SERVICE.submit(callable); 23 | } 24 | 25 | public static ScheduledFuture schedule(Runnable command, long delay, TimeUnit unit) { 26 | return EXECUTOR_SERVICE.schedule(command, delay, unit); 27 | } 28 | 29 | public static ScheduledFuture scheduleWithFixedDelay(Runnable command, long initialDelay, long delay, TimeUnit unit) { 30 | return EXECUTOR_SERVICE.scheduleWithFixedDelay(command, initialDelay, delay, unit); 31 | } 32 | 33 | public static ScheduledFuture scheduleAtFixedRate(Runnable command, long initialDelay, long period, TimeUnit unit) { 34 | return EXECUTOR_SERVICE.scheduleAtFixedRate(command, initialDelay, period, unit); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /freeswitch-esl-spring-boot-starter-example/src/test/java/com/atomscat/freeswitch/esl/spring/boot/starter/example/ExampleApplicationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.atomscat.freeswitch.esl.spring.boot.starter.example; 19 | 20 | import org.junit.Test; 21 | import org.junit.runner.RunWith; 22 | import org.springframework.boot.test.context.SpringBootTest; 23 | import org.springframework.test.context.junit4.SpringRunner; 24 | 25 | /** 26 | *

ExampleApplicationTests class.

27 | * 28 | * @author everyone 29 | * @version 1.0.0 30 | * @since 1.4.0.SNAPSHOT 31 | */ 32 | @RunWith(SpringRunner.class) 33 | @SpringBootTest 34 | public class ExampleApplicationTests { 35 | 36 | /** 37 | *

contextLoads.

38 | */ 39 | @Test 40 | public void contextLoads() { 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /freeswitch-esl-spring-boot-starter/src/main/java/com/atomscat/freeswitch/esl/spring/boot/starter/EnableFreeswitchEslAutoConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.atomscat.freeswitch.esl.spring.boot.starter; 19 | 20 | import com.atomscat.freeswitch.esl.spring.boot.starter.config.FreeswitchEslAutoConfiguration; 21 | import org.springframework.context.annotation.Import; 22 | 23 | import java.lang.annotation.*; 24 | 25 | /** 26 | *

EnableFreeswitchEslAutoConfiguration class.

27 | * 28 | * @author : everyone 29 | * @version 1.0.0 30 | */ 31 | @Target({ElementType.TYPE}) 32 | @Retention(RetentionPolicy.RUNTIME) 33 | @Documented 34 | @Inherited 35 | @Import(FreeswitchEslAutoConfiguration.class) 36 | public @interface EnableFreeswitchEslAutoConfiguration { 37 | 38 | } 39 | -------------------------------------------------------------------------------- /softswitch-all-spring-boot-starter-example/src/test/java/com/atomscat/freeswitch/esl/spring/boot/starter/example/ExampleApplicationTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.atomscat.freeswitch.esl.spring.boot.starter.example; 19 | 20 | import org.junit.Test; 21 | import org.junit.runner.RunWith; 22 | import org.springframework.boot.test.context.SpringBootTest; 23 | import org.springframework.test.context.junit4.SpringRunner; 24 | 25 | /** 26 | *

ExampleApplicationTests class.

27 | * 28 | * @author everyone 29 | * @version 1.0.0 30 | * @since 1.4.0.SNAPSHOT 31 | */ 32 | @RunWith(SpringRunner.class) 33 | @SpringBootTest 34 | public class ExampleApplicationTests { 35 | 36 | /** 37 | *

contextLoads.

38 | */ 39 | @Test 40 | public void contextLoads() { 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /freeswitch-esl/src/main/java/com/atomscat/freeswitch/esl/inbound/listener/ServerOptionListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.atomscat.freeswitch.esl.inbound.listener; 19 | 20 | import com.atomscat.freeswitch.esl.inbound.option.ServerOption; 21 | 22 | /** 23 | *

ServerOptionListener interface.

24 | * 25 | * @author : everyone 26 | * @version 1.0.0 27 | */ 28 | public interface ServerOptionListener { 29 | 30 | /** 31 | *

onAdded.

32 | * 33 | * @param serverOption a {@link ServerOption} object. 34 | */ 35 | void onAdded(ServerOption serverOption); 36 | 37 | /** 38 | *

onRemoved.

39 | * 40 | * @param serverOption a {@link ServerOption} object. 41 | */ 42 | void onRemoved(ServerOption serverOption); 43 | 44 | } 45 | -------------------------------------------------------------------------------- /freeswitch-cdr-spring-boot-starter/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | softswitch-gateway 7 | com.atomscat 8 | 2.0.0.RELEASE 9 | 10 | 4.0.0 11 | 12 | freeswitch-cdr-spring-boot-starter 13 | freeswitch-cdr-spring-boot-starter-${project.version} 14 | 15 | 17 16 | 17 17 | 18 | 19 | 20 | 21 | ${project.groupId} 22 | freeswitch-cdr 23 | 24 | 25 | org.springframework.boot 26 | spring-boot-configuration-processor 27 | true 28 | 29 | 30 | org.springframework.boot 31 | spring-boot-autoconfigure 32 | 33 | 34 | org.projectlombok 35 | lombok 36 | provided 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /freeswitch-esl/src/main/java/com/atomscat/freeswitch/esl/constant/EslConstant.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.atomscat.freeswitch.esl.constant; 19 | 20 | /** 21 | *

EslConstant class.

22 | * 23 | * @author : everyone 24 | * @version 1.0.0 25 | */ 26 | public class EslConstant { 27 | 28 | /** 29 | * Constant BACKGROUND_JOB="BACKGROUND_JOB" 30 | */ 31 | public static final String BACKGROUND_JOB = "BACKGROUND_JOB"; 32 | /** 33 | * Constant PLAIN="plain" 34 | */ 35 | public static final String PLAIN = "plain"; 36 | 37 | public static final String SMF_ALEG = "aleg"; 38 | public static final String SMF_BLEG = "bleg"; 39 | public static final String SMF_HOLDB = "holdb"; 40 | public static final String SMF_BOTH = "both"; 41 | } 42 | -------------------------------------------------------------------------------- /freeswitch-esl-spring-boot-starter/src/main/java/com/atomscat/freeswitch/esl/spring/boot/starter/handler/DefaultInboundEventHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.atomscat.freeswitch.esl.spring.boot.starter.handler; 19 | 20 | import com.atomscat.freeswitch.esl.helper.EslHelper; 21 | import com.atomscat.freeswitch.esl.transport.event.EslEvent; 22 | 23 | /** 24 | *

DefaultInboundEventHandler class.

25 | * 26 | * @author : everyone 27 | * @version 1.0.0 28 | */ 29 | public class DefaultInboundEventHandler extends AbstractInboundEventHandler { 30 | /** 31 | * {@inheritDoc} 32 | */ 33 | @Override 34 | public void handle(String address, EslEvent event, String coreUUID) { 35 | log.debug("Default Inbound event handler handle address[{}], event[{}]", address, EslHelper.formatEslEvent(event)); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /opensips-event-mi/src/main/java/com/atomscat/opensips/event/option/ConnectState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.atomscat.opensips.event.option; 19 | 20 | /** 21 | *

ConnectState class.

22 | * 23 | * @author : everyone 24 | * @version 1.0.0 25 | */ 26 | public enum ConnectState { 27 | /** 28 | * 初始化状态 29 | */ 30 | INIT, 31 | /** 32 | * 正在连接 33 | */ 34 | CONNECTING, 35 | /** 36 | * 连接失败 37 | */ 38 | FAILED, 39 | /** 40 | * 连接成功 41 | */ 42 | CONNECTED, 43 | /** 44 | * 认证成功 45 | */ 46 | AUTHED, 47 | /** 48 | * 认证失败 49 | */ 50 | AUTHED_FAILED, 51 | /** 52 | * 正在关闭连接 53 | */ 54 | CLOSING, 55 | /** 56 | * 连接已关闭 57 | */ 58 | CLOSED, 59 | /** 60 | * 应用已停止 61 | */ 62 | SHUTDOWN 63 | } 64 | -------------------------------------------------------------------------------- /freeswitch-esl/src/main/java/com/atomscat/freeswitch/esl/inbound/option/ConnectState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.atomscat.freeswitch.esl.inbound.option; 19 | 20 | /** 21 | *

ConnectState class.

22 | * 23 | * @author : everyone 24 | * @version 1.0.0 25 | */ 26 | public enum ConnectState { 27 | /** 28 | * 初始化状态 29 | */ 30 | INIT, 31 | /** 32 | * 正在连接 33 | */ 34 | CONNECTING, 35 | /** 36 | * 连接失败 37 | */ 38 | FAILED, 39 | /** 40 | * 连接成功 41 | */ 42 | CONNECTED, 43 | /** 44 | * 认证成功 45 | */ 46 | AUTHED, 47 | /** 48 | * 认证失败 49 | */ 50 | AUTHED_FAILED, 51 | /** 52 | * 正在关闭连接 53 | */ 54 | CLOSING, 55 | /** 56 | * 连接已关闭 57 | */ 58 | CLOSED, 59 | /** 60 | * 应用已停止 61 | */ 62 | SHUTDOWN 63 | } 64 | -------------------------------------------------------------------------------- /freeswitch-esl/src/main/java/com/atomscat/freeswitch/esl/outbound/option/ConnectState.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.atomscat.freeswitch.esl.outbound.option; 19 | 20 | /** 21 | *

ConnectState class.

22 | * 23 | * @author : everyone 24 | * @version 1.0.0 25 | */ 26 | public enum ConnectState { 27 | /** 28 | * 初始化状态 29 | */ 30 | INIT, 31 | /** 32 | * 正在连接 33 | */ 34 | CONNECTING, 35 | /** 36 | * 连接失败 37 | */ 38 | FAILED, 39 | /** 40 | * 连接成功 41 | */ 42 | CONNECTED, 43 | /** 44 | * 认证成功 45 | */ 46 | AUTHED, 47 | /** 48 | * 认证失败 49 | */ 50 | AUTHED_FAILED, 51 | /** 52 | * 正在关闭连接 53 | */ 54 | CLOSING, 55 | /** 56 | * 连接已关闭 57 | */ 58 | CLOSED, 59 | /** 60 | * 应用已停止 61 | */ 62 | SHUTDOWN 63 | } 64 | -------------------------------------------------------------------------------- /opensips-event-mi-spring-boot-starter/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | softswitch-gateway 7 | com.atomscat 8 | 2.0.0.RELEASE 9 | 10 | 4.0.0 11 | 12 | opensips-event-mi-spring-boot-starter 13 | opensips-event-mi-spring-boot-starter-${project.version} 14 | 15 | 16 | 17 17 | 17 18 | 19 | 20 | 21 | ${project.groupId} 22 | opensips-event-mi 23 | ${project.version} 24 | 25 | 26 | org.springframework.boot 27 | spring-boot-configuration-processor 28 | true 29 | 30 | 31 | org.springframework.boot 32 | spring-boot-autoconfigure 33 | 34 | 35 | org.projectlombok 36 | lombok 37 | provided 38 | 39 | 40 | -------------------------------------------------------------------------------- /freeswitch-esl-spring-boot-starter-example/src/main/java/com/atomscat/freeswitch/esl/spring/boot/starter/example/udp/UdpServerHandler.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.esl.spring.boot.starter.example.udp; 2 | 3 | import io.netty.buffer.ByteBuf; 4 | import io.netty.buffer.Unpooled; 5 | import io.netty.channel.ChannelHandlerContext; 6 | import io.netty.channel.SimpleChannelInboundHandler; 7 | import io.netty.channel.socket.DatagramPacket; 8 | 9 | import java.nio.charset.StandardCharsets; 10 | 11 | /** 12 | * todo 测试 13 | */ 14 | public class UdpServerHandler extends SimpleChannelInboundHandler { 15 | /** 16 | * 接收数据 17 | * 18 | * @param ctx a {@link ChannelHandlerContext} object. 19 | * @param packet a {@link DatagramPacket} object. 20 | */ 21 | @Override 22 | protected void channelRead0(ChannelHandlerContext ctx, DatagramPacket packet) { 23 | ByteBuf buf = packet.copy().content(); 24 | byte[] req = new byte[buf.readableBytes()]; 25 | //复制内容到字节数组bytes 26 | buf.readBytes(req); 27 | String body = new String(req, StandardCharsets.UTF_8); 28 | System.out.println("UdpServer数据1: " + body); 29 | //向客户端原样返回消息 30 | DatagramPacket data = new DatagramPacket(Unpooled.copiedBuffer(req), packet.sender()); 31 | ctx.writeAndFlush(data); 32 | } 33 | 34 | /** 35 | * 捕获异常 36 | * 37 | * @param ctx a {@link ChannelHandlerContext} object. 38 | * @param cause a {@link Throwable} object. 39 | */ 40 | @Override 41 | public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { 42 | System.out.println("UdpServer捕获异常1: " + ctx.channel().remoteAddress()); 43 | ctx.close(); 44 | cause.printStackTrace(); 45 | } 46 | } -------------------------------------------------------------------------------- /freeswitch-esl-spring-boot-starter-example/src/main/java/com/atomscat/freeswitch/esl/spring/boot/starter/example/udp/UdpServerHandler2.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.esl.spring.boot.starter.example.udp; 2 | 3 | import io.netty.buffer.ByteBuf; 4 | import io.netty.buffer.Unpooled; 5 | import io.netty.channel.ChannelHandlerContext; 6 | import io.netty.channel.SimpleChannelInboundHandler; 7 | import io.netty.channel.socket.DatagramPacket; 8 | 9 | import java.nio.charset.StandardCharsets; 10 | 11 | /** 12 | * todo 测试 13 | */ 14 | public class UdpServerHandler2 extends SimpleChannelInboundHandler { 15 | /** 16 | * 接收数据 17 | * 18 | * @param ctx a {@link ChannelHandlerContext} object. 19 | * @param packet a {@link DatagramPacket} object. 20 | */ 21 | @Override 22 | protected void channelRead0(ChannelHandlerContext ctx, DatagramPacket packet) { 23 | ByteBuf buf = packet.copy().content(); 24 | byte[] req = new byte[buf.readableBytes()]; 25 | //复制内容到字节数组bytes 26 | buf.readBytes(req); 27 | String body = new String(req, StandardCharsets.UTF_8); 28 | System.out.println("UdpServer数据2: " + body); 29 | //向客户端原样返回消息 30 | DatagramPacket data = new DatagramPacket(Unpooled.copiedBuffer(req), packet.sender()); 31 | ctx.writeAndFlush(data); 32 | } 33 | 34 | /** 35 | * 捕获异常 36 | * 37 | * @param ctx a {@link ChannelHandlerContext} object. 38 | * @param cause a {@link Throwable} object. 39 | */ 40 | @Override 41 | public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { 42 | System.out.println("UdpServer捕获异常2: " + ctx.channel().remoteAddress()); 43 | ctx.close(); 44 | cause.printStackTrace(); 45 | } 46 | } -------------------------------------------------------------------------------- /spring-boot-common/spring-boot-common-aop/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | softswitch-gateway 7 | com.atomscat 8 | 2.0.0.RELEASE 9 | ../../pom.xml 10 | 11 | 4.0.0 12 | 13 | spring-boot-common-aop 14 | 15 | 16 | 17 17 | 17 18 | 19 | 20 | 21 | 22 | ${project.groupId} 23 | spring-boot-common-core 24 | 25 | 26 | org.springframework.boot 27 | spring-boot-starter-aop 28 | 29 | 30 | org.redisson 31 | redisson-spring-boot-starter 32 | 33 | 34 | 35 | ma.glasnost.orika 36 | orika-core 37 | 38 | 39 | org.projectlombok 40 | lombok 41 | provided 42 | 43 | 44 | -------------------------------------------------------------------------------- /freeswitch-esl/src/main/java/com/atomscat/freeswitch/esl/exception/InboundTimeoutExcetion.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.atomscat.freeswitch.esl.exception; 19 | 20 | /** 21 | *

InboundTimeoutExcetion class.

22 | * 23 | * @author : everyone 24 | * @version 1.0.0 25 | */ 26 | public class InboundTimeoutExcetion extends InboundClientException { 27 | /** 28 | *

Constructor for InboundTimeoutExcetion.

29 | * 30 | * @param message a {@link java.lang.String} object. 31 | */ 32 | public InboundTimeoutExcetion(String message) { 33 | super(message); 34 | } 35 | 36 | /** 37 | *

Constructor for InboundTimeoutExcetion.

38 | * 39 | * @param message a {@link java.lang.String} object. 40 | * @param cause a {@link java.lang.Throwable} object. 41 | */ 42 | public InboundTimeoutExcetion(String message, Throwable cause) { 43 | super(message, cause); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /softswitch-all-spring-boot-starter-example/src/main/java/com/atomscat/freeswitch/esl/spring/boot/starter/example/ExampleApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.atomscat.freeswitch.esl.spring.boot.starter.example; 19 | 20 | import org.springframework.boot.SpringApplication; 21 | import org.springframework.boot.autoconfigure.SpringBootApplication; 22 | import org.springframework.scheduling.annotation.EnableScheduling; 23 | 24 | //@EnableFreeswitchEslAutoConfiguration 25 | 26 | /** 27 | *

FreeswitchEslSpringBootStarterExampleApplication class.

28 | * 29 | * @author everyone 30 | * @version 1.0.0 31 | */ 32 | @EnableScheduling 33 | @SpringBootApplication 34 | public class ExampleApplication { 35 | 36 | /** 37 | *

main.

38 | * 39 | * @param args an array of {@link java.lang.String} objects. 40 | */ 41 | public static void main(String[] args) { 42 | SpringApplication.run(ExampleApplication.class, args); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /freeswitch-esl-spring-boot-starter-example/src/main/java/com/atomscat/freeswitch/esl/spring/boot/starter/example/ExampleApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.atomscat.freeswitch.esl.spring.boot.starter.example; 19 | 20 | import com.atomscat.freeswitch.esl.spring.boot.starter.EnableFreeswitchEslAutoConfiguration; 21 | import org.springframework.boot.SpringApplication; 22 | import org.springframework.boot.autoconfigure.SpringBootApplication; 23 | 24 | 25 | 26 | /** 27 | *

FreeswitchEslSpringBootStarterExampleApplication class.

28 | * 29 | * @author everyone 30 | * @version 1.0.0 31 | */ 32 | @SpringBootApplication 33 | @EnableFreeswitchEslAutoConfiguration 34 | public class ExampleApplication { 35 | 36 | /** 37 | *

main.

38 | * 39 | * @param args an array of {@link java.lang.String} objects. 40 | */ 41 | public static void main(String[] args) { 42 | SpringApplication.run(ExampleApplication.class, args); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /opensips-event-mi/src/main/java/com/atomscat/opensips/util/RemotingUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.atomscat.opensips.util; 19 | 20 | import java.net.InetSocketAddress; 21 | import java.net.SocketAddress; 22 | 23 | /** 24 | *

RemotingUtil class.

25 | * 26 | * @author : everyone 27 | * @version 1.0.0 28 | */ 29 | public class RemotingUtil { 30 | 31 | /** 32 | * private constructor 33 | */ 34 | private RemotingUtil() { 35 | } 36 | 37 | /** 38 | *

socketAddress2String.

39 | * 40 | * @param address a {@link SocketAddress} object. 41 | * @return a {@link String} object. 42 | */ 43 | public static String socketAddress2String(final SocketAddress address) { 44 | InetSocketAddress inetSocketAddress = (InetSocketAddress) address; 45 | return inetSocketAddress.getAddress().getHostAddress() + 46 | ":" + 47 | inetSocketAddress.getPort(); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /spring-boot-common/spring-boot-common-election/src/test/java/com/atomscat/spring/boot/common/util/MatchElectionTest.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.spring.boot.common.util; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | import com.atomscat.spring.boot.common.param.*; 5 | import org.junit.Test; 6 | 7 | import java.util.ArrayList; 8 | import java.util.List; 9 | 10 | public class MatchElectionTest { 11 | 12 | @Test 13 | public void offsetMatchElection() { 14 | List producerParams = new ArrayList<>(16); 15 | List consumerParams = new ArrayList<>(16); 16 | 17 | producerParams.add(new FreeswitchProducerParam().setNodeId("FS-node-1")); 18 | producerParams.add(new FreeswitchProducerParam().setNodeId("FS-node-2")); 19 | producerParams.add(new FreeswitchProducerParam().setNodeId("FS-node-3")); 20 | producerParams.add(new FreeswitchProducerParam().setNodeId("FS-node-4")); 21 | producerParams.add(new FreeswitchProducerParam().setNodeId("FS-node-5")); 22 | producerParams.add(new FreeswitchProducerParam().setNodeId("FS-node-6")); 23 | 24 | consumerParams.add(new SoftswitchGatewayConsumerParam().setNodeId("SW-node-1")); 25 | consumerParams.add(new SoftswitchGatewayConsumerParam().setNodeId("SW-node-2")); 26 | consumerParams.add(new SoftswitchGatewayConsumerParam().setNodeId("SW-node-3")); 27 | consumerParams.add(new SoftswitchGatewayConsumerParam().setNodeId("SW-node-4")); 28 | MatchElection matchElection = new MatchElection(); 29 | List list = matchElection.offsetMatchElection(2, producerParams, consumerParams); 30 | for (ElectionResultParam resultParam : list) { 31 | System.out.println(JSON.toJSONString(resultParam)); 32 | } 33 | 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /freeswitch-esl/src/main/java/com/atomscat/freeswitch/esl/builder/Command.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.esl.builder; 2 | 3 | import com.atomscat.freeswitch.esl.util.StringUtils; 4 | 5 | /** 6 | * @author everyone 7 | * @since 1.6.0 8 | */ 9 | public class Command { 10 | 11 | public static final String UUID_ANSWER = "uuid_answer"; 12 | public static final String UUID_BRIDGE = "uuid_bridge"; 13 | public static final String UUID_BROADCAST = "uuid_broadcast"; 14 | public static final String UUID_BREAK = "uuid_break"; 15 | public static final String UUID_HOLD = "uuid_hold"; 16 | public static final String UUID_GETVAR = "uuid_getvar"; 17 | public static final String UUID_SETVAR = "uuid_setvar"; 18 | public static final String UUID_SETVAR_MULTI = "uuid_setvar_multi"; 19 | public static final String UUID_RECORD = "uuid_record"; 20 | public static final String UUID_TRANSFER = "uuid_transfer"; 21 | 22 | private final StringBuilder builder = new StringBuilder(); 23 | 24 | public static Command cmd(String cmd) { 25 | return new Command().arg(cmd); 26 | } 27 | 28 | public Command arg(String arg) { 29 | if (arg == null || arg.isEmpty()) { 30 | return this; 31 | } 32 | builder.append(arg).append(StringUtils.BLANK); 33 | return this; 34 | } 35 | 36 | public Command arg(int arg) { 37 | builder.append(arg).append(StringUtils.BLANK); 38 | return this; 39 | } 40 | 41 | public Command arg(boolean arg) { 42 | builder.append(arg).append(StringUtils.BLANK); 43 | return this; 44 | } 45 | 46 | @Override 47 | public String toString() { 48 | if (builder.length() > 0) { 49 | builder.deleteCharAt(builder.length() - 1); 50 | } 51 | return builder.toString(); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /freeswitch-esl/src/main/java/com/atomscat/freeswitch/esl/InboundEventListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.atomscat.freeswitch.esl; 19 | 20 | import com.atomscat.freeswitch.esl.transport.event.EslEvent; 21 | 22 | /** 23 | *

InboundEventListener interface.

24 | * 25 | * @author : everyone 26 | * @version 1.0.0 27 | */ 28 | public interface InboundEventListener { 29 | 30 | /** 31 | * Signal of a server initiated event. 32 | * 33 | * @param address address 34 | * @param event as an {@link EslEvent} 35 | */ 36 | void eventReceived(String address, EslEvent event); 37 | 38 | /** 39 | * Signal of an event containing the result of a client requested background job. The Job-UUID will 40 | * be available as an event header of that name. 41 | * 42 | * @param address address 43 | * @param event as an {@link EslEvent} 44 | */ 45 | void backgroundJobResultReceived(String address, EslEvent event); 46 | 47 | } 48 | -------------------------------------------------------------------------------- /freeswitch-xml-curl/src/main/java/com/atomscat/freeswitch/xml/parser/XmlCurlParser.java: -------------------------------------------------------------------------------- 1 | package com.atomscat.freeswitch.xml.parser; 2 | 3 | import com.alibaba.fastjson.JSONObject; 4 | import com.atomscat.freeswitch.xml.domain.XmlCurl; 5 | import jakarta.servlet.http.HttpServletRequest; 6 | import lombok.extern.slf4j.Slf4j; 7 | import java.util.Enumeration; 8 | import java.util.Map; 9 | import java.util.concurrent.ConcurrentHashMap; 10 | 11 | /** 12 | *

XmlCurlParser class.

13 | * 14 | * @author : everyone 15 | * @version $Id: $Id 16 | */ 17 | @Slf4j 18 | public class XmlCurlParser { 19 | 20 | 21 | private XmlCurlParser() { 22 | } 23 | 24 | /** 25 | * @param request a {@link HttpServletRequest} object. 26 | * @return a {@link XmlCurl} object. 27 | */ 28 | public static XmlCurl decodeThenParse(final HttpServletRequest request) { 29 | Map metadata = getAllRequestParam(request); 30 | XmlCurl xmlCurl = JSONObject.parseObject(JSONObject.toJSONString(metadata), XmlCurl.class); 31 | xmlCurl.setMetadata(metadata); 32 | return xmlCurl; 33 | } 34 | 35 | public static Map getAllRequestParam(final HttpServletRequest request) { 36 | Map res = new ConcurrentHashMap(); 37 | Enumeration temp = request.getParameterNames(); 38 | if (null != temp) { 39 | while (temp.hasMoreElements()) { 40 | String en = (String) temp.nextElement(); 41 | String value = request.getParameter(en); 42 | res.put(en, value); 43 | //如果字段的值为空,判断若值为空,则删除这个字段> 44 | if (null == res.get(en) || "".equals(res.get(en))) { 45 | res.remove(en); 46 | } 47 | } 48 | } 49 | return res; 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /freeswitch-esl/src/main/java/com/atomscat/freeswitch/esl/util/RemotingUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | 18 | package com.atomscat.freeswitch.esl.util; 19 | 20 | import java.net.InetSocketAddress; 21 | import java.net.SocketAddress; 22 | 23 | /** 24 | *

RemotingUtil class.

25 | * 26 | * @author : everyone 27 | * @version 1.0.0 28 | */ 29 | public class RemotingUtil { 30 | 31 | /** 32 | * private constructor 33 | */ 34 | private RemotingUtil() { 35 | } 36 | 37 | /** 38 | *

socketAddress2String.

39 | * 40 | * @param address a {@link java.net.SocketAddress} object. 41 | * @return a {@link java.lang.String} object. 42 | */ 43 | public static String socketAddress2String(final SocketAddress address) { 44 | InetSocketAddress inetSocketAddress = (InetSocketAddress) address; 45 | return inetSocketAddress.getAddress().getHostAddress() + 46 | ":" + 47 | inetSocketAddress.getPort(); 48 | } 49 | } 50 | --------------------------------------------------------------------------------