Настройка REST hooks

Здравствуйте!

Возникла необходимость имплементировать дополнительную бизнес-логику основываясь на факте подключения или отключения входящего потока. Выполнил конфигурацию, как описано в документации, но перестали публиковаться входящие потоки. Мы используем chatApp, для организации видеочата между двумя собеседниками с последующим объединением двух потоков в один с помощью микшера.

Последовательность действий:
1. Переопределяем URL для roomApp
Code:
% update app --url https://our-web-server/api/v1/webhook roomApp
App chatRoomApp has been updated successfully with key roomApp

% show apps
name              appKey            URL
----------------------------------------------------------------------------------------
chatRoomApp       chatRoomApp       http://localhost:8081/apps/ChatRoomApp
callApp           callApp           http://localhost:8081/apps/CallApp
chatRoomApp       flashRoomApp      http://localhost:8081/apps/RoomApp
clickToCallApp    clickToCallApp    http://localhost:8081/apps/ClickToCallApp
qaApp             qaApp             http://localhost:8081/apps/QAApp
defaultApp        defaultApp        http://localhost:8081/apps/EchoApp
wcs3App           wcs3App           http://localhost:8081/apps/EchoApp
websocketChatApp  websocketChatApp  http://localhost:8081/apps/ChatApp
flashStreamingApp flashStreamingApp http://localhost:8081/apps/EchoApp
chatRoomApp       roomApp           https://our-web-server/api/v1/webhook
conferenceApp     conferenceApp     http://localhost:8081/apps/ConferenceApp
flashChatApp      flashChatApp      http://localhost:8081/apps/ChatApp
2. Пробуем выполнить подключение с помощью стандартного сценария

3. В журналах сервера видим следующую картину
Code:
14:09:21,484 INFO            RestClient - API-ASYNC-pool-13-thread-38 SEND REST OBJECT ==>
URL:https://our-web-server/api/v1/webhook/connect
OBJECT:
{
  "nodeId" : "rpc46cqx5usYfyHiBaZ8Ga5UsXPGTmNe@54.171.220.129",                                                                                                                                                   
  "appKey" : "roomApp",                                                                                                                                                                                           
  "sessionId" : "/172.20.43.221:42946/172.20.0.251:8080-fffca9d3-74c2-4f17-8024-677a2b074a0a",                                                                                                                    "useWsTunnel" : false,
  "useWsTunnelPacketization2" : false,
  "msePacketizationVersion" : 2,
  "useBase64BinaryEncoding" : false,
  "mediaProviders" : [ "WebRTC", "MSE", "WSPlayer" ],
  "clientVersion" : "0.5.28",
  "clientOSVersion" : "5.0 (Macintosh)",
  "clientBrowserVersion" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0",
  "keepAlive" : false,
  "custom" : {
    "login" : "1"
  },
  "origin" : "https://demo.flashphoner.com"
}
14:09:21,727 INFO            RestClient - API-ASYNC-pool-13-thread-38 RECEIVED REST OBJECT <==
URL:https://our-web-server/api/v1/webhook/connect
OBJECT:
{
  "nodeId" : "rpc46cqx5usYfyHiBaZ8Ga5UsXPGTmNe@54.171.220.129",
  "appKey" : "roomApp",
  "sessionId" : "/172.20.43.221:42946/172.20.0.251:8080-fffca9d3-74c2-4f17-8024-677a2b074a0a",
  "useWsTunnel" : false,
  "useWsTunnelPacketization2" : false,
  "msePacketizationVersion" : 2,
  "useBase64BinaryEncoding" : false,
  "mediaProviders" : [ "WebRTC", "MSE", "WSPlayer" ],
  "restClientConfig" : {
    "subscribe" : {
      "restExclude" : "sipMessageRaw,sdp",
      "clientExclude" : "sipMessageRaw,sdp",
      "restOverwrite" : "",
      "restOnError" : "FAIL",
      "restPolicy" : "OVERWRITE"
    },
    "publishStream" : {
      "restExclude" : "sipMessageRaw,sdp",
      "clientExclude" : "sipMessageRaw,sdp",
      "restOverwrite" : "",
      "restOnError" : "FAIL",
      "restPolicy" : "OVERWRITE"
    },
    "OnDataEvent" : {
      "restExclude" : "sipMessageRaw,sdp",
      "clientExclude" : "sipMessageRaw,sdp",
      "restOverwrite" : "",
      "restOnError" : "FAIL",
      "restPolicy" : "OVERWRITE"
    }
  },
  "clientVersion" : "0.5.28",
  "clientOSVersion" : "5.0 (Macintosh)",
  "clientBrowserVersion" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0",
  "keepAlive" : false,
  "custom" : {
    "login" : "1"
  },
  "origin" : "https://demo.flashphoner.com"
}

14:09:21,729 INFO           WCS4Handler - API-ASYNC-pool-13-thread-39 RestClientConfig for client /172.20.43.221:42946/172.20.0.251:8080-fffca9d3-74c2-4f17-8024-677a2b074a0a:
{
  "subscribe" : {
    "restExclude" : "sipMessageRaw,sdp",
    "clientExclude" : "sipMessageRaw,sdp",
    "restOverwrite" : "",
    "restOnError" : "FAIL",
    "restPolicy" : "OVERWRITE"
  },
  "publishStream" : {
    "restExclude" : "sipMessageRaw,sdp",
    "clientExclude" : "sipMessageRaw,sdp",
    "restOverwrite" : "",
    "restOnError" : "FAIL",
    "restPolicy" : "OVERWRITE"
  },
  "OnDataEvent" : {
    "restExclude" : "sipMessageRaw,sdp",
    "clientExclude" : "sipMessageRaw,sdp",
    "restOverwrite" : "",
    "restOnError" : "FAIL",
    "restPolicy" : "OVERWRITE"
  }
}
14:09:21,729 INFO            RestClient - API-ASYNC-pool-13-thread-39 SEND REST OBJECT ==>
URL:https://our-web-server/api/v1/webhook/ConnectionStatusEvent
OBJECT:
{
  "nodeId" : "rpc46cqx5usYfyHiBaZ8Ga5UsXPGTmNe@54.171.220.129",
  "appKey" : "roomApp",
  "sessionId" : "/172.20.43.221:42946/172.20.0.251:8080-fffca9d3-74c2-4f17-8024-677a2b074a0a",
  "useWsTunnel" : false,
  "useWsTunnelPacketization2" : false,
  "msePacketizationVersion" : 2,
  "useBase64BinaryEncoding" : false,
  "mediaProviders" : [ "WebRTC", "MSE", "WSPlayer" ],
  "authToken" : "/172.20.43.221:42946/172.20.0.251:8080-fffca9d3-74c2-4f17-8024-677a2b074a0a",
  "status" : "ESTABLISHED",
  "clientVersion" : "0.5.28",
  "clientOSVersion" : "5.0 (Macintosh)",
  "clientBrowserVersion" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0",
  "keepAlive" : false,
  "custom" : {
    "login" : "1"
  },
  "origin" : "https://demo.flashphoner.com"
}
14:09:21,960 INFO            RestClient - API-ASYNC-pool-13-thread-39 content -> {"nodeId":"rpc46cqx5usYfyHiBaZ8Ga5UsXPGTmNe@54.171.220.129","appKey":"roomApp","sessionId":"/172.20.43.221:42946/172.20.0.251:8
080-fffca9d3-74c2-4f17-8024-677a2b074a0a","useWsTunnel":false,"useWsTunnelPacketization2":false,"msePacketizationVersion":2,"useBase64BinaryEncoding":false,"mediaProviders":["WebRTC","MSE","WSPlayer"],"authTo
ken":"/172.20.43.221:42946/172.20.0.251:8080-fffca9d3-74c2-4f17-8024-677a2b074a0a","status":"ESTABLISHED","clientVersion":"0.5.28","clientOSVersion":"5.0 (Macintosh)","clientBrowserVersion":"Mozilla/5.0 (Maci
ntosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0","keepAlive":false,"custom":{"login":"1"},"origin":"https://demo.flashphoner.com"}
14:09:21,961 INFO            RestClient - API-ASYNC-pool-13-thread-39 RECEIVED REST OBJECT <==
URL:https://our-web-server/api/v1/webhook/ConnectionStatusEvent
OBJECT:
{
  "nodeId" : "rpc46cqx5usYfyHiBaZ8Ga5UsXPGTmNe@54.171.220.129",
  "appKey" : "roomApp",
  "sessionId" : "/172.20.43.221:42946/172.20.0.251:8080-fffca9d3-74c2-4f17-8024-677a2b074a0a",
  "useWsTunnel" : false,
  "useWsTunnelPacketization2" : false,
  "msePacketizationVersion" : 2,
  "useBase64BinaryEncoding" : false,
  "mediaProviders" : [ "WebRTC", "MSE", "WSPlayer" ],
  "authToken" : "/172.20.43.221:42946/172.20.0.251:8080-fffca9d3-74c2-4f17-8024-677a2b074a0a",
  "status" : "ESTABLISHED",
  "clientVersion" : "0.5.28",
  "clientOSVersion" : "5.0 (Macintosh)",
  "clientBrowserVersion" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0",
  "keepAlive" : false,
  "custom" : {
    "login" : "1"
  },
  "origin" : "https://demo.flashphoner.com"
}
14:09:22,026 INFO            RestClient - API-ASYNC-pool-13-thread-38 SEND REST OBJECT ==>
URL:https://our-web-server/api/v1/webhook/OnDataEvent
OBJECT:
{
  "nodeId" : "rpc46cqx5usYfyHiBaZ8Ga5UsXPGTmNe@54.171.220.129",
  "appKey" : "roomApp",
  "sessionId" : "/172.20.43.221:42946/172.20.0.251:8080-fffca9d3-74c2-4f17-8024-677a2b074a0a",
  "operationId" : "40db8580-60a9-11eb-8793-d1008ae909c8",
  "payload" : {
    "command" : "join",
    "options" : {
      "name" : "room-c86139"
    }
  },
  "origin" : "https://demo.flashphoner.com"
}
14:09:22,256 INFO            RestClient - API-ASYNC-pool-13-thread-38 RECEIVED REST OBJECT <==
URL:https://our-web-server/api/v1/webhook/OnDataEvent
OBJECT:
{
  "nodeId" : "rpc46cqx5usYfyHiBaZ8Ga5UsXPGTmNe@54.171.220.129",
  "appKey" : "roomApp",
  "sessionId" : "/172.20.43.221:42946/172.20.0.251:8080-fffca9d3-74c2-4f17-8024-677a2b074a0a",
  "operationId" : "40db8580-60a9-11eb-8793-d1008ae909c8",
  "payload" : {
    "command" : "join",
    "options" : {
      "name" : "room-c86139"
    }
  },
  "origin" : "https://demo.flashphoner.com"
}
4. Запросы, которые приходили на сервер и были им успешно обработаны.
Code:
HTTP Requests
-------------
POST /api/v1/webhook/OnDataEvent           200 OK
POST /api/v1/webhook/ConnectionStatusEvent 200 OK
POST /api/v1/webhook/connect               200 OK
Конфигурация параметра "restClientConfig" для запроса "connect" настроена аналогичным образом как и в стандартном roomApp.

Как мы видим не выполняются запросы publishStream и StreamStatusEvent. Обьясните пожалуйста, почему так происходит и как решить данную проблему?
 
К примеру, лог выполнения при стандартных настройках
Code:
% show apps
name              appKey            URL
------------------------------------------------------------------------------
qaApp             qaApp             http://localhost:8081/apps/QAApp
defaultApp        defaultApp        http://localhost:8081/apps/EchoApp
wcs3App           wcs3App           http://localhost:8081/apps/EchoApp
websocketChatApp  websocketChatApp  http://localhost:8081/apps/ChatApp
flashStreamingApp flashStreamingApp http://localhost:8081/apps/EchoApp
chatRoomApp       roomApp           http://localhost:8081/apps/RoomApp
flashChatApp      flashChatApp      http://localhost:8081/apps/ChatApp
chatRoomApp       chatRoomApp       http://localhost:8081/apps/ChatRoomApp
callApp           callApp           http://localhost:8081/apps/CallApp
chatRoomApp       flashRoomApp      http://localhost:8081/apps/RoomApp
clickToCallApp    clickToCallApp    http://localhost:8081/apps/ClickToCallApp
conferenceApp     conferenceApp     http://localhost:8081/apps/ConferenceApp
Code:
14:52:14,397 INFO            RestClient - API-ASYNC-pool-13-thread-43 SEND REST OBJECT ==>
URL:http://localhost:8081/apps/RoomApp/connect
OBJECT:
{
  "nodeId" : "rpc46cqx5usYfyHiBaZ8Ga5UsXPGTmNe@54.171.220.129",
  "appKey" : "roomApp",
  "sessionId" : "/172.20.43.221:44564/172.20.0.251:8080-3c182894-1a83-4381-8f68-f4d5942ab06e",
  "useWsTunnel" : false,
  "useWsTunnelPacketization2" : false,
  "msePacketizationVersion" : 2,
  "useBase64BinaryEncoding" : false,
  "mediaProviders" : [ "WebRTC", "MSE", "WSPlayer" ],
  "clientVersion" : "0.5.28",
  "clientOSVersion" : "5.0 (Macintosh)",
  "clientBrowserVersion" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0",
  "keepAlive" : false,
  "custom" : {
    "login" : "1"
  },
  "origin" : "https://demo.flashphoner.com"
}
14:52:14,398 INFO         RestApiRouter - HTTP-pool-3-thread-29 Use controller class com.flashphoner.rest.server.apps.room.RoomApp with path /apps/RoomApp/connect
14:52:14,399 INFO            RestClient - API-ASYNC-pool-13-thread-43 RECEIVED REST OBJECT <==
URL:http://localhost:8081/apps/RoomApp/connect
OBJECT:
{
  "nodeId" : "rpc46cqx5usYfyHiBaZ8Ga5UsXPGTmNe@54.171.220.129",
  "appKey" : "roomApp",
  "sessionId" : "/172.20.43.221:44564/172.20.0.251:8080-3c182894-1a83-4381-8f68-f4d5942ab06e",
  "useWsTunnel" : false,
  "useWsTunnelPacketization2" : false,
  "msePacketizationVersion" : 2,
  "useBase64BinaryEncoding" : false,
  "mediaProviders" : [ "WebRTC", "MSE", "WSPlayer" ],
  "restClientConfig" : {
    "subscribe" : {
      "restExclude" : "sipMessageRaw,sdp",
      "clientExclude" : "sipMessageRaw,sdp",
      "restOverwrite" : "",
      "restOnError" : "FAIL",
      "restPolicy" : "OVERWRITE"
    },
    "publishStream" : {
      "restExclude" : "sipMessageRaw,sdp",
      "clientExclude" : "sipMessageRaw,sdp",
      "restOverwrite" : "",
      "restOnError" : "FAIL",
      "restPolicy" : "OVERWRITE"
    },
    "OnDataEvent" : {
      "restExclude" : "sipMessageRaw,sdp",
      "clientExclude" : "sipMessageRaw,sdp",
      "restOverwrite" : "",
      "restOnError" : "FAIL",
      "restPolicy" : "OVERWRITE"
    }
  },
  "clientVersion" : "0.5.28",
  "clientOSVersion" : "5.0 (Macintosh)",
  "clientBrowserVersion" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0",
  "keepAlive" : false,
  "custom" : {
    "login" : "1"
  },
  "origin" : "https://demo.flashphoner.com"
}
14:52:14,400 INFO           WCS4Handler - API-ASYNC-pool-13-thread-43 RestClientConfig for client /172.20.43.221:44564/172.20.0.251:8080-3c182894-1a83-4381-8f68-f4d5942ab06e:
{
  "subscribe" : {
    "restExclude" : "sipMessageRaw,sdp",
    "clientExclude" : "sipMessageRaw,sdp",
    "restOverwrite" : "",
    "restOnError" : "FAIL",
    "restPolicy" : "OVERWRITE"
  },
  "publishStream" : {
    "restExclude" : "sipMessageRaw,sdp",
    "clientExclude" : "sipMessageRaw,sdp",
    "restOverwrite" : "",
    "restOnError" : "FAIL",
    "restPolicy" : "OVERWRITE"
  },
  "OnDataEvent" : {
    "restExclude" : "sipMessageRaw,sdp",
    "clientExclude" : "sipMessageRaw,sdp",
    "restOverwrite" : "",
    "restOnError" : "FAIL",
    "restPolicy" : "OVERWRITE"
  }
}
14:52:14,400 INFO            RestClient - API-ASYNC-pool-13-thread-43 SEND REST OBJECT ==>                                                                                                            [401/1822]
URL:http://localhost:8081/apps/RoomApp/ConnectionStatusEvent
OBJECT:
{
  "nodeId" : "rpc46cqx5usYfyHiBaZ8Ga5UsXPGTmNe@54.171.220.129",
  "appKey" : "roomApp",
  "sessionId" : "/172.20.43.221:44564/172.20.0.251:8080-3c182894-1a83-4381-8f68-f4d5942ab06e",
  "useWsTunnel" : false,
  "useWsTunnelPacketization2" : false,
  "msePacketizationVersion" : 2,
  "useBase64BinaryEncoding" : false,
  "mediaProviders" : [ "WebRTC", "MSE", "WSPlayer" ],
  "authToken" : "/172.20.43.221:44564/172.20.0.251:8080-3c182894-1a83-4381-8f68-f4d5942ab06e",
  "status" : "ESTABLISHED",
  "clientVersion" : "0.5.28",
  "clientOSVersion" : "5.0 (Macintosh)",
  "clientBrowserVersion" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0",
  "keepAlive" : false,
  "custom" : {
    "login" : "1"
  },
  "origin" : "https://demo.flashphoner.com"
}
14:52:14,401 INFO         RestApiRouter - HTTP-pool-3-thread-31 Use controller class com.flashphoner.rest.server.apps.room.RoomApp with path /apps/RoomApp/ConnectionStatusEvent
14:52:14,402 INFO            RestClient - API-ASYNC-pool-13-thread-43 RECEIVED REST OBJECT <==
URL:http://localhost:8081/apps/RoomApp/ConnectionStatusEvent
OBJECT:
{
  "nodeId" : "rpc46cqx5usYfyHiBaZ8Ga5UsXPGTmNe@54.171.220.129",
  "appKey" : "roomApp",
  "sessionId" : "/172.20.43.221:44564/172.20.0.251:8080-3c182894-1a83-4381-8f68-f4d5942ab06e",
  "useWsTunnel" : false,
  "useWsTunnelPacketization2" : false,
  "msePacketizationVersion" : 2,
  "useBase64BinaryEncoding" : false,
  "mediaProviders" : [ "WebRTC", "MSE", "WSPlayer" ],
  "authToken" : "/172.20.43.221:44564/172.20.0.251:8080-3c182894-1a83-4381-8f68-f4d5942ab06e",
  "status" : "ESTABLISHED",
  "clientVersion" : "0.5.28",
  "clientOSVersion" : "5.0 (Macintosh)",
  "clientBrowserVersion" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:84.0) Gecko/20100101 Firefox/84.0",
  "keepAlive" : false,
  "custom" : {
    "login" : "1"
  },
  "origin" : "https://demo.flashphoner.com"
}
14:52:14,468 INFO            RestClient - API-ASYNC-pool-13-thread-42 SEND REST OBJECT ==>
URL:http://localhost:8081/apps/RoomApp/OnDataEvent
OBJECT:
{
  "nodeId" : "rpc46cqx5usYfyHiBaZ8Ga5UsXPGTmNe@54.171.220.129",
  "appKey" : "roomApp",
  "sessionId" : "/172.20.43.221:44564/172.20.0.251:8080-3c182894-1a83-4381-8f68-f4d5942ab06e",
  "operationId" : "3e281690-60af-11eb-9057-99e6d8f47010",
  "payload" : {
    "command" : "join",
    "options" : {
      "name" : "room-b70f3c"
    }
  },
  "origin" : "https://demo.flashphoner.com"
}
14:52:14,469 INFO         RestApiRouter - HTTP-pool-3-thread-31 Use controller class com.flashphoner.rest.server.apps.room.RoomApp with path /apps/RoomApp/OnDataEvent
14:52:14,469 INFO            RestClient - API-ASYNC-pool-13-thread-42 RECEIVED REST OBJECT <==
URL:http://localhost:8081/apps/RoomApp/OnDataEvent
OBJECT:
{
  "nodeId" : "rpc46cqx5usYfyHiBaZ8Ga5UsXPGTmNe@54.171.220.129",
  "appKey" : "roomApp",
  "sessionId" : "/172.20.43.221:44564/172.20.0.251:8080-3c182894-1a83-4381-8f68-f4d5942ab06e",
  "operationId" : "3e281690-60af-11eb-9057-99e6d8f47010",
  "payload" : {
    "command" : "join",
    "options" : {
      "name" : "room-b70f3c"
    }
  },
  "origin" : "https://demo.flashphoner.com"
}
 
Продолжение

Code:
14:52:16,060 INFO            RestClient - API-ASYNC-pool-13-thread-43 SEND REST OBJECT ==>

URL:http://localhost:8081/apps/RoomApp/publishStream

OBJECT:

{

  "nodeId" : "rpc46cqx5usYfyHiBaZ8Ga5UsXPGTmNe@54.171.220.129",

  "appKey" : "roomApp",

  "sessionId" : "/172.20.43.221:44564/172.20.0.251:8080-3c182894-1a83-4381-8f68-f4d5942ab06e",

  "mediaSessionId" : "3e3276d0-60af-11eb-9057-99e6d8f47010",

  "name" : "room-b70f3c-1-3e32",

  "published" : true,

  "hasVideo" : true,

  "hasAudio" : true,

  "status" : "PENDING",

  "record" : false,

  "width" : 0,

  "height" : 0,

  "bitrate" : 0,

  "minBitrate" : 0,

  "maxBitrate" : 0,

  "quality" : 0,

  "history" : false,

  "gop" : 0,

  "fps" : 0,

  "audioBitrate" : 0,

  "codecImpl" : "",

  "transport" : "UDP",

  "cvoExtension" : false,

  "mediaProvider" : "WebRTC",

  "custom" : {

    "name" : "room-b70f3c"

  },

  "origin" : "https://demo.flashphoner.com",

  "constraints" : {

    "audio" : true,

    "video" : true

  }

}

14:52:16,060 INFO         RestApiRouter - HTTP-pool-3-thread-31 Use controller class com.flashphoner.rest.server.apps.room.RoomApp with path /apps/RoomApp/publishStream

14:52:16,063 INFO            RestClient - API-ASYNC-pool-13-thread-43 RECEIVED REST OBJECT <==

URL:http://localhost:8081/apps/RoomApp/publishStream

OBJECT:

{

  "nodeId" : "rpc46cqx5usYfyHiBaZ8Ga5UsXPGTmNe@54.171.220.129",

  "appKey" : "roomApp",

  "sessionId" : "/172.20.43.221:44564/172.20.0.251:8080-3c182894-1a83-4381-8f68-f4d5942ab06e",

  "mediaSessionId" : "3e3276d0-60af-11eb-9057-99e6d8f47010",

  "name" : "room-b70f3c-1-3e32",

  "published" : true,

  "hasVideo" : true,

  "hasAudio" : true,

  "status" : "PENDING",

  "record" : false,

  "width" : 0,

  "height" : 0,

  "bitrate" : 0,

  "minBitrate" : 0,

  "maxBitrate" : 0,

  "quality" : 0,

  "timeShift" : 0,

  "history" : false,

  "gop" : 0,

  "fps" : 0,

  "audioBitrate" : 0,

  "codecImpl" : "",

  "transport" : "UDP",

  "cvoExtension" : false,

  "mediaProvider" : "WebRTC",

  "custom" : {

    "name" : "room-b70f3c"

  },

  "origin" : "https://demo.flashphoner.com",

  "constraints" : {

    "audio" : true,

    "video" : true

  }

}

14:52:16,347 INFO            RestClient - API-ASYNC-pool-13-thread-42 SEND REST OBJECT ==>

URL:http://localhost:8081/apps/RoomApp/StreamStatusEvent

OBJECT:

{

  "nodeId" : "rpc46cqx5usYfyHiBaZ8Ga5UsXPGTmNe@54.171.220.129",

  "appKey" : "roomApp",

  "sessionId" : "/172.20.43.221:44564/172.20.0.251:8080-3c182894-1a83-4381-8f68-f4d5942ab06e",

  "mediaSessionId" : "3e3276d0-60af-11eb-9057-99e6d8f47010",

  "name" : "room-b70f3c-1-3e32",

  "published" : true,

  "hasVideo" : true,

  "hasAudio" : true,

  "status" : "PUBLISHING",

  "audioCodec" : "opus",

  "videoCodec" : "H264",

  "record" : false,

  "width" : 0,

  "height" : 0,

  "bitrate" : 0,

  "minBitrate" : 0,

  "maxBitrate" : 0,

  "quality" : 0,

  "history" : false,

  "gop" : 0,

  "fps" : 0,

  "audioBitrate" : 0,

  "codecImpl" : "",

  "transport" : "UDP",

  "cvoExtension" : false,

  "createDate" : 1611759136065,

  "mediaType" : "publish",

  "mediaProvider" : "WebRTC",

  "custom" : {

    "name" : "room-b70f3c"

  },

  "origin" : "https://demo.flashphoner.com",

  "constraints" : {

    "audio" : true,

    "video" : true

  }

}

14:52:16,348 INFO            RestClient - API-ASYNC-pool-13-thread-42 RECEIVED REST OBJECT <==

URL:http://localhost:8081/apps/RoomApp/StreamStatusEvent

OBJECT:

{

  "nodeId" : "rpc46cqx5usYfyHiBaZ8Ga5UsXPGTmNe@54.171.220.129",

  "appKey" : "roomApp",

  "sessionId" : "/172.20.43.221:44564/172.20.0.251:8080-3c182894-1a83-4381-8f68-f4d5942ab06e",

  "mediaSessionId" : "3e3276d0-60af-11eb-9057-99e6d8f47010",

  "name" : "room-b70f3c-1-3e32",

  "published" : true,

  "hasVideo" : true,

  "hasAudio" : true,

  "status" : "PUBLISHING",

  "audioCodec" : "opus",

  "videoCodec" : "H264",

  "record" : false,

  "width" : 0,

  "height" : 0,

  "bitrate" : 0,

  "minBitrate" : 0,

  "maxBitrate" : 0,

  "quality" : 0,

  "history" : false,

  "gop" : 0,

  "fps" : 0,

  "audioBitrate" : 0,

  "codecImpl" : "",

  "transport" : "UDP",

  "cvoExtension" : false,

  "createDate" : 1611759136065,

  "mediaType" : "publish",

  "mediaProvider" : "WebRTC",

  "custom" : {

    "name" : "room-b70f3c"

  },

  "origin" : "https://demo.flashphoner.com",

  "constraints" : {

    "audio" : true,

    "video" : true

  }

}
 
Пробовали не переопределять настройки для существующего приложения roomApp, а создать новое, но разницы никакой - соединения не происходит
 

Max

Administrator
Staff member
Добрый день
К сожалению, roomApp и chatRoomApp переопределить нельзя, т.к. это встроенное приложение реализует всю логику RoomApi на стороне сервера. Поэтому можно использовать два пути:
1. Отказаться от RoomApi и реализовать полностью свой бэкенд, включая логику комнат
2. Переопределить roomApp и проксировать все запросы в стандартное приложение http://wcs:8081/apps/ChatRoomApp. Пример для аутентификации пользователя, используемый одним из клиентов в похожем случае:
PHP:
<?php
$api_method = array_pop(explode("/", $_SERVER['REQUEST_URI']));
$incoming_data = json_decode(file_get_contents('php://input'), true);
$response_data = $incoming_data;

switch($api_method) {
    case"connect":
        // Authenticate user as you wish
        if (authenticateUser($incoming_data)) {
            error_log("User authorized");
            // POST /connect query to WCS default RoomApp
            $response_data = postToRoomApp(json_encode($incoming_data));
        } else {
            error_log("User not authorized. Connection failed with 403 status.");
            ubnormalResponse(403);
        }
    break;
    default:
        // POST any query to WCS default RoomApp
        $response_data = postToRoomApp(json_encode($incoming_data));
    break;
}
header('Content-Type: application/json');
echo json_encode($response_data);

// User authentication
function authenticateUser($incoming_data) {
...
}

// Passing query to WCS default RoomApp
function postToRoomApp($data_string) {
    // Here should be your WSC RoomApp address
    $wcs_url="http://wcs:8081/apps/ChatRoomApp";

    $response="";
    if( $curl = curl_init() ) {
        curl_setopt($curl, CURLOPT_URL, $wcs_url);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($curl, CURLOPT_POST, true);
        curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "POST");
        curl_setopt($curl, CURLOPT_POSTFIELDS, $data_string);
        curl_setopt($curl, CURLOPT_HEADER, true);
        curl_setopt($curl, CURLOPT_HTTPHEADER, array('Content-Type: application/json',                                                                               
                               'Content-Length: ' . strlen($data_string)));      
        $response = curl_exec($curl);
        $http_code = curl_getinfo($curl, CURLINFO_HTTP_CODE);
        if($http_code != 200) {
            ubnormalResponse($http_code);
        }
        curl_close($curl);
    }
    return($response);
}
function ubnormalResponse($code) {
    if ($code == 403) {
    header('HTTP/1.1 403 Forbidden', true, $code);
    } else {
    header(':', true, $code);
    }
    die();
}
?>
 
Top