diff options
author | defanor <defanor@uberspace.net> | 2021-10-13 22:03:49 +0300 |
---|---|---|
committer | defanor <defanor@uberspace.net> | 2021-10-13 22:52:44 +0300 |
commit | 2e667698024e85fe1a9ae44181af9e38141176eb (patch) | |
tree | 0ed19b48b792fdf7f5ac14d569e5f7cd978adbd6 /src/rexmpp_console.c | |
parent | f2ef0cf34d32e26c45004a5f2bd57380c15c720d (diff) |
Implement Jingle RTP sessions with ICE-UDP and DTLS-SRTP
Works with Dino and Conversations, but currently relying on external
players and streamers for actual audio playback and capture.
For now requiring GnuTLS and libnice for calls; OpenSSL should be
supported as an alternative to the former, and the latter should be
made optional, maybe with libjuice as an alternative.
Diffstat (limited to 'src/rexmpp_console.c')
-rw-r--r-- | src/rexmpp_console.c | 44 |
1 files changed, 41 insertions, 3 deletions
diff --git a/src/rexmpp_console.c b/src/rexmpp_console.c index 397e603..f2d748f 100644 --- a/src/rexmpp_console.c +++ b/src/rexmpp_console.c @@ -301,8 +301,12 @@ void rexmpp_console_feed (rexmpp_t *s, char *str, ssize_t str_len) { "subscription approve <jid>\n" "subscription deny <jid>\n" "http-upload <file path>\n" + "jingle terminate <sid>\n" + "jingle decline <sid>\n" "jingle accept-file <sid> <file path>\n" "jingle send-file <jid> <file path>\n" + "jingle accept-call <sid> <in port> <out port>\n" + "jingle call <jid> <in port> <out port>\n" ; if (! strcmp(word, "help")) { @@ -566,14 +570,48 @@ void rexmpp_console_feed (rexmpp_t *s, char *str, ssize_t str_len) { if (word == NULL) { return; } - if (! strcmp(word, "accept-file")) { + if (! strcmp(word, "terminate")) { + char *sid = strtok_r(NULL, " ", &words_save_ptr); + if (sid != NULL) { + rexmpp_jingle_session_terminate(s, sid, + rexmpp_xml_new_node("success", + "urn:xmpp:jingle:1"), + NULL); + } + } else if (! strcmp(word, "decline")) { + char *sid = strtok_r(NULL, " ", &words_save_ptr); + if (sid != NULL) { + rexmpp_jingle_session_terminate(s, sid, + rexmpp_xml_new_node("decline", + "urn:xmpp:jingle:1"), + NULL); + } + } else if (! strcmp(word, "accept-file")) { char *sid = strtok_r(NULL, " ", &words_save_ptr); char *fpath = strtok_r(NULL, " ", &words_save_ptr); - rexmpp_jingle_accept_file_by_id(s, sid, fpath); + if (sid != NULL && fpath != NULL) { + rexmpp_jingle_accept_file_by_id(s, sid, fpath); + } } else if (! strcmp(word, "send-file")) { char *jid = strtok_r(NULL, " ", &words_save_ptr); char *fpath = strtok_r(NULL, " ", &words_save_ptr); - rexmpp_jingle_send_file(s, jid, fpath); + if (jid != NULL && fpath != NULL) { + rexmpp_jingle_send_file(s, jid, fpath); + } + } else if (! strcmp(word, "accept-call")) { + char *sid = strtok_r(NULL, " ", &words_save_ptr); + char *port_in = strtok_r(NULL, " ", &words_save_ptr); + char *port_out = strtok_r(NULL, " ", &words_save_ptr); + if (sid != NULL && port_in != NULL && port_out != NULL) { + rexmpp_jingle_call_accept(s, sid, atoi(port_in), atoi(port_out)); + } + } else if (! strcmp(word, "call")) { + char *jid = strtok_r(NULL, " ", &words_save_ptr); + char *port_in = strtok_r(NULL, " ", &words_save_ptr); + char *port_out = strtok_r(NULL, " ", &words_save_ptr); + if (jid != NULL && port_in != NULL && port_out != NULL) { + rexmpp_jingle_call(s, jid, atoi(port_in), atoi(port_out)); + } } } } |