├── .gitignore ├── README.md ├── janus-pp-rec ├── README.md ├── conference_record_tools.zip ├── linux_amd64 │ └── janus-pp-rec └── linux_arm64 │ └── janus-pp-rec └── janus_config ├── janus.eventhandler.gelfevh.jcfg.sample ├── janus.eventhandler.mqttevh.jcfg ├── janus.eventhandler.mqttevh.jcfg.sample ├── janus.eventhandler.nanomsgevh.jcfg ├── janus.eventhandler.nanomsgevh.jcfg.sample ├── janus.eventhandler.sampleevh.jcfg ├── janus.eventhandler.sampleevh.jcfg.sample ├── janus.eventhandler.wsevh.jcfg ├── janus.eventhandler.wsevh.jcfg.sample ├── janus.jcfg ├── janus.jcfg.sample ├── janus.plugin.audiobridge.jcfg ├── janus.plugin.audiobridge.jcfg.sample ├── janus.plugin.echotest.jcfg ├── janus.plugin.echotest.jcfg.sample ├── janus.plugin.nosip.jcfg ├── janus.plugin.nosip.jcfg.sample ├── janus.plugin.recordplay.jcfg ├── janus.plugin.recordplay.jcfg.sample ├── janus.plugin.sip.jcfg ├── janus.plugin.sip.jcfg.sample ├── janus.plugin.streaming.jcfg ├── janus.plugin.streaming.jcfg.sample ├── janus.plugin.textroom.jcfg ├── janus.plugin.textroom.jcfg.sample ├── janus.plugin.videocall.jcfg ├── janus.plugin.videocall.jcfg.sample ├── janus.plugin.videoroom.jcfg ├── janus.plugin.videoroom.jcfg.sample ├── janus.plugin.voicemail.jcfg ├── janus.plugin.voicemail.jcfg.sample ├── janus.transport.http.jcfg ├── janus.transport.http.jcfg.sample ├── janus.transport.mqtt.jcfg ├── janus.transport.mqtt.jcfg.sample ├── janus.transport.nanomsg.jcfg ├── janus.transport.nanomsg.jcfg.sample ├── janus.transport.pfunix.jcfg ├── janus.transport.pfunix.jcfg.sample ├── janus.transport.websockets.jcfg └── janus.transport.websockets.jcfg.sample /.gitignore: -------------------------------------------------------------------------------- 1 | ## ide 2 | **/.idea 3 | *.iml 4 | 5 | ## backend 6 | **/target 7 | **/logs 8 | 9 | ## front 10 | **/*.lock 11 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # 野火音视频高级版媒体服务 2 | 野火音视频高级版媒体服务,基于[janus](https://github.com/meetecho/janus-gateway)二次开发而来,开发仅限于与野火IM对接,修改开源代码在[这里](https://github.com/heavyrain2012/janus-gateway),没有做任何功能的修改。使用方法如下: 3 | 4 | ## 高级版的特点 5 | 高级版是通过云服务器中转,通信质量更有保障,详情请参考[链接](https://docs.wildfirechat.cn/blogs/野火音视频简介.html),另外支持超级会议模式,支持无限人数参与,请参考[链接](https://docs.wildfirechat.cn/blogs/野火音视频之超级会议.html)。 6 | 7 | ## 服务器的选用 8 | 由于使用的是SFU架构,所有流量都经过媒体服务,对带宽的要求非常高。如果使用固定带宽,价格会非常高昂。建议使用按照流量计费,大部分云服务器都能达到200Mbps,可以支持较大的通话容量。按量计费相比按带宽计费,费用会节省更多。 9 | 10 | 客户端会跟Janus服务进行直连,所以就需要Janus服务部署在公网,或者有足够多的UDP端口映射到公网。 11 | 12 | ## 导入docker镜像 13 | 服务在2021.8.4日、2022.7.14和2024.10.4有重大升级,最新的版本从这里下载:x86_64镜像在[这里](http://static.wildfirechat.net/wildfire_janus_amd64_ff1f4f4e.tar),下载完之后检查[md5](http://static.wildfirechat.net/wildfire_janus_amd64_ff1f4f4e.md5);arm64镜像在[这里](http://static.wildfirechat.net/wildfire_janus_arm64_ff1f4f4e.tar),下载完之后检查[md5](http://static.wildfirechat.net/wildfire_janus_arm64_ff1f4f4e.md5) 14 | 15 | 如果IM服务是2024.10.4日之前的版本,从这里下载:x86_64镜像在[这里](http://static.wildfirechat.net/wildfire_janus_amd64_before_20241004.tar),下载完之后检查[md5](http://static.wildfirechat.net/wildfire_janus_amd64_before_20241004.md5);arm64镜像在[这里](http://static.wildfirechat.net/wildfire_janus_arm64_before_20241004.tar),下载完之后检查[md5](http://static.wildfirechat.net/wildfire_janus_arm64_before_20241004.md5) 16 | 17 | 如果IM服务是2022.7.14日之前的版本,从这里下载:x86_64镜像在[这里](http://static.wildfirechat.cn/wildfire_janus_amd64_before_20220714.tar),下载完之后检查[md5](http://static.wildfirechat.cn/wildfire_janus_amd64_before_20220714.md5);arm64镜像在[这里](http://static.wildfirechat.cn/wildfire_janus_arm64_before_20220714.tar),下载完之后检查[md5](http://static.wildfirechat.cn/wildfire_janus_arm64_before_20220714.md5) 18 | 19 | 如果IM服务是2021.8.4日之前的版本,从这里下载:x86_64镜像在[这里](http://static.wildfirechat.net/wildfire_janus_amd64_legacy.tar),下载完之后检查[md5](http://static.wildfirechat.net/wildfire_janus_amd64_legacy.md5);arm64镜像在[这里](http://static.wildfirechat.net/wildfire_janus_arm64_legacy.tar),下载完之后检查[md5](http://static.wildfirechat.net/wildfire_janus_arm64_legacy.md5) 20 | 21 | 镜像下载之后通过下属命令导入镜像: 22 | ``` 23 | sudo docker load -i wildfire_janus_amd64.tar 24 | ``` 25 | > arm服务器请导入对应的arm镜像 26 | 27 | ## 修改配置 28 | 下载[janus_config](./janus_config)目录到服务器。 29 | 1. 修改目录下的```janus.transport.mqtt.jcfg``` 30 | ``` 31 | general: { 32 | enabled = true # Whether the support must be enabled 33 | im_host = "im_server_host" # Wildfire IM server host 34 | im_port = 80 # Wildfire IM server http port。请保持不变,仅当改动过客户端端口时修改 35 | client_id = "conference_server_1" # 必须是IM服务配置conference.client_list的id之一,如果有多个Janus服务,不能重复。 36 | ... 37 | } 38 | ``` 39 | >im_host和im_port是janus访问IM服务短连接的地址和端口,如果janus与im服务在同一个内网中,建议可以使用内网地址,如果使用域名,需要确保janus能够访问这个地址,client_id为了安全,请使用一个随机的uuid,如果部署多台,需要确保每台都的client_id都是唯一的,client_id需要配置到IM服务配置文件中的conference.client_list列表中去。 40 | 2. 修改```janus.jcfg``` 41 | ``` 42 | media: { 43 | ... 44 | rtp_port_range = "20000-40000" 45 | ... 46 | } 47 | 48 | nat: { 49 | ... 50 | ice_lite = true 51 | ... 52 | ice_enforce_list = "eth0" 53 | ... 54 | } 55 | 56 | ``` 57 | > rtp_port_range 为媒体流使用的UDP端口范围,端口至少5000个。UDP端口范围默认是20000-40000,如果修改端口范围建议最小端口大于10000,最大不能超过65535。需要确保服务器防火墙和安全组放开权限,需要确保客户端网络防火墙放开权限。 58 | 59 | > 配置文件中的```ice_enforce_list```配置需要设置上外网IP所对应的网卡。查找网卡名称可以用```ifconfig```命令来查看。 60 | 61 | ## 防火墙和安全组设置 62 | 服务器需要开放UDP指定端口范围的入访权限(默认是20000-40000)。服务器需要去连接IM,需要开通到IM服务的80/1883端口。 63 | 64 | ## 修改IM服务 65 | IM服务配置文件中修改音视频服务的client_id列表(conference.client_list)、signal_server_address(conference.signal_server_address)。其中: 66 | 1. client_id列表要包含所有janus服务的clientId,以逗号分割,为了以后扩展方便,可以预先写入多个id; 67 | 2. signal_server_address填写当前IM服务的内网地址,这样janus服务就与IM服务内网通信; 68 | 69 | 修改配置后重新启动IM服务。 70 | 71 | ## 启动媒体服务 72 | IM服务启动之后才可以启动媒体服务。请使用下面命令启动: 73 | ``` 74 | sudo docker run -it --privileged=true -e DOCKER_IP=YOUR_PUBLIC_IP(服务器公网IP) --name wf_janus_server --net host -v PATH_TO_janus_config(配置文件目录的绝对路径):/var/janus/janus/etc/janus -v PATH_TO_RECORDS_FOLDER(用来保存会议录制的目录的绝对路径):/opt/janus/share/janus/recordings wildfire_janus 75 | ``` 76 | 注意```YOUR_PUBLIC_IP(服务器公网IP)```为Janus服务所在服务器的外网IP,```PATH_TO_janus_config(配置文件目录的绝对路径)```为配置文件的路径,```PATH_TO_RECORDS_FOLDER(用来保存会议录制的目录的绝对路径)```为录制文件保存目录,**这三个占位符本身需要修改为具体的值,而不是修改```:```后面那部分,其他的不用修改**, 下面是修改后的命令示例: 77 | 78 | ``` 79 | sudo docker run -it --privileged=true -e DOCKER_IP=46.8.147.195 --name wfc_janus_server --net host -v /Users/userName/wf-janus/config:/var/janus/janus/etc/janus -v /Users/userName/records_folder:/opt/janus/share/janus/recordings wildfire_janus 80 | ``` 81 | 82 | 上线时需要deamon方式运行,且设置为自动重启。命令如下: 83 | ``` 84 | sudo docker run -d --privileged=true -e DOCKER_IP=YOUR_PUBLIC_IP --name wf_janus_server --net host -v PATH_TO_janus_config:/var/janus/janus/etc/janus -v PATH_TO_RECORDS_FOLDER:/opt/janus/share/janus/recordings --restart=always wildfire_janus 85 | ``` 86 | 87 | > --restart=always 一定要设置上,因为当出现不可逆错误时,janus服务会退出,这样自动重启就能恢复。 88 | > docker 挂载主机目录,请参考 [docker run -v](https://www.cnblogs.com/starfish29/p/10653960.html), [docker volums](https://docs.docker.com/storage/volumes/) 89 | 90 | ## 客户端 91 | 确保客户端能够正常运行,能够收发消息;替换音视频高级版的SDK;注意高级版是不需要stun/turn服务,去除掉turn服务的配置。 92 | 93 | ## 双流模式 94 | 双流模式下,客户端会发出去两路视频流,一路是标准流,另外一路是微流。标准流的参数可以通过设置profile接口来更改,微流的流量大小固定为10KB/s。客户端SDK会自动根据view的大小,设置其中最大的一个窗口为标准流,其他都为微流。这样就节省大量的带宽资源。如果不需要双流模式,可以关闭双流模式,客户端只发布和拉取标准流。 95 | 96 | ## 手动控制视频流 97 | 如果主播视频超过一屏,没有显示的主播拉取视频流就是浪费资源的,可以手动控制每个主播的视频流。SDK有个属性```autoSwitchVideoType```,当值为false时,可以通过```setParticipantVideoType```方法来控制主播```不拉取视频流```、```拉取视频大流```和```拉取视频小流```。 98 | 99 | ## 视频处理 100 | 美颜、虚化背景等功能需要处理视频流,SDK有回调,应用实现回调,可以处理视频Frame。 101 | 102 | ## 通话容量计算 103 | 野火普通模式和双流模式的容量计算是不同的。 104 | 105 | 普通模式下,对于N个参与者来说,每个人都会发送一路上行数据,所以上行路数就是参与者的个数,每个人都接受其他每个人的下行数据,这样下行路数就是N x (N-1)路。 106 | 107 | 双流模式下,对于N个参与者来说,每个人都会发送一路标准流和一路微,所以上行就是N路标准流,N路微流,每个人都接受一路标准流和N-2路微流,这样下行流量就是N路标准流 + N*(N-2)路微流。 108 | 109 | 默认情况下一路标准流的带宽需要100KB/s(可以配置),微流是10KB/s。所以普通模式下每个人上行是100KB/s,服务器的上行总流量为N * 100KB/s;双流模式下每个人是110KB/s,服务器的上行总流量为N * 110KB/s。下行时标准模式,每个人的流量为(N - 1) * 100KB/s,服务器总的下行流量为 N * (N - 1) * 100KB/s;双流模式下每个人的流量为 100KB/s + (N - 2) * 10KB/s,服务器总的下行流量为 N * 100KB/s + N * (N - 2) * 10KB/s。 110 | 111 | 以9人通话为例子,标准模式下,每人上行100KB/s,下行 8 * 100 = 800KB/s,服务器总上行 9 * 100 = 900KB/s,服务器总下行为 7200KB/s。在双流模式下,每人上行110KB/s,下行 100 + 7 * 10 = 170KB/s,服务器的总上行 9 * 110 = 990KB/s,服务器的总下行为 1530KB/s。可以看出9人会议,双流模式流量上行比普通模式多消耗10%,但下行双流模式比普通模式少接近80%的流量。 112 | 113 | 野火音视频高级版可以支持会议模式,也就是有N个主播(发布自己的数据和接收其它主播的数据)和M个听众(只接收主播的数据),同理可以计算对应流量。 114 | 115 | 如果更改过视频profile,可以实际测量每一路流量大小,从而计算整体容量大小(双流模式下,微流固定是10KB/s,上行数减去微流大小就是标准流的带宽)。 116 | 117 | ## 水平扩展 118 | 通过容量计算方法可以看出,受限于服务器的带宽,单台只能支持有限的通话容量。可以部署多台媒体服务来水平扩展媒体服务。当用户发起音视频通话时,IM服务会Hash分配会议到某台媒体服务。因此可以看出总的容量可以随着媒体服务器的增加而增加,但单个会议的最大容量还是受限于单台服务器的最大带宽。使用超级会议模式时,会议可以扩展到整个系统中,因此当发起大用户数量的视频会议直播时可以选择超级会议模式。 119 | 120 | 扩展时需要确保每台服务的```client_id```不能重复,请同步修改janus服务的配置文件和IM服务的配置文件,确保janus配置中```client_id```是唯一的,且在IM配置文件中janus ```client_id```列表中。 121 | 122 | ## 录制文件的处理 123 | Janus支持服务器端录制,在IM服务的配置文件关于janus配置部分有如下配置: 124 | ``` 125 | #音视频服务录制策略。0 不允许录制,1 总是录制,2 客户端选择是否录制。 126 | conference.record_strategy 1 127 | ``` 128 | 当策略为0时,所有实时音视频都不录制;当策略为1时,所有实时音视频都录制;当策略为2时,客户端发起会议有个是否录制参数,决定是否录制。不支持实时音视频发起后再更改是否录制。 129 | 130 | 当录制完成后,会保存到janus启动的docker命令指定的目录。录制文件的格式为```mjr```,这种格式是直接把每个流的RTP内容写入文件,这样就不会对服务器造成任何的计算压力。录制的文件是每个用户的每个流独立存储,文件名格式如下: 131 | ``` 132 | videoroom-${roomId}-user-${userId}-${timestamp}-[audio/video]-[0-2].mjr 133 | ``` 134 | roomId也就是会议id,如果是客户端生成格式是发起者的ID加上```|```加上随机数字,也可以应用层生产会议id发起时填入;userId为此媒体流所属的用户id;timestamp为此媒体流开始的时间;```[audio/video]``` 此媒体类是语音流还是视频流;```[0-2]```媒体类的id,一般音频是```0```,视频大流是```1```,视频小流是```2```。 135 | 136 | 以9人视频会议为例,每人会录制3个文件,分别是音频文件、视频大流文件和视频小流文件,一共录制27个文件。 137 | 138 | janus只能支持这种处理方式,不能录制为常见格式也不能自动合流。因此需要进行后期处理才能够回放,下载[janus-pp-rec](./janus-pp-rec),然后执行: 139 | ``` 140 | ./janus-pp-rec videoroom-${roomId}-user-${userId}-${timestamp}-audio-0.mjr 1.opus 141 | ./janus-pp-rec videoroom-${roomId}-user-${userId}-${timestamp}-video-1.mjr 1.mp4 142 | ``` 143 | 再使用ffmepg把音频和视频结合成一个文件: 144 | ``` 145 | ffmpeg -i 1.mp4 -i 1.opus -c:v copy -c:a aac call.mp4 146 | ``` 147 | 至此已经为一个用户合成了多媒体文件。回放还需要把多个用户的多媒体合流成一个多媒体文件(ffmpeg可以做到,具体命令请网上搜索,注意起始时间同步),或者播放时播放多个文件。 148 | 149 | 详情请参考[janus录制](https://janus.conf.meetecho.com/docs/recordings.html) 150 | 151 | ## 媒体流转发(RTP_FORWARD) 152 | RTP_FORWARD是[janus](https://janus.conf.meetecho.com/docs/videoroom.html)一个有意思的功能,可以把音视频的RTP流实时的转发到指定的UDP端口上去。这样当需要把会议内容实时推流到直播平台时,就可以使用这种方法。请注意这里janus只是把RTP流原封不动的转发出来,还需要不小的工作量做来把音视频转换后再推送到直播平台。下面讲一下如果使用媒体流转发功能: 153 | 154 | ### 开启转发 155 | 在server sdk中的ConferenceAdmin对象中,有个listParticipants方法,可以查询到用户的发布媒体流情况,可以得到媒体类型(音频还是视频)、媒体ID、编码(音频为opus,视频为H264/VP8)。当知道这些信息后,就可以调用rtpForward方法把音视频流转到指定地址去 156 | ``` 157 | static IMResult rtpForward(String roomId, String userId, String rtpHost, int audioPort, int audioPt, long audioSSRC, int videoPort, int videoPt, long videoSSRC) 158 | ``` 159 | 方法中,roomId为房间ID,也就是客户端看到的callId或者会议ID;userId为您要转发用户的ID;rtpHost只接收地址。音频和视频要分开转发,需要不同的端口,如果不需要某个流,可以把对应的port赋为0就行。audioPt一般为111,videoPt在H264编码时为98,VP8时为100(实际上其他数字也可以,在接收端需要把PT对应起来)。SSRC默认可以为0. 160 | 161 | 当开启成功后,指定用户的RTP流就会持续的转发过去。可以使用gstreamer来处理转发过来的流,比如下面会播放收到的视频流 162 | ``` 163 | gst-launch-1.0 -v udpsrc port=10005 caps = "application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, payload=(int)98" ! rtph264depay ! decodebin ! videoconvert ! autovideosink sync=false 164 | ``` 165 | 166 | ### 查询转发 167 | 在server sdk中的ConferenceAdmin对象中,有个listRtpForwarders方法,可以查询到已经开启的媒体流转发状态。查询的每个流中都有个streamId,停止媒体转发需要使用到此参数,所以一般停止之前都需要先查询一下。 168 | 169 | ### 停止转发 170 | 当不需要时,可以停止转发。在server sdk中的ConferenceAdmin对象中,有个stopForwarders方法,可以查询到已经开启的媒体流转发状态。注意此参数需要对每个流调用一次,比如某个用户同时转发了音频流和视频流,需要调用2次来停止。 171 | 172 | ## 问题排查 173 | 1. 音视频依赖IM作为信令通道的,首先确保通话双方能够互相发送文本消息。 174 | 2. Janus服务器公网IP配置不对,也就是启动命令中的```DOCKER_IP```参数。一定要使用***Janus服务器的公网IP地址***,不能是域名也不能是内网IP,也不能配置为IM服务的地址(分开部署的情况下)。 175 | 3. 没有配置```ice_enforce_list```或者配置错误。请指定为绑定公网IP的网卡。 176 | 4. Janus服务挂掉。当出现严重错误或者IM服务节点变动时,Janus会自动退出,这时需要在docker启动命令中添加```--restart=always```参数,让janus服务自动重启。 177 | 5. 客户端到服务器的连通问题,这时需要检查云服务器的安全组和防火墙是否开放了对应的UDP端口。确认过安全组和防火墙后如果还是无法正常使用,请再按照下面说明检查端口是否是通的。 178 | 6. 移动客户端音视频SDK授权域名不对,请检查客户端配置文件中的***IM host***是不是跟音视频SDK绑定的地址一致。 179 | 7. 如果上述检查还是无法解决问题,请抓取IM服务日志,janus服务日志和客户端日志发送给support@wildfirechat.cn,其中IM服务日志需要改成同步写,请参考[IM服务常见问题](https://docs.wildfirechat.cn/faq/server.html)中的问题45。 180 | 181 | ### UDP端口连通性检查 182 | Janus服务处于公网,客户端无论处于任何NAT之内都应该可以连接。当出现连接超时的错误时,很有可能是Janus与客户端之间UDP端口无法互通。可以用[netcat](https://www.baidu.com/s?wd=netcat)来检查他们之间的连通性。 183 | 1. 环境准备: 需要在客户端网络之内准备一台linux或者mac作为测试客户端(不能用同一个机房的服务器,如果本地没有linux或者mac,可以去外网外地购买一台按小时计费的最低配云服务器,一天不到2元,测试完释放花不了多少钱);在测试客户端和janus服务器上分别安装```netcat```,已知Ubuntu和mac已经预安装了,centos可以用命令```yum install -y nc```来安装。其它系统可以百度怎么安装。 184 | 2. 在Janus服务上,执行命令 ```nc -ulvp 30000```。30000为监听UDP端口,需要注意Janus服务配置的端口范围之内。 185 | 3. 在客户端上执行命令 ```nc -u YOUR_PUBLIC_IP 30000```。```YOUR_PUBLIC_IP```是Janus服务的公网IP,也是启动命令内的参数。 186 | 4. 在客户端输入内容,检查服务器端是否收到对应内容。 187 | 5. 服务器端收到后,在服务器端窗口输入内容,检查客户端是否收到对应内容。 188 | 189 | 如果4、5失败说明网络之间不通,需要运维检查网络环境。如果成功,客户端需要断开,再重试几次。再更换服务器端端口,重复测试几次。UDP检查方案来源于[这里](https://docs.azure.cn/zh-cn/articles/azure-operations-guide/virtual-network/aog-virtual-network-using-netcat-check-the-connectivity#测试-udp-端口连通性)。 190 | 191 | ## ffmpeg安装 192 | 录制音视频转换工具[janus-pp-rec](./janus-pp-rec)需要依赖ffmpeg库3.X,一般通过命令直接安装即可。如果无法直接安装,也可以下载源码编译安装: 193 | ``` 194 | wget https://github.com/FFmpeg/FFmpeg/releases/download/n3.0/ffmpeg-3.0.tar.gz 195 | tar -xzvf ffmpeg-3.0.tar.gz 196 | cd ffmpeg-3.0 197 | ./configure --prefix=/usr --enable-shared 198 | make 199 | sudo make install 200 | ``` 201 | 202 | ## 服务兼容 203 | 服务在2021.8.4日和2022.7.14日有重大升级,需要确保janus服务、IM服务和客户端SDK同时使用这个日期之前的版本或者之后的版本。如果是新的janus服务和IM服务,旧的客户端SDK,可能会有部分旧型号的手机无法接通,已知影响手机为iphone8及之前型号,Android还没有发现有不能接通问题。请升级时注意janus服务和IM服务同时升级,客户端也要尽量升级。 204 | 205 | ## 关于野火音视频高级版的一些基础知识 206 | 如果需要更好地二次开发和使用,请详细阅读[野火音视频高级版的一些基础知识](https://docs.wildfirechat.cn/blogs/野火音视频高级版的一些知识.html),确保您对野火音视频高级版有一定的了解。 207 | 208 | ## 鸣谢 209 | 本产品基于[janus](https://github.com/meetecho/janus-gateway)二次开发而来,十分感谢他们的奉献! 210 | -------------------------------------------------------------------------------- /janus-pp-rec/README.md: -------------------------------------------------------------------------------- 1 | # 录制 2 | 3 | ## 修改IM服务配置文件 4 | 打开总是录制开关,录制路径不要改。 5 | ``` 6 | #音视频服务录制策略。0 不允许录制,1 总是录制,2 客户端选择是否录制。 7 | conference.record_strategy 1 8 | conference.record_path /opt/janus/share/janus/recordings 9 | ``` 10 | 录制的文件会存入到服务启动时指定的目录去。 11 | 12 | ## 录制文件的处理 13 | 录制文件的格式为```mjr```,这种格式是直接把RTP信息写入文件,这样就不会对服务器造成任何的计算压力。录制后需要进行后期处理才能够播放,下载janus-pp-rec,然后执行: 14 | ``` 15 | ./janus-pp-rec videoroom-${roomId}-user-${userId}-${timestamp}-audio.mjr videoroom-${roomId}-user-${userId}-${timestamp}.opus 16 | ./janus-pp-rec videoroom-${roomId}-user-${userId}-${timestamp}-video.mjr videoroom-${roomId}-user-${userId}-${timestamp}.mp4 17 | ``` 18 | 至此就转为常见格式了,再使用ffmepg把音频和视频结合成一个文件。janus只能支持这种格式,无法支持别的格式。 19 | 20 | 详情请参考[janus录制](https://janus.conf.meetecho.com/docs/recordings.html) 21 | 22 | ## 环境依赖 23 | janus-pp-rec依赖ffmpeg-dev,在ubuntu上运行下面命令安装 24 | ``` 25 | sudo apt-get update 26 | sudo apt-get install ffmpeg 27 | ``` 28 | 在centos7上运行下面命令 29 | ``` 30 | sudo yum install epel-release 31 | sudo yum localinstall --nogpgcheck https://download1.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm 32 | sudo yum install ffmpeg ffmpeg-devel 33 | ``` 34 | 其它系统或者遇到问题,请百度或者谷歌查找解决 35 | 36 | ## 处理脚本 37 | 我们提供了一个简单的处理工具,见此目录下的zip软件包。可以把会议转成MP4文件。可以直接使用或者参考来实现你们自己的需求。 38 | 39 | 40 | ## 鸣谢 41 | 感谢[janus](https://github.com/meetecho/janus-gateway)提供如此好的开源产品。 42 | -------------------------------------------------------------------------------- /janus-pp-rec/conference_record_tools.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wildfirechat/wf-janus/e39492b0e0ba2c9c76ad8593d2415a75fc0d2be1/janus-pp-rec/conference_record_tools.zip -------------------------------------------------------------------------------- /janus-pp-rec/linux_amd64/janus-pp-rec: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wildfirechat/wf-janus/e39492b0e0ba2c9c76ad8593d2415a75fc0d2be1/janus-pp-rec/linux_amd64/janus-pp-rec -------------------------------------------------------------------------------- /janus-pp-rec/linux_arm64/janus-pp-rec: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wildfirechat/wf-janus/e39492b0e0ba2c9c76ad8593d2415a75fc0d2be1/janus-pp-rec/linux_arm64/janus-pp-rec -------------------------------------------------------------------------------- /janus_config/janus.eventhandler.gelfevh.jcfg.sample: -------------------------------------------------------------------------------- 1 | # This configures the GELF event handler. Appending necessary headers 2 | # and sending messages via TCP or UDP 3 | 4 | general: { 5 | enabled = false # By default the module is not enabled 6 | events = "all" 7 | # Comma separated list of the events mask you're interested 8 | # in. Valid values are none, sessions, handles, jsep, webrtc, 9 | # media, plugins, transports, core, external and all. By 10 | # default we subscribe to everything (all) 11 | 12 | backend = "your.graylog.server" # DNS or IP of your Graylog server 13 | port = "12201" # Port Graylog server is listening on 14 | protocol = "tcp" # tcp or udp transport type 15 | max_message_len = 1024 # Note that we add 12 bytes of headers + standard UDP headers (8 bytes) 16 | # when calculating packet size based on MTU 17 | 18 | #compress = true # Optionally, only for UDP transport, JSON messages can be compressed using zlib 19 | #compression = 9 # In case, you can specify the compression factor, where 1 is 20 | # the fastest (low compression), and 9 gives the best compression 21 | } 22 | -------------------------------------------------------------------------------- /janus_config/janus.eventhandler.mqttevh.jcfg: -------------------------------------------------------------------------------- 1 | # This configures the MQTT event handler. Events are sent either on 2 | # one topic or on a topic per event type. 3 | # 4 | # By default, configuration topics for handle and webrtc event types 5 | # with the base topic are configured to /janus/events, e.g.: 6 | # /janus/events/handle 7 | # /janus/events/webrtc 8 | 9 | general: { 10 | enabled = false # By default the module is not enabled 11 | events = "all" # Comma separated list of the events mask you're interested 12 | # in. Valid values are none, sessions, handles, jsep, webrtc, 13 | # media, plugins, transports, core, external and all. By 14 | # default we subscribe to everything (all) 15 | json = "indented" # Whether the JSON messages should be indented (default), 16 | # plain (no indentation) or compact (no indentation and no spaces) 17 | 18 | url = "tcp://localhost:1883" # The URL of the MQTT server. Only tcp supported at this time. 19 | client_id = "janus.example.com" # Janus client id. You have to configure a unique ID (default: guest). 20 | #keep_alive_interval = 20 # Keep connection for N seconds (default: 30) 21 | #cleansession = 0 # Clean session flag (default: off) 22 | #retain = 0 # Default MQTT retain flag for published events 23 | #qos = 1 # Default MQTT QoS for published events 24 | #disconnect_timeout = 100 # Seconds to wait before destroying client 25 | #username = "guest" # Username for authentication (default: no authentication) 26 | #password = "guest" # Password for authentication (default: no authentication) 27 | #topic = "/janus/events" # Base topic (default: /janus/events) 28 | #addevent = true # Whether we should add the event type to the base topic 29 | 30 | # Initial message sent to status topic 31 | #connect_status = "{\"event\": \"connected\", \"eventhandler\": \"janus.eventhandler.mqttevh\"}" 32 | # Message sent after disconnect or as LWT 33 | #disconnect_status = "{\"event\": \"disconnected\"}" 34 | 35 | #will_enabled = false # Whether to enable LWT (default: false) 36 | #will_retain = 1 # Whether LWT should be retained (default: 1) 37 | #will_qos = 0 # QoS for LWT (default: 0) 38 | 39 | # Additional parameters if "mqtts://" schema is used 40 | #tls_verify_peer = true # Whether peer verification must be enabled 41 | #tls_verify_hostname = true # Whether hostname verification must be enabled 42 | 43 | # Certificates to use when SSL support is enabled, if needed 44 | #tls_cacert = "/path/to/cacert.pem" 45 | #tls_client_cert = "/path/to/cert.pem" 46 | #tls_client_key = "/path/to/key.pem" 47 | #tls_ciphers 48 | #tls_version 49 | } 50 | -------------------------------------------------------------------------------- /janus_config/janus.eventhandler.mqttevh.jcfg.sample: -------------------------------------------------------------------------------- 1 | # This configures the MQTT event handler. Events are sent either on 2 | # one topic or on a topic per event type. 3 | # 4 | # By default, configuration topics for handle and webrtc event types 5 | # with the base topic are configured to /janus/events, e.g.: 6 | # /janus/events/handle 7 | # /janus/events/webrtc 8 | 9 | general: { 10 | enabled = false # By default the module is not enabled 11 | events = "all" # Comma separated list of the events mask you're interested 12 | # in. Valid values are none, sessions, handles, jsep, webrtc, 13 | # media, plugins, transports, core, external and all. By 14 | # default we subscribe to everything (all) 15 | json = "indented" # Whether the JSON messages should be indented (default), 16 | # plain (no indentation) or compact (no indentation and no spaces) 17 | 18 | url = "tcp://localhost:1883" # The URL of the MQTT server. Only tcp supported at this time. 19 | client_id = "janus.example.com" # Janus client id. You have to configure a unique ID (default: guest). 20 | #keep_alive_interval = 20 # Keep connection for N seconds (default: 30) 21 | #cleansession = 0 # Clean session flag (default: off) 22 | #retain = 0 # Default MQTT retain flag for published events 23 | #qos = 1 # Default MQTT QoS for published events 24 | #disconnect_timeout = 100 # Seconds to wait before destroying client 25 | #username = "guest" # Username for authentication (default: no authentication) 26 | #password = "guest" # Password for authentication (default: no authentication) 27 | #topic = "/janus/events" # Base topic (default: /janus/events) 28 | #addevent = true # Whether we should add the event type to the base topic 29 | 30 | # Initial message sent to status topic 31 | #connect_status = "{\"event\": \"connected\", \"eventhandler\": \"janus.eventhandler.mqttevh\"}" 32 | # Message sent after disconnect or as LWT 33 | #disconnect_status = "{\"event\": \"disconnected\"}" 34 | 35 | #will_enabled = false # Whether to enable LWT (default: false) 36 | #will_retain = 1 # Whether LWT should be retained (default: 1) 37 | #will_qos = 0 # QoS for LWT (default: 0) 38 | 39 | # Additional parameters if "mqtts://" schema is used 40 | #tls_verify_peer = true # Whether peer verification must be enabled 41 | #tls_verify_hostname = true # Whether hostname verification must be enabled 42 | 43 | # Certificates to use when SSL support is enabled, if needed 44 | #tls_cacert = "/path/to/cacert.pem" 45 | #tls_client_cert = "/path/to/cert.pem" 46 | #tls_client_key = "/path/to/key.pem" 47 | #tls_ciphers 48 | #tls_version 49 | } 50 | -------------------------------------------------------------------------------- /janus_config/janus.eventhandler.nanomsgevh.jcfg: -------------------------------------------------------------------------------- 1 | # This configures the Nanomsg event handler. Since this plugin only 2 | # forwards each event it receives via Nanomsg, you simply need to 3 | # configure (i) which events to subscribe to, (ii) the address to use for 4 | # the communication, and (iii) whether the address should be used to bind 5 | # locally or to connect to a remote endpoint. Notice that the only supported 6 | # pattern is NN_PUBSUB, where the Nanomsg event handler is the publisher. 7 | 8 | general: { 9 | enabled = false # By default the module is not enabled 10 | events = "all" # Comma separated list of the events mask you're interested 11 | # in. Valid values are none, sessions, handles, jsep, webrtc, 12 | # media, plugins, transports, core, external and all. By 13 | # default we subscribe to everything (all) 14 | grouping = true # Whether events should be sent individually (one per 15 | # HTTP POST, JSON object), or if it's ok to group them 16 | # (one or more per HTTP POST, JSON array with objects) 17 | # The default is 'yes' to limit the number of connections. 18 | 19 | # Address the plugin will send all events to as HTTP POST 20 | # requests with an application/json payload. In case 21 | # authentication is required to contact the backend, set 22 | # the credentials as well (basic authentication only). 23 | json = "indented" # Whether the JSON messages should be indented (default), 24 | # plain (no indentation) or compact (no indentation and no spaces) 25 | 26 | #mode = "bind" # Whether we should 'bind' to the specified 27 | # address, or connect to it if remote (default) 28 | address = "ipc:///tmp/janusevh.ipc" # Address to use, refer to the Nanomsg documentation 29 | # for more info on different transports you can use here 30 | } 31 | -------------------------------------------------------------------------------- /janus_config/janus.eventhandler.nanomsgevh.jcfg.sample: -------------------------------------------------------------------------------- 1 | # This configures the Nanomsg event handler. Since this plugin only 2 | # forwards each event it receives via Nanomsg, you simply need to 3 | # configure (i) which events to subscribe to, (ii) the address to use for 4 | # the communication, and (iii) whether the address should be used to bind 5 | # locally or to connect to a remote endpoint. Notice that the only supported 6 | # pattern is NN_PUBSUB, where the Nanomsg event handler is the publisher. 7 | 8 | general: { 9 | enabled = false # By default the module is not enabled 10 | events = "all" # Comma separated list of the events mask you're interested 11 | # in. Valid values are none, sessions, handles, jsep, webrtc, 12 | # media, plugins, transports, core, external and all. By 13 | # default we subscribe to everything (all) 14 | grouping = true # Whether events should be sent individually (one per 15 | # HTTP POST, JSON object), or if it's ok to group them 16 | # (one or more per HTTP POST, JSON array with objects) 17 | # The default is 'yes' to limit the number of connections. 18 | 19 | # Address the plugin will send all events to as HTTP POST 20 | # requests with an application/json payload. In case 21 | # authentication is required to contact the backend, set 22 | # the credentials as well (basic authentication only). 23 | json = "indented" # Whether the JSON messages should be indented (default), 24 | # plain (no indentation) or compact (no indentation and no spaces) 25 | 26 | #mode = "bind" # Whether we should 'bind' to the specified 27 | # address, or connect to it if remote (default) 28 | address = "ipc:///tmp/janusevh.ipc" # Address to use, refer to the Nanomsg documentation 29 | # for more info on different transports you can use here 30 | } 31 | -------------------------------------------------------------------------------- /janus_config/janus.eventhandler.sampleevh.jcfg: -------------------------------------------------------------------------------- 1 | # This configures the sample event handler. Since this plugin simply 2 | # forwards each event it receives via HTTP POST, you simply need to 3 | # configure (i) which events to subscribe to, and (ii) the address of 4 | # the web server which will receive the requests. 5 | 6 | general: { 7 | enabled = false # By default the module is not enabled 8 | events = "all" # Comma separated list of the events mask you're interested 9 | # in. Valid values are none, sessions, handles, jsep, webrtc, 10 | # media, plugins, transports, core, external and all. By 11 | # default we subscribe to everything (all) 12 | grouping = true # Whether events should be sent individually (one per 13 | # HTTP POST, JSON object), or if it's ok to group them 14 | # (one or more per HTTP POST, JSON array with objects) 15 | # The default is 'yes' to limit the number of connections. 16 | json = "indented" # Whether the JSON messages should be indented (default), 17 | # plain (no indentation) or compact (no indentation and no spaces) 18 | 19 | #compress = true # Optionally, the JSON messages can be compressed using zlib 20 | #compression = 9 # In case, you can specify the compression factor, where 1 is 21 | # the fastest (low compression), and 9 gives the best compression 22 | 23 | # Address the plugin will send all events to as HTTP POST 24 | # requests with an application/json payload. In case 25 | # authentication is required to contact the backend, set 26 | # the credentials as well (basic authentication only). 27 | backend = "http://your.webserver.here/and/a/path" 28 | #backend_user = "myuser" 29 | #backend_pwd = "mypwd" 30 | 31 | # You can also configure how retransmissions should 32 | # happen, after a failed attempt to deliver an event. 33 | # Specifically, you can specify how many times a 34 | # retransmission should be attempted (default=5) and 35 | # which step is used, in milliseconds, for the exponential 36 | # backoff before retrying (e.g, if step=100ms, then the 37 | # the first retry will happen after 100ms, the second 38 | # after 200ms, then 400ms, and so on). If the event cannot 39 | # be retransmitted after the maximum number of attemps 40 | # is reached, then it's lost. Beware that retransmissions 41 | # will also delay pending events and increase the queue. 42 | #max_retransmissions = 5 43 | #retransmissions_backoff = 100 44 | } 45 | -------------------------------------------------------------------------------- /janus_config/janus.eventhandler.sampleevh.jcfg.sample: -------------------------------------------------------------------------------- 1 | # This configures the sample event handler. Since this plugin simply 2 | # forwards each event it receives via HTTP POST, you simply need to 3 | # configure (i) which events to subscribe to, and (ii) the address of 4 | # the web server which will receive the requests. 5 | 6 | general: { 7 | enabled = false # By default the module is not enabled 8 | events = "all" # Comma separated list of the events mask you're interested 9 | # in. Valid values are none, sessions, handles, jsep, webrtc, 10 | # media, plugins, transports, core, external and all. By 11 | # default we subscribe to everything (all) 12 | grouping = true # Whether events should be sent individually (one per 13 | # HTTP POST, JSON object), or if it's ok to group them 14 | # (one or more per HTTP POST, JSON array with objects) 15 | # The default is 'yes' to limit the number of connections. 16 | json = "indented" # Whether the JSON messages should be indented (default), 17 | # plain (no indentation) or compact (no indentation and no spaces) 18 | 19 | #compress = true # Optionally, the JSON messages can be compressed using zlib 20 | #compression = 9 # In case, you can specify the compression factor, where 1 is 21 | # the fastest (low compression), and 9 gives the best compression 22 | 23 | # Address the plugin will send all events to as HTTP POST 24 | # requests with an application/json payload. In case 25 | # authentication is required to contact the backend, set 26 | # the credentials as well (basic authentication only). 27 | backend = "http://your.webserver.here/and/a/path" 28 | #backend_user = "myuser" 29 | #backend_pwd = "mypwd" 30 | 31 | # You can also configure how retransmissions should 32 | # happen, after a failed attempt to deliver an event. 33 | # Specifically, you can specify how many times a 34 | # retransmission should be attempted (default=5) and 35 | # which step is used, in milliseconds, for the exponential 36 | # backoff before retrying (e.g, if step=100ms, then the 37 | # the first retry will happen after 100ms, the second 38 | # after 200ms, then 400ms, and so on). If the event cannot 39 | # be retransmitted after the maximum number of attemps 40 | # is reached, then it's lost. Beware that retransmissions 41 | # will also delay pending events and increase the queue. 42 | #max_retransmissions = 5 43 | #retransmissions_backoff = 100 44 | } 45 | -------------------------------------------------------------------------------- /janus_config/janus.eventhandler.wsevh.jcfg: -------------------------------------------------------------------------------- 1 | # This configures the WebSockets event handler. Since this plugin only 2 | # forwards each event it receives via WebSockets, you simply need to 3 | # configure (i) which events to subscribe to, and (ii) the address of 4 | # the WebSockets server which will receive the requests. 5 | 6 | general: { 7 | enabled = false # By default the module is not enabled 8 | events = "all" # Comma separated list of the events mask you're interested 9 | # in. Valid values are none, sessions, handles, jsep, webrtc, 10 | # media, plugins, transports, core, external and all. By 11 | # default we subscribe to everything (all) 12 | grouping = true # Whether events should be sent individually (one per 13 | # HTTP POST, JSON object), or if it's ok to group them 14 | # (one or more per HTTP POST, JSON array with objects) 15 | # The default is 'yes' to limit the number of connections. 16 | 17 | # Address the plugin will send all events to as HTTP POST 18 | # requests with an application/json payload. In case 19 | # authentication is required to contact the backend, set 20 | # the credentials as well (basic authentication only). 21 | json = "indented" # Whether the JSON messages should be indented (default), 22 | # plain (no indentation) or compact (no indentation and no spaces) 23 | 24 | backend = "ws://your.websocket.here" 25 | # subprotocol = "your-subprotocol" 26 | } 27 | -------------------------------------------------------------------------------- /janus_config/janus.eventhandler.wsevh.jcfg.sample: -------------------------------------------------------------------------------- 1 | # This configures the WebSockets event handler. Since this plugin only 2 | # forwards each event it receives via WebSockets, you simply need to 3 | # configure (i) which events to subscribe to, and (ii) the address of 4 | # the WebSockets server which will receive the requests. 5 | 6 | general: { 7 | enabled = false # By default the module is not enabled 8 | events = "all" # Comma separated list of the events mask you're interested 9 | # in. Valid values are none, sessions, handles, jsep, webrtc, 10 | # media, plugins, transports, core, external and all. By 11 | # default we subscribe to everything (all) 12 | grouping = true # Whether events should be sent individually (one per 13 | # HTTP POST, JSON object), or if it's ok to group them 14 | # (one or more per HTTP POST, JSON array with objects) 15 | # The default is 'yes' to limit the number of connections. 16 | 17 | # Address the plugin will send all events to as HTTP POST 18 | # requests with an application/json payload. In case 19 | # authentication is required to contact the backend, set 20 | # the credentials as well (basic authentication only). 21 | json = "indented" # Whether the JSON messages should be indented (default), 22 | # plain (no indentation) or compact (no indentation and no spaces) 23 | 24 | backend = "ws://your.websocket.here" 25 | # subprotocol = "your-subprotocol" 26 | } 27 | -------------------------------------------------------------------------------- /janus_config/janus.jcfg: -------------------------------------------------------------------------------- 1 | # General configuration: folders where the configuration and the plugins 2 | # can be found, how output should be logged, whether Janus should run as 3 | # a daemon or in foreground, default interface to use, debug/logging level 4 | # and, if needed, shared apisecret and/or token authentication mechanism 5 | # between application(s) and Janus. 6 | general: { 7 | configs_folder = "/var/janus/janus/etc/janus" # Configuration files folder 8 | plugins_folder = "/var/janus/janus/lib/janus/plugins" # Plugins folder 9 | transports_folder = "/var/janus/janus/lib/janus/transports" # Transports folder 10 | events_folder = "/var/janus/janus/lib/janus/events" # Event handlers folder 11 | loggers_folder = "/var/janus/janus/lib/janus/loggers" # External loggers folder 12 | 13 | # The next settings configure logging 14 | #log_to_stdout = false # Whether the Janus output should be written 15 | # to stdout or not (default=true) 16 | #log_to_file = "/path/to/janus.log" # Whether to use a log file or not 17 | debug_level = 4 # Debug/logging level, valid values are 0-7 18 | debug_timestamps = true # Whether to show a timestamp for each log line 19 | #debug_colors = false # Whether colors should be disabled in the log 20 | #debug_locks = true # Whether to enable debugging of locks (very verbose!) 21 | #log_prefix = "[janus] " # In case you want log lines to be prefixed by some 22 | # custom text, you can use the 'log_prefix' property. 23 | # It supports terminal colors, meaning something like 24 | # "[\x1b[32mjanus\x1b[0m] " would show a green "janus" 25 | # string in square brackets (assuming debug_colors=true). 26 | 27 | # This is what you configure if you want to launch Janus as a daemon 28 | #daemonize = true # Whether Janus should run as a daemon 29 | # or not (default=run in foreground) 30 | #pid_file = "/path/to/janus.pid" # PID file to create when Janus has been 31 | # started, and to destroy at shutdown 32 | 33 | # There are different ways you can authenticate the Janus and Admin APIs 34 | #api_secret = "janusrocks" # String that all Janus requests must contain 35 | # to be accepted/authorized by the Janus core. 36 | # Useful if you're wrapping all Janus API requests 37 | # in your servers (that is, not in the browser, 38 | # where you do the things your way) and you 39 | # don't want other application to mess with 40 | # this Janus instance. 41 | #token_auth = true # Enable a token based authentication 42 | # mechanism to force users to always provide 43 | # a valid token in all requests. Useful if 44 | # you want to authenticate requests from web 45 | # users. 46 | #token_auth_secret = "janus" # Use HMAC-SHA1 signed tokens (with token_auth). Note that 47 | # without this, the Admin API MUST 48 | # be enabled, as tokens are added and removed 49 | # through messages sent there. 50 | admin_secret = "janusoverlord" # String that all Janus requests must contain 51 | # to be accepted/authorized by the admin/monitor. 52 | # only needed if you enabled the admin API 53 | # in any of the available transports. 54 | 55 | # Generic settings 56 | #interface = "1.2.3.4" # Interface to use (will be used in SDP) 57 | #server_name = "MyJanusInstance"# Public name of this Janus instance 58 | # as it will appear in an info request 59 | #session_timeout = 60 # How long (in seconds) we should wait before 60 | # deciding a Janus session has timed out. A 61 | # session times out when no request is received 62 | # for session_timeout seconds (default=60s). 63 | # Setting this to 0 will disable the timeout 64 | # mechanism, which is NOT suggested as it may 65 | # risk having orphaned sessions (sessions not 66 | # controlled by any transport and never freed). 67 | # To avoid timeouts, keep-alives can be used. 68 | #candidates_timeout = 45 # How long (in seconds) we should keep hold of 69 | # pending (trickle) candidates before discarding 70 | # them (default=45s). Notice that setting this 71 | # to 0 will NOT disable the timeout, but will 72 | # be considered an invalid value and ignored. 73 | #reclaim_session_timeout = 0 # How long (in seconds) we should wait for a 74 | # janus session to be reclaimed after the transport 75 | # is gone. After the transport is gone, a session 76 | # times out when no request is received for 77 | # reclaim_session_timeout seconds (default=0s). 78 | # Setting this to 0 will disable the timeout 79 | # mechanism, and sessions will be destroyed immediately 80 | # if the transport is gone. 81 | recordings_tmp_ext = "tmp" # The extension for recordings, in Janus, is 82 | # .mjr, a custom format we devised ourselves. 83 | # By default, we save to .mjr directly. If you'd 84 | # rather the recording filename have a temporary 85 | # extension while it's being saved, and only 86 | # have the .mjr extension when the recording 87 | # is over (e.g., to automatically trigger some 88 | # external scripts), then uncomment and set the 89 | # recordings_tmp_ext property to the extension 90 | # to add to the base (e.g., tmp --> .mjr.tmp). 91 | #event_loops = 8 # By default, Janus handles each have their own 92 | # event loop and related thread for all the media 93 | # routing and management. If for some reason you'd 94 | # rather limit the number of loop/threads, and 95 | # you want handles to share those, you can do that 96 | # configuring the event_loops property: this will 97 | # spawn the specified amount of threads at startup, 98 | # run a separate event loop on each of them, and 99 | # add new handles to one of them when attaching. 100 | # Notice that, while cutting the number of threads 101 | # and possibly reducing context switching, this 102 | # might have an impact on the media delivery, 103 | # especially if the available loops can't take 104 | # care of all the handles and their media in time. 105 | # As such, if you want to use this you should 106 | # provision the correct value according to the 107 | # available resources (e.g., CPUs available). 108 | #opaqueid_in_api = true # Opaque IDs set by applications are typically 109 | # only passed to event handlers for correlation 110 | # purposes, but not sent back to the user or 111 | # application in the related Janus API responses 112 | # or events; in case you need them to be in the 113 | # Janus API too, set this property to 'true'. 114 | #hide_dependencies = true # By default, a call to the "info" endpoint of 115 | # either the Janus or Admin API now also returns 116 | # the versions of the main dependencies (e.g., 117 | # libnice, libsrtp, which crypto library is in 118 | # use and so on). Should you want that info not 119 | # to be disclose, set 'hide_dependencies' to true. 120 | 121 | # The following is ONLY useful when debugging RTP/RTCP packets, 122 | # e.g., to look at unencrypted live traffic with a browser. By 123 | # default it is obviously disabled, as WebRTC mandates encryption. 124 | #no_webrtc_encryption = true 125 | 126 | # Janus provides ways via its API to specify custom paths to save 127 | # files to (e.g., recordings, pcap captures and the like). In order 128 | # to avoid people can mess with folders they're not supposed to, 129 | # you can configure an array of folders that Janus should prevent 130 | # creating files in. If the 'protected_folder' property below is 131 | # commented, no folder is protected. 132 | # Notice that at the moment this only covers attempts to start 133 | # an .mjr recording and pcap/text2pcap packet captures. 134 | protected_folders = [ 135 | "/bin", 136 | "/boot", 137 | "/dev", 138 | "/etc", 139 | "/initrd", 140 | "/lib", 141 | "/lib32", 142 | "/lib64", 143 | "/proc", 144 | "/sbin", 145 | "/sys", 146 | "/usr", 147 | "/var", 148 | # We add what are usually the folders Janus is installed to 149 | # as well: we don't just put "/var/janus/janus" because that would 150 | # include folders like "/var/janus/janus/share" that is where 151 | # recordings might be saved to by some plugins 152 | "/var/janus/janus/bin", 153 | "/var/janus/janus/etc", 154 | "/var/janus/janus/include", 155 | "/var/janus/janus/lib", 156 | "/var/janus/janus/lib32", 157 | "/var/janus/janus/lib64", 158 | "/var/janus/janus/sbin" 159 | ] 160 | } 161 | 162 | # Certificate and key to use for DTLS (and passphrase if needed). If missing, 163 | # Janus will autogenerate a self-signed certificate to use. Notice that 164 | # self-signed certificates are fine for the purpose of WebRTC DTLS 165 | # connectivity, for the time being, at least until Identity Providers 166 | # are standardized and implemented in browsers. If for some reason you 167 | # want to enforce the DTLS stack in Janus to enforce valid certificates 168 | # from peers, though, you can do that setting 'dtls_accept_selfsigned' to 169 | # 'false' below: DO NOT TOUCH THAT IF YOU DO NOT KNOW WHAT YOU'RE DOING! 170 | # You can also configure the DTLS ciphers to offer: the default if not 171 | # set is "DEFAULT:!NULL:!aNULL:!SHA256:!SHA384:!aECDH:!AESGCM+AES256:!aPSK" 172 | # Finally, by default NIST P-256 certificates are generated (see #1997), 173 | # but RSA generation is still supported if you set 'rsa_private_key' to 'true'. 174 | certificates: { 175 | #cert_pem = "/var/janus/janus/etc/janus/cacert.pem" 176 | #cert_key = "/var/janus/janus/etc/janus/privkey.pem" 177 | #cert_pwd = "123456" 178 | #dtls_accept_selfsigned = false 179 | #dtls_ciphers = "your-desired-openssl-ciphers" 180 | #rsa_private_key = false 181 | } 182 | 183 | # Media-related stuff: you can configure whether if you want 184 | # to enable IPv6 support, the minimum size of the NACK queue (in ms, 185 | # defaults to 200ms) for retransmissions no matter the RTT, the range of 186 | # ports to use for RTP and RTCP (by default, no range is envisaged), the 187 | # starting MTU for DTLS (1200 by default, it adapts automatically), 188 | # how much time, in seconds, should pass with no media (audio or 189 | # video) being received before Janus notifies you about this (default=1s, 190 | # 0 disables these events entirely), how many lost packets should trigger 191 | # a 'slowlink' event to users (default=4), and how often, in milliseconds, 192 | # to send the Transport Wide Congestion Control feedback information back 193 | # to senders, if negotiated (default=200ms). Finally, if you're using BoringSSL 194 | # you can customize the frequency of retransmissions: OpenSSL has a fixed 195 | # value of 1 second (the default), while BoringSSL can override that. Notice 196 | # that lower values (e.g., 100ms) will typically get you faster connection 197 | # times, but may not work in case the RTT of the user is high: as such, 198 | # you should pick a reasonable trade-off (usually 2*max expected RTT). 199 | media: { 200 | #ipv6 = true 201 | #min_nack_queue = 500 202 | rtp_port_range = "20000-40000" 203 | dtls_mtu = 1200 204 | #no_media_timer = 1 205 | slowlink_threshold = 10 206 | #twcc_period = 100 207 | #dtls_timeout = 500 208 | 209 | # If you need DSCP packet marking and prioritization, you can configure 210 | # the 'dscp' property to a specific values, and Janus will try to 211 | # set it on all outgoing packets using libnice. Normally, the specs 212 | # suggest to use different values depending on whether audio, video 213 | # or data are used, but since all PeerConnections in Janus are bundled, 214 | # we can only use one. You can refer to this document for more info: 215 | # https://tools.ietf.org/html/draft-ietf-tsvwg-rtcweb-qos-18#page-6 216 | # That said, DON'T TOUCH THIS IF YOU DON'T KNOW WHAT IT MEANS! 217 | #dscp = 46 218 | } 219 | 220 | # NAT-related stuff: specifically, you can configure the STUN/TURN 221 | # servers to use to gather candidates if the gateway is behind a NAT, 222 | # and srflx/relay candidates are needed. In case STUN is not enough and 223 | # this is needed (it shouldn't), you can also configure Janus to use a 224 | # TURN server# please notice that this does NOT refer to TURN usage in 225 | # browsers, but in the gathering of relay candidates by Janus itself, 226 | # e.g., if you want to limit the ports used by a Janus instance on a 227 | # private machine. Furthermore, you can choose whether Janus should be 228 | # configured to do full-trickle (Janus also trickles its candidates to 229 | # users) rather than the default half-trickle (Janus supports trickle 230 | # candidates from users, but sends its own within the SDP), and whether 231 | # it should work in ICE-Lite mode (by default it doesn't). Finally, 232 | # you can also enable ICE-TCP support (beware that this may lead to problems 233 | # if you do not enable ICE Lite as well), choose which interfaces should 234 | # be used for gathering candidates, and enable or disable the 235 | # internal libnice debugging, if needed. 236 | nat: { 237 | #stun_server = "stun.voip.eutelia.it" 238 | #stun_port = 3478 239 | nice_debug = false 240 | #full_trickle = true 241 | ice_lite = true 242 | #ice_tcp = true 243 | 244 | # By default Janus tries to resolve mDNS (.local) candidates: even 245 | # though this is now done asynchronously and shouldn't keep the API 246 | # busy, even in case mDNS resolution takes a long time to timeout, 247 | # you can choose to drop all .local candidates instead, which is 248 | # helpful in case you know clients will never be in the same private 249 | # network as the one the Janus instance is running from. Notice that 250 | # this will cause ICE to fail if mDNS is the only way to connect! 251 | #ignore_mdns = true 252 | 253 | # In case you're deploying Janus on a server which is configured with 254 | # a 1:1 NAT (e.g., Amazon EC2), you might want to also specify the public 255 | # address of the machine using the setting below. This will result in 256 | # all host candidates (which normally have a private IP address) to 257 | # be rewritten with the public address provided in the settings. As 258 | # such, use the option with caution and only if you know what you're doing. 259 | # Make sure you keep ICE Lite disabled, though, as it's not strictly 260 | # speaking a publicly reachable server, and a NAT is still involved. 261 | # If you'd rather keep the private IP address in place, rather than 262 | # replacing it (and so have both of them as advertised candidates), 263 | # then set the 'keep_private_host' property to true. 264 | #nat_1_1_mapping = "1.2.3.4" 265 | #keep_private_host = true 266 | 267 | # You can configure a TURN server in two different ways: specifying a 268 | # statically configured TURN server, and thus provide the address of the 269 | # TURN server, the transport (udp/tcp/tls) to use, and a set of valid 270 | # credentials to authenticate... 271 | #turn_server = "myturnserver.com" 272 | #turn_port = 3478 273 | #turn_type = "udp" 274 | #turn_user = "myuser" 275 | #turn_pwd = "mypassword" 276 | 277 | # ... or you can make use of the TURN REST API to get info on one or more 278 | # TURN services dynamically. This makes use of the proposed standard of 279 | # such an API (https://tools.ietf.org/html/draft-uberti-behave-turn-rest-00) 280 | # which is currently available in both rfc5766-turn-server and coturn. 281 | # You enable this by specifying the address of your TURN REST API backend, 282 | # the HTTP method to use (GET or POST) and, if required, the API key Janus 283 | # must provide. 284 | #turn_rest_api = "http://yourbackend.com/path/to/api" 285 | #turn_rest_api_key = "anyapikeyyoumayhaveset" 286 | #turn_rest_api_method = "GET" 287 | 288 | # You can also choose which interfaces should be explicitly used by the 289 | # gateway for the purpose of ICE candidates gathering, thus excluding 290 | # others that may be available. To do so, use the 'ice_enforce_list' 291 | # setting and pass it a comma-separated list of interfaces or IP addresses 292 | # to enforce. This is especially useful if the server hosting the gateway 293 | # has several interfaces, and you only want a subset to be used. Any of 294 | # the following examples are valid: 295 | # ice_enforce_list = "eth0" 296 | # ice_enforce_list = "eth0,eth1" 297 | # ice_enforce_list = "eth0,192.168." 298 | # ice_enforce_list = "eth0,192.168.0.1" 299 | # By default, no interface is enforced, meaning Janus will try to use them all. 300 | #ice_enforce_list = "eth0" 301 | 302 | # In case you don't want to specify specific interfaces to use, but would 303 | # rather tell Janus to use all the available interfaces except some that 304 | # you don't want to involve, you can also choose which interfaces or IP 305 | # addresses should be excluded and ignored by the gateway for the purpose 306 | # of ICE candidates gathering. To do so, use the 'ice_ignore_list' setting 307 | # and pass it a comma-separated list of interfaces or IP addresses to 308 | # ignore. This is especially useful if the server hosting the gateway 309 | # has several interfaces you already know will not be used or will simply 310 | # always slow down ICE (e.g., virtual interfaces created by VMware). 311 | # Partial strings are supported, which means that any of the following 312 | # examples are valid: 313 | # ice_ignore_list = "vmnet8,192.168.0.1,10.0.0.1" 314 | # ice_ignore_list = "vmnet,192.168." 315 | # Just beware that the ICE ignore list is not used if an enforce list 316 | # has been configured. By default, Janus ignores all interfaces whose 317 | # name starts with 'vmnet', to skip VMware interfaces: 318 | ice_ignore_list = "vmnet,docker" 319 | 320 | # In case you want to allow Janus to start even if the configured STUN or TURN 321 | # server is unreachable, you can set 'ignore_unreachable_ice_server' to true. 322 | # WARNING: We do not recommend to ignore reachability problems, particularly 323 | # if you run Janus in the cloud. Before enabling this flag, make sure your 324 | # system is correctly configured and Janus starts after the network layer of 325 | # your machine is ready. Note that Linux distributions offer such directives. 326 | # You could use the following directive in systemd: 'After=network-online.target' 327 | # https://www.freedesktop.org/software/systemd/man/systemd.unit.html#Before= 328 | #ignore_unreachable_ice_server = true 329 | } 330 | 331 | # You can choose which of the available plugins should be 332 | # enabled or not. Use the 'disable' directive to prevent Janus from 333 | # loading one or more plugins: use a comma separated list of plugin file 334 | # names to identify the plugins to disable. By default all available 335 | # plugins are enabled and loaded at startup. 336 | plugins: { 337 | #disable = "libjanus_voicemail.so,libjanus_recordplay.so" 338 | } 339 | 340 | # You can choose which of the available transports should be enabled or 341 | # not. Use the 'disable' directive to prevent Janus from loading one 342 | # or more transport: use a comma separated list of transport file names 343 | # to identify the transports to disable. By default all available 344 | # transports are enabled and loaded at startup. 345 | transports: { 346 | #disable = "libjanus_rabbitmq.so" 347 | } 348 | 349 | # As a core feature, Janus can log either on the standard output, or to 350 | # a local file. Should you need more advanced logging functionality, you 351 | # can make use of one of the custom loggers, or write one yourself. Use the 352 | # 'disable' directive to prevent Janus from loading one or more loggers: 353 | # use a comma separated list of logger file names to identify the loggers 354 | # to disable. By default all available loggers are enabled and loaded at startup. 355 | loggers: { 356 | #disable = "libjanus_jsonlog.so" 357 | } 358 | 359 | # Event handlers allow you to receive live events from Janus happening 360 | # in core and/or plugins. Since this can require some more resources, 361 | # the feature is disabled by default. Setting broadcast to yes will 362 | # enable them. You can then choose which of the available event handlers 363 | # should be loaded or not. Use the 'disable' directive to prevent Janus 364 | # from loading one or more event handlers: use a comma separated list of 365 | # file names to identify the event handlers to disable. By default, if 366 | # broadcast is set to yes all available event handlers are enabled and 367 | # loaded at startup. Finally, you can choose how often media statistics 368 | # (packets sent/received, losses, etc.) should be sent: by default it's 369 | # once per second (audio and video statistics sent separately), but may 370 | # considered too verbose, or you may want to limit the number of events, 371 | # especially if you have many PeerConnections active. To change this, 372 | # just set 'stats_period' to the number of seconds that should pass in 373 | # between statistics for each handle. Setting it to 0 disables them (but 374 | # not other media-related events). 375 | events: { 376 | #broadcast = true 377 | #disable = "libjanus_sampleevh.so" 378 | #stats_period = 5 379 | } 380 | -------------------------------------------------------------------------------- /janus_config/janus.jcfg.sample: -------------------------------------------------------------------------------- 1 | # General configuration: folders where the configuration and the plugins 2 | # can be found, how output should be logged, whether Janus should run as 3 | # a daemon or in foreground, default interface to use, debug/logging level 4 | # and, if needed, shared apisecret and/or token authentication mechanism 5 | # between application(s) and Janus. 6 | general: { 7 | configs_folder = "/var/janus/janus/etc/janus" # Configuration files folder 8 | plugins_folder = "/var/janus/janus/lib/janus/plugins" # Plugins folder 9 | transports_folder = "/var/janus/janus/lib/janus/transports" # Transports folder 10 | events_folder = "/var/janus/janus/lib/janus/events" # Event handlers folder 11 | loggers_folder = "/var/janus/janus/lib/janus/loggers" # External loggers folder 12 | 13 | # The next settings configure logging 14 | #log_to_stdout = false # Whether the Janus output should be written 15 | # to stdout or not (default=true) 16 | #log_to_file = "/path/to/janus.log" # Whether to use a log file or not 17 | debug_level = 4 # Debug/logging level, valid values are 0-7 18 | #debug_timestamps = true # Whether to show a timestamp for each log line 19 | #debug_colors = false # Whether colors should be disabled in the log 20 | #debug_locks = true # Whether to enable debugging of locks (very verbose!) 21 | #log_prefix = "[janus] " # In case you want log lines to be prefixed by some 22 | # custom text, you can use the 'log_prefix' property. 23 | # It supports terminal colors, meaning something like 24 | # "[\x1b[32mjanus\x1b[0m] " would show a green "janus" 25 | # string in square brackets (assuming debug_colors=true). 26 | 27 | # This is what you configure if you want to launch Janus as a daemon 28 | #daemonize = true # Whether Janus should run as a daemon 29 | # or not (default=run in foreground) 30 | #pid_file = "/path/to/janus.pid" # PID file to create when Janus has been 31 | # started, and to destroy at shutdown 32 | 33 | # There are different ways you can authenticate the Janus and Admin APIs 34 | #api_secret = "janusrocks" # String that all Janus requests must contain 35 | # to be accepted/authorized by the Janus core. 36 | # Useful if you're wrapping all Janus API requests 37 | # in your servers (that is, not in the browser, 38 | # where you do the things your way) and you 39 | # don't want other application to mess with 40 | # this Janus instance. 41 | #token_auth = true # Enable a token based authentication 42 | # mechanism to force users to always provide 43 | # a valid token in all requests. Useful if 44 | # you want to authenticate requests from web 45 | # users. 46 | #token_auth_secret = "janus" # Use HMAC-SHA1 signed tokens (with token_auth). Note that 47 | # without this, the Admin API MUST 48 | # be enabled, as tokens are added and removed 49 | # through messages sent there. 50 | admin_secret = "janusoverlord" # String that all Janus requests must contain 51 | # to be accepted/authorized by the admin/monitor. 52 | # only needed if you enabled the admin API 53 | # in any of the available transports. 54 | 55 | # Generic settings 56 | #interface = "1.2.3.4" # Interface to use (will be used in SDP) 57 | #server_name = "MyJanusInstance"# Public name of this Janus instance 58 | # as it will appear in an info request 59 | #session_timeout = 60 # How long (in seconds) we should wait before 60 | # deciding a Janus session has timed out. A 61 | # session times out when no request is received 62 | # for session_timeout seconds (default=60s). 63 | # Setting this to 0 will disable the timeout 64 | # mechanism, which is NOT suggested as it may 65 | # risk having orphaned sessions (sessions not 66 | # controlled by any transport and never freed). 67 | # To avoid timeouts, keep-alives can be used. 68 | #candidates_timeout = 45 # How long (in seconds) we should keep hold of 69 | # pending (trickle) candidates before discarding 70 | # them (default=45s). Notice that setting this 71 | # to 0 will NOT disable the timeout, but will 72 | # be considered an invalid value and ignored. 73 | #reclaim_session_timeout = 0 # How long (in seconds) we should wait for a 74 | # janus session to be reclaimed after the transport 75 | # is gone. After the transport is gone, a session 76 | # times out when no request is received for 77 | # reclaim_session_timeout seconds (default=0s). 78 | # Setting this to 0 will disable the timeout 79 | # mechanism, and sessions will be destroyed immediately 80 | # if the transport is gone. 81 | #recordings_tmp_ext = "tmp" # The extension for recordings, in Janus, is 82 | # .mjr, a custom format we devised ourselves. 83 | # By default, we save to .mjr directly. If you'd 84 | # rather the recording filename have a temporary 85 | # extension while it's being saved, and only 86 | # have the .mjr extension when the recording 87 | # is over (e.g., to automatically trigger some 88 | # external scripts), then uncomment and set the 89 | # recordings_tmp_ext property to the extension 90 | # to add to the base (e.g., tmp --> .mjr.tmp). 91 | #event_loops = 8 # By default, Janus handles each have their own 92 | # event loop and related thread for all the media 93 | # routing and management. If for some reason you'd 94 | # rather limit the number of loop/threads, and 95 | # you want handles to share those, you can do that 96 | # configuring the event_loops property: this will 97 | # spawn the specified amount of threads at startup, 98 | # run a separate event loop on each of them, and 99 | # add new handles to one of them when attaching. 100 | # Notice that, while cutting the number of threads 101 | # and possibly reducing context switching, this 102 | # might have an impact on the media delivery, 103 | # especially if the available loops can't take 104 | # care of all the handles and their media in time. 105 | # As such, if you want to use this you should 106 | # provision the correct value according to the 107 | # available resources (e.g., CPUs available). 108 | #opaqueid_in_api = true # Opaque IDs set by applications are typically 109 | # only passed to event handlers for correlation 110 | # purposes, but not sent back to the user or 111 | # application in the related Janus API responses 112 | # or events; in case you need them to be in the 113 | # Janus API too, set this property to 'true'. 114 | #hide_dependencies = true # By default, a call to the "info" endpoint of 115 | # either the Janus or Admin API now also returns 116 | # the versions of the main dependencies (e.g., 117 | # libnice, libsrtp, which crypto library is in 118 | # use and so on). Should you want that info not 119 | # to be disclose, set 'hide_dependencies' to true. 120 | 121 | # The following is ONLY useful when debugging RTP/RTCP packets, 122 | # e.g., to look at unencrypted live traffic with a browser. By 123 | # default it is obviously disabled, as WebRTC mandates encryption. 124 | #no_webrtc_encryption = true 125 | 126 | # Janus provides ways via its API to specify custom paths to save 127 | # files to (e.g., recordings, pcap captures and the like). In order 128 | # to avoid people can mess with folders they're not supposed to, 129 | # you can configure an array of folders that Janus should prevent 130 | # creating files in. If the 'protected_folder' property below is 131 | # commented, no folder is protected. 132 | # Notice that at the moment this only covers attempts to start 133 | # an .mjr recording and pcap/text2pcap packet captures. 134 | protected_folders = [ 135 | "/bin", 136 | "/boot", 137 | "/dev", 138 | "/etc", 139 | "/initrd", 140 | "/lib", 141 | "/lib32", 142 | "/lib64", 143 | "/proc", 144 | "/sbin", 145 | "/sys", 146 | "/usr", 147 | "/var", 148 | # We add what are usually the folders Janus is installed to 149 | # as well: we don't just put "/var/janus/janus" because that would 150 | # include folders like "/var/janus/janus/share" that is where 151 | # recordings might be saved to by some plugins 152 | "/var/janus/janus/bin", 153 | "/var/janus/janus/etc", 154 | "/var/janus/janus/include", 155 | "/var/janus/janus/lib", 156 | "/var/janus/janus/lib32", 157 | "/var/janus/janus/lib64", 158 | "/var/janus/janus/sbin" 159 | ] 160 | } 161 | 162 | # Certificate and key to use for DTLS (and passphrase if needed). If missing, 163 | # Janus will autogenerate a self-signed certificate to use. Notice that 164 | # self-signed certificates are fine for the purpose of WebRTC DTLS 165 | # connectivity, for the time being, at least until Identity Providers 166 | # are standardized and implemented in browsers. If for some reason you 167 | # want to enforce the DTLS stack in Janus to enforce valid certificates 168 | # from peers, though, you can do that setting 'dtls_accept_selfsigned' to 169 | # 'false' below: DO NOT TOUCH THAT IF YOU DO NOT KNOW WHAT YOU'RE DOING! 170 | # You can also configure the DTLS ciphers to offer: the default if not 171 | # set is "DEFAULT:!NULL:!aNULL:!SHA256:!SHA384:!aECDH:!AESGCM+AES256:!aPSK" 172 | # Finally, by default NIST P-256 certificates are generated (see #1997), 173 | # but RSA generation is still supported if you set 'rsa_private_key' to 'true'. 174 | certificates: { 175 | #cert_pem = "/path/to/certificate.pem" 176 | #cert_key = "/path/to/key.pem" 177 | #cert_pwd = "secretpassphrase" 178 | #dtls_accept_selfsigned = false 179 | #dtls_ciphers = "your-desired-openssl-ciphers" 180 | #rsa_private_key = false 181 | } 182 | 183 | # Media-related stuff: you can configure whether if you want 184 | # to enable IPv6 support, the minimum size of the NACK queue (in ms, 185 | # defaults to 200ms) for retransmissions no matter the RTT, the range of 186 | # ports to use for RTP and RTCP (by default, no range is envisaged), the 187 | # starting MTU for DTLS (1200 by default, it adapts automatically), 188 | # how much time, in seconds, should pass with no media (audio or 189 | # video) being received before Janus notifies you about this (default=1s, 190 | # 0 disables these events entirely), how many lost packets should trigger 191 | # a 'slowlink' event to users (default=4), and how often, in milliseconds, 192 | # to send the Transport Wide Congestion Control feedback information back 193 | # to senders, if negotiated (default=200ms). Finally, if you're using BoringSSL 194 | # you can customize the frequency of retransmissions: OpenSSL has a fixed 195 | # value of 1 second (the default), while BoringSSL can override that. Notice 196 | # that lower values (e.g., 100ms) will typically get you faster connection 197 | # times, but may not work in case the RTT of the user is high: as such, 198 | # you should pick a reasonable trade-off (usually 2*max expected RTT). 199 | media: { 200 | #ipv6 = true 201 | #min_nack_queue = 500 202 | #rtp_port_range = "20000-40000" 203 | #dtls_mtu = 1200 204 | #no_media_timer = 1 205 | #slowlink_threshold = 4 206 | #twcc_period = 100 207 | #dtls_timeout = 500 208 | 209 | # If you need DSCP packet marking and prioritization, you can configure 210 | # the 'dscp' property to a specific values, and Janus will try to 211 | # set it on all outgoing packets using libnice. Normally, the specs 212 | # suggest to use different values depending on whether audio, video 213 | # or data are used, but since all PeerConnections in Janus are bundled, 214 | # we can only use one. You can refer to this document for more info: 215 | # https://tools.ietf.org/html/draft-ietf-tsvwg-rtcweb-qos-18#page-6 216 | # That said, DON'T TOUCH THIS IF YOU DON'T KNOW WHAT IT MEANS! 217 | #dscp = 46 218 | } 219 | 220 | # NAT-related stuff: specifically, you can configure the STUN/TURN 221 | # servers to use to gather candidates if the gateway is behind a NAT, 222 | # and srflx/relay candidates are needed. In case STUN is not enough and 223 | # this is needed (it shouldn't), you can also configure Janus to use a 224 | # TURN server# please notice that this does NOT refer to TURN usage in 225 | # browsers, but in the gathering of relay candidates by Janus itself, 226 | # e.g., if you want to limit the ports used by a Janus instance on a 227 | # private machine. Furthermore, you can choose whether Janus should be 228 | # configured to do full-trickle (Janus also trickles its candidates to 229 | # users) rather than the default half-trickle (Janus supports trickle 230 | # candidates from users, but sends its own within the SDP), and whether 231 | # it should work in ICE-Lite mode (by default it doesn't). Finally, 232 | # you can also enable ICE-TCP support (beware that this may lead to problems 233 | # if you do not enable ICE Lite as well), choose which interfaces should 234 | # be used for gathering candidates, and enable or disable the 235 | # internal libnice debugging, if needed. 236 | nat: { 237 | #stun_server = "stun.voip.eutelia.it" 238 | #stun_port = 3478 239 | nice_debug = false 240 | #full_trickle = true 241 | #ice_lite = true 242 | #ice_tcp = true 243 | 244 | # By default Janus tries to resolve mDNS (.local) candidates: even 245 | # though this is now done asynchronously and shouldn't keep the API 246 | # busy, even in case mDNS resolution takes a long time to timeout, 247 | # you can choose to drop all .local candidates instead, which is 248 | # helpful in case you know clients will never be in the same private 249 | # network as the one the Janus instance is running from. Notice that 250 | # this will cause ICE to fail if mDNS is the only way to connect! 251 | #ignore_mdns = true 252 | 253 | # In case you're deploying Janus on a server which is configured with 254 | # a 1:1 NAT (e.g., Amazon EC2), you might want to also specify the public 255 | # address of the machine using the setting below. This will result in 256 | # all host candidates (which normally have a private IP address) to 257 | # be rewritten with the public address provided in the settings. As 258 | # such, use the option with caution and only if you know what you're doing. 259 | # Make sure you keep ICE Lite disabled, though, as it's not strictly 260 | # speaking a publicly reachable server, and a NAT is still involved. 261 | # If you'd rather keep the private IP address in place, rather than 262 | # replacing it (and so have both of them as advertised candidates), 263 | # then set the 'keep_private_host' property to true. 264 | #nat_1_1_mapping = "1.2.3.4" 265 | #keep_private_host = true 266 | 267 | # You can configure a TURN server in two different ways: specifying a 268 | # statically configured TURN server, and thus provide the address of the 269 | # TURN server, the transport (udp/tcp/tls) to use, and a set of valid 270 | # credentials to authenticate... 271 | #turn_server = "myturnserver.com" 272 | #turn_port = 3478 273 | #turn_type = "udp" 274 | #turn_user = "myuser" 275 | #turn_pwd = "mypassword" 276 | 277 | # ... or you can make use of the TURN REST API to get info on one or more 278 | # TURN services dynamically. This makes use of the proposed standard of 279 | # such an API (https://tools.ietf.org/html/draft-uberti-behave-turn-rest-00) 280 | # which is currently available in both rfc5766-turn-server and coturn. 281 | # You enable this by specifying the address of your TURN REST API backend, 282 | # the HTTP method to use (GET or POST) and, if required, the API key Janus 283 | # must provide. 284 | #turn_rest_api = "http://yourbackend.com/path/to/api" 285 | #turn_rest_api_key = "anyapikeyyoumayhaveset" 286 | #turn_rest_api_method = "GET" 287 | 288 | # You can also choose which interfaces should be explicitly used by the 289 | # gateway for the purpose of ICE candidates gathering, thus excluding 290 | # others that may be available. To do so, use the 'ice_enforce_list' 291 | # setting and pass it a comma-separated list of interfaces or IP addresses 292 | # to enforce. This is especially useful if the server hosting the gateway 293 | # has several interfaces, and you only want a subset to be used. Any of 294 | # the following examples are valid: 295 | # ice_enforce_list = "eth0" 296 | # ice_enforce_list = "eth0,eth1" 297 | # ice_enforce_list = "eth0,192.168." 298 | # ice_enforce_list = "eth0,192.168.0.1" 299 | # By default, no interface is enforced, meaning Janus will try to use them all. 300 | #ice_enforce_list = "eth0" 301 | 302 | # In case you don't want to specify specific interfaces to use, but would 303 | # rather tell Janus to use all the available interfaces except some that 304 | # you don't want to involve, you can also choose which interfaces or IP 305 | # addresses should be excluded and ignored by the gateway for the purpose 306 | # of ICE candidates gathering. To do so, use the 'ice_ignore_list' setting 307 | # and pass it a comma-separated list of interfaces or IP addresses to 308 | # ignore. This is especially useful if the server hosting the gateway 309 | # has several interfaces you already know will not be used or will simply 310 | # always slow down ICE (e.g., virtual interfaces created by VMware). 311 | # Partial strings are supported, which means that any of the following 312 | # examples are valid: 313 | # ice_ignore_list = "vmnet8,192.168.0.1,10.0.0.1" 314 | # ice_ignore_list = "vmnet,192.168." 315 | # Just beware that the ICE ignore list is not used if an enforce list 316 | # has been configured. By default, Janus ignores all interfaces whose 317 | # name starts with 'vmnet', to skip VMware interfaces: 318 | ice_ignore_list = "vmnet" 319 | 320 | # In case you want to allow Janus to start even if the configured STUN or TURN 321 | # server is unreachable, you can set 'ignore_unreachable_ice_server' to true. 322 | # WARNING: We do not recommend to ignore reachability problems, particularly 323 | # if you run Janus in the cloud. Before enabling this flag, make sure your 324 | # system is correctly configured and Janus starts after the network layer of 325 | # your machine is ready. Note that Linux distributions offer such directives. 326 | # You could use the following directive in systemd: 'After=network-online.target' 327 | # https://www.freedesktop.org/software/systemd/man/systemd.unit.html#Before= 328 | #ignore_unreachable_ice_server = true 329 | } 330 | 331 | # You can choose which of the available plugins should be 332 | # enabled or not. Use the 'disable' directive to prevent Janus from 333 | # loading one or more plugins: use a comma separated list of plugin file 334 | # names to identify the plugins to disable. By default all available 335 | # plugins are enabled and loaded at startup. 336 | plugins: { 337 | #disable = "libjanus_voicemail.so,libjanus_recordplay.so" 338 | } 339 | 340 | # You can choose which of the available transports should be enabled or 341 | # not. Use the 'disable' directive to prevent Janus from loading one 342 | # or more transport: use a comma separated list of transport file names 343 | # to identify the transports to disable. By default all available 344 | # transports are enabled and loaded at startup. 345 | transports: { 346 | #disable = "libjanus_rabbitmq.so" 347 | } 348 | 349 | # As a core feature, Janus can log either on the standard output, or to 350 | # a local file. Should you need more advanced logging functionality, you 351 | # can make use of one of the custom loggers, or write one yourself. Use the 352 | # 'disable' directive to prevent Janus from loading one or more loggers: 353 | # use a comma separated list of logger file names to identify the loggers 354 | # to disable. By default all available loggers are enabled and loaded at startup. 355 | loggers: { 356 | #disable = "libjanus_jsonlog.so" 357 | } 358 | 359 | # Event handlers allow you to receive live events from Janus happening 360 | # in core and/or plugins. Since this can require some more resources, 361 | # the feature is disabled by default. Setting broadcast to yes will 362 | # enable them. You can then choose which of the available event handlers 363 | # should be loaded or not. Use the 'disable' directive to prevent Janus 364 | # from loading one or more event handlers: use a comma separated list of 365 | # file names to identify the event handlers to disable. By default, if 366 | # broadcast is set to yes all available event handlers are enabled and 367 | # loaded at startup. Finally, you can choose how often media statistics 368 | # (packets sent/received, losses, etc.) should be sent: by default it's 369 | # once per second (audio and video statistics sent separately), but may 370 | # considered too verbose, or you may want to limit the number of events, 371 | # especially if you have many PeerConnections active. To change this, 372 | # just set 'stats_period' to the number of seconds that should pass in 373 | # between statistics for each handle. Setting it to 0 disables them (but 374 | # not other media-related events). 375 | events: { 376 | #broadcast = true 377 | #disable = "libjanus_sampleevh.so" 378 | #stats_period = 5 379 | } 380 | -------------------------------------------------------------------------------- /janus_config/janus.plugin.audiobridge.jcfg: -------------------------------------------------------------------------------- 1 | # room-: { 2 | # description = "This is my awesome room" 3 | # is_private = true|false (whether this room should be in the public list, default=true) 4 | # secret = "" 5 | # pin = "" 6 | # sampling_rate = (e.g., 16000 for wideband mixing) 7 | # audiolevel_ext = true|false (whether the ssrc-audio-level RTP extension must 8 | # be negotiated/used or not for new joins, default=true) 9 | # audiolevel_event = true|false (whether to emit event to other users or not, default=false) 10 | # audio_active_packets = 100 (number of packets with audio level, default=100, 2 seconds) 11 | # audio_level_average = 25 (average value of audio level, 127=muted, 0='too loud', default=25) 12 | # default_prebuffering = number of packets to buffer before decoding each particiant (default=6) 13 | # record = true|false (whether this room should be recorded, default=false) 14 | # record_file = "/path/to/recording.wav" (where to save the recording) 15 | # 16 | # The following lines are only needed if you want the mixed audio 17 | # to be automatically forwarded via plain RTP to an external component 18 | # (e.g., an ffmpeg script, or a gstreamer pipeline) for processing 19 | # By default plain RTP is used, SRTP must be configured if needed 20 | # rtp_forward_id = numeric RTP forwarder ID for referencing it via API (optional: random ID used if missing) 21 | # rtp_forward_host = "" 22 | # rtp_forward_host_family = "" 23 | # rtp_forward_port = port to forward RTP packets of mixed audio to 24 | # rtp_forward_ssrc = SSRC to use to use when streaming (optional: stream_id used if missing) 25 | # rtp_forward_codec = opus (default), pcma (A-Law) or pcmu (mu-Law) 26 | # rtp_forward_ptype = payload type to use when streaming (optional: only read for Opus, 100 used if missing) 27 | # rtp_forward_srtp_suite = length of authentication tag (32 or 80) 28 | # rtp_forward_srtp_crypto = "" 29 | # rtp_forward_always_on = true|false, whether silence should be forwarded when the room is empty (optional: false used if missing) 30 | #} 31 | 32 | general: { 33 | #admin_key = "supersecret" # If set, rooms can be created via API only 34 | # if this key is provided in the request 35 | #lock_rtp_forward = true # Whether the admin_key above should be 36 | # enforced for RTP forwarding requests too 37 | #lock_play_file = true # Whether the admin_key above should be 38 | # enforced for playing .opus files too 39 | #record_tmp_ext = "tmp" # Optional temporary extension to add to filenames 40 | # while recording: e.g., setting "tmp" would mean 41 | # .wav --> .wav.tmp until the file is closed 42 | #events = false # Whether events should be sent to event 43 | # handlers (default=true) 44 | 45 | # By default, integers are used as a unique ID for both rooms and participants. 46 | # In case you want to use strings instead (e.g., a UUID), set string_ids to true. 47 | #string_ids = true 48 | } 49 | 50 | room-1234: { 51 | description = "Demo Room" 52 | secret = "adminpwd" 53 | sampling_rate = 16000 54 | record = false 55 | #record_file = "/path/to/recording.wav" 56 | } 57 | -------------------------------------------------------------------------------- /janus_config/janus.plugin.audiobridge.jcfg.sample: -------------------------------------------------------------------------------- 1 | # room-: { 2 | # description = "This is my awesome room" 3 | # is_private = true|false (whether this room should be in the public list, default=true) 4 | # secret = "" 5 | # pin = "" 6 | # sampling_rate = (e.g., 16000 for wideband mixing) 7 | # audiolevel_ext = true|false (whether the ssrc-audio-level RTP extension must 8 | # be negotiated/used or not for new joins, default=true) 9 | # audiolevel_event = true|false (whether to emit event to other users or not, default=false) 10 | # audio_active_packets = 100 (number of packets with audio level, default=100, 2 seconds) 11 | # audio_level_average = 25 (average value of audio level, 127=muted, 0='too loud', default=25) 12 | # default_prebuffering = number of packets to buffer before decoding each particiant (default=6) 13 | # record = true|false (whether this room should be recorded, default=false) 14 | # record_file = "/path/to/recording.wav" (where to save the recording) 15 | # 16 | # The following lines are only needed if you want the mixed audio 17 | # to be automatically forwarded via plain RTP to an external component 18 | # (e.g., an ffmpeg script, or a gstreamer pipeline) for processing 19 | # By default plain RTP is used, SRTP must be configured if needed 20 | # rtp_forward_id = numeric RTP forwarder ID for referencing it via API (optional: random ID used if missing) 21 | # rtp_forward_host = "" 22 | # rtp_forward_host_family = "" 23 | # rtp_forward_port = port to forward RTP packets of mixed audio to 24 | # rtp_forward_ssrc = SSRC to use to use when streaming (optional: stream_id used if missing) 25 | # rtp_forward_codec = opus (default), pcma (A-Law) or pcmu (mu-Law) 26 | # rtp_forward_ptype = payload type to use when streaming (optional: only read for Opus, 100 used if missing) 27 | # rtp_forward_srtp_suite = length of authentication tag (32 or 80) 28 | # rtp_forward_srtp_crypto = "" 29 | # rtp_forward_always_on = true|false, whether silence should be forwarded when the room is empty (optional: false used if missing) 30 | #} 31 | 32 | general: { 33 | #admin_key = "supersecret" # If set, rooms can be created via API only 34 | # if this key is provided in the request 35 | #lock_rtp_forward = true # Whether the admin_key above should be 36 | # enforced for RTP forwarding requests too 37 | #lock_play_file = true # Whether the admin_key above should be 38 | # enforced for playing .opus files too 39 | #record_tmp_ext = "tmp" # Optional temporary extension to add to filenames 40 | # while recording: e.g., setting "tmp" would mean 41 | # .wav --> .wav.tmp until the file is closed 42 | #events = false # Whether events should be sent to event 43 | # handlers (default=true) 44 | 45 | # By default, integers are used as a unique ID for both rooms and participants. 46 | # In case you want to use strings instead (e.g., a UUID), set string_ids to true. 47 | #string_ids = true 48 | } 49 | 50 | room-1234: { 51 | description = "Demo Room" 52 | secret = "adminpwd" 53 | sampling_rate = 16000 54 | record = false 55 | #record_file = "/path/to/recording.wav" 56 | } 57 | -------------------------------------------------------------------------------- /janus_config/janus.plugin.echotest.jcfg: -------------------------------------------------------------------------------- 1 | # events = true|false, whether events should be sent to event handlers 2 | 3 | general: { 4 | #events = false 5 | } 6 | -------------------------------------------------------------------------------- /janus_config/janus.plugin.echotest.jcfg.sample: -------------------------------------------------------------------------------- 1 | # events = true|false, whether events should be sent to event handlers 2 | 3 | general: { 4 | #events = false 5 | } 6 | -------------------------------------------------------------------------------- /janus_config/janus.plugin.nosip.jcfg: -------------------------------------------------------------------------------- 1 | general: { 2 | # Specify which local IP address to bind to for media. 3 | # If not set it will be automatically guessed from the system 4 | #local_ip = "1.2.3.4" 5 | 6 | # Specify which (public) IP address to advertise in the SDP. 7 | # If not set, the value above or anything autodetected will be used 8 | #sdp_ip = "1.2.3.4" 9 | 10 | # Range of ports to use for RTP/RTCP (default=10000-60000) 11 | rtp_port_range = "20000-40000" 12 | 13 | # Whether events should be sent to event handlers (default=true) 14 | #events = false 15 | 16 | # If you need DSCP packet marking and prioritization, you can configure 17 | # the 'dscp_audio_rtp' and/or 'dscp_video_rtp' property to specific values, 18 | # and the plugin will set it on all outgoing audio/video RTP packets. 19 | # No packet marking is done if this parameter is undefined or equal to 0 20 | #dscp_audio_rtp = 46 21 | #dscp_video_rtp = 26 22 | 23 | } 24 | -------------------------------------------------------------------------------- /janus_config/janus.plugin.nosip.jcfg.sample: -------------------------------------------------------------------------------- 1 | general: { 2 | # Specify which local IP address to bind to for media. 3 | # If not set it will be automatically guessed from the system 4 | #local_ip = "1.2.3.4" 5 | 6 | # Specify which (public) IP address to advertise in the SDP. 7 | # If not set, the value above or anything autodetected will be used 8 | #sdp_ip = "1.2.3.4" 9 | 10 | # Range of ports to use for RTP/RTCP (default=10000-60000) 11 | rtp_port_range = "20000-40000" 12 | 13 | # Whether events should be sent to event handlers (default=true) 14 | #events = false 15 | 16 | # If you need DSCP packet marking and prioritization, you can configure 17 | # the 'dscp_audio_rtp' and/or 'dscp_video_rtp' property to specific values, 18 | # and the plugin will set it on all outgoing audio/video RTP packets. 19 | # No packet marking is done if this parameter is undefined or equal to 0 20 | #dscp_audio_rtp = 46 21 | #dscp_video_rtp = 26 22 | 23 | } 24 | -------------------------------------------------------------------------------- /janus_config/janus.plugin.recordplay.jcfg: -------------------------------------------------------------------------------- 1 | # path = where to place recordings in the file system 2 | # events = true|false, whether events should be sent to event handlers 3 | 4 | general: { 5 | path = "/var/janus/janus/share/janus/recordings" 6 | #events = false 7 | } 8 | -------------------------------------------------------------------------------- /janus_config/janus.plugin.recordplay.jcfg.sample: -------------------------------------------------------------------------------- 1 | # path = where to place recordings in the file system 2 | # events = true|false, whether events should be sent to event handlers 3 | 4 | general: { 5 | path = "/var/janus/janus/share/janus/recordings" 6 | #events = false 7 | } 8 | -------------------------------------------------------------------------------- /janus_config/janus.plugin.sip.jcfg: -------------------------------------------------------------------------------- 1 | general: { 2 | # Specify which local IP address to bind to for SIP stack. 3 | # If not set it will be automatically guessed from the system 4 | #local_ip = "1.2.3.4" 5 | 6 | # Specify which local IP address to bind for the media stack. 7 | # If not set it will be automatically set to the value of local_ip 8 | #local_media_ip = "1.2.3.4" 9 | 10 | # Specify which (public) IP address to advertise in the SDP. 11 | # If not set, the value above or anything autodetected will be used 12 | #sdp_ip = "1.2.3.4" 13 | 14 | # Enable local keep-alives to keep the registration open. Keep-alives are 15 | # sent in the form of OPTIONS requests, at the given interval inseconds. 16 | # (0 to disable) 17 | keepalive_interval = 120 18 | 19 | # Indicate if the server is behind NAT. If so, the server will use STUN 20 | # to guess its own public IP address and use it in the Contact header of 21 | # outgoing requests 22 | behind_nat = false 23 | 24 | # User-Agent string to be used 25 | # user_agent = "Cool WebRTC Gateway" 26 | 27 | # Expiration time for registrations 28 | register_ttl = 3600 29 | 30 | # Range of ports to use for RTP/RTCP (default=10000-60000) 31 | rtp_port_range = "20000-40000" 32 | 33 | # Whether events should be sent to event handlers (default=true) 34 | #events = false 35 | 36 | # If you need DSCP packet marking and prioritization, you can configure 37 | # the 'dscp_audio_rtp' and/or 'dscp_video_rtp' property to specific values, 38 | # and the plugin will set it on all outgoing audio/video RTP packets. 39 | # No packet marking is done if this parameter is undefined or equal to 0 40 | #dscp_audio_rtp = 46 41 | #dscp_video_rtp = 26 42 | 43 | } 44 | -------------------------------------------------------------------------------- /janus_config/janus.plugin.sip.jcfg.sample: -------------------------------------------------------------------------------- 1 | general: { 2 | # Specify which local IP address to bind to for SIP stack. 3 | # If not set it will be automatically guessed from the system 4 | #local_ip = "1.2.3.4" 5 | 6 | # Specify which local IP address to bind for the media stack. 7 | # If not set it will be automatically set to the value of local_ip 8 | #local_media_ip = "1.2.3.4" 9 | 10 | # Specify which (public) IP address to advertise in the SDP. 11 | # If not set, the value above or anything autodetected will be used 12 | #sdp_ip = "1.2.3.4" 13 | 14 | # Enable local keep-alives to keep the registration open. Keep-alives are 15 | # sent in the form of OPTIONS requests, at the given interval inseconds. 16 | # (0 to disable) 17 | keepalive_interval = 120 18 | 19 | # Indicate if the server is behind NAT. If so, the server will use STUN 20 | # to guess its own public IP address and use it in the Contact header of 21 | # outgoing requests 22 | behind_nat = false 23 | 24 | # User-Agent string to be used 25 | # user_agent = "Cool WebRTC Gateway" 26 | 27 | # Expiration time for registrations 28 | register_ttl = 3600 29 | 30 | # Range of ports to use for RTP/RTCP (default=10000-60000) 31 | rtp_port_range = "20000-40000" 32 | 33 | # Whether events should be sent to event handlers (default=true) 34 | #events = false 35 | 36 | # If you need DSCP packet marking and prioritization, you can configure 37 | # the 'dscp_audio_rtp' and/or 'dscp_video_rtp' property to specific values, 38 | # and the plugin will set it on all outgoing audio/video RTP packets. 39 | # No packet marking is done if this parameter is undefined or equal to 0 40 | #dscp_audio_rtp = 46 41 | #dscp_video_rtp = 26 42 | 43 | } 44 | -------------------------------------------------------------------------------- /janus_config/janus.plugin.streaming.jcfg: -------------------------------------------------------------------------------- 1 | # stream-name: { 2 | # type = rtp|live|ondemand|rtsp 3 | # rtp = stream originated by an external tool (e.g., gstreamer or 4 | # ffmpeg) and sent to the plugin via RTP 5 | # live = local file streamed live to multiple listeners 6 | # (multiple listeners = same streaming context) 7 | # ondemand = local file streamed on-demand to a single listener 8 | # (multiple listeners = different streaming contexts) 9 | # rtsp = stream originated by an external RTSP feed (only 10 | # available if libcurl support was compiled) 11 | # id = (if missing, a random one will be generated) 12 | # description = This is my awesome stream 13 | # metadata = An optional string that can contain any metadata (e.g., JSON) 14 | # associated with the stream you want users to receive 15 | # is_private = true|false (private streams don't appear when you do a 'list' 16 | # request) 17 | # secret = 19 | # pin = 20 | # filename = path to the local file to stream (only for live/ondemand) 21 | # audio = true|false (do/don't stream audio) 22 | # video = true|false (do/don't stream video) 23 | # The following options are only valid for the 'rtp' type: 24 | # data = true|false (do/don't stream text via datachannels) 25 | # audioport = local port for receiving audio frames 26 | # audiortcpport = local port, if any, for receiving and sending audio RTCP feedback 27 | # audiomcast = multicast group port for receiving audio frames, if any 28 | # audioiface = network interface or IP address to bind to, if any (binds to all otherwise) 29 | # audiopt =