Connecting freeswitch remotely using node esl fails - freeswitch

Im trying to connect remotely to FreeSwitch service using ESL.
Connecting machine and FS Service both are in my local VM's, 2 different VM's
But i get below error
[WARNING] mod_event_socket.c:2639 IP 10.95.38.254 Rejected by acl "loopback.auto"
/autoload_configs/event_socket.conf.xml
<configuration name="event_socket.conf" description="Socket Client">
<settings>
<param name="listen-ip" value="0.0.0.0"/>
<param name="listen-port" value="8021"/>
<param name="password" value="ClueCon"/>
</settings>
</configuration>
Script:
var conn = new esl.Connection('10.191.73.254', 8021, 'ClueCon', function() {
conn.api('status', function(res) {
console.log(' >> Connected >> ');
console.log(res.getBody());
});
});

I added below lines into acl.config.xml and its working fine
/auto_configs/acl.config.xml
<list name="loopback.auto" default="allow">
<node type="allow" cidr="10.95.38.0/24"/>
</list>

you need to use apply-inbound-acl explicitly in your event_socket.conf.xml. If none is applied, the default loopback ACL is used for ESL.

Related

CF2021 Getting Started with WebSockets (cfwebsocket)

I am just getting started with cfwebsockets and I am having a bit of trouble. What I found from online, is that since this is public-facing application, it is best to use a websocket proxy.
CF2021, Version: 2021.0.03.329779
Ubuntu 20.04LTS
Steps so far:
I added the websocket package to my server and enabled web-sockets. Restarted Server.
Added this to my application.cfc:
<cfset this.wschannels = [ {name="chat"} ] />
(the application has a this.name= set from a variable as well
3. created a simple page that has this:
<cfwebsocket
name="wSocketObj"
onMessage="wsOnMessage"
onOpen="wsOnOpen"
onClose="wsOnClose"
onError="wsOnError"
subscribeTo="chat"
secure="true"/>
<script type="text/javascript">
wsOnMessage = function(aEvent,aToken) {
console.log('wsOnMessage',aevent);
var message = ColdFusion.JSON.encode(atoken);
var txt=document.getElementById("myDiv");
txt.innerHTML +=message +"<br>";
}
wsOnOpen = function() {
alert("wsOnOpen Connection is open");
}
wsOnClose = function() {
alert("wsOnClose Connection Closed");
}
wsOnError = function() {
alert("wsOnError!");
console.log(arguments);
}
sendMessage = function() {
var text = window.prompt("Enter some text","");
if (text) {
wSocketObj.publish("chat", text);
}
}
</script>
<cfdiv id="myDiv"></cfdiv>
<div id="myChatArea"></div>
<input type="text" id="myMessage" /><input id="myButton" type="button" value="Send Message" onClick="sendMessage()" />
got this in the Chrome Console:
WebSocket connection to 'wss://myhost.mydomain.com:8555/cfusion/cfusion' failed:
CFWebSocketWrapper.open # cfwebsocketCore.js:21
init # cfwebsocketChannel.js:49
_cf_websockets_init_6322652258206397 # client.cfm:35
fire # cfajax.js:1214
$E.windowLoadHandler # cfajax.js:1321
cfwebsocketCore.js:54 Uncaught TypeError: Cannot set properties of undefined (setting 'readyState')
at WebSocket.wsConnection.onerror (cfwebsocketCore.js:54:29)
thinking it was a firewall issue, I disabled it in Ubuntu
It was at this point that it seemed to be that I needed to configure a proxy.
I ran /opt/ColdFusion/cfusion/bin/wsproxyconfig.sh from the command line and verified that both the line in apache2.conf was there and the folder "/opt/ColdFusion/config/wsproxy/1/mod_wsproxy.conf" was created. Restarted apache2 and CF2021
Same Result
Realized I need to change the websocket config in CF Admin,
When I select the Use Proxy in CF Admin, the Save Changes button disappears and I cannot save it.
Obviously I am missing something very fundamental here. Any help that anyone can provide would be appreciated.
thanks in advance

clickhouse external dictionary loading error

I plan to upgrade clickhouse cluster.From v19.14.6. to v21.3.10.But when I load a mysql external dictionary on v21.3.10,I got an error:
Query:
SYSTEM RELOAD DICTIONARY dim_subject_movie
Received exception from server:
Poco::Exception. Code: 1000, e.code() = 0, e.displayText() = Exception: Connections to all replicas failed: frodo#mysql1:3306 as user test, frodo#mysql1:3306 as user test (version 21.3.10.1 (official build))
The configuration are as follows
<dictionary>
<name>dim_subject_movie</name>
<source>
<mysql>
<port>3306</port>
<user>test</user>
<password>test1</password>
<replica>
<host>mysql1</host>
<priority>1</priority>
</replica>
<db>frodo</db>
<table>subject_movie_collection</table>
<where>date=subdate(current_date, 1)</where>
</mysql>
</source>
<lifetime>
<min>300</min>
<max>360</max>
</lifetime>
<layout><hashed /></layout>
<structure>
<id>
<name>movie_id</name>
</id>
<attribute>
<name>movie_title</name>
<type>String</type>
<null_value></null_value>
</attribute>
</structure>
</dictionary>
Somebody who ever encountered the same problem?Thankx!
I found the reason that because of the dic source (mysql 5.1) is too old to be compatible with the high version clickhouse. Finally I change clickhouse's version back to 19.14.6.

camel-http4 post not working I get no response

this is my first camel HTTP4 implementation and having trouble. I get no response as if the route to URI is wrong and message goes ??? it doesn't make the HTTP4 call it appears?
using camel-version 2.17.0.redhat-630310, java 8
my pom has dependency
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-http4</artifactId>
</dependency>
my route
<route
id="core.getToken.route"
autoStartup="true" >
<from id="getToken" ref="getToken" />
<process ref="uAARequestTokenProcessor" />
<log message="Message after uAARequestTokenProcessor: ${body}" loggingLevel="INFO"/>
<setHeader headerName="CamelHttpMethod">
<constant>POST</constant>
</setHeader>
<to uri="http4://dummyhost" />
<log message="After HTTP4 POST: ${body}" loggingLevel="INFO"/>
<to uri="{{accessToken}}" />
</route>
I call the uAARequestTokenProcessor to condition the outbound message.
public class UAARequestTokenProcessor implements Processor {
private static final Logger LOG = LoggerFactory.getLogger(UAARequestTokenProcessor.class);
#Override
public void process(Exchange exchange) throws Exception {
LOG.info("Entering UAA Request Token Processor: start " );
final String clientId = (String)exchange.getIn().getHeader("CLIENTID");
final byte[] ClientId = clientId.getBytes("UTF-8");
final String userName = (String)exchange.getIn().getHeader("USERNAME");
final String password = (String)exchange.getIn().getHeader("PASSWORD");
final String tokenUrl = (String)exchange.getIn().getHeader("TOKENURL");
LOG.info("ClientId: " + new String(ClientId));
LOG.info("userName: " + userName);
LOG.info("password: " + password);
LOG.info("tokenUrl: " + tokenUrl);
LOG.info("Processing UAA token request for Client ID: " + clientId + " and User Name: " + userName);
LOG.info("Before Base64 encryption of Client ID: " + new String(ClientId));
StringBuilder authHeader = new StringBuilder("Basic ");
authHeader.append(Base64.getEncoder().encodeToString(ClientId));
LOG.info("after Base64 encryption of Client ID: " + authHeader.toString());
String body = String.format("grant_type=password&username=%s&password=%s",
URLEncoder.encode(userName, "UTF-8"), //Translates a string into x-www-form-urlencoded format
URLEncoder.encode(password, "UTF-8"));
LOG.info("HTTP BODY: " + body);
exchange.getIn().setHeader(Exchange.HTTP_URI, tokenUrl);
exchange.getIn().setHeader(Exchange.CONTENT_TYPE, "MediaType.APPLICATION_FORM_URLENCODE");
exchange.getIn().setHeader("Authorization", authHeader.toString());
exchange.getIn().setBody(body);
LOG.info("Exchange.HTTP_URI: " + exchange.getIn().getHeader("Exchange.HTTP_URI"));
LOG.info("Exchange.CONTENT_TYPE: " + exchange.getIn().getHeader("Exchange.CONTENT_TYPE"));
LOG.info("Authorization: " + exchange.getIn().getHeader("Authorization"));
LOG.info("Exiting UAA Request Token Processor: Finish " );
}
}
it looks like to me that the Exchange.HTTP_URI or HTTP headers are not getting set unless the headers for HTTP4 are different? but I'm following the HTTP4 doc, https://github.com/apache/camel/blob/master/components/camel-http4/src/main/docs/http4-component.adoc
what happens is inside the processor I try to read the HTTP headers and it shows they are null, after being set.
Entering UAA Request Token Processor: start
ClientId: ingestor.57e72dd3-6f9e-4931-b4bc-cd04eaaff3e3.1f7dbe12-2372-439e-8104-06a5f4098ec9
userName: 5c0642fe-a495-44db-93f7-67056fa2c061_ingestor
password: 154f0252d166f27b5e21ef171b02a79f41a0daf3
tokenUrl: http4://d1e53858-2903-4c21-86c0-95edc7a5cef2.predix-uaa.run.aws-usw02-pr.ice.predix.io/oauth/token
Processing UAA token request for Client ID: ingestor.57e72dd3-6f9e-4931-b4bc-cd04eaaff3e3.1f7dbe12-2372-439e-8104-06a5f4098eff9 and User Name: 5c0232fe-a495-44db-94f7-67156fa2c061_ingestor
Before Base64 encryption of Client ID: ingestor.57e72dd3-6f9e-4931-b4bc-cd04eaaff3e3.1f7dbe12-2372-439e-8104-06a5f4098eff9
after Base64 encryption of Client ID: Basic aW5nZXN0b3IuNTdlNzJkZDMtNmY5ZS00OTMxLWI0YmMtY2QwNGVhYWZmM2UzLjFmN2RiZTEyLTIzNzItNDM5ZS04MTA0LTA2YTVmNDA5OGVjOQ==
HTTP BODY: grant_type=password&username=5c0232fe-a495-44db-94f7-67156fa2c061_ingestor&password=154f0252d166f27b5e21ef171b02beebop
Exchange.HTTP_URI: null
Exchange.CONTENT_TYPE: null
Authorization: Basic aW5nZXN0b3IuNTdlNzJkZDMtNmY5ZS00OTMxLWI0YmMtY2QwNGVhYWZmM2UzLjFmN2RiZTEyLTIzNzItNDM5ZS04MTA0LTA2YTVmNDA5OGVjOQ==
Exiting UAA Request Token Processor: Finish
The stack trace shows headers but not as EXCHANGE.HTTP_URI
2018-04-23 13:17:29,203 | INFO | ile://ge-ip/core | Tracer | 231 - org.apache.camel.camel-core - 2.17.0.redhat-630310 | ID-alphprdfuse2i-44477-1524503724804-3-52 >>>
(core.getToken.route) setHeader[CamelHttpMethod, POST] --> http4://predhost <<< Pattern:InOnly,
Headers:{Authorization=Basic aW5nZXN0b3IuNTdlNzJkZDMtNmY5ZS00OTMxLWI0YmMtY2QwNGVhYWZmM2UzLjFmN2RiZTEyLTIzNzItNDM5ZS04MTA0LTA2YTVmNDA5OGVjOQ==,
breadcrumbId=ID-alphprdfuse2i-44477-1524503724804-3-50,
CamelFileAbsolute=false,
CamelFileAbsolutePath=/app/iprctest/jboss-fuse-6.3.0.redhat-310/ge-ip/core/Noble/nst_dge-1_2018-04-10_19-55-10.CSV, CamelFileLastModified=1524503800000,
CamelFileLength=3706, CamelFileName=Noble/nst_dge-1_2018-04-10_19-55-10.CSV, CamelFileNameConsumed=Noble/nst_dge-1_2018-04-10_19-55-10.CSV, CamelFileNameOnly=nst_dge-1_2018-04-10_19-55-10.CSV,
CamelFileNameProduced=ge-ip/upload/Noble/nst_dge-1_2018-04-10_19-55-10.CSV, CamelFileParent=ge-ip/core/Noble,
CamelFilePath=ge-ip/core/Noble/nst_dge-1_2018-04-10_19-55-10.CSV, CamelFileRelativePath=Noble/nst_dge-1_2018-04-10_19-55-10.CSV, CamelHttpMethod=POST,
CamelHttpUri=http4://d1e53858-2903-4c21-86c0-95edc7a5cef2.pred-uaa.run.aws-usw02-pr.ice.pred.io/oauth/token,
CLIENTID=ingestor.57e72dd3-6f9e-4931-b4bc-cd04eaaff3e3.1f7dbe12-2372-439e-8104-06a5f4098ec9,
Content-Type=MediaType.APPLICATION_FORM_URLENCODE,
CUSTKEY=Noble, PASSWORD=154f0252d166f27b5e21a79f41a0daf3,
TENANTUUID=c0642fe-a495-44db-93f7-67056fa2c061,
TOKENURL=http4://d1e53858-2903-4c21-86c0-95edc7f2.pred-uaa.run.aws-usw02-pr.ice.pred.io/oauth/token,
UPLOADURL=http4://apm-times-query-svc-prod.app-api.aws-usw02-pr.pred.io/v2/time_series/upload,
USERNAME=5c0642fe-a495-44db-93f7-67056fa2c061_ingestor},
BodyType:String, Body:grant_type=password&username=5c0642fe-a495-44db-93f7-2c061_ingestor&password=154f0252d166f2ef171b02a79f41a0daf3
THE http4://predhost is a dummy URI in the spring XML and should be over ridden by the exchange.getIn().setHeader(Exchange.HTTP_URI, tokenUrl);
I never reach the URL endpoint and never reach the log message after making the to HTTP4://
<to uri="http4://predixhost" />
<log message="After HTTP4 POST: ${body}" loggingLevel="INFO"/>
I have tried the following but still get no response, no exceptions, nothing. setting the header CamelHttpUri to overirde the default dummy uri, and a dynamic toD, ???
<route
id="core.getToken.route"
autoStartup="true" >
<from id="getToken" ref="getToken" />
<process ref="uAARequestTokenProcessor" />
<!-- <log message="Message after uAARequestTokenProcessor: ${body}" loggingLevel="INFO"/> -->
<setHeader headerName="CamelHttpMethod">
<constant>POST</constant>
</setHeader>
<!-- <setHeader headerName="CamelHttpUri">
<simple>${header.TOKENURL}</simple>
</setHeader> -->
<toD uri="${header.TOKENURL}" />
<log message="After HTTP4 POST: ${body}" loggingLevel="INFO"/>
<to uri="{{accessToken}}" />
</route>
I don't know what is wrong? I can't get a response, an exception, it looks like I cannot send to the HTTP4 endpoint. I am reaching now, verified my proxy settings in the environment, and also tried in the camel context, I don't know what is going on or what to do, I get no logging info to go on, ...
<camelContext
id="com.passthru.coreCamelContext"
trace="true"
xmlns="http://camel.apache.org/schema/blueprint"
allowUseOriginalMessage="false"
streamCache="true"
errorHandlerRef="deadLetterErrorHandler" >
<properties>
<property key="http.proxyHost" value="PITC-Zscaler-Americas-Cin.proxy.corporate.comp.com"/>
<property key="http.proxyPort" value="80"/>
</properties>
<streamCaching id="CacheConfig"
spoolUsedHeapMemoryThreshold="70"
anySpoolRules="true"/>
I've tried with CURL and it works from command line, I've tried with Postman and it works. thanks for your help.
What this is to do, simply POST a message to an UAA(https) service with a body of:
grant_type=password&username=myUserName&password=myPassword
and headers:
Content-Type=application/x-www-form-urlencoded
Authorization=Basic aW5nZXN0b3IuNTdlNzJkZDMt==
and the server will issue an access token.
like this postman example:
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/x-www-form-urlencoded");
RequestBody body = RequestBody.create(mediaType, "username=93f7c061_ingestor&password=15a79f41a0daf3&grant_type=password");
Request request = new Request.Builder()
.url("https://d1e53858-2903-4c21-86c0-95edc7a5cef2.uaa.run.aws-usw02-pr.ice.io/oauth/token")
.post(body)
.addHeader("Content-Type", "application/x-www-form-urlencoded")
.addHeader("Authorization", "Basic aW5nZXN0b3IuNTdlNzJkZDMtNmY5ZS00OTMxLWI0YmMtY2QwNGVhYWZmM2UzLjFmN2RiZTEyLTIzNzItNDM5ZS04MTA0LTA2YTVmNDA5OGVjOTo=")
.addHeader("Cache-Control", "no-cache")
.addHeader("Postman-Token", "ad8ba9b0-6215-4c53-a6ef-b3a5bf7901f6")
.build();
Response response = client.newCall(request).execute();
Hello I hope there is someone out there that can help, I'm stuck.
I have confirmed, I believe that the HTTP4 endpoint is not working. I have a deadletter queue
<bean id="deadLetterErrorHandler" class="org.apache.camel.builder.DeadLetterChannelBuilder">
<property name="deadLetterUri" value="${deadLetterQueue}"/>
<property name="redeliveryPolicy" ref="redeliveryPolicyConfig"/>
</bean>
<bean id="redeliveryPolicyConfig" class="org.apache.camel.processor.RedeliveryPolicy">
<property name="maximumRedeliveries" value="3"/>
</bean>
and each exchange sent to this endpoint is tried 3x and then sent to the deadletter queue. the content of the message in the deadletter queue is what should be sent to the HTTP4 endpoint and thus the UAA service.
├── deadletterqueue
│   ├── ID-alphprdfuse2i-36326-1524606956414-3-65
grant_type=password&username=5c0642fe_ingestor&password=02a79f41a0daf3
the message headers leading in to this look good too.
core.getToken.route) log[HTTP4 POST body: ${body}] --> http4://d1e53858-2903-4c21-86c0-95edc7a5cef2.uaa.run.aws-usw02.io:443/oauth/token?throwExceptionOnFailure=false <<< Pattern:InOnly, Headers:{Authorization=Basic aW5nZXN0b3IuNTdlNzJkZDMtNmY5ZS00OTMxLWI0YmMtY2QwNGVhYWZmM2UzLjFmN2RiZTEyLTIzNzItNDM5ZS04MTA0LTA2YTVmNDA5OGVjOQ==, CamelHttpCharacterEncoding=UTF-8, CamelHttpMethod=POST, CamelHttpUri=http4://d1e53858-2903-4c21-86c0-95edc7a5cef2.uaa.run.aws.io:443/oauth/token, Content-Type=MediaType.APPLICATION_FORM_URLENCODE, TOKENURL=http4://d95edc7a5cef2.uaa.run.aws-usw02-pr.ice.io:443/oauth/token}, BodyType:String, Body:grant_type=password&username=5c06-a495-44db-93f7-67056fa2c061_ingestor&password=7b5e21ef171b02a79f41a0daf3
I'm convinced it must be something wrong with the way I'm implementing HTTP4. I do not need to expose a web service I only need to push to it. I can't get this to work. please help.
ok, this was a multi faceted problem.
1st my proxy setting was incorrect. I found it has to be set with either the IP or the name, cononical name without the protocol http://.
I had it like:
<camelContext
id="com.ge.digital.passthru.coreCamelContext"
trace="true"
xmlns="http://camel.apache.org/schema/blueprint"
allowUseOriginalMessage="false"
streamCache="true"
errorHandlerRef="deadLetterErrorHandler" >
<properties>
<property key="http.proxyHost" value="http://PITC-Zscaler-Americas.proxy.corporate.com"/>
<property key="http.proxyPort" value="80"/>
</properties>
but as mentioned this apparently is incorrect and do not use the protocol in the def. like:
<properties>
<property key="http.proxyHost" value="PITC-Zscaler-Americas.proxy.corporate.com"/>
<property key="http.proxyPort" value="80"/>
</properties>
or
<properties>
<property key="http.proxyHost" value="123.123.123.123"/>
<property key="http.proxyPort" value="80"/>
</properties>
this gave me a response, not the one I was hoping for but one that gave me hope.
this gave me a 504 gateway timeout, wow, i was getting something back. :)
2nd, The endpoint over ride wasn't working...
m.setHeader(Exchange.HTTP_URI, tokenUrl);
using
<toD uri="${header.TOKENURL}?throwExceptionOnFailure=false" />
<toD uri="${header.TOKENURL}" />
so I just tried a simple to in the route
<to uri="http4://d1e53858-uaa.run.aws-usw02-pr.ice.io:443/oauth/token?throwExceptionOnFailure=false" />
with the over ride
m.setHeader(Exchange.HTTP_URI, tokenUrl);
where the tokenUrl was defined as
http4://d1e53858-uaa.run.aws-usw02-pr.ice.io:443/oauth/token
this gives me a 504, I was hoping this was something I could take care of on my side, usually isn't but sometimes... so I kept trying things... until... I used the actual address in the HTTP_URI like...
https://d1e53858-uaa.run.aws-usw02-pr.ice.io/oauth/token
and now I am getting a CamelHttpResponseCode=401, CamelHttpResponseText=Unauthorized
I'm one happy camper, this is something I can work with... I then tested the same substitution setting the URI in the route in xml. and this worked also.
<setHeader headerName="CamelHttpMethod">
<constant>POST</constant>
</setHeader>
<log message="HTTP4 POST headers: ${headers}" loggingLevel="DEBUG"/>
<setHeader headerName="CamelHttpUri">
<simple>${header.TOKENURL}?throwExceptionOnFailure=false</simple>
</setHeader>
<to uri="http4://d1e53858-uaa.run.aws-usw02-pr.ice.io/oauth/token?throwExceptionOnFailure=false" />
I am still trying to get the dynamic route working, but I'm satisfied with what I have and will focus more on that later.
<toD uri="${header.TOKENURL}?throwExceptionOnFailure=false" />
<toD uri="${header.TOKENURL}" /> -->
thank you everyone, I hope my struggles as a newbie help others, I can't be the only one with these silly happenings. anyway, cheers all.

RECORD_START|STOP event in Freeswitch ESL

I have setup a NodeJS application (with node_esl) and connected it with event socket layer (ESL) of a Freeswitch server deployed on Amazon AWS. See code below:
var esl = require('modesl'),
conn = new esl.Connection('SERVER_IP', PORT, 'PASSWORD', function() {
conn.api('status', function(res) {
//res is an esl.Event instance
console.log(res.getBody());
});
conn.subscribe([
'RECORD_START',
'RECORD_STOP'
], function(evt) {
console.log(evt)
});
conn.on('esl::event::RECORD_START::*', function(evt) {
console.log(evt);
});
conn.on('esl::event::RECORD_STOP::*', function(evt) {
console.log(evt);
});
});
I am recording a video conference in Freeswitch using following commands and I expect the above interface to receive the RECORD_START|STOP events. However the said events are never received.
# To start recording
conference <conf_id> recording start
# To stop recording
conference <conf_id> recording stop
Below is Freeswitch profile for the conference I am recording:
<profile name="cp">
<param name="domain" value="$${domain}"/>
<param name="rate" value="8000"/>
<param name="video-mode" value="transcode"/>
<param name="interval" value="20"/>
<param name="caller-controls" value="default"/>
<param name="energy-level" value="0"/>
<param name="conference-flags" value="wait-mod|audio-always|livearray-sync|livearray-json-status"/>
<param name="max-members" value="25"/>
<param name="sound-prefix" value="/usr/local/freeswitch/conf/sounds/"/>
<param name="enter-sound" value="tone_stream://%(200,0,500,600,700)"/>
<param name="exit-sound" value="tone_stream://%(500,0,300,200,100,50,25)"/>
</profile>
I receive majority of ESL events through this interface but not the RECORD_START|STOP. Any ideas?
I tested this out and it looks like the RECORD_START|STOP events only emit for the record application (and probably the record_session application. I did not test this), but not for conference recording.
For troubleshooting, I ran fs_cli> /event plain all from the freeswitch command line, and these events did show up when I ran conference <conf_id> recording start and conference <conf_id> recording stop.
Here is the start event:
RECV EVENT
Event-Subclass: conference::maintenance
Event-Name: CUSTOM
Core-UUID: fe0ebcc0-0c43-44ed-adb3-ce4e7ee8f48b
FreeSWITCH-Hostname: freeswitch
FreeSWITCH-Switchname: freeswitch
FreeSWITCH-IPv4: 192.168.1.114
FreeSWITCH-IPv6: ::1
Event-Date-Local: 2017-09-14 17:38:22
Event-Date-GMT: Thu, 14 Sep 2017 17:38:22 GMT
Event-Date-Timestamp: 1505410702748201
Event-Calling-File: conference_record.c
Event-Calling-Function: conference_record_thread_run
Event-Calling-Line-Number: 278
Event-Sequence: 990
Conference-Name: conference
Conference-Size: 1
Conference-Ghosts: 0
Conference-Profile-Name: cp
Conference-Unique-ID: a431361f-a59b-4319-bec1-fa76f8630197
Action: start-recording
Path:{channels=1,samplerate=8000,vw=0,vh=0,fps=0.00}/usr/local/freeswitch/log/conference_recording_1.mp3
Error: File could not be opened for recording
Here is the stop event:
RECV EVENT
Event-Subclass: conference::maintenance
Event-Name: CUSTOM
Core-UUID: fe0ebcc0-0c43-44ed-adb3-ce4e7ee8f48b
FreeSWITCH-Hostname: freeswitch
FreeSWITCH-Switchname: freeswitch
FreeSWITCH-IPv4: 192.168.1.114
FreeSWITCH-IPv6: ::1
Event-Date-Local: 2017-09-14 17:38:22
Event-Date-GMT: Thu, 14 Sep 2017 17:38:22 GMT
Event-Date-Timestamp: 1505410702748201
Event-Calling-File: conference_record.c
Event-Calling-Function: conference_record_thread_run
Event-Calling-Line-Number: 418
Event-Sequence: 991
Conference-Name: conference
Conference-Size: 1
Conference-Ghosts: 0
Conference-Profile-Name: cp
Conference-Unique-ID: a431361f-a59b-4319-bec1-fa76f8630197
Action: stop-recording
Path: {channels=1,samplerate=8000,vw=0,vh=0,fps=0.00}/usr/local/freeswitch/log/conference_recording_1.mp3
Other-Recordings: true
Samples-Out: 0
Samplerate: 8000
Milliseconds-Elapsed: 0
For your node app, you could try something like this to get what you need:
var esl = require('modesl'),
conn = new esl.Connection('127.0.0.1', 8021, 'ClueCon', function() {
conn.api('status', function(res) {
//res is an esl.Event instance
console.log(res.getBody());
});
conn.subscribe('CUSTOM conference::maintenance', function() {
conn.on('esl::event::CUSTOM::**', function(evt) {
console.log(evt);
// now do something
});
});
});

websocket failed: Error during WebSocket handshake: Unexpected response code: 400

I am using ec2, spring websocket using socksJS is working fine in local.
I have already tried below things.
1. I dont have any load balancer which is blocking TCP. Request is directly going to ec2 server
2. Use true IP in place of ec2 server name.
while server its giving following issue in chrome console, there is no error in application server logs
WebSocket connection to 'ws://ec2-XX-X-XXX-XXX.compute-1.amazonaws.com/ws/963/kaidmvd9/websocket' failed: Error during WebSocket handshake: Unexpected response code: 400
Javascript
app.service('SocketService', function(httpService,$rootScope,SoundService) {
this.registerMe = function(callback){
$rootScope.socket = new SockJS("/ws");
$rootScope.stompClient = Stomp.over($rootScope.socket);
$rootScope.stompClient.connect('guest', 'guest', function(frame1) {
$rootScope.stompClient.subscribe('/user/'+$rootScope.loggedInUser.username+'/reply', function(frame2) {
var msg = JSON.parse(frame2.body);
console.log(msg);
});
},
function(error) {
console.log(error.headers.message);
}
);});
Spring xml
<websocket:message-broker application-destination-prefix="/app" >
<websocket:stomp-endpoint path="/ws">
<websocket:sockjs />
</websocket:stomp-endpoint>
<websocket:simple-broker prefix="/topic,/user" />
</websocket:message-broker>
Came to this through your T-Hub post, don't have enough reputation to add a comment else would have done that. Here's what you could try; use your EC2's private ip (find using ifconfig) to host the WebSocket endpoint.
<websocket:message-broker application-destination-prefix="/app">
<websocket:stomp-endpoint path="/ws">
<websocket:sockjs/>
</websocket:stomp-endpoint>
<websocket:stomp-broker-relay prefix="/topic,/user"
relay-host="your-ec2-private-ip-addr" relay-port="80" heartbeat-send-interval="20000" heartbeat-receive-interval="20000"/>
</websocket:message-broker>
Got help from:
Java Spring STOMP: Set broker IP

Resources