diff options
author | phsultan <phsultan@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-09-25 10:54:42 +0000 |
---|---|---|
committer | phsultan <phsultan@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-09-25 10:54:42 +0000 |
commit | 5bec5836a0eca318b6211aaa7a36e20df1c3e978 (patch) | |
tree | 5ab153ac606077b0c90853c886a7a63aa1c25760 /channels/chan_gtalk.c | |
parent | d170b913b97407d19f6443144b8b4c00852b09b1 (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: http://svn.digium.com/svn/asterisk/trunk@220457 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_gtalk.c')
-rw-r--r-- | channels/chan_gtalk.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/channels/chan_gtalk.c b/channels/chan_gtalk.c index a0cc42408..25fdc2c63 100644 --- a/channels/chan_gtalk.c +++ b/channels/chan_gtalk.c @@ -168,6 +168,7 @@ AST_MUTEX_DEFINE_STATIC(gtalklock); /*!< Protect the interface list (of gtalk_pv /* Forward declarations */ static struct ast_channel *gtalk_request(const char *type, int format, const struct ast_channel *requestor, void *data, int *cause); static int gtalk_digit(struct ast_channel *ast, char digit, unsigned int duration); +static int gtalk_sendtext(struct ast_channel *ast, const char *text); static int gtalk_digit_begin(struct ast_channel *ast, char digit); static int gtalk_digit_end(struct ast_channel *ast, char digit, unsigned int duration); static int gtalk_call(struct ast_channel *ast, char *dest, int timeout); @@ -191,6 +192,7 @@ static const struct ast_channel_tech gtalk_tech = { .description = "Gtalk Channel Driver", .capabilities = AST_FORMAT_AUDIO_MASK, .requester = gtalk_request, + .send_text = gtalk_sendtext, .send_digit_begin = gtalk_digit_begin, .send_digit_end = gtalk_digit_end, .bridge = ast_rtp_instance_bridge, @@ -1499,6 +1501,25 @@ static int gtalk_indicate(struct ast_channel *ast, int condition, const void *da return res; } +static int gtalk_sendtext(struct ast_channel *chan, const char *text) +{ + int res = 0; + struct aji_client *client = NULL; + struct gtalk_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 gtalk_digit_begin(struct ast_channel *chan, char digit) { return gtalk_digit(chan, digit, 0); |