Class OverSIP::SIP::NameAddr
An instance of the OverSIP::SIP::NameAddr
class contains a “name-addr” or a “addr-spec” value as stated in the BNF grammar of the RFC 3261.
- A “name-addr” value is in the form “display name <URI>”. Example:
From: "Alice" <sip:alice@atlanta.com>
- A “addr-spec” value is an URI. Example:
From: sip:alice@atlanta.com
Parent class
OverSIP::SIP::NameAddr
inherits all the methods of OverSIP::SIP::Uri
and thus all the parent methods are available for retrieving data from the URI.
Class instance methods
initialize
(display_name=nil, scheme=:sip, user=nil, host=nil, port=nil)
NEW in 1.3.x
Initializer method for the OverSIP::SIP::NameAddr
instance. It should be just used for SIP, SIPS or TEL URI’s.
Parameters
display_name
- The display name value (
String
ornil
if not present). scheme
- URI scheme (
:sip
,:sips
or:tel
Symbol
). user
- SIP URI username or TEL URI number (
String
). host
- SIP URI host value.
port
- SIP URI port value.
Examples
name_addr = OverSIP::SIP::NameAddr.new "Alice", :sip, "alice", "example.net"
name_addr = OverSIP::SIP::NameAddr.new "Bob", :tel, "+12345678"
display_name
Gets the display name value (String
or nil
if not present).
Example
request.from.display_name
#=> "Alice"
display_name=
(value)
Sets the display name.
value
- The new display name (
String
ornil
for removing it).
Example
request.from.display_name = "Bob"
#=> "Bob"