/usr/share/perl5/Net/SIP/SDP.pod is in libnet-sip-perl 0.812-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | =head1 NAME
Net::SIP::SDP - Parsing and manipulation of SDP data for SIP
=head1 SYNOPSIS
my $sdp = Net::SIP::SDP->new( sdp_string );
my @media = $sdp->get_media;
=head1 DESCRIPTION
Net::SIP::SDP can parse and manipulate SDP data.
It's not a general purpose SDP class (like L<Net::SDP>) but
designed to work with SDP data contained in SIP packets
and for easy extraction and manipulation (for NAT etc)
of media information contained in the SDP.
The class is also designed for easy creation of SDP bodies
in the context of the rest of Net::SIP::*.
=head1 EXAMPLES
# creation based on media data
my $sdp = Net::SIP::SDP->new(
{ addr => '192.168.0.1' },
{ port => 2012, proto => 'RTP/AVP', media => 'audio', fmt => 0 },
{ port => 2014, proto => 'RTP/AVP', media => 'video', fmt => 0 },
);
# parse from string
my $sdp = Net::SIP::SDP->new( sdp_string );
# extract all media data
my @media = $sdp->get_media;
# and replace them with new addr + port (for NAT)
my @new_media,;
foreach (@media) {
my ($port,@socks) = create_rtp_sockets( '192.168.178.1', $_->{range} );
push @new_media, [ '192.168.178.1', $port ];
...
}
$sdp->replace_media_listen( @new_media );
=head1 CONSTRUCTOR
=over 4
=item new
Default constructor.
Depending on kind of arguments branches into B<new_from_string> or B<new_from_parts>.
See there.
=item new_from_string ( STRING )
Creates object from STRING containing the SDP data.
Raises an exception (e.g. die()) if SDP is invalid.
=item new_from_parts ( \%GLOBAL, @MEDIA )
Creates object from specification.
%GLOBAL describes the global keys, usually only a common C<addr> for all media but
any of the keys defined in L<RFC2327> can be used.
@MEDIA is a list of hash references, one hash for each media part. These hashes
can contain as keys the one-letter keys specified in L<RFC2327> and/or special
keys for constructing the 'c' and 'm' line:
=over 8
=item addr - The address, used in the 'c' line.
=item port - The port number
=item range - Range of ports, for RTP/AVP defaults to 2, else 1
=item media - The media typ, e.g. 'audio','video',...
=item proto - Transport protocol, ususally 'RTP/AVP' or 'udp'
=back
If the SDP should contain multiple values for the same key in the same
media section on can specify the value for the key as a \@list instead
of a string (this is often the case for 'a' lines).
=back
=head1 METHODS
=over 4
=item as_string
Returns string representation for object.
=item content_type
Returns 'application/sdp'
=item get_media
Returns list of all media described in the SDP. If the caller expects
an array the result will be a list, otherwise a reference to a list.
Each element of the list is a hash with the following keys:
=over 8
=item addr - IP4/IP6 address for media
=item port - Start port
=item range - Range for ports
=item proto - Media proto, usually 'RTP/AVP' or 'udp'
=item media - Media typ, usually 'audio', 'video' or 'data'
=item fmt - Format info from media line as \@list, e.g C<< [ 0,10,5 ] >>.
=item lines - All lines from media description as \@list of [ key,value ].
=back
B<WARNING!> You should never manipulate the values you got from this function,
because this might affect the objects internals.
=item replace_media_listen ( NEW_MEDIA )
Replaces the exisisting media in the object with new media. Useful for NAT.
NEW_MEDIA is ether an array or a reference to an array. Each element in
the list consists of the new [ addr,port ] mapping for the matching media
entry.
The number of entries in the list should be the same as the number of media
entries in the object ( see B<get_media> ). If this is not the case it will
C<die()>.
=item name2int ( NAME, INDEX )
Returns the RTP payload id for NAME (e.g. "telephone-event/8000").
INDEX is the index into the list of media information, matching the list
returned from L<get_media>. INDEX can also be 'audio','video'.., which
will then lookup at the first matching entry in the media list.
=back
|