SIP API Developer's Guide

Header and Message Copying Functions

int sip_copy_start_line(sip_msg_t from, sip_msg_t to);

The sip_copy_start_line() function copies the first line of the SIP message. The first line is either the request or the response line. The line is copied from the position that is indicated by the value of msg_from to the position that is indicated by the value of msg_to.

int sip_copy_header(sip_msg_t sip_msg, sip_header_t sip_header, char *param);

The sip_copy_header() function creates a new SIP header using the values given by the sip_header and param parameters, if the values for these parameters are not NULL. This function adds the new header to the message that is indicated by the value of the sip_msg parameter.

int sip_copy_header_by_name(sip_msg_t from, sip_msg_t to, char *header_name, char *param);

The sip_copy_header_by_name() function copies the header given by the value of the header_name parameter from the position specified in msg_from to the position specified in msg_to. The value of the header_name parameter can be either the long name or the compact name. The function creates a new SIP header using the contents of the header_name field in msg_from, then adds the value of the param parameter if that value is not NULL. The function adds the resulting header to msg_to.

int sip_copy_all_headers(sip_msg_t from, sip_msg_t to);

The sip_copy_all_headers() function copies all of the headers, except for the start line, from the SIP message indicated in the from parameter to the SIP message indicated in the to parameter. The API will not copy headers from a message that is marked as deleted.

sip_msg_t sip_clone_msg(const sip_msg_t sip_msg);

The sip_clone_msg() function returns a message that is a copy of the SIP message that is indicated by the value of the sip_msg parameter. The function returns a message that contains all of the headers and the contents that are present in the SIP message that is indicated by the value of the sip_msg parameter.