def register(user, password = nil, opts = {})
      send_opts = opts.dup
      send_opts[:retrans] ||= DEFAULT_RETRANS
      user, domain = parse_user user
      if password
        send register_message(domain, user), send_opts
        recv opts.merge(response: 401, auth: true, optional: false)
        send register_auth(domain, user, password), send_opts
        receive_ok opts.merge(optional: false)
      else
        send register_message(domain, user), send_opts
      end
    end
def register(user, password = nil, opts = {})
      send_opts = opts.dup
      send_opts[:retrans] ||= DEFAULT_RETRANS
      user, domain = parse_user user
      if password
        send register_message(domain, user), send_opts
        recv opts.merge(response: 401, auth: true, optional: false)
        send register_auth(domain, user, password), send_opts
        receive_ok opts.merge(optional: false)
      else
        send register_message(domain, user), send_opts
      end
    end
Send a REGISTER message with the specified credentials

 @param [String] user the user to register as. May be given as a full SIP URI (sip:user@domain.com), in email-address format (user@domain.com) or as a simple username ('user'). If no domain is supplied, the source IP from SIPp will be used.
 @param [optional, String, nil] password the password to authenticate with.
 @param [Hash] opts A set of options to modify the message

 @example Register with authentication
   s.register 'frank@there.com', 'abc123'

 @example Register without authentication or a domain
   s.register 'frank'