Method 1:
osip_message_t* answer=NULL;
eXosip_message_build_answer(je->tid,200,&answer);
// Add the contact field
osip_contact_t* contact;
osip_message_get_contact(je->request,0,&contact);
char* pContact=NULL;
Osip_contact_to_str (contact, & pcontact); // note that there is a dynamic memory allocation, passing the second-level pointer address
osip_message_set_contact(answer,pContact);
/*/Dynamic memory for important Deleted fields
osip_free(pContact);
Method 2:
osip_message_t* answer=NULL;
eXosip_message_build_answer(je->tid,200,&answer);
// Add the contact field
osip_contact_t* contact;
osip_message_get_contact(je->request,0,&contact);
char* pContact=(char*)osip_malloc(70);
sprintf(pContact,"<sip:%s@%s:%s>",contact->url->username,contact->url->host,contact->url->port);
osip_message_set_contact(answer,pContact);
osip_free(pContact);
However, the above two methods have obvious Memory leakage !!!