[asterisk-commits] branch mogorman/asterisk-xmpp r21306 - in
/team/mogorman/asterisk-xmpp: chann...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Tue Apr 18 21:29:41 MST 2006
Author: mogorman
Date: Tue Apr 18 23:29:41 2006
New Revision: 21306
URL: http://svn.digium.com/view/asterisk?rev=21306&view=rev
Log:
it builds
Modified:
team/mogorman/asterisk-xmpp/channels/chan_jingle.c
team/mogorman/asterisk-xmpp/include/asterisk/jingle.h
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=21306&r1=21305&r2=21306&view=diff
==============================================================================
--- team/mogorman/asterisk-xmpp/channels/chan_jingle.c (original)
+++ team/mogorman/asterisk-xmpp/channels/chan_jingle.c Tue Apr 18 23:29:41 2006
@@ -393,6 +393,7 @@
{
struct jingle_candidate *tmp;
struct aji_client *c = client->connection;
+ struct jingle_candidate *ours1 = NULL , *ours2 =NULL;
struct sockaddr_in sin;
struct sockaddr_in dest;
char iabuf[INET_ADDRSTRLEN];
@@ -406,7 +407,9 @@
iq = iks_new("iq");
jingle = iks_new(GOOGLE_NODE);
candidate = iks_new("candidate");
- if (!iq || !jingle || !candidate) {
+ ours1 = (struct jingle_candidate *)malloc(sizeof(struct jingle_candidate));
+ ours2 = (struct jingle_candidate *)malloc(sizeof(struct jingle_candidate));
+ if (!iq || !jingle || !candidate ||!ours1 ||!ours2) {
ast_log(LOG_WARNING, "out of memory!\n");
goto safeout;
}
@@ -428,7 +431,7 @@
ast_verbose("We're at %s port %d\n", ast_inet_ntoa(iabuf, sizeof(iabuf), __ourip), ntohs(sin.sin_port)); /// THIS IS BAD NEED TO FIX
snprintf(port, sizeof(port),"%d",ntohs(sin.sin_port));
snprintf(localip, sizeof(localip),"%s",ast_inet_ntoa(iabuf, sizeof(iabuf), __ourip)); // hack
-
+#if 0
while(tmp) { /*send standard candidates*/
snprintf(user, sizeof(user),"%08x%08x",thread_safe_rand() ,thread_safe_rand());
snprintf(pass, sizeof(pass),"%08x%08x",thread_safe_rand(), thread_safe_rand());
@@ -464,9 +467,12 @@
iks_send(c->p,iq);
tmp=tmp->next;
}
+#endif
if(!p->theircandidates) { /*send default stun, and local, and relay */
snprintf(user, sizeof(user),"%08x%08x",thread_safe_rand(),thread_safe_rand());
snprintf(pass, sizeof(pass),"%08x%08x",thread_safe_rand(),thread_safe_rand());
+ ast_copy_string(ours1->username,user,sizeof(ours1->username));
+ ast_copy_string(ours1->password,pass,sizeof(ours1->password));
iks_insert_attrib(iq,"from", c->jid->full);
iks_insert_attrib(iq,"to", iks_find_attrib(pak->x,"from"));
iks_insert_attrib(iq,"type", "set");
@@ -477,19 +483,38 @@
iks_insert_attrib(jingle,"initiator",iks_find_attrib(pak->x,"from"));
iks_insert_attrib(jingle,"xmlns", GOOGLE_NS);
iks_insert_attrib(candidate, "name", "rtp");
+ ast_copy_string(ours1->name,"rtp",sizeof(ours1->name));
iks_insert_attrib(candidate, "address",localip);
+ ast_copy_string(ours1->ip,localip,sizeof(ours1->ip));
iks_insert_attrib(candidate, "port", port); /*FIX ME*/
+ ours1->port= ntohs(sin.sin_port);
iks_insert_attrib(candidate, "username", user);
iks_insert_attrib(candidate, "password", pass);
iks_insert_attrib(candidate, "preference", "1");
+ ours1->preference=1;
iks_insert_attrib(candidate, "protocol", "udp");
+ ours1->protocol=AJI_PROTOCOL_UDP;
iks_insert_attrib(candidate, "type", "local");
+ ours1->type=AJI_CONNECT_LOCAL;
iks_insert_attrib(candidate, "network", "0");
iks_insert_attrib(candidate, "generation", "0");
+ ours1->generation=0;
iks_send(c->p,iq);
+ p->ourcandidates=ours1;
+ ours1->next=ours2;
+ ours2->next=NULL;
snprintf(user, sizeof(user),"%08x%08x",thread_safe_rand(),thread_safe_rand());
snprintf(pass, sizeof(pass),"%08x%08x",thread_safe_rand(),thread_safe_rand());
+ ast_copy_string(ours2->username,user,sizeof(ours2->username));
+ ast_copy_string(ours2->password,pass,sizeof(ours2->password));
+ ast_copy_string(ours2->ip,externip,sizeof(ours2->ip));
+ ast_copy_string(ours2->name,"rtp",sizeof(ours1->name));
+ ours2->port= ntohs(sin.sin_port);
+ ours2->preference=0.9;
+ ours2->protocol=AJI_PROTOCOL_UDP;
+ ours2->type=AJI_CONNECT_STUN;
+ ours2->generation=0;
iks_insert_attrib(iq,"id", c->mid);
ast_aji_increment_mid(c->mid);
iks_insert_attrib(candidate, "address", externip);
@@ -499,7 +524,7 @@
iks_insert_attrib(candidate, "preference", "0.9");
iks_insert_attrib(candidate, "type", "stun");
iks_send(c->p,iq);
-
+#if 0
snprintf(user, sizeof(user),"%08x%08x",thread_safe_rand(),thread_safe_rand());
snprintf(pass, sizeof(pass),"%08x%08x",thread_safe_rand(),thread_safe_rand());
iks_insert_attrib(iq,"id", c->mid);
@@ -511,7 +536,8 @@
iks_insert_attrib(candidate, "preference", "0.5");
iks_insert_attrib(candidate, "protocol", "ssltcp");
iks_insert_attrib(candidate, "type", "relay");
- iks_send(c->p,iq);
+ iks_send(c->p,iq);
+#endif
}
safeout:
if (iq)
Modified: team/mogorman/asterisk-xmpp/include/asterisk/jingle.h
URL: http://svn.digium.com/view/asterisk/team/mogorman/asterisk-xmpp/include/asterisk/jingle.h?rev=21306&r1=21305&r2=21306&view=diff
==============================================================================
--- team/mogorman/asterisk-xmpp/include/asterisk/jingle.h (original)
+++ team/mogorman/asterisk-xmpp/include/asterisk/jingle.h Tue Apr 18 23:29:41 2006
@@ -59,6 +59,7 @@
int capability;
struct ast_codec_pref prefs;
struct jingle_candidate *theircandidates;
+ struct jingle_candidate *ourcandidates;
char cid_num[80]; /*!< Caller ID num */
char cid_name[80]; /*!< Caller ID name */
char exten[80]; /* Called extension */
More information about the asterisk-commits
mailing list