drachtio-server icon indicating copy to clipboard operation
drachtio-server copied to clipboard

Document the server control protocol

Open tomponline opened this issue 6 years ago • 5 comments

Hi would be interested in controlling the Dachtio server via a non NodeJS control plane (such as Golang). Such as https://github.com/tomponline/fsclient

Is there any documentation for the control protocol used by the Dachtio server?

Thanks!

tomponline avatar Jul 11 '18 14:07 tomponline

That's an interesting idea! I don't have any documentation readily at hand, but it would not be too difficult for me to put something together. I will see if I can find some time in the next few days to scratch something together for you. Its a pretty simple utf8-based message protocol over tcp.

davehorton avatar Jul 11 '18 14:07 davehorton

Nice one thanks!

tomponline avatar Jul 11 '18 14:07 tomponline

Still looking at putting some notes together on this, but note that is is possible to generate a trace file of all messaging between the client and the server by setting a property on the Srf instance, e.g.:

const Srf = require('drachtio-srf');
const srf = new Srf();

// this will cause all messages between client and server to be logged to a file
srf.set('api logger', '/tmp/messages.log');

That would help you see exactly what is exchanged. Still, some overview of things will be needed and I hope to post something on the web site or blog in the next few days on that

davehorton avatar Jul 15 '18 14:07 davehorton

I've started some documentation here:

https://drachtio.org/docs/drachtio-server#messaging-protocol

Have a look and let me know if this is along the lines of what you are looking for. It is a work in progress, but I will try to add more information as I find time (though I probably wont have much time this week or next)

davehorton avatar Jul 15 '18 16:07 davehorton

I hate to dig up an old issue, but since it's open.

I've attempted to enable full message logging with

srf.set('api logger', '/tmp/messages.log');

But I have not seen the file outputted to /tmp. The app which I am attempting to capture is the conf-tester which is running on my host machine. The Drachtio server is running in docker with the following command:

docker run -d -p "9022:9022" -v $HOME/Downloads/drachtio.conf.xml:/etc/drachtio.conf.xml  drachtio/drachtio-server:latest

~~The reason that I am trying to get this message log is that the messaging-protocol docs, linked above, do not seem to be accurate / consistent. When sending an authenticate packet 56#fc58b88f-6ab0-49da-acf2-dd42c8a01a5a|authenticate|cymru| I get the following response:~~

2020-03-03 11:18:45.481364 ClientController::accept_handler_tcp - got connection
2020-03-03 11:18:45.481435 Client::start - Received connection from client at 172.17.0.1:50386
2020-03-03 11:18:45.481484 ClientController::join - Added client, count of connected clients is now: 1
2020-03-03 11:18:45.481515 ClientController::start_accept_tcp
2020-03-03 11:18:45.481941 Client::read_handler client sent invalid message -- JSON message length not specified properly
2020-03-03 11:18:45.481976 ClientController::leave - Removed client, count of connected clients is now: 0
2020-03-03 11:18:45.482044 BaseClient::~BaseClient

~~Looking at the messaging-protocol docs the Authenticate example terminates with a | character, yet the Invite example does not. I feel that I have tried each combination of pipes, CLRFs I that I can think of to no success.~~


@tomponline I am very interested in a Go library for Drachtio. However I don't see a public repo on your GitHub for it, and I am wondering if you ever got to make any progress on it?

IdlePhysicist avatar Mar 03 '20 11:03 IdlePhysicist