SIP::header

Description

This set of commands allows you to get or set information in the SIP header.
Note: The commands before 11.6 work only with message based load balancing, whereas the commands 11.6+ work only with the message routing framework.

Syntax

SIP::header "header-name" <index>
SIP::header value "header-name" <index>
SIP::header remove "header-name" <index>
SIP::header insert "header-name" "header-value" <index>
## v11.6 additions: ##
SIP::header count [header-name]
SIP::header exists "header-name"
SIP::header values [header-name]
SIP::header at "index"
SIP::header replace "header-name" "header-value" [index]
SIP::header names

SIP::header “header-name” <index>

  • Get SIP header “header-name”, if index is not provided, the first match is returned.

SIP::header value “header-name” <index>

  • Same as above, “value” is optional.

SIP::header remove “header-name” <index>

  • Remove SIP header “header-name”, index can be used to indicate which header is in action if there are multiple of them

SIP::header insert “header-name” “header-value” <index>

  • Insert SIP header-name: header-value pair at position index, if index is not given, it will be inserted prior to any pre-existing (same) headers. If no such header, via header will be inserted at the head of SIP headers, others will be inserted at the tail.

SIP::header count [header-name]

  • Returns the count of the SIP headers. If “header-name” is specified count the specific headers. This command works in v11.6+.

SIP::header exists “header-name”

  • Returns whether SIP header specified by name exists at least once. This command works in v11.6+.

SIP::header values [header-name]

  • Returns list of the values of all the instances of SIP header values. If optional argument header-name is specified retrieve all values of the specified header-name. This command works in v11.6+.

SIP::header at “index”

  • Returns SIP header at “index”, index is the Nth line from the SIP header. Returns only the name of the header. This command works in v11.6+.

SIP::header replace “header-name” “header-value” [index]

  • Replaces first instance of the header specified by “header-name”. New entry is added if not present already. If index optional argument is present, replace the header name at indexth position. This command works in v11.6+.

SIP::header names

  • Returns list of all the SIP header names. This command works in v11.6+.

Examples

when SIP_REQUEST_SEND {
  log local0. [SIP::method]
  SIP::header insert Via [format "SIP/2.0/TCP %s:%s" [IP::local_addr] [TCP::local_port]]
  SIP::header insert Y-Header "it is yyy"
}