finish cleaning up some more stuff before russell
gets a chance to. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@29708 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
parent
a20db7dde6
commit
5d51260c36
|
@ -184,8 +184,6 @@ static const struct ast_channel_tech jingle_tech = {
|
||||||
.capabilities = ((AST_FORMAT_MAX_AUDIO << 1) - 1),
|
.capabilities = ((AST_FORMAT_MAX_AUDIO << 1) - 1),
|
||||||
.requester = jingle_request,
|
.requester = jingle_request,
|
||||||
.send_digit = jingle_digit,
|
.send_digit = jingle_digit,
|
||||||
// .devicestate = jingle_devicestate,
|
|
||||||
// .transfer = jingle_transfer,
|
|
||||||
.bridge = ast_rtp_bridge,
|
.bridge = ast_rtp_bridge,
|
||||||
.call = jingle_call,
|
.call = jingle_call,
|
||||||
.hangup = jingle_hangup,
|
.hangup = jingle_hangup,
|
||||||
|
@ -255,7 +253,6 @@ static struct jingle *find_jingle(char *name, char *connection)
|
||||||
|
|
||||||
static void add_codec_to_answer(const struct jingle_pvt *p, int codec, iks *dcodecs)
|
static void add_codec_to_answer(const struct jingle_pvt *p, int codec, iks *dcodecs)
|
||||||
{
|
{
|
||||||
ast_verbose("Adding codec 0x%x (%s) to SDP\n", codec, ast_getformatname(codec));
|
|
||||||
if (!strcasecmp("ulaw", ast_getformatname(codec))) {
|
if (!strcasecmp("ulaw", ast_getformatname(codec))) {
|
||||||
iks *payload_eg711u, *payload_pcmu;
|
iks *payload_eg711u, *payload_pcmu;
|
||||||
payload_pcmu = iks_new("payload-type");
|
payload_pcmu = iks_new("payload-type");
|
||||||
|
@ -267,7 +264,7 @@ static void add_codec_to_answer(const struct jingle_pvt *p, int codec, iks *dcod
|
||||||
iks_insert_attrib(payload_eg711u, "name", "EG711U");
|
iks_insert_attrib(payload_eg711u, "name", "EG711U");
|
||||||
iks_insert_attrib(payload_eg711u, "xmlns", "http://www.google.com/session/phone");
|
iks_insert_attrib(payload_eg711u, "xmlns", "http://www.google.com/session/phone");
|
||||||
iks_insert_node(dcodecs, payload_pcmu);
|
iks_insert_node(dcodecs, payload_pcmu);
|
||||||
// iks_insert_node(dcodecs, payload_eg711u);
|
iks_insert_node(dcodecs, payload_eg711u);
|
||||||
}
|
}
|
||||||
if (!strcasecmp("alaw", ast_getformatname(codec))) {
|
if (!strcasecmp("alaw", ast_getformatname(codec))) {
|
||||||
iks *payload_eg711a, *payload_pcma;
|
iks *payload_eg711a, *payload_pcma;
|
||||||
|
@ -347,14 +344,12 @@ static int jingle_accept_call(struct jingle *client, struct jingle_pvt *p)
|
||||||
|
|
||||||
|
|
||||||
iks_insert_attrib(iq, "type", "set");
|
iks_insert_attrib(iq, "type", "set");
|
||||||
// iks_insert_attrib(iq,"from",client->connection->jid->full);
|
|
||||||
iks_insert_attrib(iq, "to", (p->from) ? p->from : client->user);
|
iks_insert_attrib(iq, "to", (p->from) ? p->from : client->user);
|
||||||
iks_insert_attrib(iq, "id", client->connection->mid);
|
iks_insert_attrib(iq, "id", client->connection->mid);
|
||||||
ast_aji_increment_mid(client->connection->mid);
|
ast_aji_increment_mid(client->connection->mid);
|
||||||
|
|
||||||
iks_insert_attrib(jingle, "xmlns", "http://www.google.com/session");
|
iks_insert_attrib(jingle, "xmlns", "http://www.google.com/session");
|
||||||
iks_insert_attrib(jingle, "type", JINGLE_ACCEPT);
|
iks_insert_attrib(jingle, "type", JINGLE_ACCEPT);
|
||||||
ast_verbose("WOOH %d\n", p->initiator);
|
|
||||||
iks_insert_attrib(jingle, "initiator",
|
iks_insert_attrib(jingle, "initiator",
|
||||||
p->initiator ? client->connection->jid->full : p->from);
|
p->initiator ? client->connection->jid->full : p->from);
|
||||||
iks_insert_attrib(jingle, GOOGLE_SID, tmp->sid);
|
iks_insert_attrib(jingle, GOOGLE_SID, tmp->sid);
|
||||||
|
@ -489,7 +484,6 @@ static int jingle_is_answered(struct jingle *client, ikspak *pak)
|
||||||
tmp = client->p;
|
tmp = client->p;
|
||||||
/* Make sure our new call doesn't exist yet */
|
/* Make sure our new call doesn't exist yet */
|
||||||
while (tmp) {
|
while (tmp) {
|
||||||
ast_verbose("FFFFF %s\n", tmp->sid);
|
|
||||||
if (iks_find_with_attrib(pak->x, GOOGLE_NODE, GOOGLE_SID, tmp->sid)) {
|
if (iks_find_with_attrib(pak->x, GOOGLE_NODE, GOOGLE_SID, tmp->sid)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -525,7 +519,6 @@ static int jingle_hangup_farend(struct jingle *client, ikspak *pak)
|
||||||
} else
|
} else
|
||||||
ast_log(LOG_NOTICE, "Whoa, didn't find call!\n");
|
ast_log(LOG_NOTICE, "Whoa, didn't find call!\n");
|
||||||
jingle_response(client, pak, NULL);
|
jingle_response(client, pak, NULL);
|
||||||
ast_verbose("END CALL\n");
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -537,7 +530,6 @@ static int jingle_create_candidates(struct jingle *client, struct jingle_pvt *p,
|
||||||
struct sockaddr_in sin;
|
struct sockaddr_in sin;
|
||||||
struct sockaddr_in dest;
|
struct sockaddr_in dest;
|
||||||
struct in_addr us;
|
struct in_addr us;
|
||||||
char iabuf[INET_ADDRSTRLEN];
|
|
||||||
|
|
||||||
iks *iq, *jingle, *candidate;
|
iks *iq, *jingle, *candidate;
|
||||||
char user[17], pass[17], preference[5], port[7];
|
char user[17], pass[17], preference[5], port[7];
|
||||||
|
@ -602,10 +594,9 @@ static int jingle_create_candidates(struct jingle *client, struct jingle_pvt *p,
|
||||||
ours2 = NULL;
|
ours2 = NULL;
|
||||||
}
|
}
|
||||||
ours1 = NULL;
|
ours1 = NULL;
|
||||||
dest.sin_addr = __ourip; /// THIS IS BAD NEED TO FIX
|
dest.sin_addr = __ourip;
|
||||||
dest.sin_port = sin.sin_port;
|
dest.sin_port = sin.sin_port;
|
||||||
|
|
||||||
ast_verbose("We're at %s port %d\n", ast_inet_ntoa(iabuf, sizeof(iabuf), us), ntohs(sin.sin_port)); /// THIS IS BAD NEED TO FIX
|
|
||||||
|
|
||||||
tmp = p->ourcandidates;
|
tmp = p->ourcandidates;
|
||||||
while (tmp) { /*send standard candidates */
|
while (tmp) { /*send standard candidates */
|
||||||
|
@ -666,19 +657,15 @@ static struct jingle_pvt *jingle_alloc(struct jingle *client, const char *from,
|
||||||
|
|
||||||
ast_log(LOG_DEBUG, "The client is %s for alloc\n", client->name);
|
ast_log(LOG_DEBUG, "The client is %s for alloc\n", client->name);
|
||||||
if (!sid && !strchr(from, '/')) { /*I started call! */
|
if (!sid && !strchr(from, '/')) { /*I started call! */
|
||||||
ast_verbose("shouldnt be called on inbound!\n");
|
|
||||||
if (!strcasecmp(client->name, "guest")) {
|
if (!strcasecmp(client->name, "guest")) {
|
||||||
buddy = ASTOBJ_CONTAINER_FIND(&client->connection->buddies, from);
|
buddy = ASTOBJ_CONTAINER_FIND(&client->connection->buddies, from);
|
||||||
if (buddy)
|
if (buddy)
|
||||||
resources = buddy->resources;
|
resources = buddy->resources;
|
||||||
ast_verbose("shouldnt be called on inbound! %s ----- %s ---- %s\n",
|
|
||||||
client->name, from, buddy->name);
|
|
||||||
} else {
|
} else {
|
||||||
resources = client->buddy->resources;
|
resources = client->buddy->resources;
|
||||||
}
|
}
|
||||||
while (resources) {
|
while (resources) {
|
||||||
if (resources->cap->jingle) {
|
if (resources->cap->jingle) {
|
||||||
ast_verbose("WOW FOUND\n");
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
resources = resources->next;
|
resources = resources->next;
|
||||||
|
@ -841,25 +828,6 @@ static void jingle_free_candidates(struct jingle_candidate *candidate)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct jingle_candidate *jingle_dup_candidates(struct jingle_candidate *candidate)
|
|
||||||
{
|
|
||||||
struct jingle_candidate *newcan = NULL, *prev = NULL, *tmp;
|
|
||||||
while (candidate) {
|
|
||||||
tmp = malloc(sizeof(struct jingle_candidate));
|
|
||||||
if (tmp) {
|
|
||||||
memcpy(tmp, candidate, sizeof(struct jingle_candidate));
|
|
||||||
tmp->next = NULL;
|
|
||||||
if (prev)
|
|
||||||
prev->next = tmp;
|
|
||||||
else
|
|
||||||
newcan = tmp;
|
|
||||||
prev = tmp;
|
|
||||||
}
|
|
||||||
candidate = candidate->next;
|
|
||||||
}
|
|
||||||
return newcan;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void jingle_free_pvt(struct jingle *client, struct jingle_pvt *p)
|
static void jingle_free_pvt(struct jingle *client, struct jingle_pvt *p)
|
||||||
{
|
{
|
||||||
struct jingle_pvt *cur, *prev = NULL;
|
struct jingle_pvt *cur, *prev = NULL;
|
||||||
|
@ -924,7 +892,6 @@ static int jingle_newcall(struct jingle *client, ikspak *pak)
|
||||||
ast_rtp_set_m_type(p->rtp, atoi(iks_find_attrib(codec, "id")));
|
ast_rtp_set_m_type(p->rtp, atoi(iks_find_attrib(codec, "id")));
|
||||||
ast_rtp_set_rtpmap_type(p->rtp, atoi(iks_find_attrib(codec, "id")), "audio",
|
ast_rtp_set_rtpmap_type(p->rtp, atoi(iks_find_attrib(codec, "id")), "audio",
|
||||||
iks_find_attrib(codec, "name"));
|
iks_find_attrib(codec, "name"));
|
||||||
ast_verbose("yatta!!\n");
|
|
||||||
codec = iks_next(codec);
|
codec = iks_next(codec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1003,20 +970,16 @@ static int jingle_add_candidate(struct jingle *client, ikspak *pak)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!p) {
|
if (!p) {
|
||||||
ast_verbose("NO MATCH\n");
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
traversenodes = pak->query;
|
traversenodes = pak->query;
|
||||||
while(traversenodes) {
|
while(traversenodes) {
|
||||||
ast_verbose("OOH %s\n", iks_name(traversenodes));
|
|
||||||
if(!strcasecmp(iks_name(traversenodes), "session")) {
|
if(!strcasecmp(iks_name(traversenodes), "session")) {
|
||||||
ast_verbose("XXXX OOH A SESSION\n");
|
|
||||||
traversenodes = iks_child(traversenodes);
|
traversenodes = iks_child(traversenodes);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(!strcasecmp(iks_name(traversenodes), "candidate")) {
|
if(!strcasecmp(iks_name(traversenodes), "candidate")) {
|
||||||
ast_verbose("XXXX OOH A CANDIDATE\n");
|
|
||||||
newcandidate =
|
newcandidate =
|
||||||
(struct jingle_candidate *) ast_calloc(1, sizeof(struct jingle_candidate));
|
(struct jingle_candidate *) ast_calloc(1, sizeof(struct jingle_candidate));
|
||||||
if (!newcandidate)
|
if (!newcandidate)
|
||||||
|
@ -1227,14 +1190,13 @@ static int jingle_transmit_invite(struct jingle_pvt *p)
|
||||||
iks_delete(payload_pcmu);
|
iks_delete(payload_pcmu);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
/* Not in use right now.
|
||||||
static int jingle_auto_congest(void *nothing)
|
static int jingle_auto_congest(void *nothing)
|
||||||
{
|
{
|
||||||
struct jingle_pvt *p = nothing;
|
struct jingle_pvt *p = nothing;
|
||||||
|
|
||||||
ast_mutex_lock(&p->lock);
|
ast_mutex_lock(&p->lock);
|
||||||
if (p->owner) {
|
if (p->owner) {
|
||||||
/* XXX fails on possible deadlock */
|
|
||||||
if (!ast_channel_trylock(p->owner)) {
|
if (!ast_channel_trylock(p->owner)) {
|
||||||
ast_log(LOG_NOTICE, "Auto-congesting %s\n", p->owner->name);
|
ast_log(LOG_NOTICE, "Auto-congesting %s\n", p->owner->name);
|
||||||
ast_queue_control(p->owner, AST_CONTROL_CONGESTION);
|
ast_queue_control(p->owner, AST_CONTROL_CONGESTION);
|
||||||
|
@ -1244,6 +1206,7 @@ static int jingle_auto_congest(void *nothing)
|
||||||
ast_mutex_unlock(&p->lock);
|
ast_mutex_unlock(&p->lock);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
/*! \brief Initiate new call, part of PBX interface
|
/*! \brief Initiate new call, part of PBX interface
|
||||||
* dest is the dial string */
|
* dest is the dial string */
|
||||||
|
@ -1315,7 +1278,6 @@ static struct ast_channel *jingle_request(const char *type, int format, void *da
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ast_verbose("to : %s\n from :%s\n", to, sender);
|
|
||||||
client = find_jingle(to, sender);
|
client = find_jingle(to, sender);
|
||||||
if (!client) {
|
if (!client) {
|
||||||
ast_log(LOG_WARNING, "Could not find Recipiant.\n");
|
ast_log(LOG_WARNING, "Could not find Recipiant.\n");
|
||||||
|
@ -1361,20 +1323,11 @@ static int jingle_show(int fd, int argc, char **argv)
|
||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
static char show_jingle_usage[] =
|
|
||||||
"Usage: jingle show channels\n"
|
|
||||||
" Provides summary information on active jingle channels.\n";
|
|
||||||
|
|
||||||
//static struct ast_cli_entry cli_show_jingle = {
|
|
||||||
// { "jingle", "show", "channels", NULL }, jingle_show,
|
|
||||||
// "Show status of jingle channels", show_jingle_usage, NULL };
|
|
||||||
|
|
||||||
|
|
||||||
static int jingle_parser(void *data, ikspak *pak)
|
static int jingle_parser(void *data, ikspak *pak)
|
||||||
{
|
{
|
||||||
struct jingle *client = ASTOBJ_REF((struct jingle *) data);
|
struct jingle *client = ASTOBJ_REF((struct jingle *) data);
|
||||||
|
|
||||||
ast_verbose("WOOHOO!!!\n");
|
|
||||||
if (iks_find_with_attrib(pak->x, GOOGLE_NODE, "type", JINGLE_INITIATE)) {
|
if (iks_find_with_attrib(pak->x, GOOGLE_NODE, "type", JINGLE_INITIATE)) {
|
||||||
/* New call */
|
/* New call */
|
||||||
jingle_newcall(client, pak);
|
jingle_newcall(client, pak);
|
||||||
|
@ -1385,16 +1338,14 @@ static int jingle_parser(void *data, ikspak *pak)
|
||||||
} else if (iks_find_with_attrib(pak->x, GOOGLE_NODE, "type", GOOGLE_ACCEPT)) {
|
} else if (iks_find_with_attrib(pak->x, GOOGLE_NODE, "type", GOOGLE_ACCEPT)) {
|
||||||
jingle_is_answered(client, pak);
|
jingle_is_answered(client, pak);
|
||||||
} else if (iks_find_with_attrib(pak->x, GOOGLE_NODE, "type", "terminate")) {
|
} else if (iks_find_with_attrib(pak->x, GOOGLE_NODE, "type", "terminate")) {
|
||||||
ast_verbose("not this\n");
|
|
||||||
jingle_hangup_farend(client, pak);
|
jingle_hangup_farend(client, pak);
|
||||||
} else if (iks_find_with_attrib(pak->x, GOOGLE_NODE, "type", "reject")) {
|
} else if (iks_find_with_attrib(pak->x, GOOGLE_NODE, "type", "reject")) {
|
||||||
ast_verbose("not this\n");
|
|
||||||
jingle_hangup_farend(client, pak);
|
jingle_hangup_farend(client, pak);
|
||||||
}
|
}
|
||||||
ASTOBJ_UNREF(client, jingle_member_destroy);
|
ASTOBJ_UNREF(client, jingle_member_destroy);
|
||||||
return IKS_FILTER_EAT;
|
return IKS_FILTER_EAT;
|
||||||
}
|
}
|
||||||
|
/* Not using this anymore probably take out soon
|
||||||
static struct jingle_candidate *jingle_create_candidate(char *args)
|
static struct jingle_candidate *jingle_create_candidate(char *args)
|
||||||
{
|
{
|
||||||
char *name, *type, *preference, *protocol;
|
char *name, *type, *preference, *protocol;
|
||||||
|
@ -1440,7 +1391,7 @@ static struct jingle_candidate *jingle_create_candidate(char *args)
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
static int jingle_create_member(char *label, struct ast_variable *var, int allowguest,
|
static int jingle_create_member(char *label, struct ast_variable *var, int allowguest,
|
||||||
struct ast_codec_pref prefs, char *context,
|
struct ast_codec_pref prefs, char *context,
|
||||||
struct jingle *member)
|
struct jingle *member)
|
||||||
|
@ -1494,8 +1445,6 @@ static int jingle_create_member(char *label, struct ast_variable *var, int allow
|
||||||
else {
|
else {
|
||||||
ast_log(LOG_ERROR, "No Connection or Username!\n");
|
ast_log(LOG_ERROR, "No Connection or Username!\n");
|
||||||
}
|
}
|
||||||
ast_verbose("LABEL: %s\n member->name %s\n member->user %s\n", label, member->name,
|
|
||||||
member->user);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1552,9 +1501,6 @@ static int jingle_load_config(void)
|
||||||
ast_copy_string(member->user, "guest", sizeof(member->user));
|
ast_copy_string(member->user, "guest", sizeof(member->user));
|
||||||
ast_copy_string(member->context, context, sizeof(member->context));
|
ast_copy_string(member->context, context, sizeof(member->context));
|
||||||
member->allowguest = allowguest;
|
member->allowguest = allowguest;
|
||||||
#if 0
|
|
||||||
member->ourcandidates = jingle_dup_candidates(global_candidates);
|
|
||||||
#endif
|
|
||||||
member->prefs = prefs;
|
member->prefs = prefs;
|
||||||
while (var) {
|
while (var) {
|
||||||
if (!strcasecmp(var->name, "disallow"))
|
if (!strcasecmp(var->name, "disallow"))
|
||||||
|
@ -1596,7 +1542,6 @@ static int jingle_load_config(void)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (jingle_create_member(cat, var, allowguest, prefs, context, member)) {
|
if (jingle_create_member(cat, var, allowguest, prefs, context, member)) {
|
||||||
ast_verbose("step member\n");
|
|
||||||
ASTOBJ_UNLOCK(member);
|
ASTOBJ_UNLOCK(member);
|
||||||
ASTOBJ_CONTAINER_LINK(&jingles, member);
|
ASTOBJ_CONTAINER_LINK(&jingles, member);
|
||||||
ASTOBJ_UNREF(member, jingle_member_destroy);
|
ASTOBJ_UNREF(member, jingle_member_destroy);
|
||||||
|
@ -1615,7 +1560,6 @@ static int jingle_load_config(void)
|
||||||
/*! \brief Load module into PBX, register channel */
|
/*! \brief Load module into PBX, register channel */
|
||||||
static int load_module(void *mod)
|
static int load_module(void *mod)
|
||||||
{
|
{
|
||||||
ast_verbose("step 1\n");
|
|
||||||
ASTOBJ_CONTAINER_INIT(&jingles);
|
ASTOBJ_CONTAINER_INIT(&jingles);
|
||||||
if (!jingle_load_config()) {
|
if (!jingle_load_config()) {
|
||||||
ast_log(LOG_ERROR, "Unable to read config file %s\n", JINGLE_CONFIG);
|
ast_log(LOG_ERROR, "Unable to read config file %s\n", JINGLE_CONFIG);
|
||||||
|
@ -1645,7 +1589,6 @@ static int load_module(void *mod)
|
||||||
ast_log(LOG_ERROR, "Unable to register channel class %s\n", type);
|
ast_log(LOG_ERROR, "Unable to register channel class %s\n", type);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
// ast_cli_register(&cli_show_xmpps);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1658,27 +1601,30 @@ static int reload(void *mod)
|
||||||
/*! \brief Unload the jingle channel from Asterisk */
|
/*! \brief Unload the jingle channel from Asterisk */
|
||||||
static int unload_module(void *mod)
|
static int unload_module(void *mod)
|
||||||
{
|
{
|
||||||
// struct jingle_pvt *p = NULL;
|
struct jingle_pvt *privates = NULL;
|
||||||
struct aji_client *client = NULL;
|
|
||||||
client = ast_aji_get_client("asterisk");
|
|
||||||
/* First, take us out of the channel loop */
|
/* First, take us out of the channel loop */
|
||||||
// ast_cli_unregister(&cli_show_xmpps);
|
|
||||||
ast_channel_unregister(&jingle_tech);
|
ast_channel_unregister(&jingle_tech);
|
||||||
ast_rtp_proto_unregister(&jingle_rtp);
|
ast_rtp_proto_unregister(&jingle_rtp);
|
||||||
if (!ast_mutex_lock(&jinglelock)) {
|
if (!ast_mutex_lock(&jinglelock)) {
|
||||||
/* Hangup all interfaces if they have an owner */
|
/* Hangup all interfaces if they have an owner */
|
||||||
// p = jingles->p;
|
ASTOBJ_CONTAINER_TRAVERSE(&jingles, 1, {
|
||||||
// while(p) {
|
ASTOBJ_WRLOCK(iterator);
|
||||||
// if (p->owner)
|
privates = iterator->p;
|
||||||
// ast_softhangup(p->owner, AST_SOFTHANGUP_APPUNLOAD);
|
while(privates) {
|
||||||
// p = p->next;
|
if (privates->owner)
|
||||||
// }
|
ast_softhangup(privates->owner, AST_SOFTHANGUP_APPUNLOAD);
|
||||||
// jingles->p = NULL;
|
privates = privates->next;
|
||||||
|
}
|
||||||
|
iterator->p = NULL;
|
||||||
|
ASTOBJ_UNLOCK(iterator);
|
||||||
|
});
|
||||||
ast_mutex_unlock(&jinglelock);
|
ast_mutex_unlock(&jinglelock);
|
||||||
} else {
|
} else {
|
||||||
ast_log(LOG_WARNING, "Unable to lock the monitor\n");
|
ast_log(LOG_WARNING, "Unable to lock the monitor\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
ASTOBJ_CONTAINER_DESTROYALL(&jingles, jingle_member_destroy);
|
||||||
|
ASTOBJ_CONTAINER_DESTROY(&jingles);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
107
res/res_jabber.c
107
res/res_jabber.c
|
@ -286,7 +286,6 @@ static iks *jabber_make_auth(iksid * id, const char *pass, const char *sid)
|
||||||
char sidpass[100];
|
char sidpass[100];
|
||||||
snprintf(sidpass, sizeof(sidpass), "%s%s", sid, pass);
|
snprintf(sidpass, sizeof(sidpass), "%s%s", sid, pass);
|
||||||
ast_sha1_hash(buf, sidpass);
|
ast_sha1_hash(buf, sidpass);
|
||||||
ast_verbose("\n");
|
|
||||||
iks_insert_cdata(iks_insert(y, "digest"), buf, 0);
|
iks_insert_cdata(iks_insert(y, "digest"), buf, 0);
|
||||||
} else {
|
} else {
|
||||||
iks_insert_cdata(iks_insert(y, "password"), pass, 0);
|
iks_insert_cdata(iks_insert(y, "password"), pass, 0);
|
||||||
|
@ -820,7 +819,6 @@ static int aji_client_info_handler(void *data, ikspak *pak)
|
||||||
|
|
||||||
if (pak->subtype == IKS_TYPE_RESULT) {
|
if (pak->subtype == IKS_TYPE_RESULT) {
|
||||||
if (iks_find_with_attrib(pak->query, "feature", "var", "http://www.google.com/xmpp/protocol/voice/v1")) {
|
if (iks_find_with_attrib(pak->query, "feature", "var", "http://www.google.com/xmpp/protocol/voice/v1")) {
|
||||||
ast_verbose("NO I AM JINGLECAPABLE!!!\n");
|
|
||||||
resource->cap->jingle = 1;
|
resource->cap->jingle = 1;
|
||||||
} else
|
} else
|
||||||
resource->cap->jingle = 0;
|
resource->cap->jingle = 0;
|
||||||
|
@ -1034,7 +1032,6 @@ static void aji_handle_presence(struct aji_client *client, ikspak *pak)
|
||||||
tmp->status = status;
|
tmp->status = status;
|
||||||
found = tmp;
|
found = tmp;
|
||||||
if (status == 6) { /* Sign off Destroy resource */
|
if (status == 6) { /* Sign off Destroy resource */
|
||||||
ast_verbose("KILL THE SIGN OFF!\n");
|
|
||||||
if (last && found->next) {
|
if (last && found->next) {
|
||||||
last->next = found->next;
|
last->next = found->next;
|
||||||
} else if (!last) {
|
} else if (!last) {
|
||||||
|
@ -1149,38 +1146,39 @@ static void aji_handle_presence(struct aji_client *client, ikspak *pak)
|
||||||
iks_delete(iq);
|
iks_delete(iq);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (option_verbose > 30) {
|
||||||
switch (pak->subtype) {
|
switch (pak->subtype) {
|
||||||
case IKS_TYPE_AVAILABLE:
|
case IKS_TYPE_AVAILABLE:
|
||||||
ast_verbose(VERBOSE_PREFIX_3 "JABBER: I am available ^_* %i\n", pak->subtype);
|
ast_verbose(VERBOSE_PREFIX_3 "JABBER: I am available ^_* %i\n", pak->subtype);
|
||||||
break;
|
break;
|
||||||
case IKS_TYPE_UNAVAILABLE:
|
case IKS_TYPE_UNAVAILABLE:
|
||||||
ast_verbose(VERBOSE_PREFIX_3 "JABBER: I am unavailable ^_* %i\n", pak->subtype);
|
ast_verbose(VERBOSE_PREFIX_3 "JABBER: I am unavailable ^_* %i\n", pak->subtype);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ast_verbose(VERBOSE_PREFIX_3 "JABBER: Ohh sexy and the wrong type%i\n", pak->subtype);
|
ast_verbose(VERBOSE_PREFIX_3 "JABBER: Ohh sexy and the wrong type%i\n", pak->subtype);
|
||||||
}
|
}
|
||||||
switch (pak->show) {
|
switch (pak->show) {
|
||||||
case IKS_SHOW_UNAVAILABLE:
|
case IKS_SHOW_UNAVAILABLE:
|
||||||
ast_verbose(VERBOSE_PREFIX_3 "JABBER: type: %i subtype %i\n", pak->subtype, pak->show);
|
ast_verbose(VERBOSE_PREFIX_3 "JABBER: type: %i subtype %i\n", pak->subtype, pak->show);
|
||||||
break;
|
break;
|
||||||
case IKS_SHOW_AVAILABLE:
|
case IKS_SHOW_AVAILABLE:
|
||||||
ast_verbose(VERBOSE_PREFIX_3 "JABBER: type is available\n");
|
ast_verbose(VERBOSE_PREFIX_3 "JABBER: type is available\n");
|
||||||
break;
|
break;
|
||||||
case IKS_SHOW_CHAT:
|
case IKS_SHOW_CHAT:
|
||||||
ast_verbose(VERBOSE_PREFIX_3 "JABBER: type: %i subtype %i\n", pak->subtype, pak->show);
|
ast_verbose(VERBOSE_PREFIX_3 "JABBER: type: %i subtype %i\n", pak->subtype, pak->show);
|
||||||
break;
|
break;
|
||||||
case IKS_SHOW_AWAY:
|
case IKS_SHOW_AWAY:
|
||||||
ast_verbose(VERBOSE_PREFIX_3 "JABBER: type is away\n");
|
ast_verbose(VERBOSE_PREFIX_3 "JABBER: type is away\n");
|
||||||
break;
|
break;
|
||||||
case IKS_SHOW_XA:
|
case IKS_SHOW_XA:
|
||||||
ast_verbose(VERBOSE_PREFIX_3 "JABBER: type: %i subtype %i\n", pak->subtype, pak->show);
|
ast_verbose(VERBOSE_PREFIX_3 "JABBER: type: %i subtype %i\n", pak->subtype, pak->show);
|
||||||
break;
|
break;
|
||||||
case IKS_SHOW_DND:
|
case IKS_SHOW_DND:
|
||||||
ast_verbose(VERBOSE_PREFIX_3 "JABBER: type: %i subtype %i\n", pak->subtype, pak->show);
|
ast_verbose(VERBOSE_PREFIX_3 "JABBER: type: %i subtype %i\n", pak->subtype, pak->show);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ast_verbose(VERBOSE_PREFIX_3 "JABBER: Kinky! how did that happen %i\n", pak->show);
|
ast_verbose(VERBOSE_PREFIX_3 "JABBER: Kinky! how did that happen %i\n", pak->show);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1191,29 +1189,26 @@ static void aji_handle_presence(struct aji_client *client, ikspak *pak)
|
||||||
*/
|
*/
|
||||||
static void aji_handle_subscribe(struct aji_client *client, ikspak *pak)
|
static void aji_handle_subscribe(struct aji_client *client, ikspak *pak)
|
||||||
{
|
{
|
||||||
int res = 0;
|
if(pak->subtype == IKS_TYPE_SUBSCRIBE)
|
||||||
switch (pak->subtype) {
|
iks_send(client->p, iks_make_s10n(IKS_TYPE_SUBSCRIBED, iks_find_attrib(pak->x, "from"), "Asterisk has approved subscription"));
|
||||||
case IKS_TYPE_SUBSCRIBE:
|
if (option_verbose > 30) {
|
||||||
res = iks_send(client->p, iks_make_s10n(IKS_TYPE_SUBSCRIBED, iks_find_attrib(pak->x, "from"), "Asterisk has approved subscription"));
|
switch (pak->subtype) {
|
||||||
if (option_verbose > 30)
|
case IKS_TYPE_SUBSCRIBE:
|
||||||
ast_verbose(VERBOSE_PREFIX_3 "JABBER: This is a subcription of type %i\n", pak->subtype);
|
ast_verbose(VERBOSE_PREFIX_3 "JABBER: This is a subcription of type %i\n", pak->subtype);
|
||||||
break;
|
break;
|
||||||
case IKS_TYPE_SUBSCRIBED:
|
case IKS_TYPE_SUBSCRIBED:
|
||||||
if (option_verbose > 30)
|
|
||||||
ast_verbose(VERBOSE_PREFIX_3 "JABBER: This is a subcription of type %i\n", pak->subtype);
|
ast_verbose(VERBOSE_PREFIX_3 "JABBER: This is a subcription of type %i\n", pak->subtype);
|
||||||
break;
|
break;
|
||||||
case IKS_TYPE_UNSUBSCRIBE:
|
case IKS_TYPE_UNSUBSCRIBE:
|
||||||
if (option_verbose > 30)
|
|
||||||
ast_verbose(VERBOSE_PREFIX_3 "JABBER: This is a subcription of type %i\n", pak->subtype);
|
ast_verbose(VERBOSE_PREFIX_3 "JABBER: This is a subcription of type %i\n", pak->subtype);
|
||||||
break;
|
break;
|
||||||
case IKS_TYPE_UNSUBSCRIBED:
|
case IKS_TYPE_UNSUBSCRIBED:
|
||||||
if (option_verbose > 30)
|
|
||||||
ast_verbose(VERBOSE_PREFIX_3 "JABBER: This is a subcription of type %i\n", pak->subtype);
|
ast_verbose(VERBOSE_PREFIX_3 "JABBER: This is a subcription of type %i\n", pak->subtype);
|
||||||
break;
|
break;
|
||||||
default: /*IKS_TYPE_ERROR: */
|
default: /*IKS_TYPE_ERROR: */
|
||||||
if (option_verbose > 30)
|
|
||||||
ast_verbose(VERBOSE_PREFIX_3 "JABBER: This is a subcription of type %i\n", pak->subtype);
|
ast_verbose(VERBOSE_PREFIX_3 "JABBER: This is a subcription of type %i\n", pak->subtype);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1353,7 +1348,7 @@ static void *aji_recv_loop(void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res != IKS_OK) {
|
if (res != IKS_OK) {
|
||||||
ast_verbose("reconnecting %d\n", res);
|
if(option_verbose > 3) ast_verbose("JABBER: reconnecting %d\n", res);
|
||||||
aji_reconnect(client);
|
aji_reconnect(client);
|
||||||
res = IKS_OK;
|
res = IKS_OK;
|
||||||
}
|
}
|
||||||
|
@ -1904,7 +1899,6 @@ static int aji_create_client(char *label, struct ast_variable *var, int debug)
|
||||||
int flag = 0;
|
int flag = 0;
|
||||||
client = ASTOBJ_CONTAINER_FIND(&clients,label);
|
client = ASTOBJ_CONTAINER_FIND(&clients,label);
|
||||||
if(!client) {
|
if(!client) {
|
||||||
ast_verbose("CLIENT NOT FOUND!\n");
|
|
||||||
flag = 1;
|
flag = 1;
|
||||||
client = (struct aji_client *) malloc(sizeof(struct aji_client));
|
client = (struct aji_client *) malloc(sizeof(struct aji_client));
|
||||||
if(client) {
|
if(client) {
|
||||||
|
@ -1936,7 +1930,6 @@ static int aji_create_client(char *label, struct ast_variable *var, int debug)
|
||||||
client->usesasl = 0;
|
client->usesasl = 0;
|
||||||
if (flag) client->state = AJI_DISCONNECTED;
|
if (flag) client->state = AJI_DISCONNECTED;
|
||||||
while (var) {
|
while (var) {
|
||||||
ast_verbose("var->value: %s\n",var->value);
|
|
||||||
if (!strcasecmp(var->name, "username"))
|
if (!strcasecmp(var->name, "username"))
|
||||||
ast_copy_string(client->user, var->value, sizeof(client->user));
|
ast_copy_string(client->user, var->value, sizeof(client->user));
|
||||||
else if (!strcasecmp(var->name, "serverhost"))
|
else if (!strcasecmp(var->name, "serverhost"))
|
||||||
|
@ -1952,10 +1945,8 @@ static int aji_create_client(char *label, struct ast_variable *var, int debug)
|
||||||
client->component = AJI_COMPONENT;
|
client->component = AJI_COMPONENT;
|
||||||
} else if (!strcasecmp(var->name, "usetls")) {
|
} else if (!strcasecmp(var->name, "usetls")) {
|
||||||
client->usetls = (ast_false(var->value)) ? 0 : 1;
|
client->usetls = (ast_false(var->value)) ? 0 : 1;
|
||||||
ast_verbose("USETLS = %d\n",client->usetls);
|
|
||||||
} else if (!strcasecmp(var->name, "usesasl")) {
|
} else if (!strcasecmp(var->name, "usesasl")) {
|
||||||
client->usesasl = (ast_false(var->value)) ? 0 : 1;
|
client->usesasl = (ast_false(var->value)) ? 0 : 1;
|
||||||
ast_verbose("USESASL = %d\n",client->usesasl);
|
|
||||||
} else if (!strcasecmp(var->name, "forceoldssl"))
|
} else if (!strcasecmp(var->name, "forceoldssl"))
|
||||||
client->forcessl = (ast_false(var->value)) ? 0 : 1;
|
client->forcessl = (ast_false(var->value)) ? 0 : 1;
|
||||||
else if (!strcasecmp(var->name, "keepalive"))
|
else if (!strcasecmp(var->name, "keepalive"))
|
||||||
|
|
Loading…
Reference in New Issue