comparison src/protocols/simple/simple.c @ 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 cbebda5f019c
children 4d3119205a33
comparison
equal deleted inserted replaced
12195:d040123d2b69 12196:2f379ed0c26b
492 } 492 }
493 493
494 static void send_sip_request(GaimConnection *gc, gchar *method, gchar *url, gchar *to, gchar *addheaders, gchar *body, struct sip_dialog *dialog, TransCallback tc) { 494 static void send_sip_request(GaimConnection *gc, gchar *method, gchar *url, gchar *to, gchar *addheaders, gchar *body, struct sip_dialog *dialog, TransCallback tc) {
495 struct simple_account_data *sip = gc->proto_data; 495 struct simple_account_data *sip = gc->proto_data;
496 char *callid= dialog ? g_strdup(dialog->callid) : gencallid(); 496 char *callid= dialog ? g_strdup(dialog->callid) : gencallid();
497 if(!strcmp(method,"REGISTER")) {
498 if(sip->regcallid) callid = g_strdup(sip->regcallid);
499 else sip->regcallid = g_strdup(callid);
500 }
497 char *auth=""; 501 char *auth="";
498 char *addh=""; 502 char *addh="";
499 gchar *branch = genbranch(); 503 gchar *branch = genbranch();
500 char *buf; 504 char *buf;
501 505
512 auth = g_strdup_printf("Proxy-Authorization: %s",buf); 516 auth = g_strdup_printf("Proxy-Authorization: %s",buf);
513 g_free(buf); 517 g_free(buf);
514 gaim_debug(GAIM_DEBUG_MISC, "simple", "header %s", auth); 518 gaim_debug(GAIM_DEBUG_MISC, "simple", "header %s", auth);
515 } 519 }
516 520
521 if(!sip->ip || !strcmp(sip->ip,"0.0.0.0")) { // if there was no known ip retry now
522 g_free(sip->ip);
523 sip->ip = g_strdup(gaim_network_get_public_ip());
524 }
517 buf = g_strdup_printf("%s %s SIP/2.0\r\n" 525 buf = g_strdup_printf("%s %s SIP/2.0\r\n"
518 "Via: SIP/2.0/%s %s:%d;branch=%s\r\n" 526 "Via: SIP/2.0/%s %s:%d;branch=%s\r\n"
519 "From: <sip:%s@%s>;tag=%s\r\n" 527 "From: <sip:%s@%s>;tag=%s\r\n"
520 "To: <%s>%s%s\r\n" 528 "To: <%s>%s%s\r\n"
521 "Max-Forwards: 10\r\n" 529 "Max-Forwards: 10\r\n"