include "logger.h" and errno.h from asterisk.h - usage shows that they
[asterisk/asterisk.git] / channels / chan_jingle.c
index 37c7e69..f8072fd 100644 (file)
 /*** MODULEINFO
        <depend>iksemel</depend>
        <depend>res_jabber</depend>
-       <use>gnutls</use>
+       <use>openssl</use>
  ***/
 
 #include "asterisk.h"
 
 ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
 #include <sys/socket.h>
-#include <errno.h>
 #include <fcntl.h>
 #include <netdb.h>
 #include <netinet/in.h>
@@ -51,19 +46,12 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #include <iksemel.h>
 #include <pthread.h>
 
-#ifdef HAVE_GNUTLS
-#include <gcrypt.h>
-GCRY_THREAD_OPTION_PTHREAD_IMPL;
-#endif /* HAVE_GNUTLS */
-
 #include "asterisk/lock.h"
 #include "asterisk/channel.h"
 #include "asterisk/config.h"
-#include "asterisk/logger.h"
 #include "asterisk/module.h"
 #include "asterisk/pbx.h"
 #include "asterisk/options.h"
-#include "asterisk/lock.h"
 #include "asterisk/sched.h"
 #include "asterisk/io.h"
 #include "asterisk/rtp.h"
@@ -203,7 +191,7 @@ static int jingle_get_codec(struct ast_channel *chan);
 static const struct ast_channel_tech jingle_tech = {
        .type = "Jingle",
        .description = "Jingle Channel Driver",
-       .capabilities = ((AST_FORMAT_MAX_AUDIO << 1) - 1),
+       .capabilities = AST_FORMAT_AUDIO_MASK,
        .requester = jingle_request,
        .send_digit_begin = jingle_digit_begin,
        .send_digit_end = jingle_digit_end,
@@ -345,10 +333,7 @@ static int jingle_accept_call(struct jingle *client, struct jingle_pvt *p)
                                continue;
                        if (alreadysent & pref_codec)
                                continue;
-                       if (pref_codec <= AST_FORMAT_MAX_AUDIO)
-                               add_codec_to_answer(p, pref_codec, dcodecs);
-                       else
-                               add_codec_to_answer(p, pref_codec, dcodecs);
+                       add_codec_to_answer(p, pref_codec, dcodecs);
                        alreadysent |= pref_codec;
                }
                payload_red = iks_new("payload-type");
@@ -377,7 +362,7 @@ static int jingle_accept_call(struct jingle *client, struct jingle_pvt *p)
                iks_insert_node(dcodecs, payload_audio);
                iks_insert_node(dcodecs, payload_cn);
 
-               iks_send(c->p, iq);
+               ast_aji_send(c, iq);
                iks_delete(payload_red);
                iks_delete(payload_audio);
                iks_delete(payload_cn);
@@ -478,7 +463,7 @@ static int jingle_response(struct jingle *client, ikspak *pak, const char *reaso
                                iks_insert_node(response, error);
                        }
                }
-               iks_send(client->connection->p, response);
+               ast_aji_send(client->connection, response);
                if (reason)
                        iks_delete(reason);
                if (error)
@@ -734,7 +719,7 @@ static int jingle_create_candidates(struct jingle *client, struct jingle_pvt *p,
                }
                iks_insert_attrib(candidate, "ufrag", tmp->ufrag);
 
-               iks_send(c->p, iq);
+               ast_aji_send(c, iq);
        }
        p->laststun = 0;
 
@@ -920,7 +905,7 @@ static int jingle_action(struct jingle *client, struct jingle_pvt *p, const char
 
                        iks_insert_node(iq, jingle);
 
-                       iks_send(client->connection->p, iq);
+                       ast_aji_send(client->connection, iq);
                        iks_delete(jingle);
                        res = 0;
                }
@@ -1129,7 +1114,7 @@ static int jingle_add_candidate(struct jingle *client, ikspak *pak)
        iks_insert_attrib(receipt, "from", c->jid->full);
        iks_insert_attrib(receipt, "to", iks_find_attrib(pak->x, "from"));
        iks_insert_attrib(receipt, "id", iks_find_attrib(pak->x, "id"));
-       iks_send(c->p, receipt);
+       ast_aji_send(c, receipt);
        iks_delete(receipt);
 
        return 1;
@@ -1292,7 +1277,7 @@ static int jingle_digit(struct ast_channel *ast, char digit, unsigned int durati
        } else if (ast->dtmff.frametype == AST_FRAME_DTMF_END || duration != 0) {
                iks_insert_attrib(dtmf, "action", "button-up");
        }
-       iks_send(client->connection->p, iq);
+       ast_aji_send(client->connection, iq);
        iks_delete(iq);
        iks_delete(jingle);
        iks_delete(dtmf);
@@ -1359,7 +1344,7 @@ static int jingle_transmit_invite(struct jingle_pvt *p)
        iks_insert_node(jingle, content);
        iks_insert_node(iq, jingle);
 
-       iks_send(client->p, iq);
+       ast_aji_send(client, iq);
 
        iks_delete(iq);
        iks_delete(jingle);
@@ -1804,10 +1789,6 @@ static int jingle_load_config(void)
 /*! \brief Load module into PBX, register channel */
 static int load_module(void)
 {
-#ifdef HAVE_GNUTLS     
-        gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread);
-#endif /* HAVE_GNUTLS */
-
        ASTOBJ_CONTAINER_INIT(&jingle_list);
        if (!jingle_load_config()) {
                ast_log(LOG_ERROR, "Unable to read config file %s. Not loading module.\n", JINGLE_CONFIG);