Open johanseld opened 1 year ago
This error means that asterlink failed to start http api on address specified in endpoint_addr
.
It may be that port 5678 is already taken or IP doesn't belong to server where asterlink is starting.
I.e. you should specify 172.16.34.21:5678
, if you start asterlink on the same server with asterisk.
Also note that in order for popup card to work 172.16.34.21:5678
must be accessibly by user's browser.
I'm so confused about documentation.
what is the endpoint_addr
? It´s the server where are installed Asterlink, PBX Server or SuiteCRM Module
.
endpoint_addr
in conf.yml is listen address for asterlink's HTTP api web server. You can specify 0.0.0.0:5678
so asterlink will be accessibly on 5678 tcp port on every IP addresses of a server.
Endpoint URL
in suitecrm module settings is address of asterlink. SuiteCRM and user's web browser will connect to asterlink using this address.
If you start asterlink with endpoint_addr: 0.0.0.0:5678
on server with IP 172.16.34.21, then in suitecrm module settings you must specify 172.16.34.21:5678
.
I'll try to make it more clear and easy to install in furuther releases.
Thank you.
ProxyPass "/asterlink/ws/" "ws://my_endpoint_addr:my_endpoint_port/ws/" ProxyPass "/asterlink/" "http://my_endpoint_addr:my_endpoint_port/"
Where are the location "DocumentRoot" [/asterlink/ws/ & /asterlink/"] to configure the proxypass?
ProxyPass "/asterlink/ws/" "ws://172.16.34.21:5678/ws/"
ProxyPass "/asterlink/" "http://172.16.34.21:5678/"
It's apache2 config. Usually located at /etc/httpd/conf/httpd.conf or /etc/apache2/apache2.conf.
ProxyPass can also be put inside <VirtualHost>
config (/etc/apache2/sites-available/000-default.conf etc.) for suitecrm, if you have one.
Also For ProxyPass to work following modules need to be enabled first: mod_proxy, mod_proxy_http, mod_proxy_wstunnel.
For Ubuntu execute following commands:
a2enmod proxy
a2enmod proxy_http
a2enmod proxy_wstunnel
Or simply uncomment them in httpd.conf (or apache2.conf) file:
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so
LoadModule proxy_http_module modules/mod_proxy_http.so
Then you can update suitecrm module settings to use proxy:
Endpoint URL: http://172.16.34.23/asterlink
WebSocket URL: ws://172.16.34.23/asterlink
I can be sure that what I do. I'll do the proxypass configuration in the server where I installed Asterlink or SuiteCRM Module?
On the SuiteCRM web-server. So, user will be able to reach asterlink via suitecrm webserver.
On the SuiteCRM Web-server, I configured the Proxy_pass but when tying to access from the SuiteCRM Web-server to http://myasterlink.myserver.lan:5678/asterlink give an error :404 page not found
.
server {
listen 80;
server_name myasterlink.myserver.lan;
}
location /asterlink/ {
proxy_pass http://172.16.34.21:5678/;
proxy_redirect off;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header Host "myasterlink.myserver.lan";
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
}
give an error :404 page not found
That's ok, 404 page not found
is from asterlink (if you access http://172.16.34.21:5678/ you will get same result).
At this point you should have click2call working.
For popup card you will also need to setup ws proxy.
Place it above location /asterlink/
:
location /asterlink/ws/ {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
# enable WebSockets
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://172.16.34.21:5678;
}
SuiteCRM Module config:
http://myasterlink.myserver.lan/asterlink
ws://myasterlink.myserver.lan//asterlink
Also, those location rules are recommended to be placed inside nginx config for suitecrm. Overall it could look like this:
But it's also fine to use subdomain.
after setup setup ws proxy:
ws.js?v=wGrHdMwUNY-5ft4YcYeuoA:5 WebSocket connection to 'ws://myasterlink.myserver.lan/asterlink/ws/?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6IjEifQ.6hgFFl6riTZ6FYY0NITbyhpnP_D-tOxS3bHo-MJrnbM' failed:
alWs @ ws.js?v=wGrHdMwUNY-5ft4YcYeuoA:5 "http://172.16.34.23/modules/AsterLink/javascript/ws.js?v=wGrHdMwUNY-5ft4YcYeuoA"
Here is correct proxy configuration (note the trailing / for proxy_pass):
location /asterlink/ws/ {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
# enable WebSockets
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass http://172.16.34.21:5678/ws/;
}
location /asterlink/ {
proxy_pass http://172.16.34.21:5678/;
proxy_redirect off;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header Host "myasterlink.myserver.lan";
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
}
The same error:
ws.js?v=wGrHdMwUNY-5ft4YcYeuoA:5 WebSocket connection to 'ws://myasterlink.myserver.lan/asterlink/ws/?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpZCI6IjEifQ.6hgFFl6riTZ6FYY0NITbyhpnP_D-tOxS3bHo-MJrnbM' failed:
alWs @ ws.js?v=wGrHdMwUNY-5ft4YcYeuoA:5
Is it still fails because of "404" ? Please check network tab on browser developer tools, it should show requests to myasterlink.myserver.lan.
Does click2call work ?
From the suitecrm server (172.16.34.23):
Can you show /asterlink/ws request ? Select "WS" on network tab to filter. If it shows 403, then make sure that "endpoint_token" in conf.yml and "Token" in suitecrm module settings are both the same.
Also please show "Console" tab.
I exclude the servers to use proxy and now I don´t see any issues on browser developer tools.
I would like to thank you in advance for your support.
When I call to 478XXXXXX from SuiteCRM (my extension "2002") on my softphone I receive the call from my extension and when accept the incoming call the call going out.
My conf.yml
dialplan:
dial_context: from-internal
ext_context:
- macro-dial-one
- macro-dial
incoming_context:
- from-pstn
outgoing_context:
- macro-dialout-trunk
log_level: trace
suitecrm:
endpoint_addr: "0.0.0.0:5678"
endpoint_token: my_endpoint_token
url: "http://172.16.34.23/"
extensions_custom.conf
[assigned]
exten => 2002,1,Set(ASSIGNED=${CURL(http://172.16.34.23/asterlink/assigned/${UNIQUEID})})
exten => 2002,n,GotoIf($[${ASSIGNED}]?from-did-direct,${ASSIGNED},1)
exten => 2002,n,Goto(ext-queues,400,1)
exten => 2002,n,Hangup
extensions_additional.conf
exten => 2002,1,Set(__RINGTIMER=${IF($["${DB(AMPUSER/2002/ringtimer)}" > "0"]?${DB(AMPUSER/2002/ringtimer)}:${RINGTIMER_DEFAULT})})
exten => 2002,n,ExecIf($["${REGEX("from-queue" ${CHANNEL})}"="1" && "${CONTEXT}"="from-internal-xfer"]?Set(__CWIGNORE=))
exten => 2002,n,Macro(exten-vm,novm,2002,0,0,0)
exten => 2002,n(dest),Set(__PICKUPMARK=)
exten => 2002,n,GotoIf($["${IVR_CONTEXT}" != ""]?${IVR_CONTEXT},return,1)
exten => 2002,hint,PJSIP/2002&Custom:DND2002,CustomPresence:2002
When I call to 478XXXXXX from SuiteCRM (my extension "2002") on my softphone I receive the call from my extension and when accept the incoming call the call going out.
Yes, that how click2call is supposed to work. First it calls operator extension and on accept it calls clicked number. I see that popup card's also working, meaning that asterlink's successfully configured.
Yes, that how click2call is supposed to work. First it calls operator extension and on accept it calls clicked number. I see that popup card's also working, meaning that asterlink's successfully configured.
Yes, the outgoing call working but incoming call not. When the call operator receiving a call I can not see the popup card´s.
When the call operator receiving a call I can not see the popup card´s.
Does incoming call register in suitecrm's "call log" ? If not, check incoming context, it should match trunk's context.
For chan_sip it's context=
line in incoming settings, for chan_pjsip it's Context
on "pjsip Settings" tab. Usually it's from-pstn
or from-trunk
.
does incoming call register in suitecrm's "call log"
not, I chek the incoming context and its the same in trunks context "from-trunk".
trunks context "from-trunk".
You need to update incoming_context
to from_trunk
in conf.yml:
dialplan:
dial_context: from-internal
ext_context:
- macro-dial-one
- macro-dial
incoming_context:
- from-trunk
outgoing_context:
- macro-dialout-trunk
log_level: trace
suitecrm:
endpoint_addr: "0.0.0.0:5678"
endpoint_token: my_endpoint_token
url: "http://172.16.34.23/"
My conf.yml have this configuration.
dialplan:
dial_context: from-internal
ext_context:
- macro-dial-one
- macro-dial
incoming_context:
- from-trunk
outgoing_context:
- macro-dialout-trunk
log_level: trace
suitecrm:
endpoint_addr: "0.0.0.0:5678"
endpoint_token: my_endpoint_token
url: "http://172.16.34.23/"
FW Console - FreePBX Utility 16.0.21.18 Asterisk 19.5.0 built by mockbuild @ jenkins7 on a x86_64 running Linux on 2022-07-07 06:25:53 UTC Server IP:172.16.34.21
SuiteCRM Version 7.12.7 Sugar Version 6.5.25 (Build 344) Server IP:172.16.34.23
When I used the command ./Asterlink I am getting the following message error: