rem: LOG(L_ERR, "mangle_pidf -4-\n"); wav3statusNode = xmlNewNode(ns, "wav3status"); xmlNodeSetContent(wav3statusNode, strdup(xmlNodeGetContent(noteNode))); xmlAddChild(presenceNode, wav3statusNode); LOG(L_ERR, "mangle_pidf -5-\n");
add: wav3substatusNode = xmlNewNode(ns, "wav3substatus"); xmlNodeSetContent(wav3substatusNode, strdup(xmlNodeGetContent(noteNode))); xmlAddChild(presenceNode, wav3substatusNode); LOG(L_ERR, "mangle_pidf -5-\n");
context: int mangle_pidf(struct sip_msg* _msg, char* _domain, char* _s2){     char *body = get_body(_msg);     int body_len = strlen(body);     xmlDocPtr doc = NULL;     xmlNodePtr presenceNode = NULL;     xmlNodePtr personNode = NULL;     xmlNodePtr noteNode = NULL;     xmlNodePtr wav3statusNode = NULL;     doc = event_body_parse(body);     if (!doc) {	  return 1;     }     presenceNode = xmlDocGetNodeByName(doc, "presence", NULL);     personNode = xmlDocGetNodeByName(doc, "person", NULL);     noteNode = xmlDocGetNodeByName(doc, "note", NULL);     wav3statusNode = xmlDocGetNodeByName(doc, "wav3status", NULL);     if (presenceNode) {	  xmlNsPtr ns = presenceNode->ns;	  int patch = 0;	  LOG(L_ERR, "mangle_pidf -1-\n");	  if (wav3statusNode) {	       // add note node for Eyebeam with copy of contents of wav3status	    LOG(L_ERR, "mangle_pidf -2-\n");	       noteNode = xmlNewNode(ns, "note");	       xmlAddChild(presenceNode, noteNode);	       xmlNodeSetContent(noteNode, strdup(xmlNodeGetContent(wav3statusNode)));	    LOG(L_ERR, "mangle_pidf -3-\n");	       patch = 1;	  } else if (noteNode) {	    LOG(L_ERR, "mangle_pidf -4-\n");	       wav3statusNode = xmlNewNode(ns, "wav3status");	       xmlNodeSetContent(wav3statusNode, strdup(xmlNodeGetContent(noteNode)));	       xmlAddChild(presenceNode, wav3statusNode);	    LOG(L_ERR, "mangle_pidf -5-\n");	       patch = 1;	  }	  if (patch) {	       xmlChar *new_body = NULL;	       char *nbp;	       int new_body_len = 0;	    LOG(L_ERR, "mangle_pidf -6-\n");	       xmlDocDumpMemory(doc, &new_body, &new_body_len);	       if (new_body && new_body_len > 0) {		 nbp = shm_malloc(new_body_len+1);		 strcpy(nbp, new_body);		 LOG(L_ERR, "mangle_pidf -7- old_body_len=%d new_body_len=%d new_body=%s\n", 		     body_len, new_body_len, nbp);		 LOG(L_ERR, "mangle_pidf -7a- body_lumps=%p\n", _msg->body_lumps);		 patch_msg(_msg, body, body_len, nbp, new_body_len);	       }	  }     }     LOG(L_ERR, "mangle_pidf -8-\n");     return 1;}