SetParameterValue

The SetParameterValue function adds or sets a specific parameter value in a SIP header.

Syntax

  Copy imageCopy Code
bool SetParameterValue(
  string or StandardHeader value headerName,
  string parameterName,
  string value
);

Parameters

HeaderName

The name of the header where the parameter will be added or set. For example, SetParameterValue("Contact", "param1", "value1") sets a parameter on the "Contact" header.

ParameterName

The name of the parameter to add or set. For example, SetParameterValue("Contact", "param1", "value1") sets the "param1" parameter on the "Contact" header.

Value

The value associated with parameterName. If this value contains an empty string (""), the corresponding parameter is deleted.

Return Values

Returns true if the parameter is set successfully; false if it is not (the header does not exist, or a parameter name is not supplied).

Remarks

If the parameter does not exist in the supplied header, the parameter and its associated value are added; if it does exist, the value replaces the existing one. If there is more than one parameter with the same name, this function will replace the first occurrence with the new value. Also, if there are multiple headers with the same name, only the first header is modified.

There is no way to add parameters that are not of the form "param=value".