open-webrtc-toolkit / owt-server

General server (streaming/conference/transcoding/anayltics) for OWT. (A.k.a. MediaServer)
https://01.org/open-webrtc-toolkit
Apache License 2.0
1.13k stars 368 forks source link

Intercommunication between intranet and Extranet #563

Open zhanhaiwa opened 4 years ago

zhanhaiwa commented 4 years ago

I have a server and a public IP address. How to configure OWT. Can let the person of Intranet and extranet share the same room video

我有一台服务器 , 有一个公网ip 怎么配置 owt 。 能让 内网 与 外网 的人同一个房间视频

qwu16 commented 3 years ago

You need to deploy 2 portals for internal and external network so that clients in both network can communicate with OWT server. Configure ip_address in portal/portal.toml to external network ip for one portal and configure ip_address in portal/portal.toml to internal network ip for the other portal.

zhanhaiwa commented 3 years ago

hi ,bro 留下你的wechat id ,,,我联系你一下可好 。

zhanhaiwa commented 3 years ago

您需要为内部和外部网络部署2个门户,以便两个网络中的客户端都可以与OWT服务器通信。将Portal / portal.toml中的ip_address配置为一个门户的外部网络ip,将portal / portal.toml中的ip_address配置为另一个门户的内部网络ip。

兄弟 ,,需要你的帮助

qwu16 commented 3 years ago

Do you have any problem when deploying 2 portals in one device?

zhanhaiwa commented 3 years ago

在一台设备上部署2个门户时,您有任何问题吗?

具体的细节还是不明白,,,就是改 portal.toml 么 ? 我现在局域网有两台机器 一台内网 一台映射了外网
大神 受累 多指教点 。

qwu16 commented 3 years ago

Assume that your environment is listed as follow: device A with internal network only: 192.168.1.3, rabbitmq-server are configured with allowing external guest access as https://www.rabbitmq.com/access-control.html#loopback-users shows. mongodb are configured with binding ip to 0.0.0.0 device B with both internal and external: internal ip: 192.168.1.5, external ip:10.232.2.4 and the network interface for external ip is eth0

you can deploy as follow: on device A:

  1. Modify portal/portal.toml: regions = ["internal"]

  2. Modify webrtc_agent/agent.toml: regions = ["internal"]

  3. Add preference parameter to createToken in extras/basic_example/public/scripts/index.js: createToken(myRoom, 'user', 'presenter', preference:{isp: "", region: "internal"}, function(response) {

4.Add preference parameter to createToken in extras/basic_example/public/scripts/rest-sample.js: var createToken = function (room, user, role, preference, callback, host) { var body = { room: room, user: user, role: role, preference: preference };

  1. Add preference parse in createToken request in extras/basic_example/samplertcservice.js: var preference = req.body.preference;

launch all modules including rabbitmq and mongodb, with the default configuration then clients in internal network can access to OWT.

on device B:

  1. Modify portal/portal.toml: ip_address = "10.232.2.4" host = "192.168.1.3" dataBaseURL = "192.168.1.3/owtdb" [capacity] regions = ["external"]

  2. launch webrtc-agent on device B and configure webrtc_agent/agent.toml: host = "192.168.1.3" [capacity] regions = ["external"] [internal] ip_address = "192.168.1.5" [webrtc] network_interfaces = [{name = "eth0", replaced_ip_address = "10.232.2.4"}]

  3. launch app on device B and configure extras/basic_example/samplertcservice.js: in createToken request in extras/basic_example/samplertcservice.js: var preference = req.body.preference;

    iceREST.API.init("sampleserviceid", "sampleservicekey", "https://192.168.1.3:3000/",false); sampleserviceid and sampleservicekey should be the sampleserviceid and sampleservicekey printed on console when you run ./bin/init.sh on device A

  4. Add preference parameter to createToken in extras/basic_example/public/scripts/index.js: createToken(myRoom, 'user', 'presenter', preference:{isp: "", region: "external"}, function(response) {

  5. Add preference parameter to createToken in extras/basic_example/public/scripts/rest-sample.js: var createToken = function (room, user, role, preference, callback, host) { var body = { room: room, user: user, role: role, preference: preference };

Then clients in external network can access to OWT. Clients of both network can join the same room with this deployment

zhanhaiwa commented 3 years ago

假定您的环境列出如下: 仅具有内部网络的设备A:192.168.1.3,rabbitmq-server配置为允许外部来宾访问为https://www.rabbitmq.com/access-control.html#loopback-users节目。 mongodb配置为将IP绑定到 具有内部和外部的0.0.0.0 设备B:内部ip:192.168.1.5,外部ip:10.232.2.4,外部ip的网络接口为eth0

您可以按以下方式进行部署: 在设备A上: 使用默认配置启动所有模块,包括Rabbitmq和mongodb,内部网络中的客户端可以访问OWT。

在设备B上: 启动门户,修改portal / portal.toml: ip_address =“ 10.232.2.4” 主机=“ 192.168.1.3” dataBaseURL =“ 192.168.1.3/owtdb”

在设备B上启动webrtc-agent并配置webrtc_agent / agent.toml: host =“ 192.168.1.3” [webrtc] network_interfaces = [{name =“ eth0”,replaced_ip_address =“ 10.232.2.4”}]

在设备B上启动应用并配置extras / basic_example / samplertcservice.js: iceREST.API.init(“ sampleserviceid”,“ sampleservicekey”,“ https://192.168.1.3:3000/",false); 当您在设备A上运行./bin/init.sh时,sampleserviceid和sampleservicekey应该是控制台上打印的sampleserviceid和sampleservicekey

然后,外部网络中的客户端可以访问OWT。两个网络的客户端可以通过此部署加入同一房间

感谢 优秀的你 , 我去实际操作一下 。

zhanhaiwa commented 3 years ago

假定您的环境列出如下: 仅具有内部网络的设备A:192.168.1.3,rabbitmq-server配置为允许外部来宾访问为https://www.rabbitmq.com/access-control.html#loopback-users节目。 mongodb配置为将IP绑定到 具有内部和外部的0.0.0.0 设备B:内部ip:192.168.1.5,外部ip:10.232.2.4,外部ip的网络接口为eth0 您可以按以下方式进行部署: 在设备A上: 使用默认配置启动所有模块,包括Rabbitmq和mongodb,内部网络中的客户端可以访问OWT。 在设备B上: 启动门户,修改portal / portal.toml: ip_address =“ 10.232.2.4” 主机=“ 192.168.1.3” dataBaseURL =“ 192.168.1.3/owtdb” 在设备B上启动webrtc-agent并配置webrtc_agent / agent.toml: host =“ 192.168.1.3” [webrtc] network_interfaces = [{name =“ eth0”,replaced_ip_address =“ 10.232.2.4”}] 在设备B上启动应用并配置extras / basic_example / samplertcservice.js: iceREST.API.init(“ sampleserviceid”,“ sampleservicekey”,“ https://192.168.1.3:3000/",false); 当您在设备A上运行./bin/init.sh时,sampleserviceid和sampleservicekey应该是控制台上打印的sampleserviceid和sampleservicekey 然后,外部网络中的客户端可以访问OWT。两个网络的客户端可以通过此部署加入同一房间

感谢 优秀的你 , 我去实际操作一下 。

我实验了一下 内网与外网通讯 没有通过 , 在测试两网段服务器的时候出现了一个问题 ,,,单独测试运行单独外网的时候 订阅画面第一次或偶尔第二次进入的时候画面黑色没有画面。日志 :ERROR: owt.RawTransport - TCP wrote data error: Broken pipe 。 [internal]

The IP address used for internal-cluster media spreading. Will use the IP got from the 'network_interface' item if 'ip_address' is not specified or equal to "".

ip_address = "" #default: ""

The network interface used for internal-cluster media spreading. The first enumerated network interface in the system will be adopted if this item is not specified.

network_interface = "eth0" # default: undefined

The internal listening port range, only works for TCP now

maxport = 50400 #default: 0 minport = 40500 #default: 0

######################################################################################### [webrtc]

The network inferface all peer-connections will be established through. All network interfaces in the system will be adopted if this item is not specified or specified with an empty array.

Valid value is an array of objects that has two properties: name and replaced_ip_address. name is the name of network interface that will be used, replaced_ip_address is the IP address used for replacing the internal IP address in locally generated SDP's and ICE candidates during establishing the peer-connection(useful when behind NATs). replaced_ip_address is optional, if it is not specified, IP address from corresponding network interface will not be replaced.

Example of valid value: [{name = "eth1"}, {name = "eth2", replaced_ip_address = "192.0.2.2"}].

network_interfaces = [{name = "eno1", replaced_ip_address = "60.14.63.56"}] # default: []

keystorePath = "./cert/cert# The internal listening port range, only works for TCP now maxport = 50400 #default: 0 minport = 40500 #default: 0ificate.pfx"

note, this won't work with all versions of libnice. With 0 all the available ports are used

The webrtc port range

maxport = 60500 #default: 0 minport = 50500 #default: 0

zhanhaiwa commented 3 years ago

假定您的环境列出如下: 仅具有内部网络的设备A:192.168.1.3,rabbitmq-server配置为允许外部来宾访问为https://www.rabbitmq.com/access-control.html#loopback-users节目。 mongodb配置为将IP绑定到 具有内部和外部的0.0.0.0 设备B:内部ip:192.168.1.5,外部ip:10.232.2.4,外部ip的网络接口为eth0 您可以按以下方式进行部署: 在设备A上: 使用默认配置启动所有模块,包括Rabbitmq和mongodb,内部网络中的客户端可以访问OWT。 在设备B上: 启动门户,修改portal / portal.toml: ip_address =“ 10.232.2.4” 主机=“ 192.168.1.3” dataBaseURL =“ 192.168.1.3/owtdb” 在设备B上启动webrtc-agent并配置webrtc_agent / agent.toml: host =“ 192.168.1.3” [webrtc] network_interfaces = [{name =“ eth0”,replaced_ip_address =“ 10.232.2.4”}] 在设备B上启动应用并配置extras / basic_example / samplertcservice.js: iceREST.API.init(“ sampleserviceid”,“ sampleservicekey”,“ https://192.168.1.3:3000/",false); 当您在设备A上运行./bin/init.sh时,sampleserviceid和sampleservicekey应该是控制台上打印的sampleserviceid和sampleservicekey 然后,外部网络中的客户端可以访问OWT。两个网络的客户端可以通过此部署加入同一房间

感谢 优秀的你 , 我去实际操作一下 。

我实验了一下 内网与外网通讯 没有通过 , 在测试两网段服务器的时候出现了一个问题 ,,,单独测试运行单独外网的时候 订阅画面第一次或偶尔第二次进入的时候画面黑色没有画面。日志 :ERROR: owt.RawTransport - TCP wrote data error: Broken pipe 。 [internal]

The IP address used for internal-cluster media spreading. Will use the IP got from the 'network_interface' item if 'ip_address' is not specified or equal to "".

ip_address = "" #default: ""

The network interface used for internal-cluster media spreading. The first enumerated network interface in the system will be adopted if this item is not specified.

network_interface = "eth0" # default: undefined

The internal listening port range, only works for TCP now

maxport = 50400 #default: 0 minport = 40500 #default: 0

######################################################################################### [webrtc]

The network inferface all peer-connections will be established through. All network interfaces in the system will be adopted if this item is not specified or specified with an empty array.

Valid value is an array of objects that has two properties: name and replaced_ip_address. name is the name of network interface that will be used, replaced_ip_address is the IP address used for replacing the internal IP address in locally generated SDP's and ICE candidates during establishing the peer-connection(useful when behind NATs). replaced_ip_address is optional, if it is not specified, IP address from corresponding network interface will not be replaced.

Example of valid value: [{name = "eth1"}, {name = "eth2", replaced_ip_address = "192.0.2.2"}].

network_interfaces = [{name = "eno1", replaced_ip_address = "-- -- -- --"}] # default: []

keystorePath = "./cert/cert# The internal listening port range, only works for TCP now maxport = 50400 #default: 0 minport = 40500 #default: 0ificate.pfx"

note, this won't work with all versions of libnice. With 0 all the available ports are used

The webrtc port range

maxport = 60500 #default: 0 minport = 50500 #default: 0

starwarfan commented 3 years ago

Hi, You can try to edit the "ip_address" under "[internal]" section with your internal IP.

[internal]

The IP address used for internal-cluster media spreading. Will use the IP got from the 'network_interface' item if 'ip_address' is not specified or equal to "".

ip_address = "" #default: ""

qwu16 commented 3 years ago

@zhanhaiwa Update configuration and add region control info in portal, webrtc_agent and sample app, so that clients communication can be directed to correct agents.

zhanhaiwa commented 3 years ago

root@afk:~/owt-server-4.3/dist/logs# vi webrtc-61658f6efe5c90a3026e@10.252.0.11_4.log 2072-08-05 02:57:53.862 - INFO: WorkingNode - pid: 5122 2020-08-05 02:57:53.864 - INFO: WorkingNode - Connecting to rabbitMQ server... 2020-08-05 02:57:53.876 - INFO: AmqpClient - Connecting to rabbitMQ server OK, options: { host: 'localhost', port: 5672 } 2020-08-05 02:57:53.898 - INFO: InternalConnectionFactory - QUIC is not enabled for internal IO 2020-08-05 02:57:53.908 - INFO: WorkingNode - webrtc-61658f6efe5c90a3026e@10.252.0.11_4 as rpc server ready 2020-08-05 02:57:53.913 - INFO: WorkingNode - webrtc-61658f6efe5c90a3026e@10.252.0.11_4 as monitor ready 2020-08-05 03:01:12,271 - ERROR: owt.RawTransport - Error establishing the TCP connection: Connection timed out 2020-08-05 03:01:12,271 - ERROR: owt.RawTransport - TCP wrote data error: Broken pipe 2020-08-05 03:01:12,271 - ERROR: owt.RawTransport - TCP wrote data error: Broken pipe 2020-08-05 03:01:12,271 - ERROR: owt.RawTransport - TCP wrote data error: Broken pipe 2020-08-05 03:01:12,271 - ERROR: owt.RawTransport - TCP wrote data error: Broken pipe 2020-08-05 03:01:12,271 - ERROR: owt.RawTransport - TCP wrote data error: Broken pipe

哎 ,心碎了一地 。

qwu16 commented 3 years ago

Do you add region setting info as the updated instruction settings in webrtc_agent/agent.toml, portal/portal.toml and extras/basic_example?

zhanhaiwa commented 3 years ago

哥 ,内网那台机器是好使的 , 我现在在做外网的这台机器 ,,,我想先映射出一台公网好使的 但是公网的这台 进去的时候总是黑屏。 单纯的想配置一下 公网服务器 : 2020-08-05 03:01:12,271-错误:owt.RawTransport-TCP写入数据错误:管道损坏

starwarfan commented 3 years ago

Assume that your environment is listed as follow: device A with internal network only: 192.168.1.3, rabbitmq-server are configured with allowing external guest access as https://www.rabbitmq.com/access-control.html#loopback-users shows. mongodb are configured with binding ip to 0.0.0.0 device B with both internal and external: internal ip: 192.168.1.5, external ip:10.232.2.4 and the network interface for external ip is eth0

you can deploy as follow: on device A:

Modify portal/portal.toml: regions = ["internal"]

Modify webrtc_agent/agent.toml: regions = ["internal"]

Add preference parameter to createToken in extras/basic_example/public/scripts/index.js: createToken(myRoom, 'user', 'presenter', preference:{isp: "", region: "internal"}, function(response) {

4.Add preference parameter to createToken in extras/basic_example/public/scripts/rest-sample.js: var createToken = function (room, user, role, preference, callback, host) { var body = { room: room, user: user, role: role, preference: preference };

Add preference parse in createToken request in extras/basic_example/samplertcservice.js: var preference = req.body.preference; launch all modules including rabbitmq and mongodb, with the default configuration then clients in internal network can access to OWT.

on device B:

Modify portal/portal.toml: ip_address = "10.232.2.4" host = "192.168.1.3" dataBaseURL = "192.168.1.3/owtdb" [capacity] regions = ["external"]

launch webrtc-agent on device B and configure webrtc_agent/agent.toml: host = "192.168.1.3" [capacity] regions = ["external"] [internal] ip_address = "192.168.1.5" [webrtc] network_interfaces = [{name = "eth0", replaced_ip_address = "10.232.2.4"}]

launch app on device B and configure extras/basic_example/samplertcservice.js: in createToken request in extras/basic_example/samplertcservice.js: var preference = req.body.preference;

iceREST.API.init("sampleserviceid", "sampleservicekey", "https://192.168.1.3:3000/",false); sampleserviceid and sampleservicekey should be the sampleserviceid and sampleservicekey printed on console when you run ./bin/init.sh on device A

Add preference parameter to createToken in extras/basic_example/public/scripts/index.js: createToken(myRoom, 'user', 'presenter', preference:{isp: "", region: "external"}, function(response) {

Add preference parameter to createToken in extras/basic_example/public/scripts/rest-sample.js: var createToken = function (room, user, role, preference, callback, host) { var body = { room: room, user: user, role: role, preference: preference };

Then clients in external network can access to OWT. Clients of both network can join the same room with this deployment

zhanhaiwa commented 3 years ago

@qwu16 @星际迷 3q , 迷茫的道路上 ,有陌生的朋友帮助 ,感谢

zhanhaiwa commented 3 years ago

You need to deploy 2 portals for internal and external network so that clients in both network can communicate with OWT server. Configure ip_address in portal/portal.toml to external network ip for one portal and configure ip_address in portal/portal.toml to internal network ip for the other portal.

能看到消息么 , 想联系你一下 ,请教问题

zhanhaiwa commented 3 years ago

Do you have any problem when deploying 2 portals in one device?

@qwu16 Have a chat

qwu16 commented 3 years ago

Please refer to https://github.com/open-webrtc-toolkit/owt-server/wiki/How-to-deploy-OWT-for-clients-from-internal-and-external-network-to-access-to-OWT-server for a more detailed description