├── README.md ├── add_user ├── README.md └── defalut_test_numbers.md ├── bridge └── README.md ├── claster └── README.md ├── configuration ├── README.md ├── fs_cli.md ├── local_acl.md └── pic │ ├── SIP_UA.log │ ├── SIP_UA.png │ ├── Zopier1.jpg │ ├── Zopier2.jpg │ ├── linphone1.jpg │ ├── linphone2.jpg │ └── linphone3.jpg ├── confluence └── README.md ├── custom_media ├── README.md └── src │ ├── include │ ├── switch_core_media.h │ ├── switch_frame.h │ ├── switch_jitterbuffer.h │ └── switch_rtp.h │ ├── switch_buffer.c │ ├── switch_core_media.c │ ├── switch_jitterbuffer.c │ └── switch_rtp.c ├── diaplan └── README.md ├── fusionpbx └── README.md ├── im └── README.md ├── inbound └── README.md ├── init.sh ├── install ├── Firewall.md ├── README.md ├── freeswitch-v1.10.x-install-on-centos7.x.md ├── freeswitch-v1.10.x-install-on-debian.md ├── patch │ ├── libx264.c │ └── switch_rtp.c └── swap.sh ├── ipo └── README.md ├── ivr └── README.md ├── media_handling_modes └── README.md ├── mod ├── README.md └── src │ ├── .gitignore │ └── mod │ ├── .gitignore │ ├── Makefile.am │ ├── applications │ ├── .gitignore │ ├── mod_abstraction │ │ ├── Makefile.am │ │ ├── conf │ │ │ └── autoload_configs │ │ │ │ └── abstraction.conf.xml │ │ ├── mod_abstraction.2017.vcxproj │ │ └── mod_abstraction.c │ ├── mod_av │ │ ├── Makefile.am │ │ ├── autoload_configs │ │ │ └── av.conf.xml │ │ ├── avcodec.c │ │ ├── avformat.c │ │ ├── mod_av.2017.vcxproj │ │ ├── mod_av.c │ │ ├── mod_av.h │ │ └── test │ │ │ ├── cluecon.png │ │ │ ├── conf │ │ │ ├── av.conf.xml │ │ │ ├── freeswitch.xml │ │ │ └── old_av.conf.xml │ │ │ ├── test_avformat.c │ │ │ ├── test_mod_av.2017.vcxproj │ │ │ └── test_mod_av.c │ ├── mod_conference │ │ ├── .gitignore │ │ ├── Makefile.am │ │ ├── TODO │ │ ├── conf │ │ │ ├── autoload_configs │ │ │ │ └── conference.conf.xml │ │ │ └── dialplan │ │ │ │ └── conference_dialplan.xml │ │ ├── conference_al.c │ │ ├── conference_api.c │ │ ├── conference_cdr.c │ │ ├── conference_event.c │ │ ├── conference_file.c │ │ ├── conference_loop.c │ │ ├── conference_member.c │ │ ├── conference_record.c │ │ ├── conference_utils.c │ │ ├── conference_video.c │ │ ├── mod_conference.2017.vcxproj │ │ ├── mod_conference.c │ │ ├── mod_conference.h │ │ └── test │ │ │ ├── conf │ │ │ ├── font │ │ │ │ └── AEH.ttf │ │ │ └── freeswitch.xml │ │ │ ├── images │ │ │ └── signalwire.png │ │ │ ├── test_image.c │ │ │ └── test_member.c │ ├── mod_cv │ │ ├── Makefile.am │ │ ├── Makefile.hint │ │ ├── mod_cv.2017.vcxproj │ │ └── mod_cv.cpp │ ├── mod_mp4 │ │ ├── Makefile.am │ │ ├── exception.hpp │ │ ├── mod_mp4.cpp │ │ ├── mp4_helper.cpp │ │ └── mp4_helper.hpp │ ├── mod_mp4v2 │ │ ├── Makefile.am │ │ └── mod_mp4v2.c │ ├── mod_snapshot │ │ ├── .gitignore │ │ ├── Makefile.am │ │ └── mod_snapshot.c │ ├── mod_test │ │ ├── Makefile.am │ │ ├── mod_test.c │ │ └── test │ │ │ ├── freeswitch.xml │ │ │ ├── sounds │ │ │ ├── agent.wav │ │ │ ├── hi.wav │ │ │ ├── ivr-please_state_your_name_and_reason_for_calling.wav │ │ │ ├── test.wav │ │ │ └── test_agent.wav │ │ │ ├── test_asr.c │ │ │ └── test_tts.c │ └── mod_video_filter │ │ ├── Makefile.am │ │ └── mod_video_filter.c │ ├── codecs │ ├── mod_b64 │ │ ├── Makefile.am │ │ └── mod_b64.c │ ├── mod_h26x │ │ ├── Makefile.am │ │ ├── mod_h26x.2017.vcxproj │ │ └── mod_h26x.c │ ├── mod_openh264 │ │ ├── Makefile.am │ │ ├── mod_openh264.cpp │ │ └── test │ │ │ ├── conf │ │ │ └── freeswitch.xml │ │ │ ├── data │ │ │ ├── case1.packet1.264 │ │ │ ├── case1.packet2.264 │ │ │ ├── case1.packet3.264 │ │ │ ├── case1.packet4.264 │ │ │ ├── case1.packet5.264 │ │ │ ├── case2.packet1.264 │ │ │ ├── case2.packet2.264 │ │ │ ├── case2.packet3.264 │ │ │ └── case2.packet4.264 │ │ │ └── test_mod_openh264.cpp │ └── mod_yuv │ │ └── mod_yuv.c │ ├── dialplans │ ├── mod_dialplan_asterisk │ │ ├── Makefile.am │ │ ├── conf │ │ │ └── extensions.conf │ │ ├── mod_dialplan_asterisk.2017.vcxproj │ │ └── mod_dialplan_asterisk.c │ ├── mod_dialplan_directory │ │ ├── Makefile.am │ │ ├── mod_dialplan_directory.2017.vcxproj │ │ └── mod_dialplan_directory.c │ └── mod_dialplan_xml │ │ ├── Makefile.am │ │ ├── mod_dialplan_xml.2017.vcxproj │ │ └── mod_dialplan_xml.c │ ├── endpoints │ ├── mod_alsa │ │ ├── Makefile.am │ │ ├── conf │ │ │ └── autoload_configs │ │ │ │ └── alsa.conf.xml │ │ └── mod_alsa.c │ ├── mod_loopback │ │ ├── Makefile.am │ │ ├── mod_loopback.2017.vcxproj │ │ └── mod_loopback.c │ ├── mod_rtc │ │ ├── Makefile.am │ │ ├── mod_rtc.2017.vcxproj │ │ └── mod_rtc.c │ ├── mod_rtmp │ │ ├── Makefile.am │ │ ├── conf │ │ │ └── autoload_configs │ │ │ │ └── rtmp.conf.xml │ │ ├── handshake.h │ │ ├── libamf │ │ │ ├── CMakeLists.txt │ │ │ ├── amf-cmake.h.in │ │ │ ├── src │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── amf.h │ │ │ │ ├── amf0.b │ │ │ │ ├── amf0.c │ │ │ │ ├── amf0.h │ │ │ │ ├── amf3.h │ │ │ │ ├── amf_list.c │ │ │ │ ├── amf_list.h │ │ │ │ ├── hash.c │ │ │ │ ├── hash.h │ │ │ │ ├── io.c │ │ │ │ ├── io.h │ │ │ │ ├── ptrarray.c │ │ │ │ ├── ptrarray.h │ │ │ │ ├── types.c │ │ │ │ └── types.h │ │ │ └── tests │ │ │ │ ├── CMakeLists.txt │ │ │ │ ├── amf0 │ │ │ │ └── amf0_demo.c │ │ ├── mod_rtmp.2017.vcxproj │ │ ├── mod_rtmp.c │ │ ├── mod_rtmp.h │ │ ├── mod_rtmp_2010.vcxproj │ │ ├── rtmp.c │ │ ├── rtmp_sig.c │ │ ├── rtmp_tcp.c │ │ ├── rtmp_video.c │ │ └── rtmp_video.h │ ├── mod_sofia │ │ ├── .gitignore │ │ ├── Makefile.am │ │ ├── conf │ │ │ └── sofia.conf.xml │ │ ├── mod_sofia.2017.vcxproj │ │ ├── mod_sofia.c │ │ ├── mod_sofia.h │ │ ├── rtp.c │ │ ├── sip-dig.c │ │ ├── sofia.c │ │ ├── sofia_glue.c │ │ ├── sofia_json_api.c │ │ ├── sofia_media.c │ │ ├── sofia_presence.c │ │ ├── sofia_reg.c │ │ └── test │ │ │ └── test_sofia_funcs.c │ └── mod_verto │ │ ├── Makefile.am │ │ ├── mcast │ │ ├── .gitignore │ │ ├── MCAST.i │ │ ├── MCAST.pm │ │ ├── mcast.c │ │ ├── mcast.h │ │ ├── mcast_cpp.cpp │ │ ├── mcast_cpp.h │ │ ├── mcast_wrap.cpp │ │ ├── perlxsi.c │ │ ├── test.c │ │ ├── test.pl │ │ └── test2.pl │ │ ├── mod_verto.2017.vcxproj │ │ ├── mod_verto.c │ │ ├── mod_verto.h │ │ ├── ws.c │ │ └── ws.h │ └── sdk │ └── autotools │ ├── .gitignore │ ├── Makefile.am │ ├── autogen.sh │ ├── configure.ac │ ├── m4 │ └── ax_compiler_vendor.m4 │ └── src │ ├── Makefile.am │ └── mod_example.c ├── outbound └── README.md ├── rtsp ├── README.md └── rtsp.c ├── sbc └── README.md ├── sip_trunk └── README.md ├── webrtc ├── README.md ├── The-solution-of-problem.md ├── conf │ ├── coturn_conf │ │ └── turnserver.conf │ ├── freeswitch_certs │ │ ├── agent.pem │ │ ├── cafile.pem │ │ ├── dtls-srtp.crt │ │ ├── dtls-srtp.pem │ │ └── wss.pem │ ├── freeswitch_conf │ │ ├── event_socket.conf.xml │ │ ├── external.xml │ │ ├── internal.xml │ │ ├── switch.conf.xml │ │ ├── vars.xml │ │ └── verto.conf.xml │ └── nginx_conf │ │ ├── SSL_CA.pem │ │ ├── SSL_Priv.pem │ │ ├── SSL_Pub.pem │ │ └── nginx.conf ├── nginx │ └── nginx.md ├── pic │ ├── 2.jpg │ ├── 3.png │ ├── 4.png │ ├── 51.jpg │ ├── 52.jpg │ ├── 53.jpg │ ├── 54.jpg │ ├── web-sip2.PNG │ └── web-sip3.PNG ├── ssl │ ├── Installation SSL certificates and Coturn for OpenMeetings 5.0.0-M4 on CentOS 7-8.pdf │ ├── freeswitch_Certificates.md │ ├── how_to_make_your_own_ca_correctly.txt │ ├── self-signed-certs.sh │ └── ssl.ca.md └── stun_turn │ ├── coturn │ ├── coturn.command │ ├── coturn.help │ ├── coturn.log │ ├── coturn.zhoudd │ └── stunman └── webrtc2sip ├── WEBRTC-to-SIP └── README.md ├── doubango-webrtc2sip └── README.md └── technical-guide-1.0.pdf /README.md: -------------------------------------------------------------------------------- 1 | # FreeSWITCH2 2 | FreeSWITCH细节繁多,这里更多的关注多媒体方向的应用和定制. 3 | 4 | ## 1. FreeSWITCH常规应用 5 | 1. IM即时通讯系统. 6 | 2. SIP电话系统. 7 | 3. SIP会议系统(语音会议和视频会议),以及常用webrtc, pjsip, linphone客户端的接入. 8 | 9 | ## 2. FreeSWITCH定制以及二次开发 10 | 1. FreeSWITCH内置的sip通信模块定制. 11 | 2. FreeSWITCH内置rtp媒体通道的定制. 12 | 3. FreeSWITCH外置bypass模式媒体的定制. 13 | 4. FreeSWITCH内置Proxy模式媒体的定制. 14 | 5. FreeSWITCH音视频AI定制. 15 | 16 | ## 3. FreeSWITCH应用场景拓展 17 | FreeSWITCH的应用模型大抵遵循 接入 ---> 媒体处理 ---> 输出 18 | 除了常规的IM即时通讯, 电话系统,会议系统,FreeSWITCH经过一些定制, 可以方便的用于安防监控, 在线教育, 线上办公, 远程医疗等场景. 19 | 20 | ## 4. FreeSWITCH各模块的定制 21 | ... 22 | ... 23 | ... 24 | 坑位先留着,有时间有力气就来补一点. 25 | 26 | ## 5. 感谢 27 | https://freeswitch.com/ 28 | 百问Freeswitch第三版.pdf 29 | FreeSWITCH Cookbook 30 | FreeSWITCH权威指南.pdf 31 | FreeSwitch简要使用教程.pdf 32 | FreeSWITCH: VoIP实战.pdf 33 | http://freeswitch.net.cn/73.html 34 | www.fusionpbx.com 35 | 36 | -------------------------------------------------------------------------------- /add_user/README.md: -------------------------------------------------------------------------------- 1 | ### add user 2 | 3 | scripts/perl/add_user 1020 4 | 5 | scripts/perl/add_user --users=1020-1029 6 | 7 | vi conf/dialplan/default.xml 8 | ``` 9 | 10 | 12 | ``` 13 | 14 | ``` 15 | 17 | ``` 18 | 19 | ``` 20 | By default, Local_Extension has a regular expression that will match 1000, 1001, and so on up to 1019. After adding that number range, it is necessary to modify the regular expression to account for those new numbers. In our example, we added user IDs 1020 through 1029, so we need to match these. We use this regular expression: 21 | 22 | ^(10[012][0-9])$ 23 | 24 | This matches 1000 through 1029. Let's say we have added another block of user IDs with the range from 1030 to 1039. We can modify our regular expression to catch them as well: 25 | 26 | ^(10[0123][0-9])$ or ^(10[0-3][0-9])$ 27 | ``` 28 | 29 | 30 | -------------------------------------------------------------------------------- /add_user/defalut_test_numbers.md: -------------------------------------------------------------------------------- 1 | ``` 2 | FreeSWITCH默认号码 3 | 4 | 默认号码及说明 5 | 号码 说明 6 | 9664 保持音乐 7 | 9191 注册ClueCon 8 | 9192 在log中显示Channel 9 | 9195 echo,回音测试,延迟5秒 10 | 9196 echo,回音测试 11 | 9197 milliwatte extension, 铃音生成 12 | 9198 TGML 铃音生成实例 13 | 9180 铃音测试,使用远端生成的回铃音 14 | 9181 铃音测试,产生英式铃音 15 | 9182 铃音测试。使用音乐当铃音,彩铃 16 | 9183 先应答,然后发送英式彩铃 17 | 9184 先应答,然后发送音乐彩铃 18 | 9178 发传真 19 | 9179 收传真 20 | 5000 实例IVR 21 | 4000 听取语音信箱 22 | 33xx 电话会议,48kHz(其中xx可为00~99,下同) 23 | 32xx 电话会议,32kHz 24 | 31xx 电话会议,16kHz 25 | 30xx 电话会议,8kHz 26 | 35xx 视频会议 27 | 2000-2002 呼叫组 28 | 1000-1019 默认分机号(密码默认为1234) 29 | ``` 30 | -------------------------------------------------------------------------------- /bridge/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tppi/freeswitch2/f790d22a468ee21f9f3b499c95e53123519afa8e/bridge/README.md -------------------------------------------------------------------------------- /claster/README.md: -------------------------------------------------------------------------------- 1 | ## FreeSWITCH集群方式有若干种 2 | 3 | > sip trunk gateway 4 | > sip register 5 | > sip alc 6 | 7 | ### 1. SIP中继对接 8 | https://blog.51cto.com/908405/1945574 9 | 10 | 11 | ### 2. 百问 FreeSwitch(第三版) 12 | 第 82 页 13 | 第 99 页 14 | 第 112 页 15 | -------------------------------------------------------------------------------- /configuration/fs_cli.md: -------------------------------------------------------------------------------- 1 | ### 运维命令 2 | ``` 3 | 在freeswitch/bin下使用fs_cil客户端。启动后在“freeswitch@internal>”控制器下进行操作,基本命令如下。 4 | reloadxml 修改完xml后加载使用 5 | sofia profile external rescan reloadxml 配置网关生效 6 | sofia status 显示当前sofia状态 7 | status 显示当前状态 8 | sofia status profile internal reg 显示当前注册上来的用户信息 9 | /quit 退出 10 | ``` 11 | http://www.simonzhang.net/?p=2239 12 | 13 | 14 | ### FreeSwitch常用命令 15 | ``` 16 | 1.进入FS_cli: 17 | /usr/local/freeswitch/bin/fs_cli -H 127.0.0.1 -P 8021 -p password 18 | 2.停止FreeSwitch: 19 | /usr/local/freeswitch/bin/freeswitch -stop 20 | 3.FS关闭日志: 21 | console loglevel 0 22 | sofia loglevel all 0 23 | 4.拨打分机命令: 24 | originate sofia/local/1001%127.0.0.1 &echo 25 | 5.查询网关状态: 26 | sofia status profile local 27 | 6.查询网关分机注册状态: 28 | sofia status profile local reg 29 | 7.重启网关: 30 | sofia profile local restart 31 | 8.服务器时间同步: 32 | fsctl sync_clock 33 | fsctl sync_clock_when_idle 34 | 9.重启acl: 35 | reloadacl 36 | 10.开启/关闭SIP消息跟踪: 37 | sofia profile internal siptrace on 38 | sofia profile internal siptrace off 39 | ``` 40 | https://blog.csdn.net/nioqnw/article/details/84956819 41 | -------------------------------------------------------------------------------- /configuration/local_acl.md: -------------------------------------------------------------------------------- 1 | ### acl 2 | ``` 3 | 局域网支持 4 | 5 | 1) 6 | conf/autoload_configs/acl.conf.xml 中,加入下面配置: 7 | 8 | 9 | 10 | 11 | 2) 12 | 然后,conf/sip_profiles/internal.xml 中加入下列配置: 13 | 14 | 15 | ``` 16 | 17 | https://blog.csdn.net/foruok/article/details/74287842 18 | -------------------------------------------------------------------------------- /configuration/pic/SIP_UA.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tppi/freeswitch2/f790d22a468ee21f9f3b499c95e53123519afa8e/configuration/pic/SIP_UA.png -------------------------------------------------------------------------------- /configuration/pic/Zopier1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tppi/freeswitch2/f790d22a468ee21f9f3b499c95e53123519afa8e/configuration/pic/Zopier1.jpg -------------------------------------------------------------------------------- /configuration/pic/Zopier2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tppi/freeswitch2/f790d22a468ee21f9f3b499c95e53123519afa8e/configuration/pic/Zopier2.jpg -------------------------------------------------------------------------------- /configuration/pic/linphone1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tppi/freeswitch2/f790d22a468ee21f9f3b499c95e53123519afa8e/configuration/pic/linphone1.jpg -------------------------------------------------------------------------------- /configuration/pic/linphone2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tppi/freeswitch2/f790d22a468ee21f9f3b499c95e53123519afa8e/configuration/pic/linphone2.jpg -------------------------------------------------------------------------------- /configuration/pic/linphone3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tppi/freeswitch2/f790d22a468ee21f9f3b499c95e53123519afa8e/configuration/pic/linphone3.jpg -------------------------------------------------------------------------------- /confluence/README.md: -------------------------------------------------------------------------------- 1 | ### FreeSWITCH Explained 2 | 3 | https://freeswitch.org/confluence/display/FREESWITCH/FreeSWITCH+Explained 4 | 5 | ### FreeSWITCH has 3 media handling modes 6 | 7 | https://freeswitch.org/confluence/display/FREESWITCH/Proxy+Media 8 | 9 | ### NAT Traversal 10 | 11 | https://freeswitch.org/confluence/display/FREESWITCH/NAT+Traversal 12 | 13 | ### Bypass Media Overview 14 | 15 | https://freeswitch.org/confluence/display/FREESWITCH/Bypass+Media+Overview 16 | 17 | ### Proxy Media 18 | 19 | https://freeswitch.org/confluence/display/FREESWITCH/Proxy+Media 20 | -------------------------------------------------------------------------------- /custom_media/README.md: -------------------------------------------------------------------------------- 1 | ### FreeSwitch_Custom_Media 2 | 3 | 4 | -------------------------------------------------------------------------------- /custom_media/src/include/switch_frame.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application 3 | * Copyright (C) 2005-2014, Anthony Minessale II 4 | * 5 | * Version: MPL 1.1 6 | * 7 | * The contents of this file are subject to the Mozilla Public License Version 8 | * 1.1 (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * http://www.mozilla.org/MPL/ 11 | * 12 | * Software distributed under the License is distributed on an "AS IS" basis, 13 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 14 | * for the specific language governing rights and limitations under the 15 | * License. 16 | * 17 | * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application 18 | * 19 | * The Initial Developer of the Original Code is 20 | * Anthony Minessale II 21 | * Portions created by the Initial Developer are Copyright (C) 22 | * the Initial Developer. All Rights Reserved. 23 | * 24 | * Contributor(s): 25 | * 26 | * Anthony Minessale II 27 | * 28 | * 29 | * switch_frame.h -- Media Frame Structure 30 | * 31 | */ 32 | /*! \file switch_frame.h 33 | \brief Media Frame Structure 34 | */ 35 | 36 | #ifndef SWITCH_FRAME_H 37 | #define SWITCH_FRAME_H 38 | 39 | #include 40 | 41 | SWITCH_BEGIN_EXTERN_C 42 | 43 | typedef struct switch_frame_geometry { 44 | int32_t w; 45 | int32_t h; 46 | int32_t x; 47 | int32_t y; 48 | int32_t z; 49 | int32_t M; 50 | int32_t X; 51 | } switch_frame_geometry_t; 52 | 53 | /*! \brief An abstraction of a data frame */ 54 | struct switch_frame { 55 | /*! a pointer to the codec information */ 56 | switch_codec_t *codec; 57 | /*! the originating source of the frame */ 58 | const char *source; 59 | /*! the raw packet */ 60 | void *packet; 61 | /*! the size of the raw packet when applicable */ 62 | uint32_t packetlen; 63 | /*! the extra frame data */ 64 | void *extra_data; 65 | /*! the frame data */ 66 | void *data; 67 | /*! the size of the buffer that is in use */ 68 | uint32_t datalen; 69 | /*! the entire size of the buffer */ 70 | uint32_t buflen; 71 | /*! the number of audio samples present (audio only) */ 72 | uint32_t samples; 73 | /*! the rate of the frame */ 74 | uint32_t rate; 75 | /*! the number of channels in the frame */ 76 | uint32_t channels; 77 | /*! the payload of the frame */ 78 | switch_payload_t payload; 79 | /*! the timestamp of the frame */ 80 | uint32_t timestamp; 81 | uint16_t seq; 82 | uint32_t ssrc; 83 | switch_bool_t m; 84 | /*! frame flags */ 85 | switch_frame_flag_t flags; 86 | void *user_data; 87 | payload_map_t *pmap; 88 | switch_image_t *img; 89 | struct switch_frame_geometry geometry; 90 | }; 91 | 92 | SWITCH_END_EXTERN_C 93 | #endif 94 | /* For Emacs: 95 | * Local Variables: 96 | * mode:c 97 | * indent-tabs-mode:t 98 | * tab-width:4 99 | * c-basic-offset:4 100 | * End: 101 | * For VIM: 102 | * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet: 103 | */ 104 | -------------------------------------------------------------------------------- /custom_media/src/include/switch_jitterbuffer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application 3 | * Copyright (C) 2005-2014, Anthony Minessale II 4 | * 5 | * Version: MPL 1.1 6 | * 7 | * The contents of this file are subject to the Mozilla Public License Version 8 | * 1.1 (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * http://www.mozilla.org/MPL/ 11 | * 12 | * Software distributed under the License is distributed on an "AS IS" basis, 13 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 14 | * for the specific language governing rights and limitations under the 15 | * License. 16 | * 17 | * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application 18 | * 19 | * The Initial Developer of the Original Code is 20 | * Anthony Minessale II 21 | * Portions created by the Initial Developer are Copyright (C) 22 | * the Initial Developer. All Rights Reserved. 23 | * 24 | * Contributor(s): 25 | * 26 | * Anthony Minessale II 27 | * 28 | * switch_jitterbuffer.h -- Audio/Video Jitter Buffer 29 | * 30 | */ 31 | 32 | 33 | #ifndef SWITCH_VIDDERBUFFER_H 34 | #define SWITCH_VIDDERBUFFER_H 35 | 36 | typedef enum { 37 | SJB_QUEUE_ONLY = (1 << 0) 38 | } switch_jb_flag_t; 39 | 40 | typedef enum { 41 | SJB_VIDEO = 0, 42 | SJB_AUDIO, 43 | SJB_TEXT 44 | } switch_jb_type_t; 45 | 46 | 47 | SWITCH_BEGIN_EXTERN_C 48 | SWITCH_DECLARE(switch_status_t) switch_jb_create(switch_jb_t **jbp, switch_jb_type_t type, 49 | uint32_t min_frame_len, uint32_t max_frame_len, switch_memory_pool_t *pool); 50 | SWITCH_DECLARE(switch_status_t) switch_jb_set_frames(switch_jb_t *jb, uint32_t min_frame_len, uint32_t max_frame_len); 51 | SWITCH_DECLARE(switch_status_t) switch_jb_peek_frame(switch_jb_t *jb, uint32_t ts, uint16_t seq, int peek, switch_frame_t *frame); 52 | SWITCH_DECLARE(switch_status_t) switch_jb_get_frames(switch_jb_t *jb, uint32_t *min_frame_len, uint32_t *max_frame_len, uint32_t *cur_frame_len, uint32_t *highest_frame_len); 53 | SWITCH_DECLARE(switch_status_t) switch_jb_destroy(switch_jb_t **jbp); 54 | SWITCH_DECLARE(void) switch_jb_reset(switch_jb_t *jb); 55 | SWITCH_DECLARE(void) switch_jb_debug_level(switch_jb_t *jb, uint8_t level); 56 | SWITCH_DECLARE(int) switch_jb_frame_count(switch_jb_t *jb); 57 | SWITCH_DECLARE(int) switch_jb_poll(switch_jb_t *jb); 58 | SWITCH_DECLARE(switch_status_t) switch_jb_put_packet(switch_jb_t *jb, switch_rtp_packet_t *packet, switch_size_t len); 59 | SWITCH_DECLARE(switch_size_t) switch_jb_get_last_read_len(switch_jb_t *jb); 60 | SWITCH_DECLARE(switch_status_t) switch_jb_get_packet(switch_jb_t *jb, switch_rtp_packet_t *packet, switch_size_t *len); 61 | SWITCH_DECLARE(uint32_t) switch_jb_pop_nack(switch_jb_t *jb); 62 | SWITCH_DECLARE(switch_status_t) switch_jb_get_packet_by_seq(switch_jb_t *jb, uint16_t seq, switch_rtp_packet_t *packet, switch_size_t *len); 63 | SWITCH_DECLARE(void) switch_jb_set_session(switch_jb_t *jb, switch_core_session_t *session); 64 | SWITCH_DECLARE(void) switch_jb_ts_mode(switch_jb_t *jb, uint32_t samples_per_frame, uint32_t samples_per_second); 65 | SWITCH_DECLARE(void) switch_jb_set_flag(switch_jb_t *jb, switch_jb_flag_t flag); 66 | SWITCH_DECLARE(void) switch_jb_clear_flag(switch_jb_t *jb, switch_jb_flag_t flag); 67 | 68 | SWITCH_END_EXTERN_C 69 | #endif 70 | 71 | /* For Emacs: 72 | * Local Variables: 73 | * mode:c 74 | * indent-tabs-mode:t 75 | * tab-width:4 76 | * c-basic-offset:4 77 | * End: 78 | * For VIM: 79 | * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet: 80 | */ 81 | -------------------------------------------------------------------------------- /diaplan/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tppi/freeswitch2/f790d22a468ee21f9f3b499c95e53123519afa8e/diaplan/README.md -------------------------------------------------------------------------------- /fusionpbx/README.md: -------------------------------------------------------------------------------- 1 | https://www.fusionpbx.com/download 2 | -------------------------------------------------------------------------------- /im/README.md: -------------------------------------------------------------------------------- 1 | ### 百问 FreeSwitch(第三版) 2 | 第 171 页 3 | 4 | -------------------------------------------------------------------------------- /inbound/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tppi/freeswitch2/f790d22a468ee21f9f3b499c95e53123519afa8e/inbound/README.md -------------------------------------------------------------------------------- /init.sh: -------------------------------------------------------------------------------- 1 | git checkout --orphan latest_branch 2 | 3 | git add -A 4 | 5 | #git commit -m "中秋 ✌ " 6 | 7 | git commit -m "commit init" 8 | 9 | git branch -D master 10 | 11 | git branch -m master 12 | 13 | git push -f origin master 14 | 15 | git branch --set-upstream-to=origin/master master 16 | -------------------------------------------------------------------------------- /install/Firewall.md: -------------------------------------------------------------------------------- 1 | centos 2 | [root@freeswitch ~]# systemctl stop firewalld.service 3 | [root@freeswitch ~]# systemctl disable firewalld 4 | [root@freeswitch ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/sysconfig/selinux 5 | 6 | 7 | debian 8 | [root@debian9]:apt-get install ufw 9 | [root@debian9]:ufw status 10 | Status: inactive 11 | [root@debian9]:/usr/src/freeswitch# ufw disable 12 | Firewall stopped and disabled on system startup 13 | -------------------------------------------------------------------------------- /install/README.md: -------------------------------------------------------------------------------- 1 | 1) Quickly install 2 | ``` 3 | yum install -y http://files.freeswitch.org/freeswitch-release-1-6.noarch.rpm epel-release 4 | yum install -y freeswitch-config-vanilla freeswitch-lang-* freeswitch-sounds-* 5 | systemctl enable freeswitch 6 | freeswitch 7 | ``` 8 | 9 | 2) Source install 10 | ``` 11 | #freeswitch_v1.6_install_centos7.6.sh 12 | 13 | yum install -y http://files.freeswitch.org/freeswitch-release-1-6.noarch.rpm epel-release 14 | 15 | yum install -y git alsa-lib-devel autoconf automake bison broadvoice-devel bzip2 curl-devel db-devel e2fsprogs-devel flite-devel g722_1-devel gcc-c++ gdbm-devel gnutls-devel ilbc2-devel ldns-devel libcodec2-devel libcurl-devel libedit-devel libidn-devel libjpeg-devel libmemcached-devel libogg-devel libsilk-devel libsndfile-devel libtheora-devel libtiff-devel libtool libuuid-devel libvorbis-devel libxml2-devel lua-devel lzo-devel mongo-c-driver-devel ncurses-devel net-snmp-devel openssl-devel opus-devel pcre-devel perl perl-ExtUtils-Embed pkgconfig portaudio-devel postgresql-devel python26-devel python-devel soundtouch-devel speex-devel sqlite-devel unbound-devel unixODBC-devel wget which yasm zlib-devel 16 | 17 | # 18 | cd /usr/local/src 19 | #git clone -b v1.6 https://github.com/signalwire/freeswitch.git freeswitch 20 | git clone -b v1.6 https://gitee.com/dong2/freeswitch.git freeswitch 21 | cd /usr/local/src/freeswitch 22 | ./bootstrap.sh -j 23 | ./configure 24 | make -j 25 | make -j install 26 | 27 | # 28 | #make -j cd-sounds-install 29 | #make -j cd-moh-install 30 | 31 | # 32 | ln -sf /usr/local/freeswitch/bin/freeswitch /usr/bin/ 33 | ln -sf /usr/local/freeswitch/bin/fs_cli /usr/bin/ 34 | 35 | # 36 | #freeswitch 37 | #freeswitch -nc 38 | #freeswitch -nonat -nonatmap 39 | #freeswitch -nonat -nonatmap -nosql 40 | 41 | # 42 | #netstat -anp|grep 5060 43 | 44 | # 45 | #fs_cli 46 | #fsctl_shutdown 47 | ``` 48 | 49 | 3) https://freeswitch.org/confluence/display/FREESWITCH/CentOS+7+and+RHEL+7 50 | 51 | 4) 还是在debian上安装freeswitch更方便,默认就支持视频了, freeswitch-v1.10.x支持了webrtc 52 | https://freeswitch.org/confluence/display/FREESWITCH/Debian+9+Stretch 53 | 54 | 55 | -------------------------------------------------------------------------------- /install/freeswitch-v1.10.x-install-on-centos7.x.md: -------------------------------------------------------------------------------- 1 | 1. 安装依赖库 2 | ``` 3 | yum install vim git wget lrzsz 4 | yum install autoconf automake libtool openssl* libtiff* libjpeg* 5 | 6 | cd /usr/local/src 7 | git clone https://gitee.com/dong2/sofia-sip 8 | cd sofia-sip 9 | ./bootstrap.sh 10 | ./configure 11 | make 12 | make install 13 | 14 | git clone https://gitee.com/dong2/spandsp 15 | cd spandsp 16 | ./bootstrap.sh 17 | ./configure 18 | make 19 | make install 20 | 21 | export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig 22 | 23 | yum install -y https://files.freeswitch.org/repo/yum/centos-release/freeswitch-release-repo-0-1.noarch.rpm epel-release 24 | yum install yum-utils 25 | yum-builddep -y freeswitch --skip-broken 26 | yum install -y yum-plugin-ovl centos-release-scl rpmdevtools 27 | 28 | # 此时如果不需要视频模块直接跳到第4步安装freeswitch即可 29 | # 或者参考官网https://freeswitch.org/confluence/display/FREESWITCH/CentOS+7+and+RHEL+7 30 | ``` 31 | 32 | 2. 补上mod_av模块 33 | ``` 34 | wget https://www.nasm.us/pub/nasm/releasebuilds/2.14.02/nasm-2.14.02.tar.xz 35 | tar xf nasm-2.14.02.tar.xz 36 | cd nasm-2.14.02 37 | ./configure 38 | make 39 | make install 40 | 41 | git clone https://gitee.com/dong2/x264.git 42 | # the output directory may be difference depending on the version and date 43 | cd x264 44 | ./configure --enable-shared --enable-pic 45 | make 46 | make install 47 | 48 | git clone https://gitee.com/dong2/libpng.git 49 | cd libpng 50 | ./configure 51 | make 52 | make install 53 | cp /usr/local/lib/pkgconfig/libpng* /usr/lib64/pkgconfig/ 54 | 55 | wget https://libav.org/releases/libav-12.3.tar.xz 56 | tar xf libav-12.3.tar.xz 57 | cd libav-12.3 58 | # 进入 libav 源码目录下, 将 libavcodec/libx264.c 文件里面的 "x264_bit_depth" 全部替换为 "X264_BIT_DEPTH",否则编译会报错。 59 | # scp patch/libx264.c root@8.134.56.226:/usr/local/src/libav-12.3/libavcodec/ 60 | ./configure --enable-shared --enable-libx264 --enable-gpl 61 | make 62 | make install 63 | ln -sf /usr/local/lib/pkgconfig/libavcodec.pc /usr/lib64/pkgconfig/libavcodec.pc 64 | ln -sf /usr/local/lib/pkgconfig/libavdevice.pc /usr/lib64/pkgconfig/libavdevice.pc 65 | ln -sf /usr/local/lib/pkgconfig/libavfilter.pc /usr/lib64/pkgconfig/libavfilter.pc 66 | ln -sf /usr/local/lib/pkgconfig/libavformat.pc /usr/lib64/pkgconfig/libavformat.pc 67 | ln -sf /usr/local/lib/pkgconfig/libavresample.pc /usr/lib64/pkgconfig/libavresample.pc 68 | ln -sf /usr/local/lib/pkgconfig/libavutil.pc /usr/lib64/pkgconfig/libavutil.pc 69 | ln -sf /usr/local/lib/pkgconfig/libswscale.pc /usr/lib64/pkgconfig/libswscale.pc 70 | 71 | ldconfig 72 | ``` 73 | 74 | 3. 补上mod_signalwire,大多数情况不需要mod_signalwire. 75 | ``` 76 | yum install libatomic -y 77 | 78 | wget http://www.cmake.org/files/v3.15/cmake-3.15.2.tar.gz 79 | tar xf cmake-3.15.2.tar.gz 80 | cd cmake-3.15.2 81 | ./bootstrap 82 | gmake 83 | make install 84 | 85 | git clone https://github.com/signalwire/libks.git 86 | cd libks 87 | cmake . 88 | make 89 | make install 90 | 91 | git clone https://github.com/signalwire/signalwire-c.git 92 | cd signalwire-c 93 | cmake . 94 | make 95 | make install 96 | ``` 97 | 98 | 4. 最后安装freeswitch 99 | ``` 100 | git clone -b v1.10.5 https://gitee.com/dong2/freeswitch.git freeswitch 101 | cd freeswitch 102 | # freeswitch v1.10.5 默认配置就可以支持语音会议,视频会议,但是fs对与sip终端的处理需要调整 103 | # scp patch/switch_rtp.c root@8.134.56.226:/usr/local/src/freeswitch/src 104 | ./bootstrap.sh -j 105 | # 屏蔽 signalwire 106 | # vi modules.conf 107 | export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig 108 | ./configure 109 | make 110 | make -j install 111 | 112 | # 手动上传音频文件,节约时间 113 | scp freeswitch-sounds-* root@8.134.56.226:/usr/local/src/freeswitch 114 | 115 | make -j cd-sounds-install 116 | make -j cd-moh-install 117 | 118 | ln -sf /usr/local/freeswitch/bin/freeswitch /usr/bin/ 119 | ln -sf /usr/local/freeswitch/bin/fs_cli /usr/bin/ 120 | ``` 121 | 122 | -------------------------------------------------------------------------------- /install/freeswitch-v1.10.x-install-on-debian.md: -------------------------------------------------------------------------------- 1 | 还是在debian上安装freeswitch更方便,默认就支持视频了, freeswitch-v1.10.x支持了webrtc 2 | 3 | Release source build 4 | https://freeswitch.org/confluence/display/FREESWITCH/Debian+9+Stretch 5 | -------------------------------------------------------------------------------- /install/swap.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | dd if=/dev/zero of=/swapfile bs=1k count=1024000 4 | mkswap /swapfile 5 | swapon /swapfile 6 | 7 | echo "/swapfile swap swap defaults 0 0" >> /etc/fstab 8 | 9 | sysctl vm.swappiness=100 10 | -------------------------------------------------------------------------------- /ipo/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tppi/freeswitch2/f790d22a468ee21f9f3b499c95e53123519afa8e/ipo/README.md -------------------------------------------------------------------------------- /ivr/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tppi/freeswitch2/f790d22a468ee21f9f3b499c95e53123519afa8e/ivr/README.md -------------------------------------------------------------------------------- /media_handling_modes/README.md: -------------------------------------------------------------------------------- 1 | ### FreeSWITCH has 3 media handling modes 2 | 3 | https://freeswitch.org/confluence/display/FREESWITCH/Proxy+Media 4 | 5 | https://freeswitch.org/confluence/display/FREESWITCH/Bypass+Media+Overview 6 | 7 | -------------------------------------------------------------------------------- /mod/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tppi/freeswitch2/f790d22a468ee21f9f3b499c95e53123519afa8e/mod/README.md -------------------------------------------------------------------------------- /mod/src/.gitignore: -------------------------------------------------------------------------------- 1 | /Makefile 2 | /Makefile.in 3 | /include/stamp-h1 4 | /include/switch_am_config.h 5 | /include/switch_private.h 6 | /include/switch_private.h.in 7 | /include/switch_swigable_cpp.h 8 | /include/switch_version.h 9 | /include/switch_version.h.in 10 | -------------------------------------------------------------------------------- /mod/src/mod/.gitignore: -------------------------------------------------------------------------------- 1 | /Makefile 2 | /Makefile.in 3 | /applications/mod_blacklist/Makefile 4 | /applications/mod_commands/Makefile 5 | /applications/mod_conference/Makefile 6 | /applications/mod_db/Makefile 7 | /applications/mod_dptools/Makefile 8 | /applications/mod_enum/mod_enum.log 9 | /applications/mod_expr/Makefile 10 | /applications/mod_expr/Makefile.in 11 | /applications/mod_expr/mod_expr.log 12 | /applications/mod_fax/Makefile 13 | /applications/mod_fax/Makefile.in 14 | /applications/mod_fax/mod_fax.log 15 | /applications/mod_fifo/Makefile 16 | /applications/mod_fsv/Makefile 17 | /applications/mod_httapi/Makefile 18 | /applications/mod_limit/Makefile 19 | /applications/mod_random/Makefile 20 | /applications/mod_sms/Makefile 21 | /applications/mod_spandsp/Makefile 22 | /applications/mod_spandsp/Makefile.in 23 | /applications/mod_spandsp/mod_spandsp.log 24 | /applications/mod_stress/Makefile 25 | /applications/mod_stress/Makefile.in 26 | /applications/mod_stress/mod_stress.log 27 | /applications/mod_translate/Makefile 28 | /applications/mod_valet_parking/Makefile 29 | /applications/mod_voicemail/Makefile 30 | /asr_tts/mod_unimrcp/Makefile 31 | /asr_tts/mod_unimrcp/Makefile.in 32 | /asr_tts/mod_unimrcp/mod_unimrcp.log 33 | /asr_tts/mod_flite/*/*/mod_flite_manifest.rc 34 | /codecs/mod_b64/Makefile 35 | /codecs/mod_skel_codec/Makefile 36 | /codecs/mod_vp8/Makefile 37 | /dialplans/mod_dialplan_asterisk/Makefile 38 | /dialplans/mod_dialplan_xml/Makefile 39 | /endpoints/mod_portaudio/Makefile 40 | /endpoints/mod_portaudio/Makefile.in 41 | /endpoints/mod_portaudio/mod_portaudio.log 42 | /endpoints/mod_skinny/Makefile 43 | /endpoints/mod_skinny/Makefile.in 44 | /endpoints/mod_skinny/mod_skinny.log 45 | /endpoints/mod_skypopen/Makefile 46 | /endpoints/mod_skypopen/Makefile.in 47 | /endpoints/mod_skypopen/mod_skypopen.log 48 | /endpoints/mod_sofia/Makefile 49 | /endpoints/mod_sofia/Makefile.in 50 | /endpoints/mod_sofia/mod_sofia.log 51 | /event_handlers/mod_erlang_event/Makefile 52 | /event_handlers/mod_event_socket/Makefile 53 | /formats/mod_native_file/Makefile 54 | /formats/mod_portaudio_stream/Makefile 55 | /formats/mod_portaudio_stream/Makefile.in 56 | /formats/mod_portaudio_stream/mod_portaudio_stream.log 57 | /formats/mod_tone_stream/Makefile 58 | /languages/mod_java/Makefile 59 | /languages/mod_java/classes/ 60 | /languages/mod_java/freeswitch.jar 61 | /languages/mod_lua/Makefile 62 | /languages/mod_lua/Makefile.in 63 | /languages/mod_lua/mod_lua.log 64 | /languages/mod_managed/freeswitch_wrap.cpp 65 | /languages/mod_python/Makefile 66 | /loggers/mod_console/Makefile 67 | /loggers/mod_logfile/Makefile 68 | /loggers/mod_syslog/Makefile 69 | /say/mod_say_en/Makefile 70 | /say/mod_say_fa/Makefile 71 | /say/mod_say_ja/Makefile 72 | /say/mod_say_ru/Makefile 73 | /timers/mod_posix_timer/Makefile 74 | /timers/mod_timerfd/Makefile 75 | /endpoints/mod_unicall/Makefile 76 | */*/Makefile.in 77 | */*/Makefile 78 | */*/mod_*.log 79 | codecs/mod_amr/Win32/ 80 | codecs/mod_g723_1/Win32/ 81 | codecs/mod_g729/Win32/ 82 | directories/mod_ldap/Win32/ 83 | languages/mod_managed/Win32/ 84 | /applications/mod_av/test/Makefile 85 | /applications/mod_av/test/Makefile.in 86 | /event_handlers/mod_rayo/test/Makefile 87 | /event_handlers/mod_rayo/test/Makefile.in 88 | /applications/mod_av/test/test_avformat 89 | /applications/mod_av/test/test_mod_av 90 | /languages/mod_lua/test/Makefile 91 | /languages/mod_lua/test/Makefile.in 92 | /languages/mod_lua/test/test_mod_lua 93 | 94 | -------------------------------------------------------------------------------- /mod/src/mod/Makefile.am: -------------------------------------------------------------------------------- 1 | -include modules.inc 2 | 3 | all: $(OUR_MODULES) 4 | clean: $(OUR_CLEAN_MODULES) $(OUR_DISABLED_CLEAN_MODULES) 5 | install: $(OUR_INSTALL_MODULES) 6 | uninstall: $(OUR_UNINSTALL_MODULES) $(OUR_DISABLED_UNINSTALL_MODULES) 7 | print_tests: $(OUR_TEST_MODULES) 8 | check: $(OUR_CHECK_MODULES) 9 | 10 | mod_skypopen-all: mod_gsmopen-all 11 | mod_gsmopen-all: mod_spandsp-all 12 | mod_unimrcp-all: mod_sofia-all 13 | mod_rayo-all: mod_dingaling-all 14 | mod_ssml-all: mod_rayo-all 15 | 16 | $(OUR_MODULES) $(OUR_CLEAN_MODULES) $(OUR_INSTALL_MODULES) $(OUR_UNINSTALL_MODULES) $(OUR_DISABLED_MODULES) $(OUR_DISABLED_CLEAN_MODULES) $(OUR_DISABLED_INSTALL_MODULES) $(OUR_DISABLED_UNINSTALL_MODULES) $(OUR_TEST_MODULES) $(OUR_CHECK_MODULES): 17 | @set fnord $$MAKEFLAGS; amf=$$2; \ 18 | target=`echo $@ | sed -e 's|^.*-||'`; \ 19 | modname=`echo $@ | sed -e 's|-.*||' | sed -e 's|^.*/||'`; \ 20 | enabled=`echo $(CONF_MODULES) | grep -w $$modname`; \ 21 | if ! test -z "$$enabled"; then \ 22 | confmoddir=`cat $(switch_builddir)/modules.conf | sed -e 's| ||' | sed 's/|.*//' | grep $$modname$$ | sed -e 's|#||' | head -n 1`; \ 23 | modsource=`cat $(switch_builddir)/modules.conf | grep "$$modname.*|" | sed 's/.*|//' | head -n 1`; \ 24 | if test -z "$$confmoddir" ; then \ 25 | moddir=$@ ; \ 26 | buildmoddir=$(switch_builddir)/src/mod/$@ ;\ 27 | else \ 28 | if [[ $$confmoddir == /* ]]; then \ 29 | moddir="$$confmoddir" ; \ 30 | buildmoddir="$$moddir" ; \ 31 | else \ 32 | if test -d "$(switch_srcdir)/src/mod/$$confmoddir" ; then \ 33 | moddir="$(switch_srcdir)/src/mod/$$confmoddir" ; \ 34 | buildmoddir="$(switch_builddir)/src/mod/$$confmoddir" ; \ 35 | else \ 36 | if ! test -z "$$modsource" ; then \ 37 | moddir="$(switch_srcdir)/src/mod/outoftree/$$confmoddir" ; \ 38 | buildmoddir="$(switch_builddir)/src/mod/outoftree/$$confmoddir" ; \ 39 | if ! test -d "$$buildmoddir"; then \ 40 | echo "Cloning from git: $$modsource" ; \ 41 | mkdir -p $$buildmoddir ; \ 42 | git clone $$modsource $$buildmoddir ; \ 43 | fi ; \ 44 | if ! test -d "$$buildmoddir"; then \ 45 | echo ; echo "WARNING There is no $$buildmoddir...failing ;" ; \ 46 | fail=yes ; \ 47 | fi ; \ 48 | else \ 49 | moddir="$$confmoddir" ; \ 50 | buildmoddir="$(switch_builddir)/src/mod/$$confmoddir" ; \ 51 | fi ; \ 52 | fi ; \ 53 | fi ; \ 54 | fi ; \ 55 | if test -f "$$buildmoddir/bootstrap.sh" -a ! -f "$$buildmoddir/configure" -a ! -f "$$buildmoddir/configure.sh" ; then \ 56 | cd $$buildmoddir && MODDIR=$$moddir MODNAME=$$modname BASE=$(switch_builddir) PKG_CONFIG_PATH=$(switch_builddir)/build/standalone_module:$(PKG_CONFIG_PATH) eval $$buildmoddir/bootstrap.sh ; \ 57 | fi ; \ 58 | if test -f "$$buildmoddir/configure.sh" -a ! -f "$$buildmoddir/Makefile" ; then \ 59 | cd $$buildmoddir && MODDIR=$$moddir MODNAME=$$modname BASE=$(switch_builddir) PKG_CONFIG_PATH=$(switch_builddir)/build/standalone_module:$(PKG_CONFIG_PATH) eval $$buildmoddir/configure.sh ; \ 60 | else \ 61 | if test -f "$$buildmoddir/configure" -a ! -f "$$buildmoddir/Makefile" ; then \ 62 | cd $$buildmoddir && MODDIR=$$moddir MODNAME=$$modname BASE=$(switch_builddir) PKG_CONFIG_PATH=$(switch_builddir)/build/standalone_module:$(PKG_CONFIG_PATH) eval $$buildmoddir/configure ; \ 63 | fi ; \ 64 | fi ; \ 65 | if test -z "$$target" ; then target="all" ; fi ; \ 66 | if ! test -z "$$fail" || ! test -f $$moddir/$$modname.c && ! test -f $$moddir/$$modname.cpp && test $$modname != "mod_com_g729" ; \ 67 | then echo ; echo "WARNING $$modname is not a valid FreeSWITCH module dir, skipping it..." ; else \ 68 | if test "$$target" != "print_tests" ; then echo; echo making $$target $$modname ; fi;\ 69 | test -d "$$buildmoddir" || mkdir -p $$buildmoddir ; \ 70 | (if test -f "$$moddir/Makefile" ; then \ 71 | test -f "$$buildmoddir/Makefile" || cp $$moddir/Makefile $$buildmoddir/Makefile ; \ 72 | cd $$buildmoddir && MODDIR=$$moddir MODNAME=$$modname BASE=$(switch_builddir) $(MAKE) $(AM_MAKEFLAGS) $$target; \ 73 | else\ 74 | cd $$buildmoddir && MODDIR=$$moddir MODNAME=$$modname BASE=$(switch_builddir) $(MAKE) $(AM_MAKEFLAGS) -f $(switch_builddir)/build/modmake.rules $$target ;\ 75 | fi;) || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ 76 | fi; \ 77 | test -z "$$fail" ; \ 78 | fi; 79 | 80 | mod_com_g729-activate: 81 | cd $(switch_builddir)/src/mod/codecs/mod_com_g729 && $(MAKE) $(AM_MAKEFLAGS) activate 82 | 83 | .DEFAULT: 84 | @if test -z "`echo $@ | grep '\-all$$'`"; then $(MAKE) $(AM_MAKEFLAGS) $@-all ; else echo Unknown target `echo $@ | sed -e 's|-all||'`; exit 1; fi 85 | 86 | 87 | -------------------------------------------------------------------------------- /mod/src/mod/applications/.gitignore: -------------------------------------------------------------------------------- 1 | */Makefile.in 2 | */Makefile 3 | */mod_*.log 4 | -------------------------------------------------------------------------------- /mod/src/mod/applications/mod_abstraction/Makefile.am: -------------------------------------------------------------------------------- 1 | include $(top_srcdir)/build/modmake.rulesam 2 | MODNAME=mod_abstraction 3 | 4 | mod_LTLIBRARIES = mod_abstraction.la 5 | mod_abstraction_la_SOURCES = mod_abstraction.c 6 | mod_abstraction_la_CFLAGS = $(AM_CFLAGS) 7 | mod_abstraction_la_LIBADD = $(switch_builddir)/libfreeswitch.la 8 | mod_abstraction_la_LDFLAGS = -avoid-version -module -no-undefined -shared 9 | -------------------------------------------------------------------------------- /mod/src/mod/applications/mod_abstraction/conf/autoload_configs/abstraction.conf.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /mod/src/mod/applications/mod_av/Makefile.am: -------------------------------------------------------------------------------- 1 | include $(top_srcdir)/build/modmake.rulesam 2 | MODNAME=mod_av 3 | 4 | if HAVE_AVFORMAT 5 | 6 | if HAVE_SWRESAMPLE 7 | RESAMPLE_CFLAGS = $(SWRESAMPLE_CFLAGS) 8 | RESAMPLE_LIBS = $(SWRESAMPLE_LIBS) 9 | else 10 | RESAMPLE_CFLAGS = $(AVRESAMPLE_CFLAGS) -DUSE_AVRESAMPLE 11 | RESAMPLE_LIBS = $(AVRESAMPLE_LIBS) 12 | endif 13 | 14 | noinst_LTLIBRARIES = libavmod.la 15 | 16 | libavmod_la_SOURCES = mod_av.c avformat.c avcodec.c 17 | libavmod_la_CFLAGS = $(AM_CFLAGS) $(AVFORMAT_CFLAGS) $(AVCODEC_CFLAGS) $(SWSCALE_CFLAGS) $(AVUTIL_CFLAGS) $(RESAMPLE_CFLAGS) 18 | 19 | mod_LTLIBRARIES = mod_av.la 20 | mod_av_la_SOURCES = 21 | mod_av_la_LIBADD = libavmod.la $(switch_builddir)/libfreeswitch.la $(AVFORMAT_LIBS) $(AVCODEC_LIBS) $(SWSCALE_LIBS) $(AVUTIL_LIBS) $(RESAMPLE_LIBS) 22 | mod_av_la_LDFLAGS = -avoid-version -module -no-undefined -shared -lm -lz 23 | 24 | 25 | noinst_PROGRAMS = test/test_mod_av test/test_avformat 26 | test_test_mod_av_CFLAGS = $(SWITCH_AM_CFLAGS) -I../ -DSWITCH_TEST_BASE_DIR_FOR_CONF=\"${abs_builddir}/test\" -DSWITCH_TEST_BASE_DIR_OVERRIDE=\"${abs_builddir}/test\" $(AVFORMAT_CFLAGS) $(AVCODEC_CFLAGS) $(SWSCALE_CFLAGS) $(AVUTIL_CFLAGS) $(RESAMPLE_CFLAGS) 27 | test_test_mod_av_LDFLAGS = $(AVFORMAT_LIBS) $(AVCODEC_LIBS) $(SWSCALE_LIBS) $(AVUTIL_LIBS) $(RESAMPLE_LIBS) -avoid-version -no-undefined $(SWITCH_AM_LDFLAGS) 28 | test_test_mod_av_LDADD = libavmod.la $(switch_builddir)/libfreeswitch.la 29 | test_test_avformat_CFLAGS = $(SWITCH_AM_CFLAGS) -I../ -DSWITCH_TEST_BASE_DIR_FOR_CONF=\"${abs_builddir}/test\" -DSWITCH_TEST_BASE_DIR_OVERRIDE=\"${abs_builddir}/test\" $(AVFORMAT_CFLAGS) $(AVCODEC_CFLAGS) $(SWSCALE_CFLAGS) $(AVUTIL_CFLAGS) $(RESAMPLE_CFLAGS) 30 | test_test_avformat_LDFLAGS = $(AVFORMAT_LIBS) $(AVCODEC_LIBS) $(SWSCALE_LIBS) $(AVUTIL_LIBS) $(RESAMPLE_LIBS) -avoid-version -no-undefined $(SWITCH_AM_LDFLAGS) 31 | test_test_avformat_LDADD = libavmod.la $(switch_builddir)/libfreeswitch.la 32 | 33 | TESTS = $(noinst_PROGRAMS) 34 | 35 | else 36 | install: error 37 | all: error 38 | error: 39 | $(error You must install libavformat-dev and libswscale-dev to build mod_av) 40 | endif 41 | -------------------------------------------------------------------------------- /mod/src/mod/applications/mod_av/mod_av.h: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application 3 | * Copyright (C) 2005-2014, Anthony Minessale II 4 | * 5 | * Version: MPL 1.1 6 | * 7 | * The contents of this file are subject to the Mozilla Public License Version 8 | * 1.1 (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * http://www.mozilla.org/MPL/ 11 | * 12 | * Software distributed under the License is distributed on an "AS IS" basis, 13 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 14 | * for the specific language governing rights and limitations under the 15 | * License. 16 | * 17 | * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application 18 | * 19 | * The Initial Developer of the Original Code is 20 | * Anthony Minessale II 21 | * Portions created by the Initial Developer are Copyright (C) 22 | * the Initial Developer. All Rights Reserved. 23 | * 24 | * Contributor(s): 25 | * 26 | * Anthony Minessale II 27 | * Ken Rice 28 | * Paul D. Tinsley 29 | * Bret McDanel 30 | * Marcel Barbulescu 31 | * Raymond Chandler 32 | * Emmanuel Schmidbauer 33 | * 34 | * 35 | * mod_av.h -- LibAV mod 36 | * 37 | */ 38 | 39 | #ifndef MOD_AV_H 40 | #define MOD_AV_H 41 | 42 | struct mod_av_globals { 43 | int debug; 44 | }; 45 | 46 | extern struct mod_av_globals mod_av_globals; 47 | 48 | void show_codecs(switch_stream_handle_t *stream); 49 | void show_formats(switch_stream_handle_t *stream); 50 | 51 | #endif 52 | 53 | /* For Emacs: 54 | * Local Variables: 55 | * mode:c 56 | * indent-tabs-mode:t 57 | * tab-width:4 58 | * c-basic-offset:4 59 | * End: 60 | * For VIM: 61 | * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet: 62 | */ 63 | 64 | -------------------------------------------------------------------------------- /mod/src/mod/applications/mod_av/test/cluecon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tppi/freeswitch2/f790d22a468ee21f9f3b499c95e53123519afa8e/mod/src/mod/applications/mod_av/test/cluecon.png -------------------------------------------------------------------------------- /mod/src/mod/applications/mod_av/test/conf/freeswitch.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 |
31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 |
39 |
40 | -------------------------------------------------------------------------------- /mod/src/mod/applications/mod_av/test/test_mod_av.c: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application 3 | * Copyright (C) 2005-2018, Anthony Minessale II 4 | * 5 | * Version: MPL 1.1 6 | * 7 | * The contents of this file are subject to the Mozilla Public License Version 8 | * 1.1 (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * http://www.mozilla.org/MPL/ 11 | * 12 | * Software distributed under the License is distributed on an "AS IS" basis, 13 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 14 | * for the specific language governing rights and limitations under the 15 | * License. 16 | * 17 | * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application 18 | * 19 | * The Initial Developer of the Original Code is 20 | * Seven Du 21 | * Portions created by the Initial Developer are Copyright (C) 22 | * the Initial Developer. All Rights Reserved. 23 | * 24 | * Contributor(s): 25 | * 26 | * 27 | * mod_av_test -- avcodec tests 28 | * 29 | */ 30 | 31 | #include 32 | 33 | int loop = 0; 34 | 35 | /* Add our command line options. */ 36 | static fctcl_init_t my_cl_options[] = { 37 | {"--disable-hw", /* long_opt */ 38 | NULL, /* short_opt (optional) */ 39 | FCTCL_STORE_TRUE , /* action */ 40 | "disable hardware encoder" /* help */ 41 | }, 42 | 43 | {"--loop", /* long_opt */ 44 | NULL, /* short_opt (optional) */ 45 | FCTCL_STORE_VALUE , /* action */ 46 | "loops to encode a picture" /* help */ 47 | }, 48 | FCTCL_INIT_NULL /* Sentinel */ 49 | }; 50 | 51 | FST_CORE_BEGIN("conf") 52 | { 53 | const char *loop_; 54 | fctcl_install(my_cl_options); 55 | 56 | loop_ = fctcl_val("--loop"); 57 | if (loop_) loop = atoi(loop_); 58 | 59 | FST_MODULE_BEGIN(mod_av, mod_av_test) 60 | { 61 | FST_SETUP_BEGIN() 62 | { 63 | // fst_requires_module("mod_av"); 64 | } 65 | FST_SETUP_END() 66 | 67 | FST_TEST_BEGIN(encoder_test) 68 | { 69 | switch_status_t status; 70 | switch_codec_t codec = { 0 }; 71 | switch_codec_settings_t codec_settings = {{ 0 }}; 72 | switch_image_t *img; 73 | uint8_t buf[SWITCH_DEFAULT_VIDEO_SIZE + 12]; 74 | switch_frame_t frame = { 0 }; 75 | int packets = 0; 76 | switch_status_t encode_status; 77 | 78 | switch_set_string(codec_settings.video.config_profile_name, "conference"); 79 | 80 | if (!fctcl_is("--disable-hw")) { 81 | codec_settings.video.try_hardware_encoder = 1; 82 | } 83 | 84 | status = switch_core_codec_init(&codec, 85 | "H264", 86 | NULL, 87 | NULL, 88 | 0, 89 | 0, 90 | 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, 91 | &codec_settings, fst_pool); 92 | fst_check(status == SWITCH_STATUS_SUCCESS); 93 | 94 | img = switch_img_alloc(NULL, SWITCH_IMG_FMT_I420, 1280, 720, 1); 95 | fst_requires(img); 96 | 97 | 98 | frame.packet = buf; 99 | frame.packetlen = SWITCH_DEFAULT_VIDEO_SIZE + 12; 100 | frame.data = buf + 12; 101 | frame.datalen = SWITCH_DEFAULT_VIDEO_SIZE; 102 | frame.payload = 96; 103 | frame.m = 0; 104 | frame.seq = 0; 105 | frame.timestamp = 0; 106 | frame.img = img; 107 | 108 | do { 109 | frame.datalen = SWITCH_DEFAULT_VIDEO_SIZE; 110 | encode_status = switch_core_codec_encode_video(&codec, &frame); 111 | 112 | if (encode_status == SWITCH_STATUS_SUCCESS || encode_status == SWITCH_STATUS_MORE_DATA) { 113 | 114 | fst_requires((encode_status == SWITCH_STATUS_SUCCESS && frame.m) || !frame.m); 115 | 116 | if (frame.flags & SFF_PICTURE_RESET) { 117 | frame.flags &= ~SFF_PICTURE_RESET; 118 | fst_check(0); 119 | } 120 | 121 | if (frame.datalen == 0) break; 122 | 123 | switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "[%d]: %02x %02x | m=%d | %d\n", loop, buf[12], buf[13], frame.m, frame.datalen); 124 | packets++; 125 | } 126 | 127 | } while(encode_status == SWITCH_STATUS_MORE_DATA || loop-- > 1); 128 | 129 | fst_check(frame.m == 1); 130 | fst_check(packets > 0); 131 | 132 | switch_core_codec_destroy(&codec); 133 | switch_img_free(&img); 134 | } 135 | FST_TEST_END() 136 | 137 | FST_TEARDOWN_BEGIN() 138 | { 139 | const char *err = NULL; 140 | switch_sleep(1000000); 141 | fst_check(switch_loadable_module_unload_module(SWITCH_GLOBAL_dirs.mod_dir, (char *)"mod_av", SWITCH_TRUE, &err) == SWITCH_STATUS_SUCCESS); 142 | } 143 | FST_TEARDOWN_END() 144 | } 145 | FST_MODULE_END() 146 | } 147 | FST_CORE_END() 148 | -------------------------------------------------------------------------------- /mod/src/mod/applications/mod_conference/.gitignore: -------------------------------------------------------------------------------- 1 | conf/freeswitch.xml.fsxml 2 | test/images/logo-*.png 3 | test/images/signalwire-scaled-*.png 4 | test/test_image 5 | test/test_member 6 | -------------------------------------------------------------------------------- /mod/src/mod/applications/mod_conference/Makefile.am: -------------------------------------------------------------------------------- 1 | include $(top_srcdir)/build/modmake.rulesam 2 | MODNAME=mod_conference 3 | 4 | mod_LTLIBRARIES = mod_conference.la 5 | mod_conference_la_SOURCES = mod_conference.c conference_api.c conference_loop.c conference_al.c conference_cdr.c conference_video.c 6 | mod_conference_la_SOURCES += conference_event.c conference_member.c conference_utils.c conference_file.c conference_record.c 7 | mod_conference_la_CFLAGS = $(AM_CFLAGS) -I. 8 | mod_conference_la_LIBADD = $(switch_builddir)/libfreeswitch.la 9 | mod_conference_la_LDFLAGS = -avoid-version -module -no-undefined -shared 10 | 11 | $(am_mod_conference_la_OBJECTS): mod_conference.h 12 | 13 | if HAVE_OPENAL 14 | mod_conference_la_LDFLAGS += -lopenal -lm 15 | mod_conference_la_CFLAGS += -DOPENAL_POSITIONING 16 | endif 17 | 18 | 19 | noinst_LTLIBRARIES = libmodconference.la 20 | 21 | libmodconference_la_SOURCES = $(mod_conference_la_SOURCES) 22 | libmodconference_la_CFLAGS = $(AM_CFLAGS) -I. 23 | 24 | noinst_PROGRAMS = test/test_image test/test_member 25 | 26 | test_test_image_SOURCES = test/test_image.c 27 | test_test_image_CFLAGS = $(AM_CFLAGS) -I. -DSWITCH_TEST_BASE_DIR_FOR_CONF=\"${abs_builddir}/test\" -DSWITCH_TEST_BASE_DIR_OVERRIDE=\"${abs_builddir}/test\" 28 | test_test_image_LDFLAGS = $(AM_LDFLAGS) -avoid-version -no-undefined $(freeswitch_LDFLAGS) $(switch_builddir)/libfreeswitch.la $(CORE_LIBS) $(APR_LIBS) 29 | test_test_image_LDADD = libmodconference.la 30 | 31 | test_test_member_SOURCES = test/test_member.c 32 | test_test_member_CFLAGS = $(AM_CFLAGS) -I. -DSWITCH_TEST_BASE_DIR_FOR_CONF=\"${abs_builddir}/test\" -DSWITCH_TEST_BASE_DIR_OVERRIDE=\"${abs_builddir}/test\" 33 | test_test_member_LDFLAGS = $(AM_LDFLAGS) -avoid-version -no-undefined $(freeswitch_LDFLAGS) $(switch_builddir)/libfreeswitch.la $(CORE_LIBS) $(APR_LIBS) 34 | test_test_member_LDADD = libmodconference.la 35 | 36 | TESTS = $(noinst_PROGRAMS) 37 | -------------------------------------------------------------------------------- /mod/src/mod/applications/mod_conference/TODO: -------------------------------------------------------------------------------- 1 | runtime in one file, header(with all structures), apps, api commands, utilities 2 | 3 | Currently mod_conference can compile with 'time make -j' in: 4 | real 0m9.709s 5 | user 0m9.040s 6 | sys 0m0.568s 7 | 8 | -------------------------------------------------------------------------------- /mod/src/mod/applications/mod_conference/conf/dialplan/conference_dialplan.xml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /mod/src/mod/applications/mod_conference/test/conf/font/AEH.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tppi/freeswitch2/f790d22a468ee21f9f3b499c95e53123519afa8e/mod/src/mod/applications/mod_conference/test/conf/font/AEH.ttf -------------------------------------------------------------------------------- /mod/src/mod/applications/mod_conference/test/conf/freeswitch.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 |
35 | 36 |
37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 |
52 |
53 | -------------------------------------------------------------------------------- /mod/src/mod/applications/mod_conference/test/images/signalwire.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tppi/freeswitch2/f790d22a468ee21f9f3b499c95e53123519afa8e/mod/src/mod/applications/mod_conference/test/images/signalwire.png -------------------------------------------------------------------------------- /mod/src/mod/applications/mod_conference/test/test_image.c: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application 3 | * Copyright (C) 2005-2018, Anthony Minessale II 4 | * 5 | * Version: MPL 1.1 6 | * 7 | * The contents of this file are subject to the Mozilla Public License Version 8 | * 1.1 (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * http://www.mozilla.org/MPL/ 11 | * 12 | * Software distributed under the License is distributed on an "AS IS" basis, 13 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 14 | * for the specific language governing rights and limitations under the 15 | * License. 16 | * 17 | * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application 18 | * 19 | * The Initial Developer of the Original Code is 20 | * Anthony Minessale II 21 | * Portions created by the Initial Developer are Copyright (C) 22 | * the Initial Developer. All Rights Reserved. 23 | * 24 | * Contributor(s): 25 | * Chris Rienzo 26 | * Seven Du 27 | * 28 | * 29 | * test_image.c -- test images 30 | * 31 | */ 32 | #include 33 | #include 34 | 35 | #include 36 | 37 | FST_CORE_BEGIN("./conf") 38 | { 39 | FST_SUITE_BEGIN(switch_ivr_originate) 40 | { 41 | FST_SETUP_BEGIN() 42 | { 43 | } 44 | FST_SETUP_END() 45 | 46 | FST_TEARDOWN_BEGIN() 47 | { 48 | } 49 | FST_TEARDOWN_END() 50 | 51 | FST_TEST_BEGIN(scale_test) 52 | { 53 | char path[4096]; 54 | switch_image_t *img; 55 | int i; 56 | 57 | sprintf(path, "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "../images/signalwire.png"); 58 | img = switch_img_read_png(path, SWITCH_IMG_FMT_I420); 59 | 60 | for(i = 2; i <= 10; i += 2) { 61 | switch_image_t *scaled_img = NULL; 62 | char name[1024]; 63 | 64 | switch_snprintf(name, sizeof(name), "../images/signalwire-scaled-I420-%d.png", i); 65 | sprintf(path, "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, name); 66 | switch_img_scale(img, &scaled_img, img->d_w / i, img->d_h / i); 67 | fst_requires(scaled_img); 68 | switch_img_write_png(scaled_img, path); 69 | switch_img_free(&scaled_img); 70 | } 71 | 72 | switch_img_free(&img); 73 | 74 | sprintf(path, "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "../images/signalwire.png"); 75 | img = switch_img_read_png(path, SWITCH_IMG_FMT_ARGB); 76 | 77 | for(i = 2; i <= 10; i += 2) { 78 | switch_image_t *scaled_img = NULL; 79 | char name[1024]; 80 | 81 | switch_snprintf(name, sizeof(name), "../images/signalwire-scaled-ARGB-%d.png", i); 82 | sprintf(path, "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, name); 83 | switch_img_scale(img, &scaled_img, img->d_w / i, img->d_h / i); 84 | fst_requires(scaled_img); 85 | switch_img_write_png(scaled_img, path); 86 | switch_img_free(&scaled_img); 87 | } 88 | 89 | switch_img_free(&img); 90 | 91 | } 92 | FST_TEST_END() 93 | 94 | FST_TEST_BEGIN(scale_test) 95 | { 96 | char path[1024]; 97 | switch_image_t *img; 98 | char *font_face = "font/AEH.ttf"; 99 | char *fg = "#000000"; 100 | char *altfg = "#FFFFFF"; 101 | char *bg = NULL; 102 | int font_size = 6; 103 | switch_img_txt_handle_t *txthandle = NULL; 104 | const char *txt = "FEESWITCH ROCKS"; 105 | const char *alttxt = "freeswitch"; 106 | 107 | sprintf(path, "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "../images/signalwire-scaled-ARGB-8.png"); 108 | img = switch_img_read_png(path, SWITCH_IMG_FMT_ARGB); 109 | 110 | sprintf(path, "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, font_face); 111 | switch_img_txt_handle_create(&txthandle, path, fg, bg, font_size, 0, NULL); 112 | switch_img_txt_handle_render(txthandle, img, 50, 3, txt, NULL, fg, bg, font_size, 0); 113 | switch_img_txt_handle_render(txthandle, img, 60, 15, alttxt, NULL, altfg, "#000000", font_size, 0); 114 | sprintf(path, "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "../images/signalwire-scaled-ARGB-8-txt.png"); 115 | switch_img_write_png(img, path); 116 | 117 | switch_img_free(&img); 118 | switch_img_txt_handle_destroy(&txthandle); 119 | } 120 | FST_TEST_END() 121 | 122 | 123 | 124 | } 125 | FST_SUITE_END() 126 | } 127 | FST_CORE_END() 128 | -------------------------------------------------------------------------------- /mod/src/mod/applications/mod_conference/test/test_member.c: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application 3 | * Copyright (C) 2005-2019, Anthony Minessale II 4 | * 5 | * Version: MPL 1.1 6 | * 7 | * The contents of this file are subject to the Mozilla Public License Version 8 | * 1.1 (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * http://www.mozilla.org/MPL/ 11 | * 12 | * Software distributed under the License is distributed on an "AS IS" basis, 13 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 14 | * for the specific language governing rights and limitations under the 15 | * License. 16 | * 17 | * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application 18 | * 19 | * The Initial Developer of the Original Code is 20 | * Anthony Minessale II 21 | * Portions created by the Initial Developer are Copyright (C) 22 | * the Initial Developer. All Rights Reserved. 23 | * 24 | * Contributor(s): 25 | * Chris Rienzo 26 | * Seven Du 27 | * 28 | * 29 | * test_member.c -- tests member functions 30 | * 31 | */ 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | #include 38 | 39 | FST_CORE_BEGIN("./conf") 40 | { 41 | FST_SUITE_BEGIN(switch_ivr_originate) 42 | { 43 | FST_SETUP_BEGIN() 44 | { 45 | } 46 | FST_SETUP_END() 47 | 48 | FST_TEARDOWN_BEGIN() 49 | { 50 | } 51 | FST_TEARDOWN_END() 52 | 53 | FST_TEST_BEGIN(member_test) 54 | { 55 | char path[4096]; 56 | char logo[1024]; 57 | conference_member_t smember = { 0 }; 58 | conference_member_t *member = &smember; 59 | switch_image_t *img; 60 | int i; 61 | 62 | sprintf(logo, "%s%s%s%s%s%s%s", "{position=left-bot,text_x=center," 63 | "center_offset=190,text=#000000:transparent:", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "font/AEH.ttf:50:" 64 | "'FREESWITCH ROCKS',alt_text_x=center,alt_center_offset=190," 65 | "alt_text_y=88,alt_text=#ffffff:transparent:", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "font/AEH.ttf:40:" 66 | "'freeswitch'}"); 67 | sprintf(path, "%s%s%s%s", logo, SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, "../images/signalwire.png"); 68 | switch_mutex_init(&member->write_mutex, SWITCH_MUTEX_NESTED, fst_pool); 69 | switch_mutex_init(&member->flag_mutex, SWITCH_MUTEX_NESTED, fst_pool); 70 | switch_mutex_init(&member->fnode_mutex, SWITCH_MUTEX_NESTED, fst_pool); 71 | switch_mutex_init(&member->audio_in_mutex, SWITCH_MUTEX_NESTED, fst_pool); 72 | switch_mutex_init(&member->audio_out_mutex, SWITCH_MUTEX_NESTED, fst_pool); 73 | switch_mutex_init(&member->read_mutex, SWITCH_MUTEX_NESTED, fst_pool); 74 | switch_thread_rwlock_create(&member->rwlock, fst_pool); 75 | 76 | conference_member_set_logo(member, path); 77 | img = member->video_logo; 78 | 79 | for(i = 2; i <= 10; i += 2) { 80 | switch_image_t *scaled_img = NULL; 81 | char name[1024]; 82 | 83 | switch_snprintf(name, sizeof(name), "../images/logo-signalwire-scaled-%d.png", i); 84 | sprintf(path, "%s%s%s", SWITCH_GLOBAL_dirs.conf_dir, SWITCH_PATH_SEPARATOR, name); 85 | switch_img_scale(img, &scaled_img, img->d_w / i, img->d_h / i); 86 | fst_requires(scaled_img); 87 | switch_img_write_png(scaled_img, path); 88 | switch_img_free(&scaled_img); 89 | } 90 | 91 | switch_img_free(&img); 92 | } 93 | FST_TEST_END() 94 | 95 | } 96 | FST_SUITE_END() 97 | } 98 | FST_CORE_END() 99 | -------------------------------------------------------------------------------- /mod/src/mod/applications/mod_cv/Makefile.am: -------------------------------------------------------------------------------- 1 | include $(top_srcdir)/build/modmake.rulesam 2 | MODNAME=mod_cv 3 | 4 | if HAVE_OPENCV 5 | 6 | mod_LTLIBRARIES = mod_cv.la 7 | mod_cv_la_SOURCES = mod_cv.cpp 8 | mod_cv_la_CXXFLAGS = $(AM_CXXFLAGS) $(OPENCV_CFLAGS) 9 | mod_cv_la_LIBADD = $(switch_builddir)/libfreeswitch.la $(OPENCV_LIBS) 10 | mod_cv_la_LDFLAGS = -avoid-version -module -no-undefined -shared -lm -lz 11 | 12 | else 13 | install: error 14 | all: error 15 | error: 16 | $(error You must install libopencv-dev to build mod_cv) 17 | endif 18 | -------------------------------------------------------------------------------- /mod/src/mod/applications/mod_cv/Makefile.hint: -------------------------------------------------------------------------------- 1 | LOCAL_LDFLAGS=-lopencv_core -lopencv_objdetect -lopencv_imgproc -lopencv_highgui -lopencv_legacy -lyuv 2 | LOCAL_CFLAGS=-I/usr/include/opencv 3 | 4 | 5 | BASE=../../../.. 6 | include $(BASE)/build/modmake.rules 7 | 8 | -------------------------------------------------------------------------------- /mod/src/mod/applications/mod_mp4/Makefile.am: -------------------------------------------------------------------------------- 1 | include $(top_srcdir)/build/modmake.rulesam 2 | MODNAME=mod_mp4 3 | 4 | mod_LTLIBRARIES = mod_mp4.la 5 | mod_mp4_la_SOURCES = mod_mp4.cpp mp4_helper.cpp 6 | mod_mp4_la_CFLAGS = $(AM_CFLAGS) 7 | mod_mp4_la_LIBADD = $(switch_builddir)/libfreeswitch.la 8 | mod_mp4_la_LDFLAGS = -avoid-version -module -no-undefined -shared -lmp4v2 9 | -------------------------------------------------------------------------------- /mod/src/mod/applications/mod_mp4/exception.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | The contents of this file are subject to the Mozilla Public License 4 | Version 1.1 (the "License"); you may not use this file except in 5 | compliance with the License. You may obtain a copy of the License at 6 | http://www.mozilla.org/MPL/ 7 | 8 | Software distributed under the License is distributed on an "AS IS" 9 | basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 10 | License for the specific language governing rights and limitations 11 | under the License. 12 | 13 | The Original Code is MP4 Helper Library to Freeswitch MP4 module. 14 | 15 | The Initial Developer of the Original Code is 16 | Paulo Rogério Panhoto . 17 | Portions created by the Initial Developer are Copyright (C) 18 | the Initial Developer. All Rights Reserved. 19 | 20 | */ 21 | 22 | #ifndef EXCEPTION_HPP_ 23 | #define EXCEPTION_HPP_ 24 | 25 | #include 26 | #include 27 | 28 | class Exception: public std::exception { 29 | public: 30 | Exception() 31 | { 32 | } 33 | 34 | Exception(const std::string & message): message_(message) 35 | { 36 | } 37 | 38 | Exception(const std::exception & e): message_(e.what()) 39 | { 40 | } 41 | 42 | Exception(const Exception & e): message_(e.message_) 43 | { 44 | } 45 | 46 | virtual ~Exception() throw() 47 | { 48 | } 49 | 50 | const char * what() const throw() 51 | { 52 | return message_.c_str(); 53 | } 54 | 55 | private: 56 | std::string message_; 57 | }; 58 | 59 | #endif -------------------------------------------------------------------------------- /mod/src/mod/applications/mod_mp4/mp4_helper.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | The contents of this file are subject to the Mozilla Public License 4 | Version 1.1 (the "License"); you may not use this file except in 5 | compliance with the License. You may obtain a copy of the License at 6 | http://www.mozilla.org/MPL/ 7 | 8 | Software distributed under the License is distributed on an "AS IS" 9 | basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 10 | License for the specific language governing rights and limitations 11 | under the License. 12 | 13 | The Original Code is MP4 Helper Library to the Freeswitch MP4 Module. 14 | 15 | The Initial Developer of the Original Code is 16 | Paulo Rogério Panhoto . 17 | Portions created by the Initial Developer are Copyright (C) 18 | the Initial Developer. All Rights Reserved. 19 | 20 | Contributors: 21 | 22 | Seven Du 23 | */ 24 | 25 | #include 26 | #include "mp4_helper.hpp" 27 | 28 | namespace MP4 29 | { 30 | 31 | Context::Context(const char * file, bool newFile) 32 | { 33 | if(newFile) create(file); 34 | else open(file); 35 | } 36 | 37 | Context::~Context() 38 | { 39 | close(); 40 | } 41 | 42 | void Context::open(const char * file) 43 | { 44 | fh = MP4Read(file); 45 | if (fh == MP4_INVALID_FILE_HANDLE) throw Exception(file, "Open failed"); 46 | getTracks(file); 47 | } 48 | 49 | void Context::create(const char * file) 50 | { 51 | fh = MP4Create(file); 52 | if (fh == MP4_INVALID_FILE_HANDLE) throw Exception(file, "Create file failed"); 53 | } 54 | 55 | void Context::close() 56 | { 57 | if (!isOpen()) return; 58 | MP4Close(fh); 59 | } 60 | 61 | void Context::getTracks(const char * file) 62 | { 63 | int i = 0; 64 | bool audioTrack = false, videoTrack = false; 65 | 66 | if (!isOpen()) throw Exception(file, "File is closed."); 67 | 68 | for (;;) 69 | { 70 | TrackProperties track; 71 | if((track.hint = MP4FindTrackId(fh, i++, MP4_HINT_TRACK_TYPE, 0)) == MP4_INVALID_TRACK_ID) break; 72 | 73 | MP4GetHintTrackRtpPayload(fh, track.hint, &track.codecName, &track.payload, NULL, NULL); 74 | 75 | track.track = MP4GetHintTrackReferenceTrackId(fh, track.hint); 76 | if(track.track == MP4_INVALID_TRACK_ID) continue; 77 | track.clock = MP4GetTrackTimeScale(fh, track.hint); 78 | 79 | if (!strcmp(MP4GetTrackType(fh, track.track), MP4_AUDIO_TRACK_TYPE)) { 80 | audioTrack = true; 81 | 82 | if(!strncmp(track.codecName, "PCM", 3)) 83 | track.packetLength = 20; 84 | else 85 | track.packetLength = track.clock = 0; 86 | 87 | audio = track; 88 | } else if (!strcmp(MP4GetTrackType(fh, track.track), MP4_VIDEO_TRACK_TYPE)) { 89 | videoTrack = true; 90 | 91 | const char * sdp = MP4GetHintTrackSdp(fh, track.hint); 92 | const char * fmtp = strstr(sdp, "fmtp"); 93 | 94 | if (fmtp) { 95 | // finds beginning of 'fmtp' value; 96 | for(fmtp += 5; *fmtp != ' '; ++fmtp); 97 | ++fmtp; 98 | 99 | const char * eol = fmtp; 100 | for(;*eol != '\r' && *eol != '\n'; ++eol); 101 | video.fmtp = std::string(fmtp, eol); 102 | } 103 | video.track = track; 104 | } 105 | } 106 | 107 | if (!audioTrack || !videoTrack) throw Exception(file, "Missing audio/video track."); 108 | } 109 | 110 | bool Context::getVideoPacket(void * buffer, u_int & size, u_int & ts) 111 | { 112 | return getPacket(video.track.hint, video.track.runtime, true, buffer, size, ts); 113 | } 114 | 115 | bool Context::getAudioPacket(void * buffer, u_int & size, u_int & ts) 116 | { 117 | return getPacket(audio.hint, audio.runtime, false, buffer, size, ts); 118 | } 119 | 120 | bool Context::getPacket(MP4TrackId hint, RuntimeProperties & rt, 121 | bool header, void * buffer, u_int & size, u_int & ts) 122 | { 123 | if (rt.frame == 0 || rt.packet == rt.packetsPerFrame) { 124 | ++rt.frame; 125 | if(!MP4ReadRtpHint(fh, hint, rt.frame, &rt.packetsPerFrame)) 126 | return false; 127 | rt.packet = 0; 128 | rt.last_frame = MP4GetSampleTime(fh, hint, rt.frame); 129 | } 130 | 131 | ts = rt.last_frame; 132 | if (!MP4ReadRtpPacket(fh, hint, rt.packet, (uint8_t **) &buffer, &size, 0, header, true)) return false; 133 | ++rt.packet; 134 | return true; 135 | } 136 | } 137 | -------------------------------------------------------------------------------- /mod/src/mod/applications/mod_mp4/mp4_helper.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | The contents of this file are subject to the Mozilla Public License 4 | Version 1.1 (the "License"); you may not use this file except in 5 | compliance with the License. You may obtain a copy of the License at 6 | http://www.mozilla.org/MPL/ 7 | 8 | Software distributed under the License is distributed on an "AS IS" 9 | basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 10 | License for the specific language governing rights and limitations 11 | under the License. 12 | 13 | The Original Code is MP4 Helper Library to Freeswitch MP4 module. 14 | 15 | The Initial Developer of the Original Code is 16 | Paulo Rogério Panhoto . 17 | Portions created by the Initial Developer are Copyright (C) 18 | the Initial Developer. All Rights Reserved. 19 | 20 | Contributor(s): 21 | 22 | Seven Du 23 | 24 | */ 25 | 26 | #ifndef MP4_HELPER_HPP_ 27 | #define MP4_HELPER_HPP_ 28 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | typedef unsigned int u_int; 35 | 36 | namespace MP4 37 | { 38 | class Exception: public std::exception { 39 | public: 40 | Exception(const std::string & file, const std::string & error) 41 | : description_(file + ':' + error) 42 | { 43 | } 44 | 45 | const char * what() const throw() 46 | { 47 | return description_.c_str(); 48 | } 49 | 50 | ~Exception() throw() 51 | { 52 | } 53 | 54 | private: 55 | std::string description_; 56 | }; 57 | 58 | struct RuntimeProperties { 59 | uint32_t frame; // sampleID 60 | uint16_t packetsPerFrame; 61 | uint16_t packet; // packetID 62 | uint32_t last_frame; // timestamp 63 | 64 | RuntimeProperties(): frame(0), packetsPerFrame(0), packet(0) 65 | { 66 | } 67 | }; 68 | 69 | 70 | struct TrackProperties { 71 | MP4TrackId hint; 72 | MP4TrackId track; 73 | 74 | char * codecName; 75 | uint8_t payload; 76 | uint32_t clock; 77 | uint32_t packetLength; // packet Length in time (ms) 78 | 79 | RuntimeProperties runtime; 80 | 81 | TrackProperties(): hint(MP4_INVALID_TRACK_ID), track(MP4_INVALID_TRACK_ID), 82 | codecName(NULL), payload(0), clock(0), packetLength(0) 83 | { 84 | } 85 | }; 86 | 87 | typedef TrackProperties AudioProperties; 88 | 89 | struct VideoProperties { 90 | TrackProperties track; 91 | std::string fmtp; 92 | 93 | VideoProperties() 94 | { 95 | } 96 | 97 | VideoProperties(const TrackProperties & rhs): track(rhs) 98 | { 99 | } 100 | }; 101 | 102 | class Context { 103 | public: 104 | 105 | Context(const char * file, bool create = false); 106 | ~Context(); 107 | 108 | void open(const char * file); 109 | 110 | void create(const char * file); 111 | 112 | void close(); 113 | 114 | // returns: TRUE = has more data, FALSE = end-of-stream or failure 115 | bool getVideoPacket(void * buffer, u_int & size, u_int & ts); 116 | 117 | // returns: TRUE = has more data, FALSE = end-of-stream or failure 118 | bool getAudioPacket(void * buffer, u_int & size, u_int & ts); 119 | 120 | bool isOpen() const { return fh != MP4_INVALID_FILE_HANDLE; } 121 | 122 | bool isSupported() const { return audio.track != MP4_INVALID_TRACK_ID && video.track.track != MP4_INVALID_TRACK_ID; } 123 | 124 | const AudioProperties & audioTrack() const { return audio; } 125 | 126 | const VideoProperties & videoTrack() const { return video; } 127 | 128 | private: 129 | MP4FileHandle fh; 130 | AudioProperties audio; 131 | 132 | VideoProperties video; 133 | 134 | // Prevent copy construction. 135 | Context(const Context &); 136 | 137 | bool getPacket(MP4TrackId hint, RuntimeProperties & rt, 138 | bool header, void * buffer, u_int & size, u_int & ts); 139 | 140 | void getTracks(const char * file); 141 | }; 142 | } 143 | #endif 144 | -------------------------------------------------------------------------------- /mod/src/mod/applications/mod_mp4v2/Makefile.am: -------------------------------------------------------------------------------- 1 | include $(top_srcdir)/build/modmake.rulesam 2 | MODNAME=mod_mp4v2 3 | 4 | mod_LTLIBRARIES = mod_mp4v2.la 5 | mod_mp4v2_la_SOURCES = mod_mp4v2.c 6 | mod_mp4v2_la_CFLAGS = $(AM_CFLAGS) 7 | mod_mp4v2_la_LIBADD = $(switch_builddir)/libfreeswitch.la 8 | mod_mp4v2_la_LDFLAGS = -avoid-version -module -no-undefined -shared -lmp4v2 9 | -------------------------------------------------------------------------------- /mod/src/mod/applications/mod_snapshot/.gitignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | -------------------------------------------------------------------------------- /mod/src/mod/applications/mod_snapshot/Makefile.am: -------------------------------------------------------------------------------- 1 | include $(top_srcdir)/build/modmake.rulesam 2 | MODNAME=mod_snapshot 3 | 4 | mod_LTLIBRARIES = mod_snapshot.la 5 | mod_snapshot_la_SOURCES = mod_snapshot.c 6 | mod_snapshot_la_CFLAGS = $(AM_CFLAGS) 7 | mod_snapshot_la_LIBADD = $(switch_builddir)/libfreeswitch.la 8 | mod_snapshot_la_LDFLAGS = -avoid-version -module -no-undefined -shared 9 | -------------------------------------------------------------------------------- /mod/src/mod/applications/mod_test/Makefile.am: -------------------------------------------------------------------------------- 1 | include $(top_srcdir)/build/modmake.rulesam 2 | MODNAME=mod_test 3 | 4 | noinst_LTLIBRARIES = libtestmod.la 5 | libtestmod_la_SOURCES = mod_test.c 6 | 7 | mod_LTLIBRARIES = mod_test.la 8 | mod_test_la_CFLAGS = $(AM_CFLAGS) 9 | mod_test_la_SOURCES = 10 | mod_test_la_LIBADD = $(switch_builddir)/libfreeswitch.la $(SOFIALA) libtestmod.la 11 | mod_test_la_LDFLAGS = -avoid-version -module -no-undefined -shared 12 | 13 | noinst_PROGRAMS = test/test_asr test/test_tts 14 | 15 | test_test_asr_SOURCES = test/test_asr.c 16 | test_test_asr_CFLAGS = $(AM_CFLAGS) -I. -DSWITCH_TEST_BASE_DIR_FOR_CONF=\"${abs_builddir}/test\" -DSWITCH_TEST_BASE_DIR_OVERRIDE=\"${abs_builddir}/test\" 17 | test_test_asr_LDFLAGS = $(AM_LDFLAGS) -avoid-version -no-undefined $(freeswitch_LDFLAGS) $(switch_builddir)/libfreeswitch.la $(CORE_LIBS) $(APR_LIBS) 18 | test_test_asr_LDADD = libtestmod.la 19 | 20 | test_test_tts_SOURCES = test/test_tts.c 21 | test_test_tts_CFLAGS = $(AM_CFLAGS) -I. -DSWITCH_TEST_BASE_DIR_FOR_CONF=\"${abs_builddir}/test\" -DSWITCH_TEST_BASE_DIR_OVERRIDE=\"${abs_builddir}/test\" 22 | test_test_tts_LDFLAGS = $(AM_LDFLAGS) -avoid-version -no-undefined $(freeswitch_LDFLAGS) $(switch_builddir)/libfreeswitch.la $(CORE_LIBS) $(APR_LIBS) 23 | test_test_tts_LDADD = libtestmod.la 24 | 25 | TESTS = $(noinst_PROGRAMS) 26 | 27 | -------------------------------------------------------------------------------- /mod/src/mod/applications/mod_test/test/freeswitch.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 |
4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 |
24 | -------------------------------------------------------------------------------- /mod/src/mod/applications/mod_test/test/sounds/agent.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tppi/freeswitch2/f790d22a468ee21f9f3b499c95e53123519afa8e/mod/src/mod/applications/mod_test/test/sounds/agent.wav -------------------------------------------------------------------------------- /mod/src/mod/applications/mod_test/test/sounds/hi.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tppi/freeswitch2/f790d22a468ee21f9f3b499c95e53123519afa8e/mod/src/mod/applications/mod_test/test/sounds/hi.wav -------------------------------------------------------------------------------- /mod/src/mod/applications/mod_test/test/sounds/ivr-please_state_your_name_and_reason_for_calling.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tppi/freeswitch2/f790d22a468ee21f9f3b499c95e53123519afa8e/mod/src/mod/applications/mod_test/test/sounds/ivr-please_state_your_name_and_reason_for_calling.wav -------------------------------------------------------------------------------- /mod/src/mod/applications/mod_test/test/sounds/test.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tppi/freeswitch2/f790d22a468ee21f9f3b499c95e53123519afa8e/mod/src/mod/applications/mod_test/test/sounds/test.wav -------------------------------------------------------------------------------- /mod/src/mod/applications/mod_test/test/sounds/test_agent.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tppi/freeswitch2/f790d22a468ee21f9f3b499c95e53123519afa8e/mod/src/mod/applications/mod_test/test/sounds/test_agent.wav -------------------------------------------------------------------------------- /mod/src/mod/applications/mod_test/test/test_tts.c: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application 3 | * Copyright (C) 2005-2020, Anthony Minessale II 4 | * 5 | * Version: MPL 1.1 6 | * 7 | * The contents of this file are subject to the Mozilla Public License Version 8 | * 1.1 (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * http://www.mozilla.org/MPL/ 11 | * 12 | * Software distributed under the License is distributed on an "AS IS" basis, 13 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 14 | * for the specific language governing rights and limitations under the 15 | * License. 16 | * 17 | * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application 18 | * 19 | * The Initial Developer of the Original Code is 20 | * Anthony Minessale II 21 | * Portions created by the Initial Developer are Copyright (C) 22 | * the Initial Developer. All Rights Reserved. 23 | * 24 | * Contributor(s): 25 | * Seven Du 26 | * 27 | * 28 | * test_tts.c -- tests for mock test tts interface 29 | * 30 | */ 31 | #include 32 | #include 33 | 34 | FST_CORE_BEGIN(".") 35 | 36 | FST_MODULE_BEGIN(mod_test, test_asr) 37 | 38 | FST_SETUP_BEGIN() 39 | { 40 | fst_requires_module("mod_tone_stream"); 41 | fst_requires_module("mod_sndfile"); 42 | fst_requires_module("mod_dptools"); 43 | } 44 | FST_SETUP_END() 45 | 46 | FST_TEARDOWN_BEGIN() 47 | { 48 | } 49 | FST_TEARDOWN_END() 50 | 51 | 52 | FST_TEST_BEGIN(tts_8000) 53 | { 54 | switch_speech_handle_t sh = { 0 }; 55 | switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE; 56 | switch_status_t status; 57 | int sample_rate = 8000; 58 | int interval = 20; 59 | uint8_t data[320]; 60 | size_t datalen = sizeof(data); 61 | int read = 0; 62 | 63 | status = switch_core_speech_open(&sh, "test", "default", sample_rate, interval, 1, &flags, NULL); 64 | fst_requires(status == SWITCH_STATUS_SUCCESS); 65 | status = switch_core_speech_feed_tts(&sh, "text", &flags); 66 | fst_requires(status == SWITCH_STATUS_SUCCESS); 67 | do { 68 | status = switch_core_speech_read_tts(&sh, data, &datalen, &flags); 69 | read++; 70 | } while (status == SWITCH_STATUS_SUCCESS); 71 | 72 | fst_check(read = sample_rate / interval); // samples of 1 second 73 | switch_core_speech_close(&sh, &flags); 74 | } 75 | FST_TEST_END() 76 | 77 | FST_TEST_BEGIN(tts_48000) 78 | { 79 | switch_speech_handle_t sh = { 0 }; 80 | switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE; 81 | switch_status_t status; 82 | int sample_rate = 48000; 83 | int interval = 20; 84 | uint8_t data[320]; 85 | size_t datalen = sizeof(data); 86 | int read = 0; 87 | 88 | status = switch_core_speech_open(&sh, "test", "default", sample_rate, interval, 1, &flags, NULL); 89 | fst_requires(status == SWITCH_STATUS_SUCCESS); 90 | status = switch_core_speech_feed_tts(&sh, "text", &flags); 91 | fst_requires(status == SWITCH_STATUS_SUCCESS); 92 | do { 93 | status = switch_core_speech_read_tts(&sh, data, &datalen, &flags); 94 | read++; 95 | } while (status == SWITCH_STATUS_SUCCESS); 96 | 97 | fst_check(read = sample_rate / interval); // samples of 1 second 98 | switch_core_speech_close(&sh, &flags); 99 | } 100 | FST_TEST_END() 101 | 102 | FST_TEST_BEGIN(tts_48000_2) 103 | { 104 | switch_speech_handle_t sh = { 0 }; 105 | switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE; 106 | switch_status_t status; 107 | int sample_rate = 48000; 108 | int interval = 20; 109 | uint8_t data[320]; 110 | size_t datalen = sizeof(data); 111 | int read = 0; 112 | 113 | status = switch_core_speech_open(&sh, "test", "default", sample_rate, interval, 2, &flags, NULL); 114 | fst_requires(status == SWITCH_STATUS_SUCCESS); 115 | status = switch_core_speech_feed_tts(&sh, "text", &flags); 116 | fst_requires(status == SWITCH_STATUS_SUCCESS); 117 | do { 118 | status = switch_core_speech_read_tts(&sh, data, &datalen, &flags); 119 | read++; 120 | } while (status == SWITCH_STATUS_SUCCESS); 121 | 122 | fst_check(read = sample_rate / interval); // samples of 1 second 123 | switch_core_speech_close(&sh, &flags); 124 | } 125 | FST_TEST_END() 126 | 127 | FST_TEST_BEGIN(tts_time) 128 | { 129 | switch_speech_handle_t sh = { 0 }; 130 | switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE; 131 | switch_status_t status; 132 | int sample_rate = 8000; 133 | int interval = 20; 134 | uint8_t data[320]; 135 | size_t datalen = sizeof(data); 136 | int read = 0; 137 | 138 | status = switch_core_speech_open(&sh, "test", "default", sample_rate, interval, 1, &flags, NULL); 139 | fst_requires(status == SWITCH_STATUS_SUCCESS); 140 | status = switch_core_speech_feed_tts(&sh, "silence://3000", &flags); 141 | fst_requires(status == SWITCH_STATUS_SUCCESS); 142 | do { 143 | status = switch_core_speech_read_tts(&sh, data, &datalen, &flags); 144 | read++; 145 | switch_yield(interval * 1000); 146 | } while (status == SWITCH_STATUS_SUCCESS); 147 | 148 | fst_check(read = sample_rate / interval * 3); // samples of 3 second 149 | fst_check_duration(3000, 500); 150 | switch_core_speech_close(&sh, &flags); 151 | } 152 | FST_TEST_END() 153 | 154 | FST_TEST_BEGIN(unload_test) 155 | { 156 | const char *err = NULL; 157 | switch_sleep(1000000); 158 | fst_check(switch_loadable_module_unload_module(SWITCH_GLOBAL_dirs.mod_dir, (char *)"mod_test", SWITCH_FALSE, &err) == SWITCH_STATUS_SUCCESS); 159 | } 160 | FST_TEST_END() 161 | 162 | 163 | FST_MODULE_END() 164 | 165 | FST_CORE_END() 166 | -------------------------------------------------------------------------------- /mod/src/mod/applications/mod_video_filter/Makefile.am: -------------------------------------------------------------------------------- 1 | include $(top_srcdir)/build/modmake.rulesam 2 | MODNAME=mod_video_filter 3 | 4 | mod_LTLIBRARIES = mod_video_filter.la 5 | mod_video_filter_la_SOURCES = mod_video_filter.c 6 | mod_video_filter_la_CFLAGS = $(AM_CFLAGS) 7 | mod_video_filter_la_LIBADD = $(switch_builddir)/libfreeswitch.la 8 | mod_video_filter_la_LDFLAGS = -avoid-version -module -no-undefined -shared -lm -lz 9 | -------------------------------------------------------------------------------- /mod/src/mod/codecs/mod_b64/Makefile.am: -------------------------------------------------------------------------------- 1 | include $(top_srcdir)/build/modmake.rulesam 2 | MODNAME=mod_b64 3 | 4 | mod_LTLIBRARIES = mod_b64.la 5 | mod_b64_la_SOURCES = mod_b64.c 6 | mod_b64_la_CFLAGS = $(AM_CFLAGS) 7 | mod_b64_la_LIBADD = $(switch_builddir)/libfreeswitch.la 8 | mod_b64_la_LDFLAGS = -avoid-version -module -no-undefined -shared 9 | -------------------------------------------------------------------------------- /mod/src/mod/codecs/mod_h26x/Makefile.am: -------------------------------------------------------------------------------- 1 | include $(top_srcdir)/build/modmake.rulesam 2 | MODNAME=mod_h26x 3 | 4 | mod_LTLIBRARIES = mod_h26x.la 5 | mod_h26x_la_SOURCES = mod_h26x.c 6 | mod_h26x_la_CFLAGS = $(AM_CFLAGS) 7 | mod_h26x_la_LIBADD = $(switch_builddir)/libfreeswitch.la 8 | mod_h26x_la_LDFLAGS = -avoid-version -module -no-undefined -shared 9 | -------------------------------------------------------------------------------- /mod/src/mod/codecs/mod_h26x/mod_h26x.c: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application 3 | * Copyright (C) 2005-2014, Anthony Minessale II 4 | * 5 | * Version: MPL 1.1 6 | * 7 | * The contents of this file are subject to the Mozilla Public License Version 8 | * 1.1 (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * http://www.mozilla.org/MPL/ 11 | * 12 | * Software distributed under the License is distributed on an "AS IS" basis, 13 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 14 | * for the specific language governing rights and limitations under the 15 | * License. 16 | * 17 | * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application 18 | * 19 | * The Initial Developer of the Original Code is 20 | * Anthony Minessale II 21 | * Portions created by the Initial Developer are Copyright (C) 22 | * the Initial Developer. All Rights Reserved. 23 | * 24 | * Contributor(s): 25 | * 26 | * Anthony Minessale II 27 | * 28 | * 29 | * mod_h26x.c -- H26X Signed Linear Codec 30 | * 31 | */ 32 | 33 | #include 34 | 35 | SWITCH_MODULE_LOAD_FUNCTION(mod_h26x_load); 36 | SWITCH_MODULE_DEFINITION(mod_h26x, mod_h26x_load, NULL, NULL); 37 | 38 | static switch_status_t switch_h26x_init(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings) 39 | { 40 | int encoding, decoding; 41 | 42 | encoding = (flags & SWITCH_CODEC_FLAG_ENCODE); 43 | decoding = (flags & SWITCH_CODEC_FLAG_DECODE); 44 | 45 | if (!(encoding || decoding)) { 46 | return SWITCH_STATUS_FALSE; 47 | } else { 48 | if (codec->fmtp_in) { 49 | codec->fmtp_out = switch_core_strdup(codec->memory_pool, codec->fmtp_in); 50 | } 51 | return SWITCH_STATUS_SUCCESS; 52 | } 53 | } 54 | 55 | static switch_status_t switch_h26x_encode(switch_codec_t *codec, 56 | switch_codec_t *other_codec, 57 | void *decoded_data, 58 | uint32_t decoded_data_len, 59 | uint32_t decoded_rate, void *encoded_data, uint32_t *encoded_data_len, uint32_t *encoded_rate, 60 | unsigned int *flag) 61 | { 62 | return SWITCH_STATUS_FALSE; 63 | } 64 | 65 | static switch_status_t switch_h26x_decode(switch_codec_t *codec, 66 | switch_codec_t *other_codec, 67 | void *encoded_data, 68 | uint32_t encoded_data_len, 69 | uint32_t encoded_rate, void *decoded_data, uint32_t *decoded_data_len, uint32_t *decoded_rate, 70 | unsigned int *flag) 71 | { 72 | return SWITCH_STATUS_FALSE; 73 | } 74 | 75 | static switch_status_t switch_h26x_destroy(switch_codec_t *codec) 76 | { 77 | return SWITCH_STATUS_SUCCESS; 78 | } 79 | 80 | SWITCH_MODULE_LOAD_FUNCTION(mod_h26x_load) 81 | { 82 | switch_codec_interface_t *codec_interface; 83 | /* connect my internal structure to the blank pointer passed to me */ 84 | *module_interface = switch_loadable_module_create_module_interface(pool, modname); 85 | SWITCH_ADD_CODEC(codec_interface, "H.264 Video (passthru)"); 86 | switch_core_codec_add_implementation(pool, codec_interface, 87 | SWITCH_CODEC_TYPE_VIDEO, 97, "H264", NULL, 90000, 90000, 0, 88 | 0, 0, 0, 0, 1, 1, switch_h26x_init, switch_h26x_encode, switch_h26x_decode, switch_h26x_destroy); 89 | SWITCH_ADD_CODEC(codec_interface, "H.263 Video (passthru)"); 90 | switch_core_codec_add_implementation(pool, codec_interface, 91 | SWITCH_CODEC_TYPE_VIDEO, 34, "H263", NULL, 90000, 90000, 0, 92 | 0, 0, 0, 0, 1, 1, switch_h26x_init, switch_h26x_encode, switch_h26x_decode, switch_h26x_destroy); 93 | SWITCH_ADD_CODEC(codec_interface, "H.263+ Video (passthru)"); 94 | switch_core_codec_add_implementation(pool, codec_interface, 95 | SWITCH_CODEC_TYPE_VIDEO, 115, "H263-1998", NULL, 90000, 90000, 0, 96 | 0, 0, 0, 0, 1, 1, switch_h26x_init, switch_h26x_encode, switch_h26x_decode, switch_h26x_destroy); 97 | SWITCH_ADD_CODEC(codec_interface, "H.263++ Video (passthru)"); 98 | switch_core_codec_add_implementation(pool, codec_interface, 99 | SWITCH_CODEC_TYPE_VIDEO, 121, "H263-2000", NULL, 90000, 90000, 0, 100 | 0, 0, 0, 0, 1, 1, switch_h26x_init, switch_h26x_encode, switch_h26x_decode, switch_h26x_destroy); 101 | SWITCH_ADD_CODEC(codec_interface, "H.261 Video (passthru)"); 102 | switch_core_codec_add_implementation(pool, codec_interface, 103 | SWITCH_CODEC_TYPE_VIDEO, 31, "H261", NULL, 90000, 90000, 0, 104 | 0, 0, 0, 0, 1, 1, switch_h26x_init, switch_h26x_encode, switch_h26x_decode, switch_h26x_destroy); 105 | /* indicate that the module should continue to be loaded */ 106 | return SWITCH_STATUS_SUCCESS; 107 | } 108 | 109 | /* For Emacs: 110 | * Local Variables: 111 | * mode:c 112 | * indent-tabs-mode:t 113 | * tab-width:4 114 | * c-basic-offset:4 115 | * End: 116 | * For VIM: 117 | * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet: 118 | */ 119 | -------------------------------------------------------------------------------- /mod/src/mod/codecs/mod_openh264/Makefile.am: -------------------------------------------------------------------------------- 1 | include $(top_srcdir)/build/modmake.rulesam 2 | MODNAME=mod_openh264 3 | 4 | OPENH264_DIR=/usr/local/ 5 | 6 | mod_LTLIBRARIES = mod_openh264.la 7 | mod_openh264_la_SOURCES = mod_openh264.cpp 8 | mod_openh264_la_CXXFLAGS = $(AM_CXXFLAGS) -I$(OPENH264_DIR)/include/wels 9 | mod_openh264_la_LIBADD = $(switch_builddir)/libfreeswitch.la 10 | mod_openh264_la_LDFLAGS = -L$(OPENH264_DIR)/lib/ -lopenh264 -avoid-version -module -no-undefined -shared 11 | 12 | noinst_LTLIBRARIES = libmodopenh264.la 13 | 14 | libmodopenh264_la_SOURCES = $(mod_openh264_la_SOURCES) 15 | libmodopenh264_la_CXXFLAGS = $(AM_CXXFLAGS) -I$(OPENH264_DIR)/include/wels 16 | 17 | noinst_PROGRAMS = test/test_mod_openh264 18 | test_test_mod_openh264_SOURCES = test/test_mod_openh264.cpp 19 | test_test_mod_openh264_CXXFLAGS = $(AM_CXXFLAGS) -I. 20 | test_test_mod_openh264_LDFLAGS = -L$(OPENH264_DIR)/lib/ -lopenh264 -avoid-version -module 21 | test_test_mod_openh264_LDADD = libmodopenh264.la $(switch_builddir)/libfreeswitch.la 22 | 23 | TESTS = $(noinst_PROGRAMS) 24 | -------------------------------------------------------------------------------- /mod/src/mod/codecs/mod_openh264/test/conf/freeswitch.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 |
30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |
39 | -------------------------------------------------------------------------------- /mod/src/mod/codecs/mod_openh264/test/data/case1.packet1.264: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tppi/freeswitch2/f790d22a468ee21f9f3b499c95e53123519afa8e/mod/src/mod/codecs/mod_openh264/test/data/case1.packet1.264 -------------------------------------------------------------------------------- /mod/src/mod/codecs/mod_openh264/test/data/case1.packet2.264: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tppi/freeswitch2/f790d22a468ee21f9f3b499c95e53123519afa8e/mod/src/mod/codecs/mod_openh264/test/data/case1.packet2.264 -------------------------------------------------------------------------------- /mod/src/mod/codecs/mod_openh264/test/data/case1.packet3.264: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tppi/freeswitch2/f790d22a468ee21f9f3b499c95e53123519afa8e/mod/src/mod/codecs/mod_openh264/test/data/case1.packet3.264 -------------------------------------------------------------------------------- /mod/src/mod/codecs/mod_openh264/test/data/case1.packet4.264: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tppi/freeswitch2/f790d22a468ee21f9f3b499c95e53123519afa8e/mod/src/mod/codecs/mod_openh264/test/data/case1.packet4.264 -------------------------------------------------------------------------------- /mod/src/mod/codecs/mod_openh264/test/data/case1.packet5.264: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tppi/freeswitch2/f790d22a468ee21f9f3b499c95e53123519afa8e/mod/src/mod/codecs/mod_openh264/test/data/case1.packet5.264 -------------------------------------------------------------------------------- /mod/src/mod/codecs/mod_openh264/test/data/case2.packet1.264: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tppi/freeswitch2/f790d22a468ee21f9f3b499c95e53123519afa8e/mod/src/mod/codecs/mod_openh264/test/data/case2.packet1.264 -------------------------------------------------------------------------------- /mod/src/mod/codecs/mod_openh264/test/data/case2.packet2.264: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tppi/freeswitch2/f790d22a468ee21f9f3b499c95e53123519afa8e/mod/src/mod/codecs/mod_openh264/test/data/case2.packet2.264 -------------------------------------------------------------------------------- /mod/src/mod/codecs/mod_openh264/test/data/case2.packet3.264: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tppi/freeswitch2/f790d22a468ee21f9f3b499c95e53123519afa8e/mod/src/mod/codecs/mod_openh264/test/data/case2.packet3.264 -------------------------------------------------------------------------------- /mod/src/mod/codecs/mod_openh264/test/data/case2.packet4.264: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tppi/freeswitch2/f790d22a468ee21f9f3b499c95e53123519afa8e/mod/src/mod/codecs/mod_openh264/test/data/case2.packet4.264 -------------------------------------------------------------------------------- /mod/src/mod/codecs/mod_yuv/mod_yuv.c: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application 3 | * Copyright (C) 2005-2014, Anthony Minessale II 4 | * 5 | * Version: MPL 1.1 6 | * 7 | * The contents of this file are subject to the Mozilla Public License Version 8 | * 1.1 (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * http://www.mozilla.org/MPL/ 11 | * 12 | * Software distributed under the License is distributed on an "AS IS" basis, 13 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 14 | * for the specific language governing rights and limitations under the 15 | * License. 16 | * 17 | * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application 18 | * 19 | * The Initial Developer of the Original Code is 20 | * Seven Du 21 | * Portions created by the Initial Developer are Copyright (C) 22 | * the Initial Developer. All Rights Reserved. 23 | * 24 | * Contributor(s): 25 | * 26 | * 27 | * mod_yuv.c -- YUV (raw) Video Codec 28 | * 29 | */ 30 | 31 | #include 32 | 33 | SWITCH_MODULE_LOAD_FUNCTION(mod_yuv_load); 34 | SWITCH_MODULE_DEFINITION(mod_yuv, mod_yuv_load, NULL, NULL); 35 | 36 | static switch_status_t switch_yuv_init(switch_codec_t *codec, switch_codec_flag_t flags, const switch_codec_settings_t *codec_settings) 37 | { 38 | int encoding, decoding; 39 | 40 | encoding = (flags & SWITCH_CODEC_FLAG_ENCODE); 41 | decoding = (flags & SWITCH_CODEC_FLAG_DECODE); 42 | 43 | if (!(encoding || decoding)) { 44 | return SWITCH_STATUS_FALSE; 45 | } else { 46 | if (codec->fmtp_in) { 47 | codec->fmtp_out = switch_core_strdup(codec->memory_pool, codec->fmtp_in); 48 | } 49 | return SWITCH_STATUS_SUCCESS; 50 | } 51 | } 52 | 53 | static switch_status_t switch_yuv_encode(switch_codec_t *codec, switch_frame_t *frame) 54 | { 55 | /* yuv encode is unclear, so return 0 for now */ 56 | frame->datalen = 0; 57 | frame->m = 1; 58 | return SWITCH_STATUS_SUCCESS; 59 | } 60 | 61 | static switch_status_t switch_yuv_decode(switch_codec_t *codec, switch_frame_t *frame) 62 | { 63 | switch_assert(frame); 64 | 65 | frame->img = (switch_image_t *)frame->user_data; 66 | return SWITCH_STATUS_SUCCESS; 67 | } 68 | 69 | static switch_status_t switch_yuv_destroy(switch_codec_t *codec) 70 | { 71 | return SWITCH_STATUS_SUCCESS; 72 | } 73 | 74 | SWITCH_MODULE_LOAD_FUNCTION(mod_yuv_load) 75 | { 76 | switch_codec_interface_t *codec_interface; 77 | /* connect my internal structure to the blank pointer passed to me */ 78 | *module_interface = switch_loadable_module_create_module_interface(pool, modname); 79 | SWITCH_ADD_CODEC(codec_interface, "YUV I420 Video (raw)"); 80 | 81 | switch_core_codec_add_video_implementation(pool, codec_interface, 99, "I420", NULL, 82 | switch_yuv_init, switch_yuv_encode, switch_yuv_decode, NULL, switch_yuv_destroy); 83 | 84 | /* indicate that the module should continue to be loaded */ 85 | return SWITCH_STATUS_SUCCESS; 86 | } 87 | 88 | /* For Emacs: 89 | * Local Variables: 90 | * mode:c 91 | * indent-tabs-mode:t 92 | * tab-width:4 93 | * c-basic-offset:4 94 | * End: 95 | * For VIM: 96 | * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet: 97 | */ 98 | -------------------------------------------------------------------------------- /mod/src/mod/dialplans/mod_dialplan_asterisk/Makefile.am: -------------------------------------------------------------------------------- 1 | include $(top_srcdir)/build/modmake.rulesam 2 | MODNAME=mod_dialplan_asterisk 3 | 4 | mod_LTLIBRARIES = mod_dialplan_asterisk.la 5 | mod_dialplan_asterisk_la_SOURCES = mod_dialplan_asterisk.c 6 | mod_dialplan_asterisk_la_CFLAGS = $(AM_CFLAGS) 7 | mod_dialplan_asterisk_la_LIBADD = $(switch_builddir)/libfreeswitch.la 8 | mod_dialplan_asterisk_la_LDFLAGS = -avoid-version -module -no-undefined -shared 9 | -------------------------------------------------------------------------------- /mod/src/mod/dialplans/mod_dialplan_asterisk/conf/extensions.conf: -------------------------------------------------------------------------------- 1 | [default] 2 | 3 | ; Things you're used to.... 4 | exten => music,n,Dial(SIP/1234@conference.freeswitch.org|120) 5 | 6 | exten => _1XXXXX,n,set(cool=${EXTEN}) 7 | exten => _1XXXXX,n,set(myvar=true) 8 | exten => _1XXXXX,n,Goto(default|music) 9 | exten => 2137991400/1000,n,Goto(default|music) 10 | 11 | 12 | ; Some new magic you can do.... 13 | exten => ~^(18(0{2}|8{2}|7{2}|6{2})\d{7})$,n,enum($1) 14 | exten => ~^(18(0{2}|8{2}|7{2}|6{2})\d{7})$,n,bridge(${enum_auto_route}) 15 | 16 | ; instead of exten, put anything about the call you would rather match on. 17 | ; either the names of a field in caller_profile or a string of variables to expand. 18 | caller_id_number => 2137991400,n,Goto(default|music) 19 | ${sip_from_user} => bill,n,Goto(default|music) 20 | 21 | 22 | -------------------------------------------------------------------------------- /mod/src/mod/dialplans/mod_dialplan_directory/Makefile.am: -------------------------------------------------------------------------------- 1 | include $(top_srcdir)/build/modmake.rulesam 2 | MODNAME=mod_dialplan_directory 3 | 4 | mod_LTLIBRARIES = mod_dialplan_directory.la 5 | mod_dialplan_directory_la_SOURCES = mod_dialplan_directory.c 6 | mod_dialplan_directory_la_CFLAGS = $(AM_CFLAGS) 7 | mod_dialplan_directory_la_LIBADD = $(switch_builddir)/libfreeswitch.la 8 | mod_dialplan_directory_la_LDFLAGS = -avoid-version -module -no-undefined -shared 9 | -------------------------------------------------------------------------------- /mod/src/mod/dialplans/mod_dialplan_xml/Makefile.am: -------------------------------------------------------------------------------- 1 | include $(top_srcdir)/build/modmake.rulesam 2 | MODNAME=mod_dialplan_xml 3 | 4 | mod_LTLIBRARIES = mod_dialplan_xml.la 5 | mod_dialplan_xml_la_SOURCES = mod_dialplan_xml.c 6 | mod_dialplan_xml_la_CFLAGS = $(AM_CFLAGS) 7 | mod_dialplan_xml_la_LIBADD = $(switch_builddir)/libfreeswitch.la 8 | mod_dialplan_xml_la_LDFLAGS = -avoid-version -module -no-undefined -shared 9 | -------------------------------------------------------------------------------- /mod/src/mod/endpoints/mod_alsa/Makefile.am: -------------------------------------------------------------------------------- 1 | include $(top_srcdir)/build/modmake.rulesam 2 | MODNAME=mod_alsa 3 | 4 | mod_LTLIBRARIES = mod_alsa.la 5 | mod_alsa_la_SOURCES = mod_alsa.c 6 | mod_alsa_la_CFLAGS = $(AM_CFLAGS) -I. -D__EXTENSION__=1 7 | mod_alsa_la_LIBADD = $(switch_builddir)/libfreeswitch.la 8 | mod_alsa_la_LDFLAGS = -avoid-version -module -no-undefined -shared -lasound 9 | -------------------------------------------------------------------------------- /mod/src/mod/endpoints/mod_alsa/conf/autoload_configs/alsa.conf.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /mod/src/mod/endpoints/mod_loopback/Makefile.am: -------------------------------------------------------------------------------- 1 | include $(top_srcdir)/build/modmake.rulesam 2 | MODNAME=mod_loopback 3 | 4 | mod_LTLIBRARIES = mod_loopback.la 5 | mod_loopback_la_SOURCES = mod_loopback.c 6 | mod_loopback_la_CFLAGS = $(AM_CFLAGS) 7 | mod_loopback_la_LIBADD = $(switch_builddir)/libfreeswitch.la 8 | mod_loopback_la_LDFLAGS = -avoid-version -module -no-undefined -shared 9 | -------------------------------------------------------------------------------- /mod/src/mod/endpoints/mod_rtc/Makefile.am: -------------------------------------------------------------------------------- 1 | include $(top_srcdir)/build/modmake.rulesam 2 | MODNAME=mod_rtc 3 | 4 | mod_LTLIBRARIES = mod_rtc.la 5 | mod_rtc_la_SOURCES = mod_rtc.c 6 | mod_rtc_la_CFLAGS = $(AM_CFLAGS) 7 | mod_rtc_la_LIBADD = $(switch_builddir)/libfreeswitch.la 8 | mod_rtc_la_LDFLAGS = -avoid-version -module -no-undefined -shared 9 | -------------------------------------------------------------------------------- /mod/src/mod/endpoints/mod_rtmp/Makefile.am: -------------------------------------------------------------------------------- 1 | include $(top_srcdir)/build/modmake.rulesam 2 | MODNAME=mod_rtmp 3 | mod_LTLIBRARIES = mod_rtmp.la 4 | mod_rtmp_la_SOURCES = mod_rtmp.c rtmp_sig.c rtmp.c rtmp_tcp.c rtmp_video.c 5 | mod_rtmp_la_SOURCES += libamf/src/amf0.c libamf/src/hash.c libamf/src/io.c libamf/src/ptrarray.c libamf/src/types.c 6 | mod_rtmp_la_CFLAGS = $(AM_CFLAGS) -Ilibamf/src -I$(abs_srcdir)/libamf/src 7 | mod_rtmp_la_LIBADD = $(switch_builddir)/libfreeswitch.la 8 | mod_rtmp_la_LDFLAGS = -avoid-version -module -no-undefined -shared 9 | -------------------------------------------------------------------------------- /mod/src/mod/endpoints/mod_rtmp/conf/autoload_configs/rtmp.conf.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /mod/src/mod/endpoints/mod_rtmp/libamf/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.6) 2 | project(libamf C) 3 | 4 | # generic variables 5 | set(PACKAGE "libamf") 6 | set(PACKAGE_NAME ${PACKAGE}) 7 | set(PACKAGE_BUGREPORT "libamf@sf.net") 8 | set(PACKAGE_VERSION "0.1.0") 9 | set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") 10 | 11 | #platform tests 12 | include(CheckFunctionExists) 13 | include(CheckIncludeFile) 14 | include(CheckTypeSize) 15 | include(TestBigEndian) 16 | 17 | check_include_file(sys/types.h HAVE_SYS_TYPES_H) 18 | check_include_file(stdint.h HAVE_STDINT_H) 19 | check_include_file(stddef.h HAVE_STDDEF_H) 20 | check_include_file(inttypes.h HAVE_INTTYPES_H) 21 | 22 | check_type_size("double" SIZEOF_DOUBLE) 23 | check_type_size("float" SIZEOF_FLOAT) 24 | check_type_size("long double" SIZEOF_LONG_DOUBLE) 25 | 26 | if(WIN32) 27 | set(int16_t 1) 28 | set(int32_t 1) 29 | set(int64_t 1) 30 | set(int8_t 1) 31 | set(uint16_t 1) 32 | set(uint32_t 1) 33 | set(uint64_t 1) 34 | set(uint8_t 1) 35 | endif(WIN32) 36 | 37 | test_big_endian(IS_BIGENDIAN) 38 | if(IS_BIGENDIAN) 39 | set(WORDS_BIGENDIAN 1) 40 | endif(IS_BIGENDIAN) 41 | 42 | # configuration file 43 | configure_file(amf-cmake.h.in ${CMAKE_BINARY_DIR}/amf.h) 44 | include_directories(${CMAKE_BINARY_DIR}) 45 | 46 | install( 47 | FILES ${CMAKE_BINARY_DIR}/amf.h 48 | DESTINATION include/amf 49 | ) 50 | 51 | # Visual C++ specific configuration 52 | if(MSVC) 53 | # use static library 54 | set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MT") 55 | 56 | # C runtime deprecation in Visual C++ 2005 and later 57 | add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE) 58 | endif(MSVC) 59 | 60 | add_subdirectory(src) 61 | 62 | # tests 63 | enable_testing() 64 | add_subdirectory(tests) 65 | -------------------------------------------------------------------------------- /mod/src/mod/endpoints/mod_rtmp/libamf/amf-cmake.h.in: -------------------------------------------------------------------------------- 1 | #ifndef __AMF_H__ 2 | #define __AMF_H__ 3 | 4 | /* Name of package */ 5 | #define PACKAGE "@PACKAGE@" 6 | 7 | /* Define to the address where bug reports for this package should be sent. */ 8 | #define PACKAGE_BUGREPORT "@PACKAGE_BUGREPORT@" 9 | 10 | /* Define to the full name of this package. */ 11 | #define PACKAGE_NAME "@PACKAGE_NAME@" 12 | 13 | /* Define to the full name and version of this package. */ 14 | #define PACKAGE_STRING "@PACKAGE_STRING@" 15 | 16 | /* Define to the one symbol short name of this package. */ 17 | #define PACKAGE_TARNAME "@PACKAGE_NAME@" 18 | 19 | /* Define to the version of this package. */ 20 | #define PACKAGE_VERSION "@PACKAGE_VERSION@" 21 | 22 | /* The size of `double', as computed by sizeof. */ 23 | #define SIZEOF_DOUBLE @SIZEOF_DOUBLE@ 24 | 25 | /* The size of `float', as computed by sizeof. */ 26 | #define SIZEOF_FLOAT @SIZEOF_FLOAT@ 27 | 28 | /* The size of `long double', as computed by sizeof. */ 29 | #define SIZEOF_LONG_DOUBLE @SIZEOF_LONG_DOUBLE@ 30 | 31 | /* Version number of package */ 32 | #define VERSION "@PACKAGE_VERSION@" 33 | 34 | /* Define to 1 if you have the header file. */ 35 | #cmakedefine HAVE_SYS_TYPES_H 36 | 37 | /* Define to 1 if you have the header file. */ 38 | #cmakedefine HAVE_STDINT_H 39 | 40 | /* Define to 1 if you have the header file. */ 41 | #cmakedefine HAVE_STDDEF_H 42 | 43 | /* Define to 1 if you have the header file. */ 44 | #cmakedefine HAVE_INTTYPES_H 45 | 46 | /* Define to 1 if your processor stores words with the most significant byte 47 | first (like Motorola and SPARC, unlike Intel and VAX). */ 48 | #cmakedefine WORDS_BIGENDIAN 49 | 50 | /* Define to the type of an integer type of width exactly 16 bits if 51 | such a type exists and the standard includes do not define it. */ 52 | #cmakedefine int16_t short int 53 | 54 | /* Define to the type of an integer type of width exactly 32 bits if 55 | such a type exists and the standard includes do not define it. */ 56 | #cmakedefine int32_t int 57 | 58 | /* Define to the type of an integer type of width exactly 64 bits if 59 | such a type exists and the standard includes do not define it. */ 60 | #cmakedefine int64_t long long int 61 | 62 | /* Define to the type of an integer type of width exactly 8 bits if 63 | such a type exists and the standard includes do not define it. */ 64 | #cmakedefine int8_t char 65 | 66 | /* Define to the type of an unsigned integer type of width exactly 16 bits if 67 | such a type exists and the standard includes do not define it. */ 68 | #cmakedefine uint16_t unsigned short int 69 | 70 | /* Define to the type of an unsigned integer type of width exactly 32 bits if 71 | such a type exists and the standard includes do not define it. */ 72 | #cmakedefine uint32_t unsigned int 73 | 74 | /* Define to the type of an unsigned integer type of width exactly 64 bits if 75 | such a type exists and the standard includes do not define it. */ 76 | #cmakedefine uint64_t unsigned long long int 77 | 78 | /* Define to the type of an unsigned integer type of width exactly 8 bits if 79 | such a type exists and the standard includes do not define it. */ 80 | #cmakedefine uint8_t unsigned char 81 | 82 | #ifdef HAVE_INTTYPES_H 83 | #include 84 | #endif 85 | 86 | #include 87 | 88 | /* AMF number */ 89 | typedef 90 | #if SIZEOF_FLOAT == 8 91 | float 92 | #elif SIZEOF_DOUBLE == 8 93 | double 94 | #elif SIZEOF_LONG_DOUBLE == 8 95 | long double 96 | #else 97 | uint64_t 98 | #endif 99 | number64_t; 100 | 101 | /* custom read/write function type */ 102 | typedef size_t (*read_proc_t)(void * out_buffer, size_t size, void * user_data); 103 | typedef size_t (*write_proc_t)(const void * in_buffer, size_t size, void * user_data); 104 | 105 | #endif /* __AMF_H__ */ 106 | -------------------------------------------------------------------------------- /mod/src/mod/endpoints/mod_rtmp/libamf/src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | set(libamf_src 2 | amf0.c 3 | amf0.h 4 | hash.c 5 | hash.h 6 | io.c 7 | io.h 8 | ptrarray.c 9 | ptrarray.h 10 | types.c 11 | types.h 12 | ${CMAKE_BINARY_DIR}/amf.h 13 | ) 14 | 15 | add_library(amf ${libamf_src}) 16 | 17 | install(TARGETS amf 18 | RUNTIME DESTINATION lib 19 | ARCHIVE DESTINATION lib 20 | LIBRARY DESTINATION lib 21 | ) 22 | 23 | install( 24 | FILES amf0.h amf3.h 25 | DESTINATION include/amf 26 | ) 27 | -------------------------------------------------------------------------------- /mod/src/mod/endpoints/mod_rtmp/libamf/src/amf.h: -------------------------------------------------------------------------------- 1 | #ifndef __AMF_H__ 2 | #define __AMF_H__ 3 | 4 | #include 5 | 6 | /* AMF number */ 7 | typedef double number64_t; 8 | 9 | /* custom read/write function type */ 10 | typedef size_t (*read_proc_t)(void * out_buffer, size_t size, void * user_data); 11 | typedef size_t (*write_proc_t)(const void * in_buffer, size_t size, void * user_data); 12 | 13 | #endif /* __AMF_H__ */ 14 | -------------------------------------------------------------------------------- /mod/src/mod/endpoints/mod_rtmp/libamf/src/amf3.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tppi/freeswitch2/f790d22a468ee21f9f3b499c95e53123519afa8e/mod/src/mod/endpoints/mod_rtmp/libamf/src/amf3.h -------------------------------------------------------------------------------- /mod/src/mod/endpoints/mod_rtmp/libamf/src/amf_list.c: -------------------------------------------------------------------------------- 1 | /* function common to all array types */ 2 | static void amf_list_init(amf_list * list) { 3 | if (list != NULL) { 4 | list->size = 0; 5 | list->first_element = NULL; 6 | list->last_element = NULL; 7 | } 8 | } 9 | 10 | static amf_data * amf_list_push(amf_list * list, amf_data * data) { 11 | amf_node * node = (amf_node*)malloc(sizeof(amf_node)); 12 | if (node != NULL) { 13 | node->data = data; 14 | node->next = NULL; 15 | node->prev = NULL; 16 | if (list->size == 0) { 17 | list->first_element = node; 18 | list->last_element = node; 19 | } 20 | else { 21 | list->last_element->next = node; 22 | node->prev = list->last_element; 23 | list->last_element = node; 24 | } 25 | ++(list->size); 26 | return data; 27 | } 28 | return NULL; 29 | } 30 | 31 | static amf_data * amf_list_insert_before(amf_list * list, amf_node * node, amf_data * data) { 32 | if (node != NULL) { 33 | amf_node * new_node = (amf_node*)malloc(sizeof(amf_node)); 34 | if (new_node != NULL) { 35 | new_node->next = node; 36 | new_node->prev = node->prev; 37 | 38 | if (node->prev != NULL) { 39 | node->prev->next = new_node; 40 | node->prev = new_node; 41 | } 42 | if (node == list->first_element) { 43 | list->first_element = new_node; 44 | } 45 | ++(list->size); 46 | new_node->data = data; 47 | return data; 48 | } 49 | } 50 | return NULL; 51 | } 52 | 53 | static amf_data * amf_list_insert_after(amf_list * list, amf_node * node, amf_data * data) { 54 | if (node != NULL) { 55 | amf_node * new_node = (amf_node*)malloc(sizeof(amf_node)); 56 | if (new_node != NULL) { 57 | new_node->next = node->next; 58 | new_node->prev = node; 59 | 60 | if (node->next != NULL) { 61 | node->next->prev = new_node; 62 | node->next = new_node; 63 | } 64 | if (node == list->last_element) { 65 | list->last_element = new_node; 66 | } 67 | ++(list->size); 68 | new_node->data = data; 69 | return data; 70 | } 71 | } 72 | return NULL; 73 | } 74 | 75 | static amf_data * amf_list_delete(amf_list * list, amf_node * node) { 76 | amf_data * data = NULL; 77 | if (node != NULL) { 78 | if (node->next != NULL) { 79 | node->next->prev = node->prev; 80 | } 81 | if (node->prev != NULL) { 82 | node->prev->next = node->next; 83 | } 84 | if (node == list->first_element) { 85 | list->first_element = node->next; 86 | } 87 | if (node == list->last_element) { 88 | list->last_element = node->prev; 89 | } 90 | data = node->data; 91 | free(node); 92 | --(list->size); 93 | } 94 | return data; 95 | } 96 | 97 | static amf_data * amf_list_get_at(amf_list * list, uint32 n) { 98 | if (n < list->size) { 99 | uint32 i; 100 | amf_node * node = list->first_element; 101 | for (i = 0; i < n; ++i) { 102 | node = node->next; 103 | } 104 | return node->data; 105 | } 106 | return NULL; 107 | } 108 | 109 | static amf_data * amf_list_pop(amf_list * list) { 110 | return amf_list_delete(list, list->last_element); 111 | } 112 | 113 | static amf_node * amf_list_first(amf_list * list) { 114 | return list->first_element; 115 | } 116 | 117 | static amf_node * amf_list_last(amf_list * list) { 118 | return list->last_element; 119 | } 120 | 121 | static void amf_list_clear(amf_list * list) { 122 | amf_node * node = list->first_element; 123 | while (node != NULL) { 124 | amf_data_free(node->data); 125 | amf_node * tmp = node; 126 | node = node->next; 127 | free(tmp); 128 | } 129 | list->size = 0; 130 | } 131 | -------------------------------------------------------------------------------- /mod/src/mod/endpoints/mod_rtmp/libamf/src/amf_list.h: -------------------------------------------------------------------------------- 1 | typedef struct __amf_list { 2 | uint32 size; 3 | p_amf_node first_element; 4 | p_amf_node last_element; 5 | } amf_list; -------------------------------------------------------------------------------- /mod/src/mod/endpoints/mod_rtmp/libamf/src/hash.h: -------------------------------------------------------------------------------- 1 | #ifndef _HASH_H_ 2 | #define _HASH_H_ 3 | 4 | /* Forward declarations of structures. */ 5 | typedef struct Hash Hash; 6 | typedef struct HashElem HashElem; 7 | 8 | /* A complete hash table is an instance of the following structure. 9 | ** The internals of this structure are intended to be opaque -- client 10 | ** code should not attempt to access or modify the fields of this structure 11 | ** directly. Change this structure only by using the routines below. 12 | ** However, many of the "procedures" and "functions" for modifying and 13 | ** accessing this structure are really macros, so we can't really make 14 | ** this structure opaque. 15 | */ 16 | struct Hash { 17 | char copyKey; /* True if copy of key made on insert */ 18 | int count; /* Number of entries in this table */ 19 | HashElem *first; /* The first element of the array */ 20 | void *(*xMalloc)(size_t); /* malloc() function to use */ 21 | void (*xFree)(void *); /* free() function to use */ 22 | int htsize; /* Number of buckets in the hash table */ 23 | struct _ht { /* the hash table */ 24 | int count; /* Number of entries with this hash */ 25 | HashElem *chain; /* Pointer to first entry with this hash */ 26 | } *ht; 27 | }; 28 | 29 | /* Each element in the hash table is an instance of the following 30 | ** structure. All elements are stored on a single doubly-linked list. 31 | ** 32 | ** Again, this structure is intended to be opaque, but it can't really 33 | ** be opaque because it is used by macros. 34 | */ 35 | struct HashElem { 36 | HashElem *next, *prev; /* Next and previous elements in the table */ 37 | void *data; /* Data associated with this element */ 38 | void *pKey; int nKey; /* Key associated with this element */ 39 | }; 40 | 41 | /* 42 | ** Access routines. To delete, insert a NULL pointer. 43 | */ 44 | Hash * HashCreate(char copyKey); 45 | Hash * HashCreateAlloc(char copyKey, void *(*xMalloc)(size_t), void (*xFree)(void *)); 46 | 47 | void HashFree(Hash*); 48 | 49 | void HashInit(Hash*, char copyKey, void *(*xMalloc)(size_t), void (*xFree)(void *)); 50 | void * HashInsert(Hash*, const void *pKey, int nKey, void *pData); 51 | void * HashFind(const Hash*, const void *pKey, int nKey); 52 | void HashClear(Hash*); 53 | 54 | void * HashInsertSz(Hash*, const char *pKey, void *pData); 55 | void * HashFindSz(const Hash*, const char *pKey); 56 | 57 | /* 58 | Element deletion macro 59 | */ 60 | #define HashDelete(H, K, N) (HashInsert(H, K, N, 0)) 61 | 62 | /* 63 | ** Macros for looping over all elements of a hash table. The idiom is 64 | ** like this: 65 | ** 66 | ** Hash h; 67 | ** HashElem *p; 68 | ** ... 69 | ** for(p=HashFirst(&h); p; p=HashNext(p)){ 70 | ** SomeStructure *pData = HashData(p); 71 | ** // do something with pData 72 | ** } 73 | */ 74 | #define HashFirst(H) ((H)->first) 75 | #define HashNext(E) ((E)->next) 76 | #define HashData(E) ((E)->data) 77 | #define HashKey(E) ((E)->pKey) 78 | #define HashKeysize(E) ((E)->nKey) 79 | 80 | /* 81 | ** Number of entries in a hash table 82 | */ 83 | #define HashCount(H) ((H)->count) 84 | 85 | 86 | /* 87 | more macros 88 | */ 89 | typedef struct Hash* hash_table; 90 | typedef struct HashElem* hash_elem; 91 | 92 | #define hash_create() (HashCreate(1)) 93 | #define hash_insert(H, K, V) (HashInsertSz(H, K, V)) 94 | #define hash_find(H, K) (HashFindSz(H, K)) 95 | #define hash_delete(H, K) (HashInsertSz(H, K, 0)) 96 | #define hash_clear(H) (HashClear(H)) 97 | #define hash_free(H) (HashFree(H)) 98 | 99 | #define hash_first(H) ((H)->first) 100 | #define hash_next(E) ((E)->next) 101 | #define hash_data(E) ((E)->data) 102 | #define hash_key(E) ((E)->pKey) 103 | #define hash_keysize(E) ((E)->nKey) 104 | 105 | #define hash_count(H) ((H)->count) 106 | 107 | #endif /* _HASH_H_ */ 108 | -------------------------------------------------------------------------------- /mod/src/mod/endpoints/mod_rtmp/libamf/src/io.c: -------------------------------------------------------------------------------- 1 | #include "io.h" 2 | 3 | #include 4 | #include 5 | 6 | /* callback function to mimic fread using a memory buffer */ 7 | size_t buffer_read(void * out_buffer, size_t size, void * user_data) { 8 | buffer_context * ctxt = (buffer_context *)user_data; 9 | if (ctxt->current_address >= ctxt->start_address && 10 | ctxt->current_address + size <= ctxt->start_address + ctxt->buffer_size) { 11 | 12 | memcpy(out_buffer, ctxt->current_address, size); 13 | ctxt->current_address += size; 14 | return size; 15 | } 16 | else { 17 | return 0; 18 | } 19 | } 20 | 21 | /* callback function to mimic fwrite using a memory buffer */ 22 | size_t buffer_write(const void * in_buffer, size_t size, void * user_data) { 23 | buffer_context * ctxt = (buffer_context *)user_data; 24 | if (ctxt->current_address >= ctxt->start_address && 25 | ctxt->current_address + size <= ctxt->start_address + ctxt->buffer_size) { 26 | 27 | memcpy(ctxt->current_address, in_buffer, size); 28 | ctxt->current_address += size; 29 | return size; 30 | } 31 | else { 32 | return 0; 33 | } 34 | } 35 | 36 | /* callback function to read data from a file stream */ 37 | size_t file_read(void * out_buffer, size_t size, void * user_data) { 38 | return fread(out_buffer, sizeof(uint8_t), size, (FILE *)user_data); 39 | } 40 | 41 | /* callback function to write data to a file stream */ 42 | size_t file_write(const void * in_buffer, size_t size, void * user_data) { 43 | return fwrite(in_buffer, sizeof(uint8_t), size, (FILE *)user_data); 44 | } 45 | -------------------------------------------------------------------------------- /mod/src/mod/endpoints/mod_rtmp/libamf/src/io.h: -------------------------------------------------------------------------------- 1 | #ifndef __IO_H__ 2 | #define __IO_H__ 3 | 4 | #include "amf.h" 5 | 6 | /* structure used to mimic a stream with a memory buffer */ 7 | typedef struct __buffer_context { 8 | uint8_t * start_address; 9 | uint8_t * current_address; 10 | size_t buffer_size; 11 | } buffer_context; 12 | 13 | #ifdef __cplusplus 14 | extern "C" { 15 | #endif /* __cplusplus */ 16 | 17 | /* callback function to mimic fread using a memory buffer */ 18 | size_t buffer_read(void * out_buffer, size_t size, void * user_data); 19 | 20 | /* callback function to mimic fwrite using a memory buffer */ 21 | size_t buffer_write(const void * in_buffer, size_t size, void * user_data); 22 | 23 | /* callback function to read data from a file stream */ 24 | size_t file_read(void * out_buffer, size_t size, void * user_data); 25 | 26 | /* callback function to write data to a file stream */ 27 | size_t file_write(const void * in_buffer, size_t size, void * user_data); 28 | 29 | #ifdef __cplusplus 30 | } 31 | #endif /* __cplusplus */ 32 | 33 | #endif /* __IO_H__ */ 34 | -------------------------------------------------------------------------------- /mod/src/mod/endpoints/mod_rtmp/libamf/src/ptrarray.c: -------------------------------------------------------------------------------- 1 | #include "ptrarray.h" 2 | #include 3 | 4 | /** 5 | Customize default capacity 6 | */ 7 | #ifndef PTRARRAY_DEFAULT_CAPACITY 8 | # define PTRARRAY_DEFAULT_CAPACITY 5 9 | #endif 10 | 11 | /** 12 | Enable array security checking 13 | */ 14 | /* #define PTRARRAY_SECURITY_CHECKS */ 15 | 16 | /** 17 | Customize memory allocation routines 18 | */ 19 | #ifndef PTRARRAY_MALLOC 20 | # define PTRARRAY_MALLOC malloc 21 | #endif 22 | 23 | #ifndef PTRARRAY_FREE 24 | # define PTRARRAY_FREE free 25 | #endif 26 | 27 | #ifndef PTRARRAY_REALLOC 28 | # define PTRARRAY_REALLOC realloc 29 | #endif 30 | 31 | /** 32 | This function doubles the current capacity 33 | of the given dynamic array. 34 | */ 35 | static int ptrarray_grow(ptrarray * array) { 36 | void * new_mem; 37 | size_t new_capacity; 38 | #ifdef PTRARRAY_SECURITY_CHECKS 39 | if (array == NULL) 40 | return; 41 | #endif 42 | new_capacity = array->capacity * 2; 43 | new_mem = PTRARRAY_REALLOC(array->data, new_capacity * sizeof(void*)); 44 | if (new_mem != NULL) { 45 | array->data = new_mem; 46 | array->capacity = new_capacity; 47 | return 1; 48 | } 49 | else { 50 | return 0; 51 | } 52 | } 53 | 54 | void ptrarray_init(ptrarray * array, size_t initial_capacity, data_free_proc free_proc) { 55 | if (free_proc == NULL) { 56 | free_proc = PTRARRAY_FREE; 57 | } 58 | array->data_free = free_proc; 59 | if (initial_capacity <= 0) { 60 | initial_capacity = PTRARRAY_DEFAULT_CAPACITY; 61 | } 62 | array->capacity = initial_capacity; 63 | array->data = PTRARRAY_MALLOC(initial_capacity * sizeof(void*)); 64 | array->size = 0; 65 | } 66 | 67 | /*size_t ptrarray_capacity(ptrarray * array) { 68 | return array->capacity; 69 | }*/ 70 | 71 | /*size_t ptrarray_size(ptrarray * array) { 72 | return array->size; 73 | }*/ 74 | 75 | /*int ptrarray_empty(ptrarray * array) { 76 | return !((array)->size); 77 | }*/ 78 | 79 | void ptrarray_reserve(ptrarray * array, size_t new_capacity) { 80 | void * new_mem; 81 | #ifdef PTRARRAY_SECURITY_CHECKS 82 | if (array == NULL) 83 | return; 84 | #endif 85 | if (new_capacity > array->capacity) { 86 | new_mem = PTRARRAY_REALLOC(array->data, new_capacity * sizeof(void*)); 87 | if (new_mem != NULL) { 88 | array->data = new_mem; 89 | array->capacity = new_capacity; 90 | } 91 | } 92 | else if (new_capacity < array->capacity) { 93 | new_capacity = (new_capacity < array->size) ? array->size : new_capacity; 94 | new_capacity = (new_capacity < PTRARRAY_DEFAULT_CAPACITY) ? PTRARRAY_DEFAULT_CAPACITY : new_capacity; 95 | new_mem = PTRARRAY_REALLOC(array->data, new_capacity * sizeof(void*)); 96 | if (new_mem != NULL) { 97 | array->data = new_mem; 98 | array->capacity = new_capacity; 99 | } 100 | } 101 | } 102 | 103 | void ptrarray_compact(ptrarray * array) { 104 | size_t new_capacity; 105 | void * new_mem; 106 | #ifdef PTRARRAY_SECURITY_CHECKS 107 | if (array == NULL) 108 | return; 109 | #endif 110 | new_capacity = (array->size < PTRARRAY_DEFAULT_CAPACITY) ? PTRARRAY_DEFAULT_CAPACITY : array->size; 111 | new_mem = PTRARRAY_REALLOC(array->data, new_capacity * sizeof(void*)); 112 | if (new_mem != NULL) { 113 | array->data = new_mem; 114 | array->capacity = new_capacity; 115 | } 116 | } 117 | 118 | void ptrarray_push(ptrarray * array, void * data) { 119 | #ifdef PTRARRAY_SECURITY_CHECKS 120 | if (array == NULL) 121 | return; 122 | #endif 123 | if (array->size == array->capacity) { 124 | if (!ptrarray_grow(array)) { 125 | return; 126 | } 127 | } 128 | array->data[array->size++] = data; 129 | } 130 | 131 | void * ptrarray_pop(ptrarray * array) { 132 | #ifdef PTRARRAY_SECURITY_CHECKS 133 | if (array == NULL) 134 | return NULL; 135 | #endif 136 | if (ptrarray_empty(array)) { 137 | return NULL; 138 | } 139 | return array->data[array->size--]; 140 | } 141 | 142 | void ptrarray_insert(ptrarray * array, size_t position, void * data) { 143 | void ** src_pos; 144 | 145 | #ifdef PTRARRAY_SECURITY_CHECKS 146 | if (array == NULL) 147 | return; 148 | #endif 149 | if (array->size > position) { 150 | if (array->size == array->capacity) { 151 | if (!ptrarray_grow(array)) { 152 | return; 153 | } 154 | } 155 | src_pos = array->data + position; 156 | memmove(src_pos + 1, src_pos, array->size - position); 157 | *src_pos = data; 158 | } 159 | } 160 | 161 | void ptrarray_prepend(ptrarray * array, void * data); 162 | void * ptrarray_replace(ptrarray * array, size_t position, void * data); 163 | 164 | void * ptrarray_remove(ptrarray * array, size_t position); 165 | void ptrarray_clear(ptrarray * array); 166 | 167 | void * ptrarray_first(ptrarray * array); 168 | void * ptrarray_last(ptrarray * array); 169 | void * ptrarray_get(size_t position); 170 | 171 | void ptrarray_destroy(ptrarray * array) { 172 | } 173 | -------------------------------------------------------------------------------- /mod/src/mod/endpoints/mod_rtmp/libamf/src/ptrarray.h: -------------------------------------------------------------------------------- 1 | #ifndef __PTRARRAY_H__ 2 | #define __PTRARRAY_H__ 3 | 4 | #include 5 | 6 | typedef void (*data_free_proc)(void *); 7 | 8 | typedef struct __ptrarray { 9 | size_t capacity; 10 | size_t size; 11 | void ** data; 12 | data_free_proc data_free; 13 | } ptrarray; 14 | 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif /* __cplusplus */ 18 | 19 | void ptrarray_init(ptrarray * array, size_t initial_capacity, data_free_proc free_proc); 20 | 21 | /*size_t ptrarray_capacity(ptrarray * array);*/ 22 | #define ptrarray_capacity(a) ((a)->capacity) 23 | 24 | /*size_t ptrarray_size(ptrarray * array);*/ 25 | #define ptrarray_size(a) ((a)->size) 26 | 27 | /*int ptrarray_empty(ptrarray * array);*/ 28 | #define ptrarray_empty(a) (!((a)->size)) 29 | 30 | void ptrarray_reserve(ptrarray * array, size_t new_capacity); 31 | void ptrarray_compact(ptrarray * array); 32 | 33 | void ptrarray_push(ptrarray * array, void * data); 34 | void * ptrarray_pop(ptrarray * array); 35 | void ptrarray_insert(ptrarray * array, size_t position, void * data); 36 | void ptrarray_prepend(ptrarray * array, void * data); 37 | void * ptrarray_replace(ptrarray * array, size_t position, void * data); 38 | 39 | void * ptrarray_remove(ptrarray * array, size_t position); 40 | void ptrarray_clear(ptrarray * array); 41 | 42 | void * ptrarray_first(ptrarray * array); 43 | void * ptrarray_last(ptrarray * array); 44 | void * ptrarray_get(size_t position); 45 | 46 | void ptrarray_destroy(ptrarray * array); 47 | 48 | #ifdef __cplusplus 49 | } 50 | #endif /* __cplusplus */ 51 | 52 | #endif /* __PTRARRAY_H__ */ 53 | -------------------------------------------------------------------------------- /mod/src/mod/endpoints/mod_rtmp/libamf/src/types.c: -------------------------------------------------------------------------------- 1 | /* 2 | $Id: types.c 1 2009-11-13 00:04:24Z noirotm $ 3 | 4 | FLV Metadata updater 5 | 6 | Copyright (C) 2007, 2008 Marc Noirot 7 | 8 | This file is part of FLVMeta. 9 | 10 | FLVMeta is free software; you can redistribute it and/or modify 11 | it under the terms of the GNU General Public License as published by 12 | the Free Software Foundation; either version 2 of the License, or 13 | (at your option) any later version. 14 | 15 | FLVMeta is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | GNU General Public License for more details. 19 | 20 | You should have received a copy of the GNU General Public License 21 | along with FLVMeta; if not, write to the Free Software 22 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 | */ 24 | 25 | #include "types.h" 26 | 27 | #ifndef WORDS_BIGENDIAN 28 | 29 | /* swap 64 bits doubles */ 30 | typedef union __convert_u { 31 | uint64_t i; 32 | number64_t f; 33 | } convert_u; 34 | 35 | number64_t swap_number64(number64_t n) { 36 | convert_u c; 37 | c.f = n; 38 | c.i = (((c.i & 0x00000000000000FFULL) << 56) | 39 | ((c.i & 0x000000000000FF00ULL) << 40) | 40 | ((c.i & 0x0000000000FF0000ULL) << 24) | 41 | ((c.i & 0x00000000FF000000ULL) << 8) | 42 | ((c.i & 0x000000FF00000000ULL) >> 8) | 43 | ((c.i & 0x0000FF0000000000ULL) >> 24) | 44 | ((c.i & 0x00FF000000000000ULL) >> 40) | 45 | ((c.i & 0xFF00000000000000ULL) >> 56)); 46 | return c.f; 47 | } 48 | #endif /* !WORDS_BIGENDIAN */ 49 | -------------------------------------------------------------------------------- /mod/src/mod/endpoints/mod_rtmp/libamf/src/types.h: -------------------------------------------------------------------------------- 1 | /* 2 | $Id: types.h 1 2009-11-13 00:04:24Z noirotm $ 3 | 4 | FLV Metadata updater 5 | 6 | Copyright (C) 2007, 2008 Marc Noirot 7 | 8 | This file is part of FLVMeta. 9 | 10 | FLVMeta is free software; you can redistribute it and/or modify 11 | it under the terms of the GNU General Public License as published by 12 | the Free Software Foundation; either version 2 of the License, or 13 | (at your option) any later version. 14 | 15 | FLVMeta is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | GNU General Public License for more details. 19 | 20 | You should have received a copy of the GNU General Public License 21 | along with FLVMeta; if not, write to the Free Software 22 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 | */ 24 | #ifndef __TYPES_H__ 25 | #define __TYPES_H__ 26 | 27 | #include "amf.h" 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif /* __cplusplus */ 32 | 33 | #ifdef WORDS_BIGENDIAN 34 | 35 | # define swap_uint16(x) (x) 36 | # define swap_int16(x) (x) 37 | # define swap_uint32(x) (x) 38 | # define swap_number64(x) (x) 39 | 40 | #else /* WORDS_BIGENDIAN */ 41 | /* swap 16 bits integers */ 42 | # define swap_uint16(x) ((((x) & 0x00FFU) << 8) | (((x) & 0xFF00U) >> 8)) 43 | # define swap_sint16(x) ((((x) & 0x00FF) << 8) | (((x) & 0xFF00) >> 8)) 44 | 45 | /* swap 32 bits integers */ 46 | # define swap_uint32(x) ((((x) & 0x000000FFU) << 24) | \ 47 | (((x) & 0x0000FF00U) << 8) | \ 48 | (((x) & 0x00FF0000U) >> 8) | \ 49 | (((x) & 0xFF000000U) >> 24)) 50 | 51 | /* swap 64 bits doubles */ 52 | number64_t swap_number64(number64_t); 53 | 54 | #endif /* WORDS_BIGENDIAN */ 55 | 56 | #ifdef __cplusplus 57 | } 58 | #endif /* __cplusplus */ 59 | 60 | #endif /* __TYPES_H__ */ 61 | -------------------------------------------------------------------------------- /mod/src/mod/endpoints/mod_rtmp/libamf/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories(${CMAKE_SOURCE_DIR}/src) 2 | 3 | add_executable(amf0_demo amf0_demo.c) 4 | add_dependencies(amf0_demo amf) 5 | 6 | -------------------------------------------------------------------------------- /mod/src/mod/endpoints/mod_rtmp/libamf/tests/amf0: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tppi/freeswitch2/f790d22a468ee21f9f3b499c95e53123519afa8e/mod/src/mod/endpoints/mod_rtmp/libamf/tests/amf0 -------------------------------------------------------------------------------- /mod/src/mod/endpoints/mod_rtmp/libamf/tests/amf0_demo.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "amf0.h" 4 | #include "io.h" 5 | #include "types.h" 6 | 7 | int main() { 8 | amf0_data * test; 9 | 10 | test = amf0_object_new(); 11 | amf0_object_add(test, "toto", amf0_str("une chaine de caracteres")); 12 | amf0_object_add(test, "test_bool", amf0_boolean_new(1)); 13 | 14 | amf0_data_dump(stdout, test, 0); 15 | 16 | amf0_data_free(test); 17 | } 18 | -------------------------------------------------------------------------------- /mod/src/mod/endpoints/mod_rtmp/rtmp_video.h: -------------------------------------------------------------------------------- 1 | /* 2 | * mod_rtmp for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application 3 | * Copyright (C) 2015, Seven Du. 4 | * 5 | * Version: MPL 1.1 6 | * 7 | * The contents of this file are subject to the Mozilla Public License Version 8 | * 1.1 (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * http://www.mozilla.org/MPL/ 11 | * 12 | * Software distributed under the License is distributed on an "AS IS" basis, 13 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 14 | * for the specific language governing rights and limitations under the 15 | * License. 16 | * 17 | * The Original Code is rtmp_video for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application 18 | * 19 | * The Initial Developer of the Original Code is Seven Du, 20 | * Portions created by the Initial Developer are Copyright (C) 21 | * the Initial Developer. All Rights Reserved. 22 | * 23 | * Contributor(s): 24 | * 25 | * Seven Du 26 | * Da Xiong 27 | * 28 | * rtmp_video.h -- RTMP video 29 | * 30 | */ 31 | 32 | 33 | #include "amf0.h" 34 | #include "mod_rtmp.h" 35 | 36 | #define MAX_RTP_PAYLOAD_SIZE 1400 37 | 38 | void rtmp2rtp_helper_init(rtmp2rtp_helper_t *helper); 39 | void rtp2rtmp_helper_init(rtp2rtmp_helper_t *helper); 40 | void rtmp2rtp_helper_destroy(rtmp2rtp_helper_t *helper); 41 | void rtp2rtmp_helper_destroy(rtp2rtmp_helper_t *helper); 42 | switch_status_t on_rtmp_tech_init(switch_core_session_t *session, rtmp_private_t *tech_pvt); 43 | switch_status_t on_rtmp_destroy(rtmp_private_t *tech_pvt); 44 | 45 | /*Rtmp packet to rtp frame*/ 46 | switch_status_t rtmp_rtmp2rtpH264(rtmp2rtp_helper_t *read_helper, uint8_t* data, uint32_t len); 47 | switch_status_t rtmp_rtp2rtmpH264(rtp2rtmp_helper_t *helper, switch_frame_t *frame); 48 | switch_status_t rtmp_write_video_frame(switch_core_session_t *session, switch_frame_t *frame, switch_io_flag_t flags, int stream_id); 49 | switch_status_t rtmp_read_video_frame(switch_core_session_t *session, switch_frame_t **frame, switch_io_flag_t flags, int stream_id); 50 | -------------------------------------------------------------------------------- /mod/src/mod/endpoints/mod_sofia/.gitignore: -------------------------------------------------------------------------------- 1 | test/Makefile 2 | test/Makefile.in 3 | test/freeswitch.xml.fsxml.tmp 4 | test/test_sofia_funcs 5 | -------------------------------------------------------------------------------- /mod/src/mod/endpoints/mod_sofia/Makefile.am: -------------------------------------------------------------------------------- 1 | include $(top_srcdir)/build/modmake.rulesam 2 | 3 | MODNAME=mod_sofia 4 | 5 | noinst_LTLIBRARIES = libsofiamod.la 6 | libsofiamod_la_SOURCES = mod_sofia.c sofia.c sofia_json_api.c sofia_glue.c sofia_presence.c sofia_reg.c sofia_media.c sip-dig.c rtp.c mod_sofia.h 7 | libsofiamod_la_LDFLAGS = -static 8 | libsofiamod_la_CFLAGS = $(AM_CFLAGS) -I. $(SOFIA_SIP_CFLAGS) 9 | 10 | mod_LTLIBRARIES = mod_sofia.la 11 | mod_sofia_la_SOURCES = 12 | mod_sofia_la_LIBADD = $(switch_builddir)/libfreeswitch.la libsofiamod.la 13 | mod_sofia_la_LDFLAGS = -avoid-version -module -no-undefined -shared $(SOFIA_SIP_LIBS) 14 | 15 | noinst_PROGRAMS = test/test_sofia_funcs 16 | 17 | test_test_sofia_funcs_SOURCES = test/test_sofia_funcs.c 18 | test_test_sofia_funcs_CFLAGS = $(AM_CFLAGS) $(SOFIA_SIP_CFLAGS) -DSWITCH_TEST_BASE_DIR_FOR_CONF=\"${abs_builddir}/test\" -DSWITCH_TEST_BASE_DIR_OVERRIDE=\"${abs_builddir}/test\" 19 | test_test_sofia_funcs_LDFLAGS = $(AM_LDFLAGS) -avoid-version -no-undefined $(freeswitch_LDFLAGS) $(switch_builddir)/libfreeswitch.la $(CORE_LIBS) $(APR_LIBS) 20 | test_test_sofia_funcs_LDADD = libsofiamod.la $(SOFIA_SIP_LIBS) 21 | 22 | TESTS = $(noinst_PROGRAMS) 23 | 24 | if ISMAC 25 | mod_sofia_la_LDFLAGS += -framework CoreFoundation -framework SystemConfiguration 26 | test_test_sofia_funcs_LDFLAGS += -framework CoreFoundation -framework SystemConfiguration 27 | endif 28 | 29 | -------------------------------------------------------------------------------- /mod/src/mod/endpoints/mod_sofia/sofia_media.c: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application 3 | * Copyright (C) 2005-2014, Anthony Minessale II 4 | * 5 | * Version: MPL 1.1 6 | * 7 | * The contents of this file are subject to the Mozilla Public License Version 8 | * 1.1 (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * http://www.mozilla.org/MPL/ 11 | * 12 | * Software distributed under the License is distributed on an "AS IS" basis, 13 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 14 | * for the specific language governing rights and limitations under the 15 | * License. 16 | * 17 | * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application 18 | * 19 | * The Initial Developer of the Original Code is 20 | * Anthony Minessale II 21 | * Portions created by the Initial Developer are Copyright (C) 22 | * the Initial Developer. All Rights Reserved. 23 | * 24 | * Contributor(s): 25 | * 26 | * Anthony Minessale II 27 | * 28 | * 29 | * sofia_media.c -- SOFIA SIP Endpoint (sofia media code) 30 | * 31 | */ 32 | #include "mod_sofia.h" 33 | 34 | 35 | 36 | 37 | uint8_t sofia_media_negotiate_sdp(switch_core_session_t *session, const char *r_sdp, switch_sdp_type_t type) 38 | { 39 | uint8_t t, p = 0; 40 | private_object_t *tech_pvt = switch_core_session_get_private(session); 41 | 42 | if ((t = switch_core_media_negotiate_sdp(session, r_sdp, &p, type))) { 43 | sofia_set_flag_locked(tech_pvt, TFLAG_SDP); 44 | } 45 | 46 | if (!p) { 47 | sofia_set_flag(tech_pvt, TFLAG_NOREPLY); 48 | } 49 | 50 | return t; 51 | } 52 | 53 | switch_status_t sofia_media_activate_rtp(private_object_t *tech_pvt) 54 | { 55 | switch_status_t status; 56 | 57 | switch_mutex_lock(tech_pvt->sofia_mutex); 58 | status = switch_core_media_activate_rtp(tech_pvt->session); 59 | switch_mutex_unlock(tech_pvt->sofia_mutex); 60 | 61 | 62 | if (status == SWITCH_STATUS_SUCCESS) { 63 | sofia_set_flag(tech_pvt, TFLAG_RTP); 64 | sofia_set_flag(tech_pvt, TFLAG_IO); 65 | } 66 | 67 | return status; 68 | } 69 | 70 | 71 | 72 | switch_status_t sofia_media_tech_media(private_object_t *tech_pvt, const char *r_sdp, switch_sdp_type_t type) 73 | { 74 | uint8_t match = 0; 75 | 76 | switch_assert(tech_pvt != NULL); 77 | switch_assert(r_sdp != NULL); 78 | 79 | if (zstr(r_sdp)) { 80 | return SWITCH_STATUS_FALSE; 81 | } 82 | 83 | if ((match = sofia_media_negotiate_sdp(tech_pvt->session, r_sdp, type))) { 84 | if (switch_core_media_choose_port(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO, 0) != SWITCH_STATUS_SUCCESS) { 85 | return SWITCH_STATUS_FALSE; 86 | } 87 | if (sofia_media_activate_rtp(tech_pvt) != SWITCH_STATUS_SUCCESS) { 88 | return SWITCH_STATUS_FALSE; 89 | } 90 | switch_channel_set_variable(tech_pvt->channel, SWITCH_ENDPOINT_DISPOSITION_VARIABLE, "EARLY MEDIA"); 91 | sofia_set_flag_locked(tech_pvt, TFLAG_EARLY_MEDIA); 92 | switch_channel_mark_pre_answered(tech_pvt->channel); 93 | return SWITCH_STATUS_SUCCESS; 94 | } 95 | 96 | 97 | return SWITCH_STATUS_FALSE; 98 | } 99 | 100 | static void process_mp(switch_core_session_t *session, switch_stream_handle_t *stream, const char *boundary, const char *str) { 101 | char *dname = switch_core_session_strdup(session, str); 102 | char *dval; 103 | 104 | if ((dval = strchr(dname, ':'))) { 105 | *dval++ = '\0'; 106 | if (*dval == '~') { 107 | stream->write_function(stream, "--%s\r\nContent-Type: %s\r\nContent-Length: %d\r\n%s\r\n", boundary, dname, strlen(dval), dval + 1); 108 | } else { 109 | stream->write_function(stream, "--%s\r\nContent-Type: %s\r\nContent-Length: %d\r\n\r\n%s\r\n", boundary, dname, strlen(dval) + 1, dval); 110 | } 111 | } 112 | } 113 | 114 | char *sofia_media_get_multipart(switch_core_session_t *session, const char *prefix, const char *sdp, char **mp_type) 115 | { 116 | char *extra_headers = NULL; 117 | switch_stream_handle_t stream = { 0 }; 118 | switch_event_header_t *hi = NULL; 119 | int x = 0; 120 | switch_channel_t *channel = switch_core_session_get_channel(session); 121 | const char *boundary = switch_core_session_get_uuid(session); 122 | 123 | SWITCH_STANDARD_STREAM(stream); 124 | if ((hi = switch_channel_variable_first(channel))) { 125 | for (; hi; hi = hi->next) { 126 | const char *name = (char *) hi->name; 127 | char *value = (char *) hi->value; 128 | 129 | if (!strcasecmp(name, prefix)) { 130 | if (hi->idx > 0) { 131 | int i = 0; 132 | 133 | for(i = 0; i < hi->idx; i++) { 134 | process_mp(session, &stream, boundary, hi->array[i]); 135 | x++; 136 | } 137 | } else { 138 | process_mp(session, &stream, boundary, value); 139 | x++; 140 | } 141 | } 142 | } 143 | switch_channel_variable_last(channel); 144 | } 145 | 146 | if (x) { 147 | *mp_type = switch_core_session_sprintf(session, "multipart/mixed; boundary=%s", boundary); 148 | if (sdp) { 149 | stream.write_function(&stream, "--%s\r\nContent-Type: application/sdp\r\nContent-Length: %d\r\n\r\n%s\r\n", boundary, strlen(sdp) + 1, sdp); 150 | } 151 | stream.write_function(&stream, "--%s--\r\n", boundary); 152 | } 153 | 154 | if (!zstr((char *) stream.data)) { 155 | extra_headers = stream.data; 156 | } else { 157 | switch_safe_free(stream.data); 158 | } 159 | 160 | return extra_headers; 161 | } 162 | 163 | 164 | 165 | 166 | 167 | /* For Emacs: 168 | * Local Variables: 169 | * mode:c 170 | * indent-tabs-mode:t 171 | * tab-width:4 172 | * c-basic-offset:4 173 | * End: 174 | * For VIM: 175 | * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet: 176 | */ 177 | 178 | -------------------------------------------------------------------------------- /mod/src/mod/endpoints/mod_sofia/test/test_sofia_funcs.c: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application 3 | * Copyright (C) 2005-2018, Anthony Minessale II 4 | * 5 | * Version: MPL 1.1 6 | * 7 | * The contents of this file are subject to the Mozilla Public License Version 8 | * 1.1 (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * http://www.mozilla.org/MPL/ 11 | * 12 | * Software distributed under the License is distributed on an "AS IS" basis, 13 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 14 | * for the specific language governing rights and limitations under the 15 | * License. 16 | * 17 | * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application 18 | * 19 | * The Initial Developer of the Original Code is 20 | * Anthony Minessale II 21 | * Portions created by the Initial Developer are Copyright (C) 22 | * the Initial Developer. All Rights Reserved. 23 | * 24 | * Contributor(s): 25 | * Seven Du 26 | * 27 | * 28 | * test_sofia_funcs.c -- tests sofia functions 29 | * 30 | */ 31 | 32 | #include 33 | #include 34 | #include "../mod_sofia.c" 35 | 36 | FST_MINCORE_BEGIN("./conf") 37 | 38 | FST_SUITE_BEGIN(switch_hash) 39 | 40 | FST_SETUP_BEGIN() 41 | { 42 | } 43 | FST_SETUP_END() 44 | 45 | FST_TEARDOWN_BEGIN() 46 | { 47 | } 48 | FST_TEARDOWN_END() 49 | 50 | FST_TEST_BEGIN(test_protect_url) 51 | { 52 | int ret; 53 | switch_caller_profile_t cp = { 0 }; 54 | switch_core_new_memory_pool(&cp.pool); 55 | 56 | cp.destination_number = switch_core_strdup(cp.pool, "1234"); 57 | ret = protect_dest_uri(&cp); 58 | fst_check(ret == 0); 59 | fst_check_string_equals(cp.destination_number, "1234"); 60 | 61 | cp.destination_number = switch_core_strdup(cp.pool, "1234@ip"); 62 | ret = protect_dest_uri(&cp); 63 | fst_check(ret == 0); 64 | fst_check_string_equals(cp.destination_number, "1234@ip"); 65 | 66 | cp.destination_number = switch_core_strdup(cp.pool, "external/1234@ip"); 67 | ret = protect_dest_uri(&cp); 68 | fst_check(ret == 0); 69 | fst_check_string_equals(cp.destination_number, "external/1234@ip"); 70 | 71 | cp.destination_number = switch_core_strdup(cp.pool, "external/sip:1234@ip"); 72 | ret = protect_dest_uri(&cp); 73 | fst_check(ret == 0); 74 | fst_check_string_equals(cp.destination_number, "external/1234@ip"); 75 | 76 | cp.destination_number = switch_core_strdup(cp.pool, "external/sips:1234@ip"); 77 | ret = protect_dest_uri(&cp); 78 | fst_check(ret == 0); 79 | fst_check_string_equals(cp.destination_number, "external/1234@ip"); 80 | 81 | cp.destination_number = switch_core_strdup(cp.pool, "external/bryän&!杜金房@freeswitch-testing:9080"); 82 | ret = protect_dest_uri(&cp); 83 | fst_check(ret == 1); 84 | fst_check_string_equals(cp.destination_number, "external/bry%C3%A4n%26!%E6%9D%9C%E9%87%91%E6%88%BF@freeswitch-testing:9080"); 85 | 86 | cp.destination_number = switch_core_strdup(cp.pool, "external/" SWITCH_URL_UNSAFE "@freeswitch-testing:9080"); 87 | switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "before: [%s]\n", cp.destination_number); 88 | ret = protect_dest_uri(&cp); 89 | switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "after: [%s]\n", cp.destination_number); 90 | fst_check(ret == 1); 91 | fst_check_string_equals(cp.destination_number, "external/%0D%0A%20%23%25%26%2B%3A%3B%3C%3D%3E%3F@[\\]^`{|}\"@freeswitch-testing:9080"); 92 | 93 | switch_core_destroy_memory_pool(&cp.pool); 94 | } 95 | FST_TEST_END() 96 | 97 | FST_SUITE_END() 98 | 99 | FST_MINCORE_END() 100 | 101 | 102 | /* For Emacs: 103 | * Local Variables: 104 | * mode:c 105 | * indent-tabs-mode:t 106 | * tab-width:4 107 | * c-basic-offset:4 108 | * End: 109 | * For VIM: 110 | * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet: 111 | */ 112 | -------------------------------------------------------------------------------- /mod/src/mod/endpoints/mod_verto/Makefile.am: -------------------------------------------------------------------------------- 1 | include $(top_srcdir)/build/modmake.rulesam 2 | MODNAME=mod_verto 3 | 4 | mod_LTLIBRARIES = mod_verto.la 5 | mod_verto_la_SOURCES = mod_verto.c ws.c mcast/mcast.c 6 | mod_verto_la_CFLAGS = -D__EXTENSIONS__ -D_GNU_SOURCE $(AM_CFLAGS) 7 | mod_verto_la_CPPFLAGS = -I. -I$(switch_srcdir)/src/mod/endpoints/mod_verto/mcast 8 | mod_verto_la_LIBADD = $(switch_builddir)/libfreeswitch.la 9 | mod_verto_la_LDFLAGS = -avoid-version -module -no-undefined -shared 10 | 11 | if HAVE_PERL 12 | #perldir = $(PERL_SITEDIR) 13 | noinst_LTLIBRARIES = MCAST.la 14 | MCAST_la_SOURCES = mcast/mcast_wrap.cpp mcast/perlxsi.c mcast/mcast.c mcast/mcast_cpp.cpp 15 | MCAST_la_CFLAGS = $(CC_CFLAGS) $(CFLAGS) $(SWITCH_AM_CFLAGS) $(PERL_CFLAGS) 16 | MCAST_la_CXXFLAGS = $(SWITCH_AM_CXXFLAGS) $(CXXFLAGS) -w $(PERL_INC) 17 | MCAST_la_CPPFLAGS = -I$(switch_srcdir)/src/mod/endpoints/mod_verto/mcast 18 | MCAST_la_LDFLAGS = -avoid-version -module -no-undefined -shared $(PERL_LDFLAGS) 19 | 20 | #install-data-local: perlmod-install 21 | 22 | #perlmod-install: install-perlLTLIBRARIES 23 | # install -d -m 755 $(DESTDIR)$(PERL_SITEDIR) 24 | # install -m 755 mcast/MCAST.pm $(DESTDIR)$(PERL_SITEDIR) 25 | endif 26 | 27 | mcast/mcast_wrap.cpp: 28 | cd mcast && swig -module MCAST -shadow -perl5 -c++ -DMULTIPLICITY -I../src/include -o mcast_wrap.cpp MCAST.i 29 | 30 | mcast/perlxsi.c: 31 | $(PERL) -MExtUtils::Embed -e xsinit -- -o mcast/perlxsi.c 32 | 33 | clean-data-local: 34 | rm -f *.o *.so *~ 35 | 36 | swigclean: 37 | rm -f mcast/mcast_wrap.* mcast/MCAST.so mcast/MCAST.pm mcast/perlxsi.* 38 | 39 | reswig: swigclean mcast/mcast_wrap.cpp mcast/perlxsi.c 40 | -------------------------------------------------------------------------------- /mod/src/mod/endpoints/mod_verto/mcast/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.so 3 | -------------------------------------------------------------------------------- /mod/src/mod/endpoints/mod_verto/mcast/MCAST.i: -------------------------------------------------------------------------------- 1 | %begin %{ 2 | #ifdef __clang_analyzer__ 3 | #include 4 | static int mystrcmp (const char *a, const char *b) { 5 | return a == b ? 0 : !a ? -1 : !b ? 1 : strcmp(a, b); 6 | } 7 | #define strcmp mystrcmp 8 | #endif 9 | %} 10 | 11 | %{ 12 | #include "mcast.h" 13 | #include "mcast_cpp.h" 14 | %} 15 | 16 | %newobject McastHANDLE::recv; 17 | 18 | %include "mcast_cpp.h" 19 | 20 | %perlcode %{ 21 | use constant { 22 | MCAST_SEND => (1 << 0), 23 | MCAST_RECV => (1 << 1), 24 | MCAST_TTL_HOST => (1 << 2), 25 | MCAST_TTL_SUBNET => (1 << 3), 26 | MCAST_TTL_SITE => (1 << 4), 27 | MCAST_TTL_REGION => (1 << 5), 28 | MCAST_TTL_CONTINENT => (1 << 6), 29 | MCAST_TTL_UNIVERSE => (1 << 7) 30 | }; 31 | %} 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /mod/src/mod/endpoints/mod_verto/mcast/MCAST.pm: -------------------------------------------------------------------------------- 1 | # This file was automatically generated by SWIG (http://www.swig.org). 2 | # Version 3.0.12 3 | # 4 | # Do not make changes to this file unless you know what you are doing--modify 5 | # the SWIG interface file instead. 6 | 7 | package MCAST; 8 | use base qw(Exporter); 9 | use base qw(DynaLoader); 10 | package MCASTc; 11 | bootstrap MCAST; 12 | package MCAST; 13 | @EXPORT = qw(); 14 | 15 | # ---------- BASE METHODS ------------- 16 | 17 | package MCAST; 18 | 19 | sub TIEHASH { 20 | my ($classname,$obj) = @_; 21 | return bless $obj, $classname; 22 | } 23 | 24 | sub CLEAR { } 25 | 26 | sub FIRSTKEY { } 27 | 28 | sub NEXTKEY { } 29 | 30 | sub FETCH { 31 | my ($self,$field) = @_; 32 | my $member_func = "swig_${field}_get"; 33 | $self->$member_func(); 34 | } 35 | 36 | sub STORE { 37 | my ($self,$field,$newval) = @_; 38 | my $member_func = "swig_${field}_set"; 39 | $self->$member_func($newval); 40 | } 41 | 42 | sub this { 43 | my $ptr = shift; 44 | return tied(%$ptr); 45 | } 46 | 47 | 48 | # ------- FUNCTION WRAPPERS -------- 49 | 50 | package MCAST; 51 | 52 | 53 | ############# Class : MCAST::McastHandle ############## 54 | 55 | package MCAST::McastHandle; 56 | use vars qw(@ISA %OWNER %ITERATORS %BLESSEDMEMBERS); 57 | @ISA = qw( MCAST ); 58 | %OWNER = (); 59 | %ITERATORS = (); 60 | sub new { 61 | my $pkg = shift; 62 | my $self = MCASTc::new_McastHandle(@_); 63 | bless $self, $pkg if defined($self); 64 | } 65 | 66 | sub DESTROY { 67 | return unless $_[0]->isa('HASH'); 68 | my $self = tied(%{$_[0]}); 69 | return unless defined $self; 70 | delete $ITERATORS{$self}; 71 | if (exists $OWNER{$self}) { 72 | MCASTc::delete_McastHandle($self); 73 | delete $OWNER{$self}; 74 | } 75 | } 76 | 77 | *send = *MCASTc::McastHandle_send; 78 | *recv = *MCASTc::McastHandle_recv; 79 | *filenum = *MCASTc::McastHandle_filenum; 80 | sub DISOWN { 81 | my $self = shift; 82 | my $ptr = tied(%$self); 83 | delete $OWNER{$ptr}; 84 | } 85 | 86 | sub ACQUIRE { 87 | my $self = shift; 88 | my $ptr = tied(%$self); 89 | $OWNER{$ptr} = 1; 90 | } 91 | 92 | 93 | # ------- VARIABLE STUBS -------- 94 | 95 | package MCAST; 96 | 97 | 98 | use constant { 99 | MCAST_SEND => (1 << 0), 100 | MCAST_RECV => (1 << 1), 101 | MCAST_TTL_HOST => (1 << 2), 102 | MCAST_TTL_SUBNET => (1 << 3), 103 | MCAST_TTL_SITE => (1 << 4), 104 | MCAST_TTL_REGION => (1 << 5), 105 | MCAST_TTL_CONTINENT => (1 << 6), 106 | MCAST_TTL_UNIVERSE => (1 << 7) 107 | }; 108 | 1; 109 | -------------------------------------------------------------------------------- /mod/src/mod/endpoints/mod_verto/mcast/mcast.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011, Anthony Minessale II 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * * Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * * Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 16 | * * Neither the name of the original author; nor the names of any contributors 17 | * may be used to endorse or promote products derived from this software 18 | * without specific prior written permission. 19 | * 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 25 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 26 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 27 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 28 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 29 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 30 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 31 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #ifndef __MCAST_H 35 | #define __MCAST_H 36 | 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #endif /* defined(__cplusplus) */ 40 | #if EMACS_WORKS 41 | } 42 | #endif 43 | 44 | #include 45 | #ifdef WIN32 46 | #include // struct 'sockaddr_in6' 47 | #include 48 | #else 49 | #include 50 | #include 51 | #include 52 | #endif 53 | 54 | #ifdef _MSC_VER 55 | #include 56 | #ifndef strncasecmp 57 | #define strncasecmp _strnicmp 58 | #endif 59 | #ifdef _WIN64 60 | #define WS_SSIZE_T __int64 61 | #elif _MSC_VER >= 1400 62 | #define WS_SSIZE_T __int32 __w64 63 | #else 64 | #define WS_SSIZE_T __int32 65 | #endif 66 | typedef WS_SSIZE_T ssize_t; 67 | #endif 68 | 69 | #ifndef WIN32 70 | typedef int mcast_socket_t; 71 | #else 72 | typedef SOCKET mcast_socket_t; 73 | #endif 74 | #define mcast_sock_invalid (mcast_socket_t)-1 75 | 76 | typedef struct { 77 | mcast_socket_t sock; 78 | unsigned char ttl; 79 | struct sockaddr_in send_addr; 80 | struct sockaddr_in recv_addr; 81 | struct sockaddr_in6 send_addr6; 82 | struct sockaddr_in6 recv_addr6; 83 | int family; 84 | unsigned char buffer[65536]; 85 | int ready; 86 | } mcast_handle_t; 87 | 88 | typedef enum { 89 | MCAST_SEND = (1 << 0), 90 | MCAST_RECV = (1 << 1), 91 | MCAST_TTL_HOST = (1 << 2), 92 | MCAST_TTL_SUBNET = (1 << 3), 93 | MCAST_TTL_SITE = (1 << 4), 94 | MCAST_TTL_REGION = (1 << 5), 95 | MCAST_TTL_CONTINENT = (1 << 6), 96 | MCAST_TTL_UNIVERSE = (1 << 7) 97 | } mcast_flag_t; 98 | 99 | int mcast_socket_create(const char *host, int16_t port, mcast_handle_t *handle, mcast_flag_t flags); 100 | void mcast_socket_close(mcast_handle_t *handle); 101 | ssize_t mcast_socket_send(mcast_handle_t *handle, void *data, size_t datalen); 102 | ssize_t mcast_socket_recv(mcast_handle_t *handle, void *data, size_t datalen, int ms); 103 | 104 | #ifdef __cplusplus 105 | } 106 | #endif /* defined(__cplusplus) */ 107 | 108 | #endif 109 | -------------------------------------------------------------------------------- /mod/src/mod/endpoints/mod_verto/mcast/mcast_cpp.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011, Anthony Minessale II 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * * Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * * Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 16 | * * Neither the name of the original author; nor the names of any contributors 17 | * may be used to endorse or promote products derived from this software 18 | * without specific prior written permission. 19 | * 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 25 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 26 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 27 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 28 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 29 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 30 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 31 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #include "mcast.h" 35 | #include "mcast_cpp.h" 36 | #include 37 | #ifndef WIN32 38 | #include 39 | #endif 40 | 41 | McastHandle::McastHandle(const char *host, int16_t port, int flags) 42 | { 43 | mcast_socket_create(host, port, &handle, (mcast_flag_t) flags); 44 | } 45 | 46 | McastHandle::~McastHandle() 47 | { 48 | mcast_socket_close(&handle); 49 | } 50 | 51 | int McastHandle::send(const char *data) 52 | { 53 | return (int) mcast_socket_send(&handle, (void *)data, strlen(data) + 1); 54 | } 55 | 56 | char *McastHandle::recv(int ms) 57 | { 58 | ssize_t r; 59 | 60 | if ((r = mcast_socket_recv(&handle, NULL, 0, ms)) > 0) { 61 | *((char *)handle.buffer + r) = '\0'; 62 | return (char *) handle.buffer; 63 | } 64 | 65 | return NULL; 66 | } 67 | 68 | mcast_socket_t McastHandle::filenum(void) 69 | { 70 | return handle.sock; 71 | } 72 | -------------------------------------------------------------------------------- /mod/src/mod/endpoints/mod_verto/mcast/mcast_cpp.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011, Anthony Minessale II 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * * Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * 12 | * * Redistributions in binary form must reproduce the above copyright 13 | * notice, this list of conditions and the following disclaimer in the 14 | * documentation and/or other materials provided with the distribution. 15 | * 16 | * * Neither the name of the original author; nor the names of any contributors 17 | * may be used to endorse or promote products derived from this software 18 | * without specific prior written permission. 19 | * 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 25 | * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 26 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 27 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 28 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 29 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 30 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 31 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 | */ 33 | 34 | #ifndef __MCAST_CPP_H 35 | #define __MCAST_CPP_H 36 | 37 | #ifdef __cplusplus 38 | extern "C" { 39 | #include "mcast.h" 40 | #endif /* defined(__cplusplus) */ 41 | #if EMACS_WORKS 42 | } 43 | #endif 44 | 45 | class McastHandle { 46 | private: 47 | mcast_handle_t handle; 48 | public: 49 | McastHandle(const char *host, int16_t port, int flags); 50 | virtual ~McastHandle(); 51 | int send(const char *data); 52 | char *recv(int ms = 0); 53 | mcast_socket_t filenum(void); 54 | }; 55 | 56 | #ifdef __cplusplus 57 | } 58 | #endif /* defined(__cplusplus) */ 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /mod/src/mod/endpoints/mod_verto/mcast/perlxsi.c: -------------------------------------------------------------------------------- 1 | #include "EXTERN.h" 2 | #include "perl.h" 3 | #include "XSUB.h" 4 | 5 | EXTERN_C void xs_init (pTHX); 6 | 7 | EXTERN_C void boot_DynaLoader (pTHX_ CV* cv); 8 | 9 | EXTERN_C void 10 | xs_init(pTHX) 11 | { 12 | static const char file[] = __FILE__; 13 | dXSUB_SYS; 14 | PERL_UNUSED_CONTEXT; 15 | 16 | /* DynaLoader is a special case */ 17 | newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, file); 18 | } 19 | -------------------------------------------------------------------------------- /mod/src/mod/endpoints/mod_verto/mcast/test.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include "mcast.h" 6 | 7 | int main(int argc, char *argv[]) 8 | { 9 | mcast_handle_t handle; 10 | 11 | if (argc < 2) { 12 | printf("WTF\n"); 13 | exit(-1); 14 | } 15 | 16 | mcast_socket_create("231.3.3.7", 1337, &handle, MCAST_SEND | MCAST_RECV | MCAST_TTL_HOST); 17 | perror("create"); 18 | 19 | if (!strcmp(argv[1], "send")) { 20 | mcast_socket_send(&handle, argv[2], strlen(argv[2])); 21 | exit(0); 22 | } 23 | 24 | for(;;) { 25 | int r = mcast_socket_recv(&handle, NULL, 0); 26 | printf("RECV %d [%s]\n", r, (char *)handle.buffer); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /mod/src/mod/endpoints/mod_verto/mcast/test.pl: -------------------------------------------------------------------------------- 1 | use MCAST; 2 | 3 | my $s = new MCAST::McastHandle("231.3.3.7", 1337, MCAST_SEND | MCAST_RECV | MCAST_TTL_HOST); 4 | 5 | my $action = shift; 6 | 7 | if ($action eq "send") { 8 | $s->send("W00t from Perl " . shift); 9 | exit; 10 | } 11 | 12 | for(;;) { 13 | my $foo = $s->recv(100); 14 | if ($foo) { 15 | print "RECV [$foo]\n"; 16 | } else { 17 | print "PING\n"; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /mod/src/mod/endpoints/mod_verto/mcast/test2.pl: -------------------------------------------------------------------------------- 1 | use MCAST; 2 | 3 | 4 | 5 | my $action = shift; 6 | 7 | if ($action eq "send") { 8 | my $s = new MCAST::McastHandle("224.1.1.1", 1337, MCAST::MCAST_SEND | MCAST::MCAST_TTL_HOST); 9 | $s->send(shift); 10 | print "Sending message"; 11 | exit; 12 | } 13 | 14 | my $s = new MCAST::McastHandle("224.1.1.1", 1338, MCAST::MCAST_RECV | MCAST::MCAST_TTL_HOST); 15 | 16 | for(;;) { 17 | my $foo = $s->recv(); 18 | if ($foo) { 19 | print "RECV [$foo]\n"; 20 | } else { 21 | print "PING\n"; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /mod/src/mod/endpoints/mod_verto/ws.h: -------------------------------------------------------------------------------- 1 | #ifndef _WS_H 2 | #define _WS_H 3 | 4 | //#define WSS_STANDALONE 1 5 | 6 | #define WEBSOCKET_GUID "258EAFA5-E914-47DA-95CA-C5AB0DC85B11" 7 | #define B64BUFFLEN 1024 8 | 9 | #include 10 | #ifndef _MSC_VER 11 | #include 12 | #include 13 | #include 14 | #include 15 | #else 16 | #pragma warning(disable:4996) 17 | #endif 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | //#include "sha1.h" 26 | #include 27 | 28 | #if defined(_MSC_VER) || defined(__APPLE__) || defined(__FreeBSD__) || (defined(__SVR4) && defined(__sun)) 29 | #define __bswap_64(x) \ 30 | x = (x>>56) | \ 31 | ((x<<40) & 0x00FF000000000000) | \ 32 | ((x<<24) & 0x0000FF0000000000) | \ 33 | ((x<<8) & 0x000000FF00000000) | \ 34 | ((x>>8) & 0x00000000FF000000) | \ 35 | ((x>>24) & 0x0000000000FF0000) | \ 36 | ((x>>40) & 0x000000000000FF00) | \ 37 | (x<<56) 38 | #endif 39 | #ifdef _MSC_VER 40 | #ifndef strncasecmp 41 | #define strncasecmp _strnicmp 42 | #endif 43 | #ifdef _WIN64 44 | #define WS_SSIZE_T __int64 45 | #elif _MSC_VER >= 1400 46 | #define WS_SSIZE_T __int32 __w64 47 | #else 48 | #define WS_SSIZE_T __int32 49 | #endif 50 | typedef WS_SSIZE_T ssize_t; 51 | #endif 52 | 53 | 54 | struct ws_globals_s { 55 | const SSL_METHOD *ssl_method; 56 | SSL_CTX *ssl_ctx; 57 | char cert[512]; 58 | char key[512]; 59 | }; 60 | 61 | //extern struct ws_globals_s ws_globals; 62 | 63 | #ifndef WIN32 64 | typedef int ws_socket_t; 65 | #else 66 | typedef SOCKET ws_socket_t; 67 | #endif 68 | #define ws_sock_invalid (ws_socket_t)-1 69 | 70 | 71 | typedef enum { 72 | WS_NONE = 0, 73 | WS_RECV_CLOSE = 1000, 74 | WS_PROTO_ERR = 1002, 75 | WS_DATA_TOO_BIG = 1009 76 | } ws_cause_t; 77 | 78 | typedef enum { 79 | WSOC_CONTINUATION = 0x0, 80 | WSOC_TEXT = 0x1, 81 | WSOC_BINARY = 0x2, 82 | WSOC_CLOSE = 0x8, 83 | WSOC_PING = 0x9, 84 | WSOC_PONG = 0xA 85 | } ws_opcode_t; 86 | 87 | typedef struct wsh_s { 88 | ws_socket_t sock; 89 | char *buffer; 90 | char *bbuffer; 91 | char *body; 92 | char *uri; 93 | size_t buflen; 94 | size_t bbuflen; 95 | ssize_t datalen; 96 | ssize_t wdatalen; 97 | char *payload; 98 | ssize_t plen; 99 | ssize_t rplen; 100 | ssize_t packetlen; 101 | SSL *ssl; 102 | int handshake; 103 | uint8_t down; 104 | int secure; 105 | uint8_t close_sock; 106 | SSL_CTX *ssl_ctx; 107 | int block; 108 | int sanity; 109 | int secure_established; 110 | int logical_established; 111 | int stay_open; 112 | int x; 113 | void *write_buffer; 114 | size_t write_buffer_len; 115 | } wsh_t; 116 | 117 | ssize_t ws_send_buf(wsh_t *wsh, ws_opcode_t oc); 118 | ssize_t ws_feed_buf(wsh_t *wsh, void *data, size_t bytes); 119 | 120 | 121 | ssize_t ws_raw_read(wsh_t *wsh, void *data, size_t bytes, int block); 122 | ssize_t ws_raw_write(wsh_t *wsh, void *data, size_t bytes); 123 | ssize_t ws_read_frame(wsh_t *wsh, ws_opcode_t *oc, uint8_t **data); 124 | ssize_t ws_write_frame(wsh_t *wsh, ws_opcode_t oc, void *data, size_t bytes); 125 | int ws_init(wsh_t *wsh, ws_socket_t sock, SSL_CTX *ssl_ctx, int close_sock, int block, int stay_open); 126 | ssize_t ws_close(wsh_t *wsh, int16_t reason); 127 | void ws_destroy(wsh_t *wsh); 128 | void init_ssl(void); 129 | void deinit_ssl(void); 130 | int xp_errno(void); 131 | int xp_is_blocking(int errcode); 132 | 133 | 134 | 135 | #ifndef _MSC_VER 136 | static inline uint64_t get_unaligned_uint64(const void *p) 137 | { 138 | const struct { uint64_t d; } __attribute__((packed)) *pp = p; 139 | return pp->d; 140 | } 141 | #endif 142 | 143 | #endif 144 | -------------------------------------------------------------------------------- /mod/src/mod/sdk/autotools/.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | *.lo 3 | *.so 4 | *.a 5 | *.orig 6 | *.rej 7 | *.log 8 | *.la 9 | 10 | .deps 11 | .libs 12 | 13 | stamp-h1 14 | samples* 15 | Makefile 16 | Makefile.in 17 | config.log 18 | config.sub 19 | config.guess 20 | config.status 21 | configure 22 | libtool 23 | aclocal.m4 24 | autom4te.cache 25 | depcomp 26 | install-sh 27 | compile 28 | missing 29 | ltmain.sh 30 | doxygen 31 | m4/libtool.m4 32 | m4/ltsugar.m4 33 | m4/ltoptions.m4 34 | m4/ltversion.m4 35 | m4/lt~obsolete.m4 36 | -------------------------------------------------------------------------------- /mod/src/mod/sdk/autotools/Makefile.am: -------------------------------------------------------------------------------- 1 | ACLOCAL_AMFLAGS = -I m4 2 | AUTOMAKE_OPTIONS = foreign no-dist subdir-objects 3 | 4 | SUBDIRS = src 5 | -------------------------------------------------------------------------------- /mod/src/mod/sdk/autotools/autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | autoreconf -i -f 3 | -------------------------------------------------------------------------------- /mod/src/mod/sdk/autotools/m4/ax_compiler_vendor.m4: -------------------------------------------------------------------------------- 1 | AC_DEFUN([AX_COMPILER_VENDOR], 2 | [ 3 | AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor, 4 | [ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor=unknown 5 | # note: don't check for gcc first since some other compilers define __GNUC__ 6 | for ventest in intel:__ICC,__ECC,__INTEL_COMPILER ibm:__xlc__,__xlC__,__IBMC__,__IBMCPP__ gnu:__GNUC__ sun:__SUNPRO_C,__SUNPRO_CC hp:__HP_cc,__HP_aCC dec:__DECC,__DECCXX,__DECC_VER,__DECCXX_VER borland:__BORLANDC__,__TURBOC__ comeau:__COMO__ cray:_CRAYC kai:__KCC lcc:__LCC__ metrowerks:__MWERKS__ sgi:__sgi,sgi microsoft:_MSC_VER watcom:__WATCOMC__ portland:__PGI; do 7 | vencpp="defined("`echo $ventest | cut -d: -f2 | sed 's/,/) || defined(/g'`")" 8 | AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[ 9 | #if !($vencpp) 10 | thisisanerror; 11 | #endif 12 | ])], [ax_cv_]_AC_LANG_ABBREV[_compiler_vendor=`echo $ventest | cut -d: -f1`; break]) 13 | done 14 | ]) 15 | ]) 16 | -------------------------------------------------------------------------------- /mod/src/mod/sdk/autotools/src/Makefile.am: -------------------------------------------------------------------------------- 1 | moddir = @FREESWITCH_MODULES_DIR@ 2 | sysconfdir = @FREESWITCH_CONFIG_DIR@ 3 | 4 | ### 5 | # Flags 6 | # 7 | AM_CFLAGS = 8 | AM_CXXFLAGS= 9 | AM_CPPFLAGS= -I. -I$(includedir) 10 | AM_LDFLAGS = -L. -L$(libdir) -avoid-version -module -no-undefined -shared 11 | 12 | ### 13 | # GCC (and compatible) specific flags 14 | # 15 | if CC_VENDOR_GNU 16 | AM_CFLAGS += -Wall 17 | endif 18 | 19 | ### 20 | # SunCC specific flags 21 | # 22 | if CC_VENDOR_SUN 23 | AM_CFLAGS += 24 | endif 25 | 26 | ### 27 | # symbol visibility support 28 | # 29 | if CC_HAS_VISIBILITY 30 | AM_CFLAGS += $(VISIBILITY_CFLAGS) 31 | AM_CXXFLAGS += $(VISIBILITY_CXXFLAGS) 32 | AM_CPPFLAGS += -DSWITCH_API_VISIBILITY=1 33 | endif 34 | 35 | 36 | ### 37 | # add module(s) here, with suffix '.la' 38 | # 39 | mod_LTLIBRARIES = mod_example.la 40 | 41 | ### 42 | # mod_example 43 | # 44 | mod_example_la_SOURCES = mod_example.c 45 | mod_example_la_CFLAGS = $(AM_CFLAGS) $(FREESWITCH_CFLAGS) 46 | mod_example_la_CPPFLAGS= $(AM_CPPFLAGS) $(FREESWITCH_CPPFLAGS) 47 | mod_example_la_LDFLAGS = $(AM_LDFLAGS) 48 | mod_example_la_LIBADD = $(FREESWITCH_LIBS) 49 | 50 | # configuration file 51 | #sysconf_DATA = example.conf.xml 52 | 53 | # 54 | # install configuration 55 | # 56 | #install-sysconfDATA: 57 | # $(INSTALL) -d $(DESTDIR)/$(sysconfdir) 58 | # for x in $(sysconf_DATA); do \ 59 | # test -e $(DESTDIR)$(sysconfdir)/$$x || $(INSTALL) -m644 $$x $(DESTDIR)$(sysconfdir)/$$x ; \ 60 | # done 61 | -------------------------------------------------------------------------------- /mod/src/mod/sdk/autotools/src/mod_example.c: -------------------------------------------------------------------------------- 1 | /* 2 | * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application 3 | * Copyright (C) 2005/2012, Anthony Minessale II 4 | * 5 | * Version: MPL 1.1 6 | * 7 | * The contents of this file are subject to the Mozilla Public License Version 8 | * 1.1 (the "License"); you may not use this file except in compliance with 9 | * the License. You may obtain a copy of the License at 10 | * http://www.mozilla.org/MPL/ 11 | * 12 | * Software distributed under the License is distributed on an "AS IS" basis, 13 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 14 | * for the specific language governing rights and limitations under the 15 | * License. 16 | * 17 | * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application 18 | * 19 | * The Initial Developer of the Original Code is 20 | * Anthony Minessale II 21 | * Portions created by the Initial Developer are Copyright (C) 22 | * the Initial Developer. All Rights Reserved. 23 | * 24 | * Contributor(s): 25 | * 26 | * Anthony Minessale II 27 | * Neal Horman 28 | * 29 | * 30 | * mod_example.c -- Framework Demo Module 31 | * 32 | */ 33 | #include 34 | 35 | /* 36 | SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_example_shutdown); 37 | SWITCH_MODULE_RUNTIME_FUNCTION(mod_example_runtime); 38 | */ 39 | 40 | SWITCH_MODULE_LOAD_FUNCTION(mod_example_load); 41 | SWITCH_MODULE_DEFINITION(mod_example, mod_example_load, NULL, NULL); 42 | 43 | SWITCH_MODULE_LOAD_FUNCTION(mod_example_load) 44 | { 45 | /* connect my internal structure to the blank pointer passed to me */ 46 | *module_interface = switch_loadable_module_create_module_interface(pool, modname); 47 | 48 | switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Hello World!\n"); 49 | 50 | /* indicate that the module should continue to be loaded */ 51 | return SWITCH_STATUS_SUCCESS; 52 | } 53 | 54 | /* 55 | Called when the system shuts down 56 | SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_example_shutdown); 57 | { 58 | return SWITCH_STATUS_SUCCESS; 59 | } 60 | */ 61 | 62 | /* 63 | If it exists, this is called in it's own thread when the module-load completes 64 | If it returns anything but SWITCH_STATUS_TERM it will be called again automaticly 65 | SWITCH_MODULE_RUNTIME_FUNCTION(mod_example_runtime); 66 | { 67 | while(looping) 68 | { 69 | switch_yield(1000); 70 | } 71 | return SWITCH_STATUS_TERM; 72 | } 73 | */ 74 | 75 | /* For Emacs: 76 | * Local Variables: 77 | * mode:c 78 | * indent-tabs-mode:nil 79 | * tab-width:4 80 | * c-basic-offset:4 81 | * End: 82 | * For VIM: 83 | * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet expandtab: 84 | */ 85 | -------------------------------------------------------------------------------- /outbound/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tppi/freeswitch2/f790d22a468ee21f9f3b499c95e53123519afa8e/outbound/README.md -------------------------------------------------------------------------------- /rtsp/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tppi/freeswitch2/f790d22a468ee21f9f3b499c95e53123519afa8e/rtsp/README.md -------------------------------------------------------------------------------- /rtsp/rtsp.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() { 4 | printf("hello world\n"); 5 | return 0; 6 | } 7 | -------------------------------------------------------------------------------- /sbc/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tppi/freeswitch2/f790d22a468ee21f9f3b499c95e53123519afa8e/sbc/README.md -------------------------------------------------------------------------------- /sip_trunk/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tppi/freeswitch2/f790d22a468ee21f9f3b499c95e53123519afa8e/sip_trunk/README.md -------------------------------------------------------------------------------- /webrtc/The-solution-of-problem.md: -------------------------------------------------------------------------------- 1 | 1. 通过FreeSWITCH,Linphone呼叫WebRTC的视频不通问题解决 2 | https://my.oschina.net/andywang1988/blog/1186669 3 | 4 | 2. 使用WebRTC和WebVR进行VR视频通话 5 | https://blog.csdn.net/vn9plgzvnps1522s82g/article/details/82392695 6 | 7 | 3. FreeSWITCH视频直播 8 | http://www.freeswitch.org.cn/2017/03/27/freeswitch-live-2017.html 9 | 10 | 4. Freeswitch配置:一台Freeswitch向另外一台Freeswitch转发视频会议命令 11 | https://blog.csdn.net/quantum7/article/details/108671695 12 | 13 | 5. Verto Phone step-by-step 14 | https://kovalyshyn.pp.ua/1249.html 15 | 16 | 6. nginx ssl config 17 | ``` 18 | # 一般情况不配置ssl_protocols,默认状态是 19 | ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2; 20 | 21 | # 禁止SSLv3 22 | ssl_protocols TLSv1 TLSv1.1 TLSv1.2; 23 | 24 | # 没有禁止SSLv3,但是去掉了CBC算法 25 | ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-RSA-RC4-SHA:AES128-GCM-SHA256:AES128-SHA256:AES128-SHA:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:AES256-GCM-SHA384:AES256-SHA256:AES256-SHA:ECDHE-RSA-AES128-SHA256:RC4-SHA:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!DSS:!PKS; 26 | ``` 27 | -------------------------------------------------------------------------------- /webrtc/conf/freeswitch_certs/agent.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIC5DCCAcwCAQEwDQYJKoZIhvcNAQELBQAwdzELMAkGA1UEBhMCQ04xCzAJBgNV 3 | BAgMAkdEMQswCQYDVQQHDAJHWjEMMAoGA1UECgwDWkhEMQswCQYDVQQLDAJSRDEP 4 | MA0GA1UEAwwGemhvdWRkMSIwIAYJKoZIhvcNAQkBFhMxNTAxOTQ0MjUxMUAxNjMu 5 | Y29tMB4XDTIxMDQyMTAwMzAwNloXDTMxMDQxOTAwMzAwNlowfTELMAkGA1UEBhMC 6 | Q04xCzAJBgNVBAgMAkdEMQswCQYDVQQHDAJHWjEMMAoGA1UECgwDWkhEMQswCQYD 7 | VQQLDAJSRDEVMBMGA1UEAwwMOC4xMzQuMTQuMjQxMSIwIAYJKoZIhvcNAQkBFhMx 8 | NTAxOTQ0MjUxMUAxNjMuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCV 9 | v3enSJsbUdSxuV72z0V+gtSrD58nqZ0Hlc4idK4lPBZgROUJTp0hjnSyZOn+IZXy 10 | nceQcRsysRqUU9fqRoHZmo4TMHIepO4xEF/2ZrkXqaXCGjxJOY7o8oVwi/hGI/c5 11 | //asRDrK8JlU8GxQ+mNwNxyo4jNOs7l5B4dsBPcjZwIDAQABMA0GCSqGSIb3DQEB 12 | CwUAA4IBAQArugQNRw5q+JxCUyYFtkDMUdq5Kzhh50JLgkh3rsfH+UAO2X6JV3x2 13 | uO88LbfMs0wjX0u6o2O4FOq3yBAYlc4jBuJgYzG/1SukaecKKjNEFChVtzFXQH4k 14 | 5HVC8MoxCIZCM0/Th0zhYmjynji59i8daRKDPRAzPexcK/uZjkHmrRc+FOi7xiPq 15 | fuQLs21FSnnlasjT96s1HZxGGvsJEYFGfwTA44+RpZcLVYZ4foClUvsQU0yBHTsi 16 | W5fRURiUU3R8Wyb1zzscjDPQsEJI30DQV0Shkwi/lOpJ9ta3oJpI8A/FFPyb2fyP 17 | tIfrJjYkleV1/wj/7lqdGyP3gt3KGA4A 18 | -----END CERTIFICATE----- 19 | -----BEGIN RSA PRIVATE KEY----- 20 | MIICXAIBAAKBgQCVv3enSJsbUdSxuV72z0V+gtSrD58nqZ0Hlc4idK4lPBZgROUJ 21 | Tp0hjnSyZOn+IZXynceQcRsysRqUU9fqRoHZmo4TMHIepO4xEF/2ZrkXqaXCGjxJ 22 | OY7o8oVwi/hGI/c5//asRDrK8JlU8GxQ+mNwNxyo4jNOs7l5B4dsBPcjZwIDAQAB 23 | AoGALBepgq8lRKEOsJn1dVTIkJyzQ/8gjMwreY1JmemjUUFlEUmX6uqj57qLb++4 24 | 2mRHQ53jogs7x+xP+DbLz6adGuNSuVWiGO0r5U44ztftJ+AJh01M4OBzfpmZx5rE 25 | voxihVIMh2czBZyDbJcR8/NDsV3fIAaOfvSlvFsa5YW8jpECQQDEExTP1lzTmupx 26 | thlh6GeSUAmlo75BTOdLaQ2ml6Fh9JmBAZ0HjOaTJu/QOwDxHEQQSGU5rrrco5gy 27 | 5U608ik5AkEAw4PHzuzi7UQ5vJPaiqHp2aC8rSk5DyaLZUdGCNVvnH4B7e6UXjlg 28 | Zd7YgnLw2ProyodmkO/NYzVVJtdbbijRnwJADSJSFJIBadNIvRE7pglRVsWxv7y2 29 | M92Y6L5CwdQKZWtjFPcss6LGlzjWe5ZYO85u6MBQt4pyzfDPcylVGl3WUQJAbu1S 30 | rQ1rxtBBrcN5Z9RreGUhB2HvFLB6wDCLBLIMDA7WC2ekWD1XexTPZFvQWFsrPtVJ 31 | lQvpTNNSh6ICJuMT4wJBAJucCKsoD6Sv1x5BD2Z04hMIB2h5Y1Mdg9bcJZFkKHoF 32 | 79Swlx2uWyI12kWnW8k/ZQBNPp/IZtZWb9LCqQODKEo= 33 | -----END RSA PRIVATE KEY----- 34 | -------------------------------------------------------------------------------- /webrtc/conf/freeswitch_certs/cafile.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDwTCCAqmgAwIBAgIJAPc4lAw1yJvpMA0GCSqGSIb3DQEBCwUAMHcxCzAJBgNV 3 | BAYTAkNOMQswCQYDVQQIDAJHRDELMAkGA1UEBwwCR1oxDDAKBgNVBAoMA1pIRDEL 4 | MAkGA1UECwwCUkQxDzANBgNVBAMMBnpob3VkZDEiMCAGCSqGSIb3DQEJARYTMTUw 5 | MTk0NDI1MTFAMTYzLmNvbTAeFw0yMTA0MjEwMDI3MTFaFw0zMTA0MTkwMDI3MTFa 6 | MHcxCzAJBgNVBAYTAkNOMQswCQYDVQQIDAJHRDELMAkGA1UEBwwCR1oxDDAKBgNV 7 | BAoMA1pIRDELMAkGA1UECwwCUkQxDzANBgNVBAMMBnpob3VkZDEiMCAGCSqGSIb3 8 | DQEJARYTMTUwMTk0NDI1MTFAMTYzLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEP 9 | ADCCAQoCggEBAMEteWNm4Dbv1z0KIK7g9CXBr72snG8TAuuiuODwoh+v+P9aKOnW 10 | VUXzlGNmxlDHzkfGP+ZZrzS8XlPqcupWcTR25/j6fvmgANOsIDQ2ln5t78kE9OLE 11 | 9I7fjAmx/FIkNOy3ztXnXemDtXHhmTtqAOQLaXH9R1Q6GEho+/ZuznwQ/qLuDoUb 12 | QUhSqOZFzxyObNjo/zKAXq2lrBc4wdrXS1sQV436ro1Rc15GFAtB5Tsv09mXJyUU 13 | L6UuekPyHViOrvGB4rvZ+HHiQ0192uPOCubsRIBQCMWOM7kBApXS41KB4BIPwJ99 14 | 67yCmkipCBw40PBFLdEKZvk5YoSH1s4P7J8CAwEAAaNQME4wHQYDVR0OBBYEFK5l 15 | SpkdQdbOrFL34lsG3rNOVK+xMB8GA1UdIwQYMBaAFK5lSpkdQdbOrFL34lsG3rNO 16 | VK+xMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAEPvmLpSBlofrPRr 17 | Hmpn/LL/eCr3srVK4uSdXnfjZ6sUd13DxApU4c3B0jG+3pBs8igabtHO6Pnfy1Rd 18 | 7eXYDhQHdMEj/h4QkxK3b0DMR8c0lXQcu1/t17nIC5ubXb+RbDPvUwOHH6P5rLG0 19 | hMijztgeki4fw21SznNse+GGcJaVgWdderkh4wST8tS55IOq99SOHMjGW+U0GkWp 20 | Hpoonunz35XZ4i5i1N6spZLj0YNs6JY+Wa8znrUbkL5QmFB/q+VLvIhDMPHcM4QR 21 | fft8LZUE/ZGiNqOwc7gq3Q3UwfKrzviU1lF43gKkeOU0Lfb4gO2X9T/z7MNsdQ/k 22 | 6XKDJqk= 23 | -----END CERTIFICATE----- 24 | -------------------------------------------------------------------------------- /webrtc/conf/freeswitch_certs/dtls-srtp.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIC5DCCAcwCAQEwDQYJKoZIhvcNAQELBQAwdzELMAkGA1UEBhMCQ04xCzAJBgNV 3 | BAgMAkdEMQswCQYDVQQHDAJHWjEMMAoGA1UECgwDWkhEMQswCQYDVQQLDAJSRDEP 4 | MA0GA1UEAwwGemhvdWRkMSIwIAYJKoZIhvcNAQkBFhMxNTAxOTQ0MjUxMUAxNjMu 5 | Y29tMB4XDTIxMDQyMTAwMzAwNloXDTMxMDQxOTAwMzAwNlowfTELMAkGA1UEBhMC 6 | Q04xCzAJBgNVBAgMAkdEMQswCQYDVQQHDAJHWjEMMAoGA1UECgwDWkhEMQswCQYD 7 | VQQLDAJSRDEVMBMGA1UEAwwMOC4xMzQuMTQuMjQxMSIwIAYJKoZIhvcNAQkBFhMx 8 | NTAxOTQ0MjUxMUAxNjMuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCV 9 | v3enSJsbUdSxuV72z0V+gtSrD58nqZ0Hlc4idK4lPBZgROUJTp0hjnSyZOn+IZXy 10 | nceQcRsysRqUU9fqRoHZmo4TMHIepO4xEF/2ZrkXqaXCGjxJOY7o8oVwi/hGI/c5 11 | //asRDrK8JlU8GxQ+mNwNxyo4jNOs7l5B4dsBPcjZwIDAQABMA0GCSqGSIb3DQEB 12 | CwUAA4IBAQArugQNRw5q+JxCUyYFtkDMUdq5Kzhh50JLgkh3rsfH+UAO2X6JV3x2 13 | uO88LbfMs0wjX0u6o2O4FOq3yBAYlc4jBuJgYzG/1SukaecKKjNEFChVtzFXQH4k 14 | 5HVC8MoxCIZCM0/Th0zhYmjynji59i8daRKDPRAzPexcK/uZjkHmrRc+FOi7xiPq 15 | fuQLs21FSnnlasjT96s1HZxGGvsJEYFGfwTA44+RpZcLVYZ4foClUvsQU0yBHTsi 16 | W5fRURiUU3R8Wyb1zzscjDPQsEJI30DQV0Shkwi/lOpJ9ta3oJpI8A/FFPyb2fyP 17 | tIfrJjYkleV1/wj/7lqdGyP3gt3KGA4A 18 | -----END CERTIFICATE----- 19 | -------------------------------------------------------------------------------- /webrtc/conf/freeswitch_certs/dtls-srtp.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN PRIVATE KEY----- 2 | MIIJQwIBADANBgkqhkiG9w0BAQEFAASCCS0wggkpAgEAAoICAQDF8aJJCrt2acRF 3 | X/6wJBG2d+5BWTdlIenOb41q6LmZ3XT1ldp7X5BzaszbTzDk8RB2u8M+eSKYe/jF 4 | L6Lf5Vyl7uJAs2+EpHVTBcQnlZkeOnoVxW1wAeImAOyX9h0jArkXT0EvSaL0OPAb 5 | VQtybwsdiH+OXEkWJNMU0p3LNHxLHIZQ7dscboEOooizQAePscOzUKQxZvUkRH+Q 6 | FKy2OQSy+u8/9pKzx55u4cj9yHXm/EFm7BuZ57cfuUPJ6pf7FNZFhWfLinlc7hrp 7 | XJ3TbAElo3hsJdo89FL94BUTeUYQbzdtXHi3cqa5vkbRC5gyzwXLaxW/UY8J72/9 8 | B62Hqb9SkWAKzD/NMKxfkX5svdaIqC7s3LGA0Jk+fgjJDJvSJv0MxIKP/aAlg/no 9 | ZAJzEJubW0FxZIQnjEOD5734LmTXyuGn+tWp/W6SW5cyt9OoPxyQqjTy3kNm/nGz 10 | 2IZUOE0O2xkdSK95cqAMxVUEZSj4an4JcRvh2W1y2tnitFFSJlLBozJqgZgxyyrm 11 | Fd+7MaR+9g/hnB1pjLaP/f0RHvjvIPWOzSAZM9zJNdSgtQkwQzb8vpcukoYnuu5S 12 | L7hEQH5n/oOW26iDN4IRrOhyL+4P+n/3jsoM5LDbhbUMB7pMuoiX+6lCCQ05q0kS 13 | l57ecgyWnIA+OnfXIzxTqVir1D6y+wIDAQABAoICAQCmYywoO9ZCfjuWmU+sXlVp 14 | TTzAP69Z2nz/ozN7p27EUKxM948036q76g2TV+jguWY+eCxxqj+Tb7o4fodprxIH 15 | BVu4SVy3YcqhZBpzr8OK7lrLTC5m1Z50lZhLUH1Dfbl6R4uipUJOCkKCpyU9Juxw 16 | Ado/H4HsFD4+paAwPMkyFiMtihMBvj3LwIIqMutoNWQsqd+rC0GLH+0eftKDRkCV 17 | 9msAGFNOvcCGslJSSZwZ8vdC/bthzq5XA1NhOkpQqz5GKBKMvLSxkhCbEtgz7Pi1 18 | 28iRF+xwCmxsrVzqBqoHjIVJ704l3kEZp0E93YItS2oyiKw6KuOS1WsMhdSvUdfY 19 | oqJ+kUai+IbjSBssKhVd2LYRC99m6O6CJhliIxU2q21SSfwxaItTSA6rZ+s+lRH0 20 | TQEZnaY4LsCrHes1z9yDO756Gqd2VKB0FfNsbKeSLbH6vUnnUV//3sTIvkt1wX5e 21 | jO/A0QeSOQKq/5JoB0L8Q/AHLvGtuCgmW68w0cTbYTYnfFG1iHLiJgY52Ndt+30c 22 | SuR3dnaezY7TTekuoZafUdv59jEckaUJrypDaSEOSBjuEyFgkuKNlRI9v2xWp6FN 23 | 1V6pUlFNe7BndbbAa4FDk35JGl1ANZqAdORuB5sQ5pd7K2+AEwnotFY6qE+c/v8Y 24 | Jue7UyRlL9/NCtnGObqrqQKCAQEA+UNoXVDaTwoVdzC3TvytHTKn3wVTH3ERPFcx 25 | BYgPZgAS4q6vc4Bxf0il4zuqyOush3wnN5fdRQ/lZaKB7hjJbMYVHlfblzL6+xIv 26 | a2XlwcuQ6vuRj2cDMWh7tFI03GrMpmqUCE3GBaisN1B+SP8mxoh7cdeaJmkcXimJ 27 | SiIyVCB5sEcbOUb4h7Zj3s3D7ThX0RAOEeTaGzlhUNBOLksVmOGDEjwm4RRRtOrR 28 | pvcTAVkoJZIiiM5gQbo395Ds/9S/A2kSyOa+ksOnXUGUy5jtWtFdw4w/7oioobwk 29 | VfICxIS+jaqbIiSOoJG9Rd4QCwSV/CGx2EobxhYi6mN+WYSUFwKCAQEAy0so2rE8 30 | L/z0LeSvR3cJ9jFVwyaGwV+EkRcgKPwi7Px8HkYfVgXKzQkERtDWD8fxP58igUbO 31 | QikJ2z/o6CosmZdKyjsK4UXot3jsmiQXWP1oAtN6MQtKiA6ipqBG8nhZGarOQ/Zz 32 | dOY4ZhC4Mnui+uPGS8V23NrPQ5fL9HGi8PUNoZTVeVKoJriHG63oLcNdWiFAMA3n 33 | bxVkQzYLMXPrmzMOZruBLvFAkfRGoDG+o3P9L0BVzIoJThIWR71JOl7wOwfJAeFy 34 | pZSvLfSLOzeWziADZ2JtAqw9NbDVrrNx1FTlAqxXarB1eqY8pVHBPnBm3sxKnV+u 35 | ZbyoJyK2qEJSvQKCAQEAv4UmhESiaIaT9a+tuPf2P2/zgi2CL69dkeJgnSJsym+W 36 | EywrTPDMxALayxzGXXiPaM5hB5sc/Xp4RL43XO0YnwYXpefVpngaVZ0kaD2z6lJx 37 | 98rxjaCV2HmyStu7F/zLX7aWJUc0tpZiNGIZlhbOAU9OoisJmye6DzOU9CwQRYlq 38 | VqJb7Yd1YDkoxUGOoA9hkhXm6aLQXoiZGFHlMDaq0nu7jOBA80H8gajHC6XdqXSK 39 | n0uIU1tWpEnjxMlLAErDtWgfcdOxa+z/BG1mWYUYImapx51UZgAEqbh4pry7malx 40 | DEKgzfwOxpsUNcGoy/5rC34MOua+LlZF35gwtbFjYwKCAQBXfbBGdlKN4JKCEdJx 41 | skSCRPdA9pq2LFKUUtyPZvvs/Di6mrkvv2xpU4EYrRYDUqx8EhO6iWuJQ7ovNtEY 42 | 4dWyAE+6uzBShVDDbXJ+YBwAO4cA+Fy1MMPRzGKpzX7bKXpHNqBw1WcZH1+UZYuw 43 | hk89JLwZrhEaubzLvU+Ukzdp9jz4lmJNRYqCp5XWDsFGuLa7bGYAiGta/lzZJDAr 44 | B1WVxKJlCjttpXyBlBy1ItOF6wxCwrBqR9n7VINsOoWCbot7DD2w5oL9ygCeiYlG 45 | YgUwDs0IOG7r4I6zRbig6C+MD0FEJkG0896Le3HMQGQnaB6NsmRGWIBo3omL1j/A 46 | KFMNAoIBABaxm7kAtYWFuvah0IAind1Woz/Iis7KQGYb3HunMRSLUPownxEyy4DQ 47 | YvMJ+ETqc8F7HuRcH4YGfQEXF8oiZbEGv0FZtV6OJZrq9fhdRzbzhNYT5KQKSZ7f 48 | 9deFO1xJEjl+iExkjbwTMLbFCElyscki5ve8tipp1FEHSjhy2j3D4fJUiggW74Hm 49 | bpu3V2Fdv4wcZzsYylTblertQYkrEeh89uIxvOK3ZezaOI5xgbCsUBIP4E8o/slp 50 | 8lmJwHq/lJNRqZvETY8rqrmPZd7WetuTJyNtaI0kI4n7D2I41eF3qUlFgOV72PpT 51 | +uY3uL8tPlBuVODJpD5r1wEHcD+PtPA= 52 | -----END PRIVATE KEY----- 53 | -----BEGIN CERTIFICATE----- 54 | MIIEujCCAqICAQAwDQYJKoZIhvcNAQEFBQAwIjELMAkGA1UEBhMCVVMxEzARBgNV 55 | BAMMCkZyZWVTV0lUQ0gwIBcNMjEwNDEzMTY1MzE1WhgPMjEyMTAzMjcxNjUzMTVa 56 | MCIxCzAJBgNVBAYTAlVTMRMwEQYDVQQDDApGcmVlU1dJVENIMIICIjANBgkqhkiG 57 | 9w0BAQEFAAOCAg8AMIICCgKCAgEAxfGiSQq7dmnERV/+sCQRtnfuQVk3ZSHpzm+N 58 | aui5md109ZXae1+Qc2rM208w5PEQdrvDPnkimHv4xS+i3+Vcpe7iQLNvhKR1UwXE 59 | J5WZHjp6FcVtcAHiJgDsl/YdIwK5F09BL0mi9DjwG1ULcm8LHYh/jlxJFiTTFNKd 60 | yzR8SxyGUO3bHG6BDqKIs0AHj7HDs1CkMWb1JER/kBSstjkEsvrvP/aSs8eebuHI 61 | /ch15vxBZuwbmee3H7lDyeqX+xTWRYVny4p5XO4a6Vyd02wBJaN4bCXaPPRS/eAV 62 | E3lGEG83bVx4t3Kmub5G0QuYMs8Fy2sVv1GPCe9v/Qeth6m/UpFgCsw/zTCsX5F+ 63 | bL3WiKgu7NyxgNCZPn4IyQyb0ib9DMSCj/2gJYP56GQCcxCbm1tBcWSEJ4xDg+e9 64 | +C5k18rhp/rVqf1ukluXMrfTqD8ckKo08t5DZv5xs9iGVDhNDtsZHUiveXKgDMVV 65 | BGUo+Gp+CXEb4dltctrZ4rRRUiZSwaMyaoGYMcsq5hXfuzGkfvYP4ZwdaYy2j/39 66 | ER747yD1js0gGTPcyTXUoLUJMEM2/L6XLpKGJ7ruUi+4REB+Z/6DltuogzeCEazo 67 | ci/uD/p/947KDOSw24W1DAe6TLqIl/upQgkNOatJEpee3nIMlpyAPjp31yM8U6lY 68 | q9Q+svsCAwEAATANBgkqhkiG9w0BAQUFAAOCAgEAJbu9NKfSkmKg5F0mJPSjpzaS 69 | eCeZ+hjw3+KMWS9i9vRE4j1r3xOh4+T3K9ykoWf6jYrQ1evzBTIljRnw4tUDLQmB 70 | Ehy0Jx+ZO2oAM0uH9yKYORs1n9rFHyhPKdpv79XTRMu/odBRIHmhaTzrv9cSJxly 71 | 3wlBvupveRM6SgQFehDmqnF5Ajr0i6XeF4KVRfQJgW7tee9QyNb9Auo0CWRcaXh2 72 | wXxgjYDkKPfKz3jo6paetuTpVme03Wc3ybtXuaLS68dXdKJPU/DivcQmAWyco7Cv 73 | DrpkwXuGbSGLW4xiiDorvMdrTr2XN+F/YS5HltWjdn8jN6tayWIHtt0uNjWgrb3B 74 | r0e3rb8dWd59eO5/WCSXzbQrwm6TQaIw8PJWJ3pKyzFfmD1W248RyQXFlSlGnZmQ 75 | AZLZ+5KpIn+LKuptBJunXSvT5W7r7nBFHs0GBlsAOi0m32Z10qV7DfqrrtphcTnL 76 | atg0w85k9vxFObZa+AqkzdztWHIkHI26phUwHav7BFoLxgKkwpvBhi+Y65pwPp04 77 | ThNr3qPIxeg245JqfeORcykb0a6Q5A176wlhSXgl68m+/UXNpp4iTdVmRme0AmVZ 78 | YAm2ROmb9IJR4nnXMPQPnd6xDTwBQ4jvPI29hEu3tRtoaZaxbyeC+CyeKOBRowtB 79 | VCInk3wr9F7axXbZooM= 80 | -----END CERTIFICATE----- 81 | -------------------------------------------------------------------------------- /webrtc/conf/freeswitch_certs/wss.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIC5DCCAcwCAQEwDQYJKoZIhvcNAQELBQAwdzELMAkGA1UEBhMCQ04xCzAJBgNV 3 | BAgMAkdEMQswCQYDVQQHDAJHWjEMMAoGA1UECgwDWkhEMQswCQYDVQQLDAJSRDEP 4 | MA0GA1UEAwwGemhvdWRkMSIwIAYJKoZIhvcNAQkBFhMxNTAxOTQ0MjUxMUAxNjMu 5 | Y29tMB4XDTIxMDQyMTAwMzAwNloXDTMxMDQxOTAwMzAwNlowfTELMAkGA1UEBhMC 6 | Q04xCzAJBgNVBAgMAkdEMQswCQYDVQQHDAJHWjEMMAoGA1UECgwDWkhEMQswCQYD 7 | VQQLDAJSRDEVMBMGA1UEAwwMOC4xMzQuMTQuMjQxMSIwIAYJKoZIhvcNAQkBFhMx 8 | NTAxOTQ0MjUxMUAxNjMuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCV 9 | v3enSJsbUdSxuV72z0V+gtSrD58nqZ0Hlc4idK4lPBZgROUJTp0hjnSyZOn+IZXy 10 | nceQcRsysRqUU9fqRoHZmo4TMHIepO4xEF/2ZrkXqaXCGjxJOY7o8oVwi/hGI/c5 11 | //asRDrK8JlU8GxQ+mNwNxyo4jNOs7l5B4dsBPcjZwIDAQABMA0GCSqGSIb3DQEB 12 | CwUAA4IBAQArugQNRw5q+JxCUyYFtkDMUdq5Kzhh50JLgkh3rsfH+UAO2X6JV3x2 13 | uO88LbfMs0wjX0u6o2O4FOq3yBAYlc4jBuJgYzG/1SukaecKKjNEFChVtzFXQH4k 14 | 5HVC8MoxCIZCM0/Th0zhYmjynji59i8daRKDPRAzPexcK/uZjkHmrRc+FOi7xiPq 15 | fuQLs21FSnnlasjT96s1HZxGGvsJEYFGfwTA44+RpZcLVYZ4foClUvsQU0yBHTsi 16 | W5fRURiUU3R8Wyb1zzscjDPQsEJI30DQV0Shkwi/lOpJ9ta3oJpI8A/FFPyb2fyP 17 | tIfrJjYkleV1/wj/7lqdGyP3gt3KGA4A 18 | -----END CERTIFICATE----- 19 | -----BEGIN RSA PRIVATE KEY----- 20 | MIICXAIBAAKBgQCVv3enSJsbUdSxuV72z0V+gtSrD58nqZ0Hlc4idK4lPBZgROUJ 21 | Tp0hjnSyZOn+IZXynceQcRsysRqUU9fqRoHZmo4TMHIepO4xEF/2ZrkXqaXCGjxJ 22 | OY7o8oVwi/hGI/c5//asRDrK8JlU8GxQ+mNwNxyo4jNOs7l5B4dsBPcjZwIDAQAB 23 | AoGALBepgq8lRKEOsJn1dVTIkJyzQ/8gjMwreY1JmemjUUFlEUmX6uqj57qLb++4 24 | 2mRHQ53jogs7x+xP+DbLz6adGuNSuVWiGO0r5U44ztftJ+AJh01M4OBzfpmZx5rE 25 | voxihVIMh2czBZyDbJcR8/NDsV3fIAaOfvSlvFsa5YW8jpECQQDEExTP1lzTmupx 26 | thlh6GeSUAmlo75BTOdLaQ2ml6Fh9JmBAZ0HjOaTJu/QOwDxHEQQSGU5rrrco5gy 27 | 5U608ik5AkEAw4PHzuzi7UQ5vJPaiqHp2aC8rSk5DyaLZUdGCNVvnH4B7e6UXjlg 28 | Zd7YgnLw2ProyodmkO/NYzVVJtdbbijRnwJADSJSFJIBadNIvRE7pglRVsWxv7y2 29 | M92Y6L5CwdQKZWtjFPcss6LGlzjWe5ZYO85u6MBQt4pyzfDPcylVGl3WUQJAbu1S 30 | rQ1rxtBBrcN5Z9RreGUhB2HvFLB6wDCLBLIMDA7WC2ekWD1XexTPZFvQWFsrPtVJ 31 | lQvpTNNSh6ICJuMT4wJBAJucCKsoD6Sv1x5BD2Z04hMIB2h5Y1Mdg9bcJZFkKHoF 32 | 79Swlx2uWyI12kWnW8k/ZQBNPp/IZtZWb9LCqQODKEo= 33 | -----END RSA PRIVATE KEY----- 34 | -------------------------------------------------------------------------------- /webrtc/conf/freeswitch_conf/event_socket.conf.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /webrtc/conf/freeswitch_conf/external.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /webrtc/conf/freeswitch_conf/verto.conf.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /webrtc/conf/nginx_conf/SSL_CA.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIDwTCCAqmgAwIBAgIJAPc4lAw1yJvpMA0GCSqGSIb3DQEBCwUAMHcxCzAJBgNV 3 | BAYTAkNOMQswCQYDVQQIDAJHRDELMAkGA1UEBwwCR1oxDDAKBgNVBAoMA1pIRDEL 4 | MAkGA1UECwwCUkQxDzANBgNVBAMMBnpob3VkZDEiMCAGCSqGSIb3DQEJARYTMTUw 5 | MTk0NDI1MTFAMTYzLmNvbTAeFw0yMTA0MjEwMDI3MTFaFw0zMTA0MTkwMDI3MTFa 6 | MHcxCzAJBgNVBAYTAkNOMQswCQYDVQQIDAJHRDELMAkGA1UEBwwCR1oxDDAKBgNV 7 | BAoMA1pIRDELMAkGA1UECwwCUkQxDzANBgNVBAMMBnpob3VkZDEiMCAGCSqGSIb3 8 | DQEJARYTMTUwMTk0NDI1MTFAMTYzLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEP 9 | ADCCAQoCggEBAMEteWNm4Dbv1z0KIK7g9CXBr72snG8TAuuiuODwoh+v+P9aKOnW 10 | VUXzlGNmxlDHzkfGP+ZZrzS8XlPqcupWcTR25/j6fvmgANOsIDQ2ln5t78kE9OLE 11 | 9I7fjAmx/FIkNOy3ztXnXemDtXHhmTtqAOQLaXH9R1Q6GEho+/ZuznwQ/qLuDoUb 12 | QUhSqOZFzxyObNjo/zKAXq2lrBc4wdrXS1sQV436ro1Rc15GFAtB5Tsv09mXJyUU 13 | L6UuekPyHViOrvGB4rvZ+HHiQ0192uPOCubsRIBQCMWOM7kBApXS41KB4BIPwJ99 14 | 67yCmkipCBw40PBFLdEKZvk5YoSH1s4P7J8CAwEAAaNQME4wHQYDVR0OBBYEFK5l 15 | SpkdQdbOrFL34lsG3rNOVK+xMB8GA1UdIwQYMBaAFK5lSpkdQdbOrFL34lsG3rNO 16 | VK+xMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAEPvmLpSBlofrPRr 17 | Hmpn/LL/eCr3srVK4uSdXnfjZ6sUd13DxApU4c3B0jG+3pBs8igabtHO6Pnfy1Rd 18 | 7eXYDhQHdMEj/h4QkxK3b0DMR8c0lXQcu1/t17nIC5ubXb+RbDPvUwOHH6P5rLG0 19 | hMijztgeki4fw21SznNse+GGcJaVgWdderkh4wST8tS55IOq99SOHMjGW+U0GkWp 20 | Hpoonunz35XZ4i5i1N6spZLj0YNs6JY+Wa8znrUbkL5QmFB/q+VLvIhDMPHcM4QR 21 | fft8LZUE/ZGiNqOwc7gq3Q3UwfKrzviU1lF43gKkeOU0Lfb4gO2X9T/z7MNsdQ/k 22 | 6XKDJqk= 23 | -----END CERTIFICATE----- 24 | -------------------------------------------------------------------------------- /webrtc/conf/nginx_conf/SSL_Priv.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN RSA PRIVATE KEY----- 2 | MIICXAIBAAKBgQCVv3enSJsbUdSxuV72z0V+gtSrD58nqZ0Hlc4idK4lPBZgROUJ 3 | Tp0hjnSyZOn+IZXynceQcRsysRqUU9fqRoHZmo4TMHIepO4xEF/2ZrkXqaXCGjxJ 4 | OY7o8oVwi/hGI/c5//asRDrK8JlU8GxQ+mNwNxyo4jNOs7l5B4dsBPcjZwIDAQAB 5 | AoGALBepgq8lRKEOsJn1dVTIkJyzQ/8gjMwreY1JmemjUUFlEUmX6uqj57qLb++4 6 | 2mRHQ53jogs7x+xP+DbLz6adGuNSuVWiGO0r5U44ztftJ+AJh01M4OBzfpmZx5rE 7 | voxihVIMh2czBZyDbJcR8/NDsV3fIAaOfvSlvFsa5YW8jpECQQDEExTP1lzTmupx 8 | thlh6GeSUAmlo75BTOdLaQ2ml6Fh9JmBAZ0HjOaTJu/QOwDxHEQQSGU5rrrco5gy 9 | 5U608ik5AkEAw4PHzuzi7UQ5vJPaiqHp2aC8rSk5DyaLZUdGCNVvnH4B7e6UXjlg 10 | Zd7YgnLw2ProyodmkO/NYzVVJtdbbijRnwJADSJSFJIBadNIvRE7pglRVsWxv7y2 11 | M92Y6L5CwdQKZWtjFPcss6LGlzjWe5ZYO85u6MBQt4pyzfDPcylVGl3WUQJAbu1S 12 | rQ1rxtBBrcN5Z9RreGUhB2HvFLB6wDCLBLIMDA7WC2ekWD1XexTPZFvQWFsrPtVJ 13 | lQvpTNNSh6ICJuMT4wJBAJucCKsoD6Sv1x5BD2Z04hMIB2h5Y1Mdg9bcJZFkKHoF 14 | 79Swlx2uWyI12kWnW8k/ZQBNPp/IZtZWb9LCqQODKEo= 15 | -----END RSA PRIVATE KEY----- 16 | -------------------------------------------------------------------------------- /webrtc/conf/nginx_conf/SSL_Pub.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIC5DCCAcwCAQEwDQYJKoZIhvcNAQELBQAwdzELMAkGA1UEBhMCQ04xCzAJBgNV 3 | BAgMAkdEMQswCQYDVQQHDAJHWjEMMAoGA1UECgwDWkhEMQswCQYDVQQLDAJSRDEP 4 | MA0GA1UEAwwGemhvdWRkMSIwIAYJKoZIhvcNAQkBFhMxNTAxOTQ0MjUxMUAxNjMu 5 | Y29tMB4XDTIxMDQyMTAwMzAwNloXDTMxMDQxOTAwMzAwNlowfTELMAkGA1UEBhMC 6 | Q04xCzAJBgNVBAgMAkdEMQswCQYDVQQHDAJHWjEMMAoGA1UECgwDWkhEMQswCQYD 7 | VQQLDAJSRDEVMBMGA1UEAwwMOC4xMzQuMTQuMjQxMSIwIAYJKoZIhvcNAQkBFhMx 8 | NTAxOTQ0MjUxMUAxNjMuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCV 9 | v3enSJsbUdSxuV72z0V+gtSrD58nqZ0Hlc4idK4lPBZgROUJTp0hjnSyZOn+IZXy 10 | nceQcRsysRqUU9fqRoHZmo4TMHIepO4xEF/2ZrkXqaXCGjxJOY7o8oVwi/hGI/c5 11 | //asRDrK8JlU8GxQ+mNwNxyo4jNOs7l5B4dsBPcjZwIDAQABMA0GCSqGSIb3DQEB 12 | CwUAA4IBAQArugQNRw5q+JxCUyYFtkDMUdq5Kzhh50JLgkh3rsfH+UAO2X6JV3x2 13 | uO88LbfMs0wjX0u6o2O4FOq3yBAYlc4jBuJgYzG/1SukaecKKjNEFChVtzFXQH4k 14 | 5HVC8MoxCIZCM0/Th0zhYmjynji59i8daRKDPRAzPexcK/uZjkHmrRc+FOi7xiPq 15 | fuQLs21FSnnlasjT96s1HZxGGvsJEYFGfwTA44+RpZcLVYZ4foClUvsQU0yBHTsi 16 | W5fRURiUU3R8Wyb1zzscjDPQsEJI30DQV0Shkwi/lOpJ9ta3oJpI8A/FFPyb2fyP 17 | tIfrJjYkleV1/wj/7lqdGyP3gt3KGA4A 18 | -----END CERTIFICATE----- 19 | -------------------------------------------------------------------------------- /webrtc/conf/nginx_conf/nginx.conf: -------------------------------------------------------------------------------- 1 | 2 | #user nobody; 3 | worker_processes 1; 4 | 5 | #error_log logs/error.log; 6 | #error_log logs/error.log notice; 7 | #error_log logs/error.log info; 8 | 9 | #pid logs/nginx.pid; 10 | 11 | 12 | events { 13 | worker_connections 1024; 14 | } 15 | 16 | 17 | http { 18 | include mime.types; 19 | default_type application/octet-stream; 20 | 21 | #log_format main '$remote_addr - $remote_user [$time_local] "$request" ' 22 | # '$status $body_bytes_sent "$http_referer" ' 23 | # '"$http_user_agent" "$http_x_forwarded_for"'; 24 | 25 | #access_log logs/access.log main; 26 | 27 | sendfile on; 28 | #tcp_nopush on; 29 | 30 | #keepalive_timeout 0; 31 | keepalive_timeout 65; 32 | 33 | #gzip on; 34 | 35 | server { 36 | listen 80; 37 | server_name localhost; 38 | 39 | #charset koi8-r; 40 | 41 | #access_log logs/host.access.log main; 42 | 43 | location / { 44 | root html; 45 | index index.html index.htm; 46 | } 47 | 48 | location /sip { 49 | root /home; 50 | } 51 | 52 | 53 | #error_page 404 /404.html; 54 | 55 | # redirect server error pages to the static page /50x.html 56 | # 57 | error_page 500 502 503 504 /50x.html; 58 | location = /50x.html { 59 | root html; 60 | } 61 | 62 | # proxy the PHP scripts to Apache listening on 127.0.0.1:80 63 | # 64 | #location ~ \.php$ { 65 | # proxy_pass http://127.0.0.1; 66 | #} 67 | 68 | # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 69 | # 70 | #location ~ \.php$ { 71 | # root html; 72 | # fastcgi_pass 127.0.0.1:9000; 73 | # fastcgi_index index.php; 74 | # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; 75 | # include fastcgi_params; 76 | #} 77 | 78 | # deny access to .htaccess files, if Apache's document root 79 | # concurs with nginx's one 80 | # 81 | #location ~ /\.ht { 82 | # deny all; 83 | #} 84 | } 85 | 86 | 87 | # another virtual host using mix of IP-, name-, and port-based configuration 88 | # 89 | #server { 90 | # listen 8000; 91 | # listen somename:8080; 92 | # server_name somename alias another.alias; 93 | 94 | # location / { 95 | # root html; 96 | # index index.html index.htm; 97 | # } 98 | #} 99 | 100 | 101 | # HTTPS server 102 | # 103 | #server { 104 | # listen 443 ssl; 105 | # server_name localhost; 106 | 107 | # ssl_certificate cert.pem; 108 | # ssl_certificate_key cert.key; 109 | 110 | # ssl_session_cache shared:SSL:1m; 111 | # ssl_session_timeout 5m; 112 | 113 | # ssl_ciphers HIGH:!aNULL:!MD5; 114 | # ssl_prefer_server_ciphers on; 115 | 116 | # location / { 117 | # root html; 118 | # index index.html index.htm; 119 | # } 120 | #} 121 | 122 | # HTTPS server 123 | # 124 | server { 125 | listen 443 ssl; 126 | server_name localhost; 127 | 128 | ssl_certificate SSL_Pub.pem; 129 | ssl_certificate_key SSL_Priv.pem; 130 | 131 | ssl_session_cache shared:SSL:1m; 132 | ssl_session_timeout 5m; 133 | 134 | ssl_ciphers HIGH:!aNULL:!MD5; 135 | ssl_prefer_server_ciphers on; 136 | 137 | location / { 138 | root html; 139 | index index.html index.htm; 140 | } 141 | 142 | location /sip { 143 | root /home; 144 | } 145 | } 146 | 147 | } 148 | -------------------------------------------------------------------------------- /webrtc/nginx/nginx.md: -------------------------------------------------------------------------------- 1 | ``` 2 | [root@freeswitch ~]# yum install gcc-c++ pcre pcre-devel zlib zlib-devel #openssl openssl-devel 3 | [root@freeswitch ~]# wget https://nginx.org/download/nginx-1.14.0.tar.gz 4 | [root@freeswitch ~]# tar zxf nginx-1.14.0.tar.gz 5 | [root@freeswitch ~]# cd nginx-1.14.0 6 | [root@freeswitch ~]# ./configure --prefix=/usr/local/nginx --with-http_stub_status_module --with-http_ssl_module 7 | [root@freeswitch ~]# make 8 | [root@freeswitch ~]# make install 9 | 10 | [root@freeswitch ~]# vi /usr/local/nginx/conf/nginx.conf 11 | 12 | # HTTPS server 13 | # 14 | server { 15 | listen 443 ssl; 16 | server_name localhost; 17 | 18 | ssl_certificate SSL_Pub.pem; 19 | ssl_certificate_key SSL_Priv.pem; 20 | 21 | ssl_session_cache shared:SSL:1m; 22 | ssl_session_timeout 5m; 23 | 24 | ssl_ciphers HIGH:!aNULL:!MD5; 25 | ssl_prefer_server_ciphers on; 26 | 27 | location / { 28 | root html; 29 | index index.html index.htm; 30 | } 31 | 32 | location /sip { 33 | root /home; 34 | } 35 | } 36 | 37 | [root@freeswitch ~]# /usr/local/nginx/sbin/nginx -s quit 38 | [root@freeswitch ~]# /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf 39 | [root@freeswitch ~]# /usr/local/nginx/sbin/nginx -s reload 40 | 41 | ``` 42 | -------------------------------------------------------------------------------- /webrtc/pic/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tppi/freeswitch2/f790d22a468ee21f9f3b499c95e53123519afa8e/webrtc/pic/2.jpg -------------------------------------------------------------------------------- /webrtc/pic/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tppi/freeswitch2/f790d22a468ee21f9f3b499c95e53123519afa8e/webrtc/pic/3.png -------------------------------------------------------------------------------- /webrtc/pic/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tppi/freeswitch2/f790d22a468ee21f9f3b499c95e53123519afa8e/webrtc/pic/4.png -------------------------------------------------------------------------------- /webrtc/pic/51.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tppi/freeswitch2/f790d22a468ee21f9f3b499c95e53123519afa8e/webrtc/pic/51.jpg -------------------------------------------------------------------------------- /webrtc/pic/52.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tppi/freeswitch2/f790d22a468ee21f9f3b499c95e53123519afa8e/webrtc/pic/52.jpg -------------------------------------------------------------------------------- /webrtc/pic/53.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tppi/freeswitch2/f790d22a468ee21f9f3b499c95e53123519afa8e/webrtc/pic/53.jpg -------------------------------------------------------------------------------- /webrtc/pic/54.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tppi/freeswitch2/f790d22a468ee21f9f3b499c95e53123519afa8e/webrtc/pic/54.jpg -------------------------------------------------------------------------------- /webrtc/pic/web-sip2.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tppi/freeswitch2/f790d22a468ee21f9f3b499c95e53123519afa8e/webrtc/pic/web-sip2.PNG -------------------------------------------------------------------------------- /webrtc/pic/web-sip3.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tppi/freeswitch2/f790d22a468ee21f9f3b499c95e53123519afa8e/webrtc/pic/web-sip3.PNG -------------------------------------------------------------------------------- /webrtc/ssl/Installation SSL certificates and Coturn for OpenMeetings 5.0.0-M4 on CentOS 7-8.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tppi/freeswitch2/f790d22a468ee21f9f3b499c95e53123519afa8e/webrtc/ssl/Installation SSL certificates and Coturn for OpenMeetings 5.0.0-M4 on CentOS 7-8.pdf -------------------------------------------------------------------------------- /webrtc/ssl/freeswitch_Certificates.md: -------------------------------------------------------------------------------- 1 | ### FreeSwitch_Install_Certificates 2 | ``` 3 | 4 | Antonio 发表: 5 | 6 | hi, 7 | 8 | after install, the default wss.pem gives error, so to test verto communicator with a custom certificate (i think this info is around here) if testing in local without a public domain to use lets encrypt: 9 | 10 | mkdir /root/ssl 11 | 12 | cd /root/ssl 13 | 14 | openssl req -newkey rsa:2048 -nodes -keyout key.pem -x509 -days 365 -out certificate.pem 15 | 16 | #TIP: put in common name the ip address, so when testing you only have the warning for invalid 17 | 18 | cat key.pem certificate.pem > /usr/local/freeswitch/certs/wss.pem 19 | 20 | 21 | 22 | #enable or replace in nginx ssl options for /etc/nginx/sites-enabled/default 23 | 24 | ssl_certificate /root/ssl/certificate.pem; 25 | 26 | ssl_certificate_key /root/ssl/key.pem; 27 | 28 | 29 | 30 | #vc into www, 31 | 32 | cp -a /usr/src/freeswitch/html5/verto/verto_communicator/dist/* /var/www/html/ 33 | 34 | 35 | 36 | hope it helps others (微笑) 37 | 38 | Fran Vicente赞了它 39 | 2018.02.07 40 | ``` 41 | 42 | 43 | notice: 44 | ``` 45 | WebRTC does not work properly with self–signed certs. Chrome will not even tell you why when it refuses them. This is why a proper certificate is essential even when testing WebRTC. See Let's Encrypt above. 46 | `` 47 | https://freeswitch.org/confluence/display/FREESWITCH/Certificates 48 | https://freeswitch.org/confluence/display/FREESWITCH/SIP+TLS 49 | https://freeswitch.org/confluence/display/FREESWITCH/Debian+8+Jessie 50 | https://freeswitch.org/confluence/display/FREESWITCH/WebRTC#WebRTC-InstallCertificates 51 | 52 | https://www.sslshopper.com/ssl-checker.html 53 | -------------------------------------------------------------------------------- /webrtc/ssl/how_to_make_your_own_ca_correctly.txt: -------------------------------------------------------------------------------- 1 | Someone should probably turn this into a nice how-to: 2 | 3 | Here is how I did it. 4 | 5 | wget http://files.freeswitch.org/downloads/ssl.ca-0.1.tar.gz 6 | tar zxfv ssl.ca-0.1.tar.gz 7 | cd ssl.ca-0.1/ 8 | perl -i -pe 's/md5/sha2/g' *.sh 9 | perl -i -pe 's/1024/4096/g' *.sh 10 | ./new-root-ca.sh 11 | ./new-server-cert.sh self.bkw.org 12 | ./sign-server-cert.sh self.bkw.org 13 | cat self.bkw.org.crt self.bkw.org.key > /usr/local/freeswitch/certs/wss.pem 14 | 15 | Setup Apache: 16 | 17 | default-ssl: 18 | 19 | SSLCertificateFile /usr/local/freeswitch/certs/wss.pem 20 | SSLCertificateKeyFile /usr/local/freeswitch/certs/wss.pem 21 | SSLCertificateChainFile /usr/local/freeswitch/certs/wss.pem 22 | 23 | Setup Sofia TLS: 24 | 25 | cat self.bkw.org.crt self.bkw.org.key > /usr/local/freeswitch/certs/agent.pem 26 | cat ca.crt > /usr/local/freeswitch/certs/cafile.pem 27 | 28 | vars.xml: 29 | 30 | 31 | 32 | 33 | Restart FreeSWITCH. 34 | 35 | Now make sure your system has ca.crt imported so it will trust your new found hotness. 36 | 37 | TEST: 38 | 39 | openssl s_client -connect self.bkw.org:443 40 | openssl s_client -connect self.bkw.org:5061 41 | openssl s_client -connect self.bkw.org:5081 42 | openssl s_client -connect self.bkw.org:8082 43 | 44 | 45 | Depending on what you've setup you'll see: 46 | 47 | subject=/C=US/ST=Oklahoma/L=McAlester/O=Tonka Truck/OU=Secure Web Server/CN=self.bkw.org/emailAddress=brian@bkw.org 48 | issuer=/C=US/ST=Oklahoma/L=McAlester/O=Whizzzzzzy Bang Bang/OU=Certification Services Division/CN=WBB Root CA/emailAddress=brian@bkw.org 49 | 50 | Or there abouts. 51 | -------------------------------------------------------------------------------- /webrtc/ssl/self-signed-certs.sh: -------------------------------------------------------------------------------- 1 | # Uncomment next line to create "privkey.pem" and "SSL_CA.pem" files 2 | openssl req -days 3650 -out SSL_CA.pem -new -x509 3 | # Save privkey.pem and SSL_CA.pem 4 | 5 | # General Public and private files 6 | openssl genrsa -out SSL_Priv.pem 1024 7 | openssl req -key SSL_Priv.pem -new -out ./cert.req 8 | echo 00 > file.srl 9 | openssl x509 -req -days 365 -in cert.req -CA SSL_CA.pem -CAkey privkey.pem -CAserial file.srl -out SSL_Pub.pem 10 | 11 | # To convert to DER 12 | #openssl x509 -outform der -in SSL_CA.pem -out SSL_CA.der 13 | #openssl x509 -outform der -in SSL_Pub.pem -out SSL_Pub.der 14 | -------------------------------------------------------------------------------- /webrtc/stun_turn/coturn: -------------------------------------------------------------------------------- 1 | 1. Install coturn on CentOS/Ubuntu 2 | sudo yum install coturn/sudo apt-get install coturn 3 | 4 | 2. simple mode 5 | turnserver -o -a -f -v --mobility -m 10 --max-bps=1024000 --min-port=16384 --max-port=32768 --user=test:test123 -r test --cert=/usr/local/nginx/conf/SSL_Pub.pem --pkey=/usr/local/nginx/conf/SSL_Priv.pem CA-file=/usr/local/nginx/conf/SSL_CA.pem 6 | (开放端口与freeswitch/conf/autoload_configs/switch.conf.xml配置保持同步,允许通过的比特流速率1M=1024×1024不能太小, 可以不检测密钥) 7 | 8 | # stop 9 | ps aux | grep turnserver 10 | found process id,example:2059 11 | kill 2059 12 | 13 | 3. custom config 14 | cp /etc/coturn/turnserver.conf /etc/coturn/turnserver.conf.bak 15 | vi /etc/coturn/turnserver.conf 16 | ``` 17 | ### add by zhoudd 20201225 18 | 19 | # Secure form for password 'qwerty': 20 | cli-password=qwerty 21 | 22 | # Specify the user for the TURN authentification 23 | user=test:test123 24 | 25 | # Further ports that are open for communication 26 | min-port=10000 27 | max-port=10050 28 | 29 | # Enable verbose logging 30 | verbose 31 | 32 | # Use fingerprint in TURN message 33 | fingerprint 34 | 35 | # Enable long-term credential mechanism 36 | lt-cred-mech 37 | ``` 38 | 39 | 4. sipml5 ICE Servers: 40 | [{url:'stun:8.134.18.182:3478'}] 41 | [{url:'stun:8.134.18.182:3478'},{url:'turn:8.134.18.182:3478', username:'test', credential:'test123'}] 42 | 43 | 5. firewall open the port 44 | sudo firewall-cmd --permanent --add-port=3478/tcp 45 | sudo firewall-cmd --permanent --add-port=3478/udp 46 | sudo firewall-cmd --permanent --add-port=5349/tcp 47 | sudo firewall-cmd --permanent --add-port=5349/udp 48 | sudo firewall-cmd --permanent --add-port=63000-64535/udp 49 | sudo firewall-cmd --reload 50 | 51 | 6. Reference 52 | 1) How to set up and configure your own TURN server using Coturn 53 | https://gabrieltanner.org/blog/turn-server 54 | 55 | 2) Configure Your Own TURN/STUN Server 56 | https://www.red5pro.com/docs/server/webrtc/turnstun/#step-by-step-install-on-an-ubuntu-linux-server 57 | 58 | 3) ICE server set up in Ubuntu (Coturn) 59 | https://www.codetd.com/en/article/6415507 60 | 61 | 4) Installation SSL certificates and Coturn for OpenMeetings 5.0.0-M4 on CentOS 7-8.pdf 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /webrtc/stun_turn/coturn.command: -------------------------------------------------------------------------------- 1 | turnserver -o -a -f -v --mobility -m 10 --max-bps=1024000 --min-port=16384 --max-port=32768 --user=test:test123 -r test 2 | # turnserver.conf 3 | 4 | #listening-device #-d 5 | #listening-ip #-L 6 | #listening-port #-p 7 | #relay-device #-i 8 | #relay-ip #-E 9 | #external-ip #-X 10 | verbose #-v 11 | fingerprint #-f 12 | #no-auth #-z 13 | lt-cred-mech #-a 14 | relay-threads=10 #-m 15 | min-port=16384 #--min-port 16 | max-port=32768 #--max-port 17 | user=test:test123 #-u 18 | realm=test #-r 19 | 20 | 21 | listening-port=3478 22 | verbose 23 | fingerprint 24 | lt-cred-mech 25 | mobility 26 | relay-threads=10 27 | min-port=16384 28 | max-port=32768 29 | user=test:test123 30 | realm=test 31 | 32 | 33 | turnserver -o -c /etc/turnserver.conf 34 | -------------------------------------------------------------------------------- /webrtc/stun_turn/coturn.log: -------------------------------------------------------------------------------- 1 | [root@Ubuntu14 ~]# turnserver -o -a -f -v --mobility -m 10 --max-bps=1024000 --min-port=10000 --max-port=10500 --user=test:test123 -r test 2 | 0: : Config file found: /root/../etc/coturn/turnserver.conf 3 | 0: : log file opened: /var/log/coturn/turnserver.log 4 | 0: : 1024000 bytes per second allowed per session 5 | 0: : Config file found: /root/../etc/coturn/turnserver.conf 6 | 0: : 7 | RFC 3489/5389/5766/5780/6062/6156 STUN/TURN Server 8 | Version Coturn-4.5.2 'dan Eider' 9 | 0: : 10 | Max number of open files/sockets allowed for this process: 65535 11 | 0: : 12 | Due to the open files/sockets limitation, 13 | max supported number of TURN Sessions possible is: 32500 (approximately) 14 | 0: : 15 | 16 | ==== Show him the instruments, Practical Frost: ==== 17 | 18 | 0: : TLS supported 19 | 0: : DTLS supported 20 | 0: : DTLS 1.2 supported 21 | 0: : TURN/STUN ALPN supported 22 | 0: : Third-party authorization (oAuth) supported 23 | 0: : GCM (AEAD) supported 24 | 0: : OpenSSL compile-time version: OpenSSL 1.0.2k-fips 26 Jan 2017 (0x100020bf) 25 | 0: : 26 | 0: : SQLite supported, default database location is /var/lib/coturn/turndb 27 | 0: : Redis supported 28 | 0: : PostgreSQL is not supported 29 | 0: : MySQL is not supported 30 | 0: : MongoDB is not supported 31 | 0: : 32 | 0: : Default Net Engine version: 3 (UDP thread per CPU core) 33 | 34 | ===================================================== 35 | 36 | 0: : Domain name: 37 | 0: : Default realm: test 38 | 0: : ERROR: 39 | CONFIG ERROR: Empty cli-password, and so telnet cli interface is disabled! Please set a non empty cli-password! 40 | 0: : WARNING: cannot find certificate file: turn_server_cert.pem (1) 41 | 0: : WARNING: cannot start TLS and DTLS listeners because certificate file is not set properly 42 | 0: : WARNING: cannot find private key file: turn_server_pkey.pem (1) 43 | 0: : WARNING: cannot start TLS and DTLS listeners because private key file is not set properly 44 | 0: : NO EXPLICIT LISTENER ADDRESS(ES) ARE CONFIGURED 45 | 0: : ===========Discovering listener addresses: ========= 46 | 0: : Listener address to use: 127.0.0.1 47 | 0: : Listener address to use: 172.18.112.52 48 | 0: : ===================================================== 49 | 0: : Total: 1 'real' addresses discovered 50 | 0: : ===================================================== 51 | 0: : NO EXPLICIT RELAY ADDRESS(ES) ARE CONFIGURED 52 | 0: : ===========Discovering relay addresses: ============= 53 | 0: : Relay address to use: 172.18.112.52 54 | 0: : ===================================================== 55 | 0: : Total: 1 relay addresses discovered 56 | 0: : ===================================================== 57 | [root@Ubuntu14 ~]# 58 | -------------------------------------------------------------------------------- /webrtc/stun_turn/coturn.zhoudd: -------------------------------------------------------------------------------- 1 | ### add by zhoudd 20201225 2 | 3 | # TURN server name and realm 4 | realm=8.134.18.182 5 | server-name=8.134.18.182 6 | 7 | # Use fingerprint in TURN message 8 | fingerprint 9 | 10 | # IPs the TURN server listens to 11 | listening-ip=172.19.124.224 12 | 13 | # External IP-Address of the TURN server 14 | external-ip=8.134.18.182 15 | 16 | # Main listening port 17 | listening-port=3478 18 | 19 | # Further ports that are open for communication 20 | min-port=10000 21 | max-port=10050 22 | 23 | # Log file path 24 | log-file=/var/log/turnserver.log 25 | 26 | # Enable verbose logging 27 | verbose 28 | 29 | # Specify the user for the TURN authentification 30 | user=test:test123 31 | 32 | # Enable long-term credential mechanism 33 | lt-cred-mech 34 | 35 | # SSL certificates 36 | cert=/etc/letsencrypt/live/8.134.18.182/cert.pem 37 | pkey=/etc/letsencrypt/live/8.134.18.182/privkey.pem 38 | 39 | # 443 for TURN over TLS, which can bypass firewalls 40 | tls-listening-port=443 41 | 42 | # openssl rand -hex 32 43 | # 28cafd81849cf4b3de0dbc29df90ad44fcdf410b64c77f3c1b45e60c99b207aa 44 | use-auth-secret 45 | static-auth-secret=28cafd81849cf4b3de0dbc29df90ad44fcdf410b64c77f3c1b45e60c99b207aa 46 | 47 | -------------------------------------------------------------------------------- /webrtc/stun_turn/stunman: -------------------------------------------------------------------------------- 1 | 1. Install stunserver on CentOS/Ubuntu 2 | yum -y install gcc 3 | yum -y install make 4 | yum -y install boost-devel # For Boost 5 | yum -y install openssl-devel # For OpenSSL 6 | wget http://www.stunprotocol.org/stunserver-1.2.3.tgz 7 | tar zxvf stunserver-1.2.3.tgz 8 | cd stunserver 9 | make 10 | 11 | apt-get install g++ 12 | apt-get install make 13 | apt-get install libboost-dev # For Boost 14 | apt-get install libssl-dev # For OpenSSL 15 | wget http://www.stunprotocol.org/stunserver-1.2.13.tgz 16 | tar -zxvf stunserver-1.2.13.tgz 17 | make 18 | 19 | ./stunserver 20 | netstat -ap | grep 3478 21 | udp 0 0 *:3478 *:* 3658/stunserver 22 | sudo ./stunclient 127.0.0.1 3478 23 | Binding test: success 24 | Local address: 127.0.0.1:41348 25 | Mapped address: 127.0.0.1:41348 26 | 27 | 2. sipml5 ICE Servers: 28 | [{url:'stun:8.134.18.182:3478'}] 29 | -------------------------------------------------------------------------------- /webrtc2sip/WEBRTC-to-SIP/README.md: -------------------------------------------------------------------------------- 1 | ### WEBRTC to SIP client and server 2 | 3 | https://github.com/havfo/WEBRTC-to-SIP 4 | -------------------------------------------------------------------------------- /webrtc2sip/doubango-webrtc2sip/README.md: -------------------------------------------------------------------------------- 1 | ### Webrtc2sip Gateway 2 | 3 | https://github.com/dong2/2webrtc2sip 4 | -------------------------------------------------------------------------------- /webrtc2sip/technical-guide-1.0.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tppi/freeswitch2/f790d22a468ee21f9f3b499c95e53123519afa8e/webrtc2sip/technical-guide-1.0.pdf --------------------------------------------------------------------------------