I want to set up the click2call app

Stanislav

New Member
I'm trying to setup click2call simple app but all I get in the console is FAILED and DISCONNECT. I fill the info in accont.xml and callee.xml ( where I put my whole number "+3598.....").
After the page sends a request it gets
{"message":"fail","data":[{"status":"FAILED","info":"App not found","apiMethod":"ConnectionStatusEvent"}]}
 
Last edited:

Max

Administrator
Staff member
You can get some examples here
To get this working try the simple way:
1. Open examples/min/Click-to-Call-min.html and examples/min/Click-to-Call-min.js files
You can find these files in the WCS Client package
2. Edit js file
Replace
Code:
f.connect({urlServer: "ws://192.168.1.5:8080", appKey: "click2call"});
with
Code:
f.connect({urlServer: "ws://192.168.1.5:8080", appKey: "defaultApp", sipLogin:"mylogin", sipPassword:"mypassword", sipDomain:"mysipdomain"});
Here 192.168.1.5 should be your WCS host IP.
Then Replace
Code:
call.callee = "override_by_rest";
with
Code:
call.callee = "+3598...";
It is your phone number.
So the click-to-call link should work now as a simple phone without dial-pad.
In the next post I will describe how to setup security and keep SIP credentials on server-side.
 

Max

Administrator
Staff member
In fact Click-to-Call-min.js with changes described above is very similar to Phone-min.js that you can find in the same directory examples/min.
To secure SIP credentials you have to create REST application.
On server
ssh -p 2000 admin@localhost
>
password admin
>show apps
Code:
admin defaultApp        defaultApp        1  http://localhost:9091/EchoApp
>add app click2call click2call http://my-web-server/rest
Here
click2call - is appKey which should be used in
Code:
f.connect({urlServer: "ws://192.168.1.5:8080", appKey: "click2call"});
>add app-rest-methods -a click2call
This means your HTTP url returns correct JSON for all REST methods: http://my-web-server/rest/connect, http://my-web-server/rest/call, etc.
By default it can be 'echo' JSON returning the same data as received.
You can also add 'connect' method only:
>add app-rest-method connect click2call

When WCS receives connection with appKey "click2call" it will send REST/HTTP request to your web application: http://my-web-server/rest/connect and your HTTP server should return 200 OK with response JSON body like this:
Code:
{
"sipRegisterRequired": true,

"sipLogin": "WCS1",

"sipAuthenticationName": "WCS1",

"sipDomain": "sip.org",

"sipOutboundProxy": "sip.org",

"sipPassword": "12345",

"sipPort": 5060
}
Thus these SIP credentials returned by server will be used for call.

Here you can find REST app example with PHP code:
http://flashphoner.com/downloads/REST_application_PHP_example.zip
You can customize it for testing.
Please read more documentation how to manage applications and REST methods.
http://flashphoner.com/docs/wcs4/wcs_docs/html/en/wcs-admin-guide/
Command Line Interface
and Call Flow
http://flashphoner.com/docs/wcs4/wcs_docs/html/en/wcs-call-flow/
 
Top