summaryrefslogtreecommitdiff
path: root/channels/chan_jingle.c
diff options
context:
space:
mode:
authorPhilippe Sultan <philippe.sultan@gmail.com>2009-09-25 10:54:42 +0000
committerPhilippe Sultan <philippe.sultan@gmail.com>2009-09-25 10:54:42 +0000
commitb11b94a083d902018a4b0cee5af82ddad086d0fe (patch)
tree5ab153ac606077b0c90853c886a7a63aa1c25760 /channels/chan_jingle.c
parent17180120bf31f782bb2fccd3278cd9d17a43fa91 (diff)
Add JABBER_RECEIVE as a dialplan function, implement SendText in Jingle channels
JABBER_RECEIVE (along with JabberSend) makes Asterisk interact with users over XMPP to process calls. SendText can be used instead of JabberSend in the context of XMPP based voice channels (chan_gtalk and chan_jingle). (closes issue #12569) Reported by: eech55 Tested by: phsultan, asannucci, lmadsen, jtodd, maxgo Review: https://reviewboard.asterisk.org/r/88/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@220457 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_jingle.c')
-rw-r--r--channels/chan_jingle.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/channels/chan_jingle.c b/channels/chan_jingle.c
index 71113f621..1461b83c7 100644
--- a/channels/chan_jingle.c
+++ b/channels/chan_jingle.c
@@ -169,6 +169,7 @@ AST_MUTEX_DEFINE_STATIC(jinglelock); /*!< Protect the interface list (of jingle_
/* Forward declarations */
static struct ast_channel *jingle_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause);
+static int jingle_sendtext(struct ast_channel *ast, const char *text);
static int jingle_digit_begin(struct ast_channel *ast, char digit);
static int jingle_digit_end(struct ast_channel *ast, char digit, unsigned int duration);
static int jingle_call(struct ast_channel *ast, char *dest, int timeout);
@@ -190,6 +191,7 @@ static const struct ast_channel_tech jingle_tech = {
.description = "Jingle Channel Driver",
.capabilities = AST_FORMAT_AUDIO_MASK,
.requester = jingle_request,
+ .send_text = jingle_sendtext,
.send_digit_begin = jingle_digit_begin,
.send_digit_end = jingle_digit_end,
.bridge = ast_rtp_instance_bridge,
@@ -1273,6 +1275,26 @@ static int jingle_indicate(struct ast_channel *ast, int condition, const void *d
return res;
}
+static int jingle_sendtext(struct ast_channel *chan, const char *text)
+{
+ int res = 0;
+ struct aji_client *client = NULL;
+ struct jingle_pvt *p = chan->tech_pvt;
+
+
+ if (!p->parent) {
+ ast_log(LOG_ERROR, "Parent channel not found\n");
+ return -1;
+ }
+ if (!p->parent->connection) {
+ ast_log(LOG_ERROR, "XMPP client not found\n");
+ return -1;
+ }
+ client = p->parent->connection;
+ res = ast_aji_send_chat(client, p->them, text);
+ return res;
+}
+
static int jingle_digit(struct ast_channel *ast, char digit, unsigned int duration)
{
struct jingle_pvt *p = ast->tech_pvt;