[asterisk-commits] dvossel: trunk r290974 - in /trunk: ./ channels/chan_gtalk.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Oct 8 15:45:51 CDT 2010


Author: dvossel
Date: Fri Oct  8 15:45:49 2010
New Revision: 290974

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=290974
Log:
Merged revisions 290973 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r290973 | dvossel | 2010-10-08 15:44:59 -0500 (Fri, 08 Oct 2010) | 12 lines
  
  Make outbound Google Voice calls.
  
  This patch allows for outbound Google Voice calls to be
  dialed from Asterisk using chan_gtalk. Below is an example
  dialstring.
  
  exten -> blah,1,Dial(Gtalk/asterisk/+15552225555 at voice.google.com,,)
  
  In this example, 'asterisk' is the jabber.conf profile configured
  to connect to your gmail account. In order to receive Google Voice
  calls make sure to enable 'allowguest=yes' in gtalk.conf.
........

Modified:
    trunk/   (props changed)
    trunk/channels/chan_gtalk.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.

Modified: trunk/channels/chan_gtalk.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_gtalk.c?view=diff&rev=290974&r1=290973&r2=290974
==============================================================================
--- trunk/channels/chan_gtalk.c (original)
+++ trunk/channels/chan_gtalk.c Fri Oct  8 15:45:49 2010
@@ -99,6 +99,8 @@
 	AJI_CLIENT_UNKNOWN,
 	AJI_CLIENT_GTALK,		/*!< Remote client type is GoogleTalk */
 	AJI_CLIENT_GMAIL,		/*!< Remote client type is Gmail */
+	AJI_CLIENT_GOOGLE_VOICE,/*!< Remote client type is Google Voice*/
+
 };
 
 struct gtalk_pvt {
@@ -442,7 +444,9 @@
 	iks_insert_attrib(gtalk, "id", sid);
 	iks_insert_node(iq, gtalk);
 	iks_insert_node(gtalk, dcodecs);
-	iks_insert_node(gtalk, transport);
+	if (p->ctype != AJI_CLIENT_GOOGLE_VOICE) {
+		iks_insert_node(gtalk, transport);
+	}
 	iks_insert_node(dcodecs, payload_telephone);
 
 	ast_aji_send(client->connection, iq);
@@ -950,6 +954,7 @@
 	char idroster[200];
 	char *data, *exten = NULL;
 	struct ast_sockaddr bindaddr_tmp;
+	enum gtalk_client_type ctype = AJI_CLIENT_UNKNOWN;
 
 	ast_debug(1, "The client is %s for alloc\n", client->name);
 	if (!sid && !strchr(them, '/')) {	/* I started call! */
@@ -970,6 +975,12 @@
 		}
 		if (resources) {
 			snprintf(idroster, sizeof(idroster), "%s/%s", them, resources->resource);
+			if (strstr(resources->resource, "gmail")) {
+				ctype = AJI_CLIENT_GMAIL;
+			}
+		} else if ((*them == '+') || (strstr(them, "@voice.google.com"))) {
+			snprintf(idroster, sizeof(idroster), "%s/srvres", them);
+			ctype = AJI_CLIENT_GOOGLE_VOICE;
 		} else {
 			ast_log(LOG_ERROR, "no gtalk capable clients to talk to.\n");
 			return NULL;
@@ -979,7 +990,7 @@
 		return NULL;
 	}
 	/* set client type to unknown until we have more info */
-	tmp->ctype = AJI_CLIENT_UNKNOWN;
+	tmp->ctype = ctype;
 
 	memcpy(&tmp->prefs, &client->prefs, sizeof(struct ast_codec_pref));
 
@@ -1216,8 +1227,9 @@
 
 	/* Make sure our new call doesn't exist yet */
 	from = iks_find_attrib(pak->x,"to");
-	if(!from)
+	if(!from) {
 		from = client->connection->jid->full;
+	}
 
 	while (tmp) {
 		if (iks_find_with_attrib(pak->x, "session", "id", tmp->sid) || !strcmp(iks_find_attrib(pak->query, "id"), tmp->sid)) {




More information about the asterisk-commits mailing list