# mod_srs
**Repository Path**: doibest/mod_srs
## Basic Information
- **Project Name**: mod_srs
- **Description**: No description available
- **Primary Language**: Unknown
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2024-01-23
- **Last Updated**: 2024-01-23
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# mod_srs
FreeSWITCH endpoint module to play and publish video streams from/to [SRS](https://github.com/ossrs/srs).
## Build
Build and install FreeSWITCH. If you never installed FreeSWITCH from source, you can try to do that first .
Note, mod_srs need some patches to work with bunded rtp streams, you can find the patches from the master branch in <, see for more information. Or simply build and install from .
To build and install mod_srs, from any directory, run:
```bash
git clone https://git.xswitch.cn/xswitch/mod_srs.git
cd mod_srs
cmake .
make
make install
```
Load mod_srs
```
fs_cli
freeswitch> load mod_srs
```
## connect to srs
create a srs channel and publish a local video to srs:
```bash
bgapi originate {video_use_audio_ice=true,rtp_payload_space=106,absolute_codec_string=OPUS\,H264,url=http://localhost:1985/rtc/v1/whip/?app=live&stream=livestream}srs/auto_answer &playback(/tmp/test.mp4)
```
or simply
```bash
bgapi originate {url=http://localhost:1985/rtc/v1/whip/?app=live&stream=livestream}srs/auto_answer &playback(/tmp/test.mp4)
```
bridge to a null channel:
```bash
bgapi originate {null_video_codec=H264}null/1234 &bridge({video_use_audio_ice=true,rtp_payload_space=106,absolute_codec_string=OPUS\,H264,url=http://localhost:1985/rtc/v1/whip/?app=live&stream=livestream}srs/auto_answer)
```
call a local sip extension and push to srs:
```bash
bgapi originate user/1006 &bridge({video_use_audio_ice=true,rtp_payload_space=106,absolute_codec_string=OPUS\,H264,url=http://localhost:1985/rtc/v1/whip/?app=live&stream=livestream}srs/auto_answer)
```
or create and extension and call `livestream` from any SIP video phone to push to srs:
```xml
```
screen shot:

pull srs stream from srs and play it to a conference:
```bash
conference 3000 bgdial {video_use_audio_ice=true,rtp_payload_space=106,absolute_codec_string=OPUS\,H264,url=http://localhost:1985/rtc/v1/whip-play/?app=3000&stream=livestream}srs/auto_answer
```
## More information
- [如何在FreeSWITCH中对接SRS](http://freeswitch.org.cn/blog/2023/08/use_srs/) (Chinese)
- https://ossrs.net/lts/zh-cn/docs/v5/doc/introduction
- https://ossrs.net/lts/zh-cn/docs/v4/doc/getting-started
- https://github.com/ossrs/srs/issues/3459
- https://github.com/ossrs/srs/discussions/3625
- https://ossrs.net/lts/zh-cn/docs/v4/doc/http-callback
- https://github.com/ossrs/srs-unity#usage-player