I just installed an Asterisk and i would like to configure Asterisk as a SIP server relay.
I already have a SIP server but this one doesn't accept directly Web Sockets (wss) connections.
The purpose is to have a web client which use SIPJS library : (http://sipjs.com/guides/user-agent-construction/) and which will be able to make a register on sipserver A.
How do I configure sip.js and extension.conf file on asterisk to do that ?
This likely isn't the answer that you want, but, Asterisk is not a SIP proxy. It's technically a B2BUA (back-to-back user agent).
In short, that means Asterisk is always a kind-of end-point on the call.
You might try using Kamailio which can be used as a stateless relay to act as a SIP proxy, and it's rather good at it.
However, you may be able to B2BUA the call if you can both:
A: Create a trunk from Asterisk to "SIP Server A"
B: Create a client connection from SIP.js to Asterisk. Documentation available for SIP.js specifically for this.
In which case, once the call comes inbound to Asterisk from the SIP.js client, you can bridge calls using the Dial application in Asterisk to make a call to "sip server a"
For example, sip.conf:
[sipjs]
context=inbound_sipjs
; ...and the rest from sip.js documentation
[sipservera]
context=inbound_sipserver
; rest as required with your sip server
Then, in your extensions.conf, assuming an inbound call from SIP.js client:
[inbound_sipjs]
exten => _X.,1,Noop(Call from SIP.js)
same => n,Dial(SIP/sipservera/${EXTEN})
same => n,Hangup()
Related
I want to implement webrtc server in my project. I want to make my own webrtc server and deploy it in amazon server. How can I achieve this?
WebRTC is a peer-to-peer protocol so you don't need a server for this.
You will need a signaling server for session negotiation. How you'll implement this depends on the technology that you'll use - client side: polling, ajax, websockets, stomp etc and server side.
For STUN/TURN you can deploy an existing server or use RFC and develop your own from scratch.
#Adrian Ber is correct, you need a signalling server such as this one:
https://github.com/peers/peerjs-server
You can set one of these up on AWS
You'll also need some code on the client side. There is a matching javascript client library (which does most of the work) here: http://peerjs.com/
There are some examples on the peerjs web site - they either need to be run on your local machine or on https servers (browsers will no longer allow camera access over http)
Ignore the people saying that WebRTC is peer to peer only. There is no reason why you can't implement an application, run it on a server, and treat it as a 'peer' for the sake of webRTC when it is actually a server.
That said, we've looked into pulling the WebRTC implementation out of Chrome, but it is a huge task. Depending on what you want to do, you will likely only need to support a subset of WebRTC functionality (Data channel / unreliable for example if you're doing a multiplayer web game).
There might be a few implementations out there that have cropped up now, but last I checked there wasn't anything of note.
Is it possible to have Asterisk as the signaling server for WebRTC enabled mobile app. I have found that I need to create the signaling server in node.js. I was wondering whether Asterisk can do the job for me.
Also, does the WebRTC media pass through the signaling server (or) is it direct device to device media transfer.
Any help is appreciated. Thank you. :)
If you want WebRTC signal switching alone then you can use some websocket server like socket.io but it won't handle STUN or TURN.
If you want WebRTC signalling along with STUN,TURN and media recording then you can go with Kurento, Freeswitch, asterisk etc.
If you carry media over signalling server then you might consume more CPU and memory processing on server side. Try to keep peer-peer direct media to get better audio and video.
But in all these case you need to register your endpoints to the signalling server. So if you call B from A. the signalling server knows where B is!
Is it possible to have Asterisk as the signalling server for WebRTC enabled mobile app?
Of course. Just use SIP over websocket (RFC 7118). See this Asterisk WebRTC setup guide for the details. If you already have an Asterisk server, then there is no need to implement a separate signaling server in node.js.
Also, does the WebRTC media pass through the signaling server (or) is it direct device to device media transfer.
This is handled automatically by ICE. Ideally your goal should be to have as many peer to peer media as possible to minimize the server load. However in some situations a relay is required which can be the Asterisk server itself or a separate TURN server. Also make sure to set the STUN correctly (that is required for STUN to find the direct path)
It seems like you should be able to use telnet to manually make json-rpc calls. However, when I try this, I get no response at all from the server and have to shut down the telnet client. Do I need to send headers and/or somehow indicate that my input is complete?
You have a small problem: you've completely misunderstood everything!
https://en.bitcoin.it/wiki/API_reference_%28JSON-RPC%29
It says right there that it supports JSON-RPC over HTTP. Nothing at all about JSON-RPC over plain TCP (what you're calling "Telnet" protocol).
You say "It seems like you should be able to use telnet to manually make json-rpc calls" but you don't mention how you came to this conclusion.
JSON-RPC is typically implemeted over HTTP, but can be implemented over plain TCP, websockets, or any bi-directional internet protocol. That being said, the overwhelming majority of JSON-RPC server implementations expose their APIs via JSON-RPC over HTTP.
As others have mentioned, you can talk HTTP from a telnet client and the payload of that conversation can be JSON-RPC.... if you know how. Just because you can doesn't meant you should.
I have a project that will let you host a Json-Rpc server over telnet if you like. It doesn't come with telnet support built in, but it would be trivial to host it over telnet. See the console hosting example and just replace the console with a telnet server.
http://jsonrpc2.codeplex.com/
I read that WebRTC uses relay servers, if the direct peer connection doesn't work because of firewalls.
Is there a way to check, if this is the case?
When you establishing WebRTC connection, you set STUN and/or TURN for a web browser to use. If you informed a web browser with the both options, web browser will start trying to use STUN first. Then, in case of unsuccess it will try to use TURN.
The 'relay server' is a TURN-server.
As I know, there is no standard way to know out which option a web browser decided to use: STUN or TURN.
In other hand, if you're the owner of TURN server, you can see whether web client does use it or not, and then send this information to the client.
UPDATED
This is my code: https://github.com/fycth/webrtcexample/blob/master/www/js/rtc_lib.js
You can see there I use just STUN server, so it is p2p or nothing, and no relay.
In chrome. go to chrome://webrtc-internals, go to succeeded connection-googCandidate pair(in black letters) check if googLocalcandidatetype is relay, then webrtc uses relay connection . If googLocalcandidatetype is local, then it uses peer to peer connection
In firefox, go to about:webrtc, if the succeeded connection contains any candidate as relayed-udp, then webrtc uses relay connection
Not sure if i'm really up-to-date, but i'm looking in a way to convert my existing project to use HTML5 websockets.
Here's my situation :
- Client runs a modified java vnc applet with extra parameter (CONNECT).
- Modified stunnel listenin on webserver (with both public, private IP) port 443
- Client connects to 443 and sends (prior to RFB) a HTTP packet like :
'CONNECT 10.0.0.1:4001'
- Stunnel opens a new stream to 10.0.0.1:4001 using SSL wrapper
- VNC Server (#10.0.0.1:4001) responds, connection is established.
Now I want to get rid of the Java Applet and switch to Websocket using NoVNC.
I want to be able to :
- Open a single port on the webserver (HTTPS preferably)
- Have client connect using HTML5 only (no more java applet)
I cannot change :
- VNCServer will still be listening on private LAN only.
- VNCServer will still listen to a bunch of ports, each corresponding to
a virtual server
Questions are :
- How to give NoVNC the notion of target HOST:PORT ?
- Is stunnel still be usable ? Or should I change to websocket proxy ?
If anyone has a starting point, i'd really appreciate !
Disclaimer: I created noVNC so my answer may be heavily biased ;-)
I'll answer you second question first:
stunnel cannot be used directly by noVNC. The issue is that the WebSockets protocol has an HTTP-like initial handshake and the messages are framed. In addition, until binary payload support is added to WebSockets, the payload is base64 encoded by the websockets proxy (websockify). Adding the necessary support to stunnel would be non-trivial but certainly doable. In fact noVNC issue #37 is an aspirational feature to add this support to stunnel.
First question:
noVNC already has a concept of HOST:PORT via the RFB.connect(host, port, password) method. The file vnc_auto.html at the top level shows how to get noVNC to automatically connect on page load based on the host, port and password specified as URL query string parameters.
However, I think what you are really asking is how do you get noVNC to connect to alternate VNC server ports on the backend. This problem is not directly addressed by noVNC and websockify. There are several ways to solve this and it usually involves an out-of-band setup/authorization mechanism so that the proxy can't be used to launch attacks by arbitrary hosts. For example, at my company we have a web based management framework that integrates noVNC and when the user wants to connect to the console, an authenticated AJAX call is used to configure the proxy for that particular user and the system they want to connect to. Our web management interface is internal only.
Ganeti Web Manager uses a similar model and the source is available. They have a fork of VNCAuthProxy that has WebSockets support. They use a control channel from the web interface to the VNCAuthProxy to setup a temporary password associated with a specific VNC server host:port.
Also OpenStack (Nova) integrates noVNC uses a similar out-of-band token based model to allow access with their nova-vncproxy.
Some links:
Ganeti Web Manager
Wiki page about how noVNC works in Ganeti Web Manager
Ganeti Web Manager sources
Ganeti Web Manager VNCAUthProxy sources
Using noVNC in Nova/OpenStack
OpenStack fork of noVNC
Old nova-vnc-proxy code
Current nova vnc proxy code