mickorz / rtmplite

Automatically exported from code.google.com/p/rtmplite
1 stars 0 forks source link

Configuration/method to set IP address in 'c' line of SDP #41

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Use case:
When running on amazon cloud (or behind a NAT), listening address and 
advertised address (in SDP) are same. Need a procedure or configuration to 
specify the advertised address in SDP.

Original issue reported on code.google.com by rawat.an...@gmail.com on 29 Mar 2011 at 12:31

GoogleCodeExporter commented 9 years ago
Reference from email-

Currently there is no command line option for RTP module's IP
address as it always listens on 0.0.0.0 (in p2p-sip's rfc3550.py
module's class Network). The voip.py module's "class MediaSession" is
the one that manages the SDP creation. In the constructor __init__
function, you need to modify to supply an IP address, which in turn
will get used instead of a call to getlocaladdr(). This should solve
your problem where RTP still listens on local IP address but SDP
advertises external IP, e.g., as in Amazon cloud hosting case. For the
other multi-homing case, where you want to pick one of the many local
IP addresses, you will also need to pass the IP address parameter to
the RTPNetwork class.
Additionally, p2p-sip's rfc3489bis.py has an implementation of a STUN
client (see function "request"), which can be called in siprtmp.py
before hand to obtain the external address and then supplied to
MediaSession object in rtmp_invite as well as rtmp_accept functions.

Original comment by rawat.an...@gmail.com on 29 Mar 2011 at 12:32

GoogleCodeExporter commented 9 years ago
Fixed in p2p-sip r29 and rtmplite r61.

The changes are:
1. changed command line options of siprtmp, so that -l specifying local 
listening IP address if needed, and -e specifies external IP address to 
advertise in SIP/SDP.
2. changed -s option to -l and apply it for both SIP as well as RTP now.
3. The -l command line option is sent to MediaSession which in turn sends to 
RTPNetwork, so that it can listen on this address.
4. The -e command line option sets the global in std.kutil.setlocaladdr() which 
is used by various modules to get the local IP representation for advertising 
IP address in SIP or SDP.
5. When a new User object is created, the debug trace (with -d option) prints 
both the listening and external IP addresses.

For Amazon cloud, use only the -e option to specify the external IP address of 
the host. The -l is not needed because SIP/RTP will bind to default 0.0.0.0 
anyway.
Example: $ python siprtmp.py -d -e 192.1.2.3

For multi-homing case, use -i option to select which local IP address to pick. 
By default, if -i is specified then it is also used for -e, so you don't need 
to specify -e again.

You need to specify both -i and -e if your host has multiple IP interfaces and 
you want to pick only one for listening for SIP/RTP, and you host is behind NAT 
and you want to advertise external IP of the NAT in SIP/SDP. In most cases one 
of -i or -e should be enough.

Original comment by kundan10 on 30 Mar 2011 at 5:16