Hello!
A few years ago I set up a prank call project on a WCS4. Alex helped me to make some adjustments to bring my project to work. Now I must upgrade to WCS5 due to several reasons (i.E. Microsoft Edge and Firefox are not supporting any longer my project) and I need technical help. I set up a new server running CentOS 7.4, Asterisk 14.7.6 and WCS 5.0 so far but now I need to make the adjustments similar to the ones Alex did on my WCS4.
Below you can find the documentation I got from Alex regarded to the WCS4 adjustments and also to the project itsself. Especially I need to build again a custom handler jar file. I have the four old source files
InjectSoundObject.class
InjectSoundObject.java
WCS4PrankCallsHandler.class
WCS4PrankCallsHandler.java
but surely the content must be adjusted to fit WCS5. (I post the files or the content here if asked). Please help me to do so.
A second question: In the dependencies for the former WCS4 is written (also see below) that I need the "WCS 4 client API from branch 'wcs4_opus'". Which branch now it the matching one for WCS5?
Best regards
Marc
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
[ from the custom adjustment description of WCS4 ]
Project summary
Inject sound into telephone conversation, sound must be chosen at caller side.
Callee client should not hear caller as this can reveal caller.
Aims
Main aim is to have system for prank calls based on sound injection.
Software used
- Flashphoner WCS 4
- Asterisk 11.20.0
Main idea
WCS 4 is used for call initiation from Chrome or other WebRTC browser to SIP network. It uses WebRTC to deliver sound stream to caller and provides signaling to core. Caller can request custom functions through Websocket signaling from WCS 4 to trigger sound injection at core level. Asterisk is used as IP-PBX, it connects caller and callee parties into conference and plays sounds upon request.
Logic details
Chrome browser page uses WCS 4 client connecting to WCS 4 server and initiates call to "prank destination". WCS 4 sends SIP INVITE to Asterisk server. Asterisk writes callee number to a special variable "CONF" that will be used to create dynamic conference and then creates file with "CONF" variable in it. File name must be unique, Call-ID is used to name this file.
After this it initiates call to "prank destination" using Dial command with specially configured "G" option. When callee party answers a call Asterisk separates caller channel from callee channel and transfers them as follows:
1) caller channel transferred to context "separator" priority 1, and from where caller transferred to context "fun1"
2) callee channel transferred to context "separator" priority 2, and from where caller transferred to context "fun2"
In context "fun1" Asterisk shares "CONF" variable with callee channel and creates dynamic MeetMe conference. Caller enters this conference.
In context "fun2" Asterisk retrieves previously shared variable "CONF" end puts callee party into conference.
In this state there is active conference with caller and callee parties in it. Sound stream from caller is not participating in this conference (muted at conference level). Starting from this state caller can inject custom sound to conference. Chrome page as WCS 4 client sends request using function "sendData" to WCS 4. It transfers object with next fields:
{operationId:"inject",
payload:
{sound: playFile,
callId: currentCall.callId
}
};
Upon receiving such request WCS 4 tries to find file with conference number that Asterisk created at call initiation. If file is not found or conference number is not present in file WCS 4 gives error to log file and nothing happens. So, to trigger sendData function client must know Call-ID of active call. This gives some sort of security. After WCS 4 has conference number it creates Asterisk call file and puts it to spool directory. Asterisk initiates call to conference number and plays requested sound using call file. When played file ends Asterisk exits from conference.
How to use sendData function
At client API level sendData function has two arguments, callId:String and sound:String.
callId – Call-ID of current active call
sound – name of custom sound. Custom sounds must be known by Asterisk. Sounds can be placed in /usr/local/asterisk/var/lib/asterisk/sounds/en directory. It is possible to use multilevel directories for custom sounds. When you need to trigger sound located at /usr/local/asterisk/var/lib/asterisk/sounds/en with sound name all-circuits-busy-now.wav you need to pass:
sound = “all-circuits-busy-now”
If sound located at usr/local/asterisk/var/lib/asterisk/sounds/en/mysounds/taxes/you-have-new-bill.wav you need to pass:
sound =”mysounds/taxes/you-have-new-bill”
Dependencies
1) WCS 4 client API from branch "wcs4_opus"
http://flashphoner.com/downloads/builds/WCS/4.0/x8664/wcs4_opus/
2) Custom WCS4PrankCallsHandler with sendData method
3) Asterisk with dahdi timing and MeetMe app available
Hardcoded
1) Path to file with conference number
/usr/local/asterisk/var/lib/asterisk/conferences
2) Path to asterisk spool directory
/usr/local/asterisk/var/spool/asterisk/outgoing
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
Custom Handler for WCS4
Build JAR file
You need to execute build_jar.sh in /tmp directory to build JAR-file. Output file (marcophono.jar) will be in /tmp/com/marcophono/handler/. build_jar.sh has some variables inside:
TMP_DIR="/tmp"
SRC_DIR="com/marcophono/handler"
JAVA_BIN_DIR="/usr/java/jdk1.8.0_65/bin"
All java-files should be placed in SRC_DIR. After building jar-file should be copyed to /usr/local/FlashphonerWebCallServer/lib
Deploying JAR
1. Login to server through SSH to access CLI:
ssh -p 2000 admin@localhost
password: admin
2. Update default application with "defaultApp"-name, change main class for direct calls and URL:
update app --url "http://localhost/defaultApp" -m com.flashphoner.server.client.handler.custom.WCS4PrankCallsHandler defaultApp
Create defaultApp with httpd (apache)
1. Untar /root/defaultApp.tar.gz to /var/www/html
tar -zxvf /root/defaultApp.tar.gz -C /var/www/html
2. Change credentials in /var/www/html/defaultApp/connect.json as you need:
"sipLogin" : "test",
"sipAuthenticationName" : "test",
"sipDomain" : "127.0.0.1",
"sipOutboundProxy" : "127.0.0.1",
"sipPassword" : "TopSecret",
3. Try to call from web. Go to http://144.xx.xx.xx/defaultApp/. Set SIP callee and Sound fields and click "call".
Asterisk
Asterisk installed to /usr/local/asterisk directory. Config files accessible from /etc/asterisk.
How to use sendData
Use injectSound function from /var/www/html/defaultApp/Phone-min.js
function injectSound() {
var playFile = document.getElementById('sound').value;
var data = {operationId:"inject",payload:{soundlayFile,callId:currentCall.callId}};
f.sendData(data);
}
A few years ago I set up a prank call project on a WCS4. Alex helped me to make some adjustments to bring my project to work. Now I must upgrade to WCS5 due to several reasons (i.E. Microsoft Edge and Firefox are not supporting any longer my project) and I need technical help. I set up a new server running CentOS 7.4, Asterisk 14.7.6 and WCS 5.0 so far but now I need to make the adjustments similar to the ones Alex did on my WCS4.
Below you can find the documentation I got from Alex regarded to the WCS4 adjustments and also to the project itsself. Especially I need to build again a custom handler jar file. I have the four old source files
InjectSoundObject.class
InjectSoundObject.java
WCS4PrankCallsHandler.class
WCS4PrankCallsHandler.java
but surely the content must be adjusted to fit WCS5. (I post the files or the content here if asked). Please help me to do so.
A second question: In the dependencies for the former WCS4 is written (also see below) that I need the "WCS 4 client API from branch 'wcs4_opus'". Which branch now it the matching one for WCS5?
Best regards
Marc
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
[ from the custom adjustment description of WCS4 ]
Project summary
Inject sound into telephone conversation, sound must be chosen at caller side.
Callee client should not hear caller as this can reveal caller.
Aims
Main aim is to have system for prank calls based on sound injection.
Software used
- Flashphoner WCS 4
- Asterisk 11.20.0
Main idea
WCS 4 is used for call initiation from Chrome or other WebRTC browser to SIP network. It uses WebRTC to deliver sound stream to caller and provides signaling to core. Caller can request custom functions through Websocket signaling from WCS 4 to trigger sound injection at core level. Asterisk is used as IP-PBX, it connects caller and callee parties into conference and plays sounds upon request.
Logic details
Chrome browser page uses WCS 4 client connecting to WCS 4 server and initiates call to "prank destination". WCS 4 sends SIP INVITE to Asterisk server. Asterisk writes callee number to a special variable "CONF" that will be used to create dynamic conference and then creates file with "CONF" variable in it. File name must be unique, Call-ID is used to name this file.
After this it initiates call to "prank destination" using Dial command with specially configured "G" option. When callee party answers a call Asterisk separates caller channel from callee channel and transfers them as follows:
1) caller channel transferred to context "separator" priority 1, and from where caller transferred to context "fun1"
2) callee channel transferred to context "separator" priority 2, and from where caller transferred to context "fun2"
In context "fun1" Asterisk shares "CONF" variable with callee channel and creates dynamic MeetMe conference. Caller enters this conference.
In context "fun2" Asterisk retrieves previously shared variable "CONF" end puts callee party into conference.
In this state there is active conference with caller and callee parties in it. Sound stream from caller is not participating in this conference (muted at conference level). Starting from this state caller can inject custom sound to conference. Chrome page as WCS 4 client sends request using function "sendData" to WCS 4. It transfers object with next fields:
{operationId:"inject",
payload:
{sound: playFile,
callId: currentCall.callId
}
};
Upon receiving such request WCS 4 tries to find file with conference number that Asterisk created at call initiation. If file is not found or conference number is not present in file WCS 4 gives error to log file and nothing happens. So, to trigger sendData function client must know Call-ID of active call. This gives some sort of security. After WCS 4 has conference number it creates Asterisk call file and puts it to spool directory. Asterisk initiates call to conference number and plays requested sound using call file. When played file ends Asterisk exits from conference.
How to use sendData function
At client API level sendData function has two arguments, callId:String and sound:String.
callId – Call-ID of current active call
sound – name of custom sound. Custom sounds must be known by Asterisk. Sounds can be placed in /usr/local/asterisk/var/lib/asterisk/sounds/en directory. It is possible to use multilevel directories for custom sounds. When you need to trigger sound located at /usr/local/asterisk/var/lib/asterisk/sounds/en with sound name all-circuits-busy-now.wav you need to pass:
sound = “all-circuits-busy-now”
If sound located at usr/local/asterisk/var/lib/asterisk/sounds/en/mysounds/taxes/you-have-new-bill.wav you need to pass:
sound =”mysounds/taxes/you-have-new-bill”
Dependencies
1) WCS 4 client API from branch "wcs4_opus"
http://flashphoner.com/downloads/builds/WCS/4.0/x8664/wcs4_opus/
2) Custom WCS4PrankCallsHandler with sendData method
3) Asterisk with dahdi timing and MeetMe app available
Hardcoded
1) Path to file with conference number
/usr/local/asterisk/var/lib/asterisk/conferences
2) Path to asterisk spool directory
/usr/local/asterisk/var/spool/asterisk/outgoing
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
Custom Handler for WCS4
Build JAR file
You need to execute build_jar.sh in /tmp directory to build JAR-file. Output file (marcophono.jar) will be in /tmp/com/marcophono/handler/. build_jar.sh has some variables inside:
TMP_DIR="/tmp"
SRC_DIR="com/marcophono/handler"
JAVA_BIN_DIR="/usr/java/jdk1.8.0_65/bin"
All java-files should be placed in SRC_DIR. After building jar-file should be copyed to /usr/local/FlashphonerWebCallServer/lib
Deploying JAR
1. Login to server through SSH to access CLI:
ssh -p 2000 admin@localhost
password: admin
2. Update default application with "defaultApp"-name, change main class for direct calls and URL:
update app --url "http://localhost/defaultApp" -m com.flashphoner.server.client.handler.custom.WCS4PrankCallsHandler defaultApp
Create defaultApp with httpd (apache)
1. Untar /root/defaultApp.tar.gz to /var/www/html
tar -zxvf /root/defaultApp.tar.gz -C /var/www/html
2. Change credentials in /var/www/html/defaultApp/connect.json as you need:
"sipLogin" : "test",
"sipAuthenticationName" : "test",
"sipDomain" : "127.0.0.1",
"sipOutboundProxy" : "127.0.0.1",
"sipPassword" : "TopSecret",
3. Try to call from web. Go to http://144.xx.xx.xx/defaultApp/. Set SIP callee and Sound fields and click "call".
Asterisk
Asterisk installed to /usr/local/asterisk directory. Config files accessible from /etc/asterisk.
How to use sendData
Use injectSound function from /var/www/html/defaultApp/Phone-min.js
function injectSound() {
var playFile = document.getElementById('sound').value;
var data = {operationId:"inject",payload:{soundlayFile,callId:currentCall.callId}};
f.sendData(data);
}