diff options
author | Joshua Colp <jcolp@digium.com> | 2012-07-16 12:35:04 +0000 |
---|---|---|
committer | Joshua Colp <jcolp@digium.com> | 2012-07-16 12:35:04 +0000 |
commit | e9387375700a1b3e78ce44af0495aefe29c6d2a4 (patch) | |
tree | b46a8344ac5fbb5266e879a8e4409e28a737e327 /res/res_http_websocket.c | |
parent | f9c3585d7312e65bda96755fbb8dab21fe54bcd5 (diff) |
Add support for SIP over WebSocket.
This allows SIP traffic to be exchanged over a WebSocket connection which is useful for rtcweb.
Review: https://reviewboard.asterisk.org/r/2008
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370072 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_http_websocket.c')
-rw-r--r-- | res/res_http_websocket.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/res/res_http_websocket.c b/res/res_http_websocket.c index db98ca7d6..c5fcdeeee 100644 --- a/res/res_http_websocket.c +++ b/res/res_http_websocket.c @@ -267,6 +267,23 @@ int ast_websocket_is_secure(struct ast_websocket *session) return session->secure; } +int ast_websocket_set_nonblock(struct ast_websocket *session) +{ + int flags; + + if ((flags = fcntl(session->fd, F_GETFL)) == -1) { + return -1; + } + + flags |= O_NONBLOCK; + + if ((flags = fcntl(session->fd, F_SETFL, flags)) == -1) { + return -1; + } + + return 0; +} + int ast_websocket_read(struct ast_websocket *session, char **payload, uint64_t *payload_len, enum ast_websocket_opcode *opcode, int *fragmented) { char buf[MAXIMUM_FRAME_SIZE] = ""; |