[asterisk-commits] branch mogorman/asterisk-xmpp r22231 - /team/mogorman/asterisk-xmpp/channels/

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sun Apr 23 19:39:27 MST 2006


Author: mogorman
Date: Sun Apr 23 21:39:26 2006
New Revision: 22231

URL: http://svn.digium.com/view/asterisk?rev=22231&view=rev
Log:
yadda yadda yadda

Modified:
    team/mogorman/asterisk-xmpp/channels/chan_jingle.c

Modified: team/mogorman/asterisk-xmpp/channels/chan_jingle.c
URL: http://svn.digium.com/view/asterisk/team/mogorman/asterisk-xmpp/channels/chan_jingle.c?rev=22231&r1=22230&r2=22231&view=diff
==============================================================================
--- team/mogorman/asterisk-xmpp/channels/chan_jingle.c (original)
+++ team/mogorman/asterisk-xmpp/channels/chan_jingle.c Sun Apr 23 21:39:26 2006
@@ -140,14 +140,26 @@
 
 struct jingle_container jingles;
 
-static int flipflop = 0;
-
-struct jingle *find_jingle(char *name)
+
+struct jingle *find_jingle(char *name, char *connection)
 {
 	struct jingle *jingle = NULL;
 	jingle = ASTOBJ_CONTAINER_FIND(&jingles,name);
 	if(!jingle && strchr(name, '@'))
 		jingle = ASTOBJ_CONTAINER_FIND_FULL(&jingles,name,user,,,strcasecmp);
+	if(!jingle) { /* guest call */
+		ASTOBJ_CONTAINER_TRAVERSE(&jingles,1,{
+			ASTOBJ_WRLOCK(iterator);
+			if(!strcasecmp(iterator->name,"guest")) {
+				if(!strcasecmp(iterator->connection->jid->partial, connection)) {
+					jingle = iterator;
+					break;
+				}
+			}
+			ASTOBJ_UNLOCK(iterator);
+		});
+
+	}
 	return jingle;
 }
 
@@ -524,11 +536,18 @@
 {
 	struct jingle_pvt *tmp = NULL;
 	struct aji_resource *resources = NULL;
+	struct aji_buddy *buddy;
 	char idroster[200];
 
-	if(!sid && !strchr(from,"/")) { /*I started call! */
+	if(!sid && !strchr(from,'/')) { /*I started call! */
 		ast_verbose("shouldnt be called on inbound!\n");
-		resources=client->buddy->resources;
+		if(!strcasecmp(client->name, "guest")) {
+			buddy = ASTOBJ_CONTAINER_FIND(&client->connection->buddies,from);
+			if(buddy) resources=buddy->resources;
+			ast_verbose("shouldnt be called on inbound! %s ----- %s ---- %s\n",client->name, from,buddy->name);
+		} else {
+			resources=client->buddy->resources;
+		}
 		while(resources) {
 			if(resources->jinglecapable) {
 				ast_verbose("WOW FOUND\n");
@@ -537,9 +556,9 @@
 			resources=resources->next;
 		}
 		if(resources)
-			snprintf(idroster,sizeof(idroster), "%s/%s",client->user,resources->resource);
+			snprintf(idroster,sizeof(idroster), "%s/%s",from,resources->resource);
 		else {
-			ast_log(LOG_ERROR, "no jingle capable clients to talk to.");
+			ast_log(LOG_ERROR, "no jingle capable clients to talk to.\n");
 			return NULL;
 		}
 	}
@@ -1145,9 +1164,9 @@
 		}
 	}
 	ast_verbose("to : %s\n from :%s\n",to,sender);
-	client = find_jingle(to);
+	client = find_jingle(to,sender);
 	if(!client) {
-		ast_log(LOG_WARNING, "Could not find Sender.\n");
+		ast_log(LOG_WARNING, "Could not find Recipiant.\n");
 		if(s)
 			free(s);
 		return NULL;



More information about the asterisk-commits mailing list