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
This commit is contained in:
Philippe Sultan
2009-09-25 10:54:42 +00:00
parent 17180120bf
commit b11b94a083
7 changed files with 720 additions and 136 deletions

View File

@@ -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;