修改wss

This commit is contained in:
lilong@dgg.net 2021-04-01 10:23:32 +08:00
parent 7e1db4bd92
commit 8ec1f6096a
5 changed files with 26 additions and 7 deletions

View File

@ -2,7 +2,10 @@ APP_NAME=Laravel
APP_ENV=local APP_ENV=local
APP_KEY= APP_KEY=
APP_DEBUG=true APP_DEBUG=true
APP_URL=http://localhost APP_URL=http://testcall.shupian.cn
FS_HOST=192.168.254.216
FS_WSS_URL=testcall.shupian.cn
WEBSOCKET_URL=testcall.shupian.cn
LOG_CHANNEL=stack LOG_CHANNEL=stack

View File

@ -24,6 +24,7 @@ class IndexController extends Controller
'host' => config('freeswitch.host'), 'host' => config('freeswitch.host'),
'uri' => $user->sip->username . '@' . config('freeswitch.host'), 'uri' => $user->sip->username . '@' . config('freeswitch.host'),
'wss_url' => config('freeswitch.wss_url'), 'wss_url' => config('freeswitch.wss_url'),
'websocket_url' => config('freeswitch.websocket_url'),
]; ];
return View::make("layout", compact('data')); return View::make("layout", compact('data'));
} }

View File

@ -44,8 +44,9 @@ return [
'api' => 'api_exec_queue', 'api' => 'api_exec_queue',
], ],
'record_url' => env('APP_URL','http://localhost'), 'record_url' => env('APP_URL','http://localhost'),
'host' => '192.168.254.216', 'host' => env('FS_HOST','127.0.0.1'),
'wss_url' => 'testcall.shupian.cn', 'wss_url' => env('FS_WSS_URL','127.0.0.1'),
'websocket_url' => env('WEBSOCKET_URL','127.0.0.1'),
'node_type' => [ 'node_type' => [
1 => '公共节点', 1 => '公共节点',

View File

@ -0,0 +1,15 @@
location / {
try_files $uri $uri/ /index.php$is_args$query_string;
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
}
location /wss {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:9502;#代理到上面的地址去
}

View File

@ -330,7 +330,6 @@
userAgent.start() userAgent.start()
} }
$("#regBtn").click(function () { $("#regBtn").click(function () {
initUserAgent(); initUserAgent();
userAgent.register(); userAgent.register();
@ -340,9 +339,9 @@
userAgent.unregister() userAgent.unregister()
} }
}) })
@endif
const ws = new WebSocket("wss://{{$data['websocket_url']}}/wss?user_id={{auth()->user()->id}}")
const ws = new WebSocket("ws://127.0.0.1:9502?user_id={{auth()->user()->id}}")
var ticker var ticker
ws.onopen = function () { ws.onopen = function () {
ticker = setInterval(function () { ticker = setInterval(function () {
@ -371,7 +370,7 @@
clearInterval(ticker) clearInterval(ticker)
} }
} }
@endif
}); });