jssip - v3.14.0
    Preparing search index...

    Class NameAddrHeader

    Represents a name-addr or an addr-spec value as stated in the BNF grammar of RFC 3261.

    A name-addr value is in the form "display name" <URI>. An addr-spec value is in the form URI.

    • Its parameters are those of the header field, not those of the URI. The latter live in the URI reachable through NameAddrHeader.uri.
    const uri = new JsSIP.URI('sip', 'alice', 'example.com');
    const from = new JsSIP.NameAddrHeader(uri, 'Alice');

    from.setParam('tag', '1928301774');

    from.toString(); // '"Alice" <sip:alice@example.com>;tag=1928301774'
    Index

    Constructors

    Accessors

    • get uri(): URI

      Address the header field points at.

      Returns URI

      • Read only, but the URI itself can be modified.
    • get display_name(): string | undefined

      Display name shown before the address, undefined when the header field has none.

      Returns string | undefined

    • set display_name(value: string | number | undefined): void

      Set the display name, or remove it by giving undefined.

      Parameters

      • value: string | number | undefined

      Returns void

      • A number is accepted and converted into a string.
      • It is quoted and escaped by NameAddrHeader.toString, so it must be given unquoted.

    Methods

    • Parse the given string into a NameAddrHeader.

      Parameters

      • name_addr_header: string

      Returns NameAddrHeader | undefined

      undefined if the string is not a valid name address header field value.

      const to = JsSIP.NameAddrHeader.parse('"Bob" <sip:bob@example.com>');
      
    • Set the given header field parameter.

      Parameters

      • key: string

        Parameter name, lowercased.

      • Optionalvalue: string | number | null

        Parameter value. A parameter with no value is set by giving null or nothing.

      Returns void

      nameAddrHeader.setParam('tag', '1928301774');
      
    • Get the value of the given header field parameter.

      Parameters

      • key: string

      Returns string | null | undefined

      null if the parameter has no value, undefined if the header field does not have it.

    • Whether the header field has the given parameter.

      Parameters

      • key: string

      Returns boolean | undefined

      undefined if no parameter name is given.

    • Remove the given header field parameter.

      Parameters

      • parameter: string

      Returns string | null | undefined

      The value it had, null if it had none, undefined if the header field did not have the parameter.

    • The header field value as it is written in a SIP message, with the display name quoted, the address between angle brackets and the parameters appended.

      Returns string

      nameAddrHeader.toString();
      // '"Alice" <sip:alice@example.com>;tag=1928301774'