Class: SippyCup::Media::RTPPayload

Inherits:
Object
  • Object
show all
Defined in:
lib/sippy_cup/media/rtp_payload.rb

Direct Known Subclasses

DTMFPayload, PCMUPayload

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(payload_id = 0) ⇒ RTPPayload

Returns a new instance of RTPPayload.



10
11
12
# File 'lib/sippy_cup/media/rtp_payload.rb', line 10

def initialize(payload_id = 0)
  @header = RTPHeader.new payload_id: payload_id
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/sippy_cup/media/rtp_payload.rb', line 18

def method_missing(method, *args)
  if method.to_s =~ /^rtp_/
    method = method.to_s.sub(/^rtp_/, '').to_sym
    @header.send method, *args
  else
    super
  end
end

Instance Attribute Details

#headerObject (readonly)

Returns the value of attribute header.



8
9
10
# File 'lib/sippy_cup/media/rtp_payload.rb', line 8

def header
  @header
end

Instance Method Details

#to_bytesObject



14
15
16
# File 'lib/sippy_cup/media/rtp_payload.rb', line 14

def to_bytes
  @header.to_s + media
end