void process_incoming_invite(struct fetion_account_data *sip,struct sipmsg *msg) { const gchar * to,*callid; gchar * body; const gchar *my_ip; gint my_port; struct group_chat *g_chat; struct fetion_buddy * buddy =NULL; my_ip = purple_network_get_my_ip(sip->fd); my_port = purple_network_get_port_from_fd(sip->fd); purple_debug_info("fetion:","Invite:[%s:%d]\n",my_ip,my_port); body = g_strdup_printf("v=0\r\n" "o=-0 0 IN %s:%d\r\n" "s=session\r\n" "c=IN IP4 %s:%d\r\n" "t=0 0\r\n" "m=message %d sip %s\r\n", my_ip,my_port,my_ip,my_port,my_port,sip->uri); purple_debug_info("fetion:","Invite:answer[%s]\n",body); send_sip_response(sip->gc,msg,200,"OK",body); callid = sipmsg_find_header(msg,"I"); to = sipmsg_find_header(msg,"F"); if(strncmp(to,"sip:TG",6)!=0) { buddy = g_hash_table_lookup(sip->buddies,to); if(buddy==NULL) { buddy = g_new0(struct fetion_buddy, 1); buddy->name = g_strdup(to); g_hash_table_insert(sip->buddies, buddy->name, buddy); }
void process_incoming_invite(struct fetion_account_data *sip, struct sipmsg *msg) { /* Plato Wu,2010/09/29: update it for SIP/C 4.0 protocol*/ #if 1 gchar *body, *hdr; const char *auth, *to, *callid; char* ipaddress = NULL; char* credential = NULL; int port; struct group_chat *g_chat; struct fetion_buddy *buddy = NULL; auth = g_strdup_printf(sipmsg_find_header(msg, "A")); callid = sipmsg_find_header(msg, "I"); to = sipmsg_find_header(msg, "F"); sipmsg_remove_header(msg, "K"); sipmsg_remove_header(msg, "XI"); sipmsg_remove_header(msg, "AL"); sipmsg_remove_header(msg, "A"); purple_debug_info("plato:", "Received a conversation invitation"); send_sip_response(sip->gc, msg, 200, "OK", NULL); fetion_sip_get_auth_attr(auth , &ipaddress , &port , &credential); purple_debug_info("plato:", "ipaddress is %s, port is %d, credential is %s", ipaddress, port, credential); /* Plato Wu,2010/09/29: TODO Openfetion new a TCP connection here, but I don't * know how to do in pidgin.*/ /* purple_proxy_connect(sip->gc, sip->account, ipaddress, port, invite_cb, sip->gc); */ /* Plato Wu,2010/09/29: TODO, R command should be sent into new connection. */ hdr = g_strdup_printf("A: TICKS auth=\"%s\"\r\n", credential); //" K: text/html-fragment\r\nK: multiparty\r\nK: nudge\r\n" send_sip_request(sip->gc, "R", "", "", hdr, NULL, NULL, NULL); purple_debug_info("plato:", "start free"); if (strncmp(to, "sip:TG", 6) != 0) { buddy = g_hash_table_lookup(sip->buddies, to); if (buddy == NULL) { buddy = g_new0(struct fetion_buddy, 1); buddy->name = g_strdup(to); g_hash_table_insert(sip->buddies, buddy->name, buddy); }