Description

For each of the following functions that add a header to a
SIP message, the function adds a CRLF before appending the header to
the SIP message.

The sip_add_from() and sip_add_to() functions appends a FROM and TO header respectively
to the SIP message sip_msg. The header is created using the display_name, if
non-null, and the uri values. The add_aquot parameter is used to specify
whether the uri should be enclosed within '<>'. If a display_name is
provided then add_aquot cannot be B_FALSE. The display_name parameter, if provided, is enclosed
within quotes before creating to the SIP header. Tag value for the
FROM/TO header can be specified which will be added to the SIP
header by prefixing it with “TAG=”. Any generic parameters can be specified as
the last argument, which will be added, as is, to the SIP
header.

Either the tag or the generic parameter can be specified not both,
if both are specified, the resulting header contains only the tag parameter.

The sip_add_contact() function appends a CONTACT header to the SIP message sip_msg
using the display_name and contact_uri. The add_aquot parameter has the same semantics as
in sip_add_from()/sip_add_to(). Any contact parameters specified in contact_param is added to the
CONTACT header before appending the header to the message.

The sip_add_via() function appends a VIA header to the SIP message sip_msg.
The VIA header is constructed using sent_protocol_transport, sent_by_host and sent_by_port. A value
of 0 for sent_by_port means that the port information is not present
in the resulting VIA header. The VIA header that is created has
the protocol set to “SIP” and version set to “2.0”. Any parameters specific
in via_params is added to the VIA header before appending the header
to the SIP message.

The sip_add_maxforward() function appends a MAX-FORWARDS header to the SIP message sip_msg
using the value in maxforward. The maxforward value is a positive integer.

The sip_add_callid() function appends a CALL-ID header to the SIP message sip_msg
using the value in callid, if non-null. If callid is null, this
function creates a CALL-ID header using a randomly generated value.

The sip_add_cseq() function appends a CSEQ header to the SIP message using
the values in method and cseq. Permissible values for method include:

INVITE

ACK

OPTIONS

BYE

CANCEL

REGISTER

REFER

SUBSCRIBE

NOTIFY

PRACK

INFO

The cseq value is a positive integer.

The sip_add_content_type() function appends a CONTENT-TYPE to the SIP message sip_msg. The
CONTENT-TYPE is created using the type and subtype, both should be non-null.

The sip_add_content() function adds a message body to the SIP message sip_msg.
The message body is given by the null terminated string contents. Once
the function returns, the caller may reuse or delete contents as sip_add_content()
creates a new buffer and copies over contents for its use.

The sip_add_accept() function appends an ACCEPT header to the SIP message sip_msg.
The ACCEPT header is created using type and subtype. If both type
and subtype are null, then an empty ACCEPT header is added to
the SIP message. If type is non-null, but subtype is null, then
the ACCEPT header has the specified type and sets the subtype in
the header to '*'. Any accept_param or media_param, if provided, are added to
the ACCEPT header before appending the header to the SIP message.

The sip_add_accept_enc() function appends an ACCEPT-ENCODING header to the SIP message sip_msg.
The ACCEPT-ENCODING is created using code. Any parameter specified in param is added
to the ACCEPT-ENCODING header before appending the header to the SIP message.

The sip_add_accept_lang() function appends an ACCEPT-LANGUAGE header to the SIP message sip_msg.
The ACCEPT-LANGUAGE header is created using lang. Any parameter specified in param
is added to the ACCEPT-LANGUAGE header before appending the header to the SIP
message.

The sip_add_alert_info() function appends an ALERT-INFO header to the SIP message sip_msg.
The ALERT-INFO header is created using alert. Any parameter specified in param
is added to the ALERT-INFO header before appending the header to the SIP
message.

The sip_add_allow() function appends an ALLOW header to the SIP message sip_msg.
The ALLOW header is created using alert and method. Permissible values for
method include:

INVITE

ACK

OPTIONS

BYE

CANCEL

REGISTER

REFER

INFO

SUBSCRIBE

NOTIFY

PRACK

The sip_add_call_info() function appends a CALL-INFO header to the SIP message sip_msg.
The CALL-INFO header is created using uri. Any parameter specified in param
is added to the CALL-INFO before appending the header to the SIP
message.

The sip_add_content_disp() function appends a CONTENT-DISPOSITION header to the SIP message sip_msg.
The CONTENT-DISPOSITION header is created using disp_type. Any parameter specified in param is
added to the CONTENT-DISPOSITION header before appending the header to the SIP
message.

The sip_add_content_enc() function appends a CONTENT-ENCODING header to the SIP message sip_msg.
The CONTENT-ENCODING header is created using code.

The sip_add_content_lang() function appends a CONTENT-LANGUAGE header to the SIP message sip_msg.
The CONTENT-LANGUAGE header is created using lang.

The sip_add_date() appends a DATE header to the SIP message sip_msg. The
DATE header is created using the date information specified in date. The
semantics for the date string is given is RFC 3261, section 25.1.

The sip_add_error_info() function appends an ERROR-INFO header to the SIP message sip_msg.
The ERROR-INFO header is created using uri. An parameters specified in param
is added to the ERROR-INFO header before adding the header to the
SIP message.

The sip_add_expires() function appends an EXPIRES header to the SIP message sip_msg.
The EXPIRES header is created using the seconds specified in secs.

The sip_add_in_reply_to() function appends a IN-REPLY-TO header to the SIP message sip_msg.
The IN-REPLY-TO header is created using the call-id value specified in reply_id.

The sip_add_mime_version() function appends a MIME-VERSION header to the SIP message sip_msg.
The MIME-VERSION header is created using version.

The sip_add_min_expires() function appends a MIN-EXPIRES header to the SIP message sip_msg.
The MIN-EXPIRES is created using the time in seconds specified in secs.

The sip_add_org() function appends a ORGANIZATION header to the SIP message sip_msg.
The ORGANIZATION header is created using the information specified in org.

The sip_add_priority() function appends a PRIORITY header to the SIP message sip_msg.
The PRIORITY header is created using the value specified in prio.

The sip_add_reply_to() function appends a REPLY-TO header to the SIP message sip_msg.
The REPLY-TO header is created using the display_name, if provided, and addr.
The add_aquot parameter has the same semantics as in sip_add_from()/sip_add_to(). Any parameters
specified in param is added to the REPLY-TO header before appending
the header to the SIP message.

The sip_add_passertedid() function appends a P-ASSERTED-IDENTITY header to the SIP message sip_msg.
The P-ASSERTED-IDENTITY header is created using the display_name, if provided, and the addr.
The add_aquot parameter has the same semantics as in sip_add_from()/sip_add_to().

The sip_add_ppreferredid() function appends a P-PREFERRED-IDENTITY header to the SIP message sip_msg.
The P-PREFERRED-IDENTITY header is created using the display_name, if provided, and the addr.
The add_aquot parameter has the same semantics as in sip_add_from()/sip_add_to().

The sip_add_require() function appends a REQUIRE header to the SIP message sip_msg.
The REQUIRE header is created using the information in req.

The sip_add_retry_after() function appends a RETRY-AFTER header to the SIP message sip_msg.
The RETRY-AFTER is created using the time in seconds specified in secs
comments, if any, in cmt. Any parameters specified in param, if provided, is
added to the RETRY-AFTER header before appending the header to the SIP
message.

The sip_add_route() function appends a ROUTE header to the SIP message sip_msg.
The ROUTE header is created using the display_name, if any, and the
uri. The uri is enclosed in '<>' before adding to the header. Parameters
specified in route_params are added to the ROUTE header before appending the
header to the SIP message.

The sip_add_record_route() function appends a RECORD-ROUTE header to the SIP message sip_msg.
The RECORD-ROUTE header is created using the display_name, if any, and the
uri. The uri parameter is enclosed in '<>' before adding to the
header. Any parameters specified in route_params is added to the ROUTE header
before appending the header to the SIP message.

The sip_add_server() function appends a SERVER header to the SIP message sip_msg.
The SERVER header is created using the information in srv.

The sip_add_subject() function appends a SUBJECT header to the SIP message sip_msg.
The SUBJECT header is created using the information in subject.

The sip_add_supported() function appends a SUPPORTED header to the SIP message sip_msg.
The SUPPORTED header is created using the information in support.

The sip_add_tstamp() function appends a TIMESTAMP header to the SIP message sip_msg.
The TIMESTAMP header is created using the time value in time and
the delay value, if provided, in delay.

The sip_add_unsupported() function appends an UNSUPPORTED header to the SIP message sip_msg.
The UNSUPPORTED header is created using the option-tag value in unsupport.

The sip_add_user_agent() function appends an USER-AGENT header to the SIP message sip_msg.
The USER-AGENT header is created using the server-val specified in usr.

The sip_add_warning() function appends a WARNING header to the SIP message sip_msg.
The WARNING header is created using the warn-code in code, warn-agent in
addr and warn-test in msg.

The sip_add_privacy() function appends a PRIVACY header to the SIP message sip_msg.
The PRIVACY header is created using the privacy value specified in
priv_val.

The sip_add_rseq() function appends a RSEQ header to the SIP message sip_msg.
The RSEQ header is created using the sequence number specified in resp_num.

The sip_add_rack() function appends a RACK header to the SIP message sip_msg.
The RACK header is created using the sequence number in resp_num, the
SIP method in method and the CSEQ number in cseq. Permissible values for
method include: INVITE, ACK, OPTIONS, BYE, CANCEL, REGISTER, REFER, INFO, SUBSCRIBE, NOTIFY,
PRACK.

The sip_add_author() function appends an AUTHORIZATION header to the SIP message sip_msg.
The AUTHORIZATION header is created using scheme. Any parameter specified in param
is added to the AUTHORIZATION header before the header is appended to the
SIP message.

The sip_add_authen_info() function appends an AUTHENTICATION-INFO() header to the SIP message sip_msg.
The AUTHENTICATION-INFO header is created using the authentication information in ainfo.

The sip_add_proxy_authen() function appends a PROXY-AUTHENTICATE header to the SIP message sip_msg.
The PROXY-AUTHENTICATE is created using the value specified in psacheme. Any parameter in
param is added to the PROXY-AUTHENTICATE header before adding the header to
the SIP message.

The sip_add_proxy_author() function appends a PROXY-AUTHORIZATION header to the SIP message sip_msg.
The PROXY-AUTHORIZATION header is created using the value specified in pascheme. Any parameter
in param is added to the PROXY-AUTHORIZATION header before adding the header
to the SIP message.

The sip_add_proxy_require() function appends a PROXY-REQUIRE header to the SIP message sip_msg.
The PROXY-REQUIRE header is created using the option-tag in opt.

The sip_add_www_authen() function appends a WWW-AUTHENTICATE header to the SIP message sip_msg.
The WWW-AUTHENTICATE header is created using the challenge in wascheme. Any parameter in
param is added to the WWW-AUTHENTICATE header before adding the header to
the SIP message.

The sip_add_allow_events() function appends an ALLOW-EVENTS header to the SIP message The
ALLOW-EVENTS header is created using the event specified in events.

The sip_add_event() function appends an EVENT header to the SIP message. The
EVENT header is created using the value specified in event. Any parameter
in param is added to the EVENT header before appending the header to
the SIP message.

The sip_add_substate() function appends a SUBSCRIPTION-STATE header to the SIP message. The
SUBSCRIPTION-STATE header is created using the state specified in sub. Any parameter in
param is added to the SUBSCRIPTION-STATE header before appending the header to
the SIP message.

Return Values

These functions return 0 on success and the appropriate error value on
failure.

Errors

On failure, functions that return an error value can return one of
the following:

EINVAL

Mandatory parameters are not provided, i.e. null.

For sip_add_from(), sip_add_to(), sip_add_contact(), sip_add_reply_to(), sip_add_passertedid(), sip_add_ppreferredid() if display_name is non-null and add_aquot is B_FALSE.

For sip_add_branchid_to_via() the topmost VIA header already has a branch param or the SIP message does not have a VIA header.