I want to set up the click2call app

Discussion in 'Web Call Server 4' started by Stanislav, Nov 5, 2015.

  1. Stanislav

    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: Nov 5, 2015
  2. Max

    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
    f.connect({urlServer: "ws://", appKey: "click2call"});
    f.connect({urlServer: "ws://", appKey: "defaultApp", sipLogin:"mylogin", sipPassword:"mypassword", sipDomain:"mysipdomain"});
    Here should be your WCS host IP.
    Then Replace
    call.callee = "override_by_rest";
    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.
    Stanislav likes this.
  3. Max

    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
    admin defaultApp        defaultApp        1  http://localhost:9091/EchoApp
    >add app click2call click2call http://my-web-server/rest
    click2call - is appKey which should be used in
    f.connect({urlServer: "ws://", 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:
    "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:
    You can customize it for testing.
    Please read more documentation how to manage applications and REST methods.
    Command Line Interface
    and Call Flow
    Stanislav likes this.

Share This Page