Opening a socket and sending/receiving plain text

Hi everyone, just started developing using the api. I was wondering what class I should be using to open a TCP connection to a remote host, and exchanging plain text to and from that host. I was having a look at the netrequest object, but it seems to be for http requests. If anyone has a hint on where I should start digging it would be much appreiciated.

thanks in advance

Hi wallnut,

There are only two ways for an app to communicate with outside servers and neither of them allow you to open direct sockets.

NetRequest is the one that users will be most familiar. Like browsers before the advent of WebSockets, you can use long polling to simulate socket-like communications.

The other way to communicate with a server is to use pbx.request to send SIP messages that, if you’re using Asterisk, you can then pass over AMI to your custom server application. See the section Custom Applications and the DPMA on the Custom Phone Applications with DPMA page for an example.


Thanks Shaun, I will look that up and do a few tests.