diff options
author | Philippe Sultan <philippe.sultan@gmail.com> | 2009-09-25 10:54:42 +0000 |
---|---|---|
committer | Philippe Sultan <philippe.sultan@gmail.com> | 2009-09-25 10:54:42 +0000 |
commit | b11b94a083d902018a4b0cee5af82ddad086d0fe (patch) | |
tree | 5ab153ac606077b0c90853c886a7a63aa1c25760 /channels | |
parent | 17180120bf31f782bb2fccd3278cd9d17a43fa91 (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')
-rw-r--r-- | channels/chan_gtalk.c | 21 | ||||
-rw-r--r-- | channels/chan_jingle.c | 22 |
2 files changed, 43 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); 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; |