changeset 12196:2f379ed0c26b

[gaim-migrate @ 14498] This patch from Thomas Butter fixes some Asterisk compatability issues with SIMPLE. Thanks to Cosimo Alfarano for finding this problem and testing the changes. committer: Tailor Script <tailor@pidgin.im>
author Ethan Blanton <elb@pidgin.im>
date Wed, 23 Nov 2005 04:00:29 +0000
parents d040123d2b69
children 0ab1c9916dc2
files src/protocols/simple/simple.c src/protocols/simple/simple.h
diffstat 2 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/simple/simple.c	Wed Nov 23 02:04:59 2005 +0000
+++ b/src/protocols/simple/simple.c	Wed Nov 23 04:00:29 2005 +0000
@@ -494,6 +494,10 @@
 static void send_sip_request(GaimConnection *gc, gchar *method, gchar *url, gchar *to, gchar *addheaders, gchar *body, struct sip_dialog *dialog, TransCallback tc) {
 	struct simple_account_data *sip = gc->proto_data;
 	char *callid= dialog ? g_strdup(dialog->callid) : gencallid();
+	if(!strcmp(method,"REGISTER")) {
+		if(sip->regcallid) callid = g_strdup(sip->regcallid);
+		else sip->regcallid = g_strdup(callid);
+	}
 	char *auth="";
 	char *addh="";
 	gchar *branch = genbranch();
@@ -514,6 +518,10 @@
 		gaim_debug(GAIM_DEBUG_MISC, "simple", "header %s", auth);
 	}
 
+	if(!sip->ip || !strcmp(sip->ip,"0.0.0.0")) { // if there was no known ip retry now
+		g_free(sip->ip);
+		sip->ip = g_strdup(gaim_network_get_public_ip());
+	}
 	buf = g_strdup_printf("%s %s SIP/2.0\r\n"
 			"Via: SIP/2.0/%s %s:%d;branch=%s\r\n"
 			"From: <sip:%s@%s>;tag=%s\r\n"
--- a/src/protocols/simple/simple.h	Wed Nov 23 02:04:59 2005 +0000
+++ b/src/protocols/simple/simple.h	Wed Nov 23 04:00:29 2005 +0000
@@ -81,6 +81,7 @@
 	int connecting;
 	GaimAccount *account;
 	gchar *sendlater;
+	gchar *regcallid;
 	GSList *transactions;
 	GSList *watcher;
 	GSList *openconns;