[SIP Beyond VoIP] media_ip darcs patches

Saúl Ibarra Corretgé saul at ag-projects.com
Mon Nov 17 17:58:55 CET 2014


Hi Juha,

The patch looks solid at a first glance, thanks!

For some reason I don’t see the diff as an attachment, but as part of the email, can you send it as an attachment or upload the diff somewhere for easier merging?


Thanks!

On 02 Nov 2014, at 13:10, Juha Heinanen <jh at tutpro.com> wrote:

> enclosed find 'darcs diff' patches of the media_ip feature for easy
> merging to latest darcs versions of python-sipsimple and sylkserver.
> 
> for some reason, i was not able to create a new tracker issue on this. i
> logged in, but didn't find a 'new issue' button.
> 
> i would appreciate if these could be merged to darcs archives.
> 
> -- juha
> 
> diff -rN -u old-python-sipsimple/sipsimple/account/__init__.py new-python-sipsimple/sipsimple/account/__init__.py
> --- old-python-sipsimple/sipsimple/account/__init__.py	2014-11-02 13:52:38.276370538 +0200
> +++ new-python-sipsimple/sipsimple/account/__init__.py	2014-11-02 13:52:39.512376672 +0200
> @@ -29,7 +29,7 @@
> from sipsimple.account.xcap import XCAPManager
> from sipsimple.core import Credentials, SIPURI, ContactURIFactory
> from sipsimple.configuration import ConfigurationManager, Setting, SettingsGroup, SettingsObject, SettingsObjectID
> -from sipsimple.configuration.datatypes import AudioCodecList, MSRPConnectionModel, MSRPRelayAddress, MSRPTransport, NonNegativeInteger, Path, SIPAddress, SIPProxyAddress, SRTPEncryption, STUNServerAddressList, VideoCodecList, XCAPRoot
> +from sipsimple.configuration.datatypes import AudioCodecList, MSRPConnectionModel, MSRPRelayAddress, MSRPTransport, NonNegativeInteger, Path, SIPAddress, SIPProxyAddress, SRTPEncryption, STUNServerAddressList, VideoCodecList, XCAPRoot, IPAddress
> from sipsimple.configuration.settings import SIPSimpleSettings
> from sipsimple.payloads import ParserError
> from sipsimple.payloads.messagesummary import MessageSummary
> @@ -61,6 +61,7 @@
>     video_codec_list = Setting(type=VideoCodecList, default=None, nillable=True)
>     srtp_encryption = Setting(type=SRTPEncryption, default='disabled')
>     use_srtp_without_tls = Setting(type=bool, default=False)
> +    media_ip = Setting(type=IPAddress, default=None, nillable=True)
> 
> 
> class NATTraversalSettings(SettingsGroup):
> diff -rN -u old-python-sipsimple/sipsimple/application.py new-python-sipsimple/sipsimple/application.py
> --- old-python-sipsimple/sipsimple/application.py	2014-11-02 13:52:38.320370757 +0200
> +++ new-python-sipsimple/sipsimple/application.py	2014-11-02 13:52:39.504376628 +0200
> @@ -154,6 +154,7 @@
>                        tls_privkey_file=None,
>                        # rtp
>                        rtp_port_range=(settings.rtp.port_range.start, settings.rtp.port_range.end),
> +                       media_ip = settings.rtp.media_ip,
>                        # audio
>                        codecs=list(settings.rtp.audio_codec_list),
>                        # video
> diff -rN -u old-python-sipsimple/sipsimple/session.py new-python-sipsimple/sipsimple/session.py
> --- old-python-sipsimple/sipsimple/session.py	2014-11-02 13:52:38.516371728 +0200
> +++ new-python-sipsimple/sipsimple/session.py	2014-11-02 13:52:39.508376647 +0200
> @@ -1008,9 +1008,11 @@
>                     wait_count -= 1
>             try:
>                 contact_uri = self.account.contact[PublicGRUUIfAvailable, self.route]
> -                local_ip = host.outgoing_ip_for(self.route.address)
> -                if local_ip is None:
> +                if settings.rtp.media_ip is None:
> +                    local_ip = host.outgoing_ip_for(self.route.address)
>                     raise ValueError("could not get outgoing IP address")
> +                else:
> +                    local_ip = str(settings.rtp.media_ip)
>             except (KeyError, ValueError), e:
>                 for stream in self.proposed_streams:
>                     notification_center.remove_observer(self, sender=stream)
> @@ -1276,7 +1278,10 @@
> 
>             remote_sdp = self._invitation.sdp.proposed_remote
>             sdp_connection = remote_sdp.connection or (media.connection for media in remote_sdp.media if media.connection is not None).next()
> -            local_ip = host.outgoing_ip_for(sdp_connection.address) if sdp_connection.address != '0.0.0.0' else sdp_connection.address
> +            if settings.rtp.media_ip is None:
> +                local_ip = host.outgoing_ip_for(sdp_connection.address) if sdp_connection.address != '0.0.0.0' else sdp_connection.address
> +            else:
> +                local_ip = str(settings.rtp.media_ip)
>             if local_ip is None:
>                 for stream in self.proposed_streams:
>                     notification_center.remove_observer(self, sender=stream)
> diff -rN -u old-sylkserver/sylk/configuration/__init__.py new-sylkserver/sylk/configuration/__init__.py
> --- old-sylkserver/sylk/configuration/__init__.py	2014-11-02 14:03:30.611605295 +0200
> +++ new-sylkserver/sylk/configuration/__init__.py	2014-11-02 14:03:59.743749755 +0200
> @@ -59,6 +59,7 @@
>     srtp_encryption = ConfigSetting(type=SRTPEncryption, value='optional')
>     timeout = ConfigSetting(type=NonNegativeInteger, value=30)
>     sample_rate = ConfigSetting(type=SampleRate, value=32000)
> +    media_ip = ConfigSetting(type=IPAddress, value=None)
> 
> 
> class ThorNodeConfig(ConfigSection):
> diff -rN -u old-sylkserver/sylk/configuration/settings.py new-sylkserver/sylk/configuration/settings.py
> --- old-sylkserver/sylk/configuration/settings.py	2014-11-02 14:03:30.615605311 +0200
> +++ new-sylkserver/sylk/configuration/settings.py	2014-11-02 14:03:59.743749755 +0200
> @@ -15,7 +15,7 @@
> 
> from sylk import __version__ as server_version
> from sylk.configuration import ServerConfig, SIPConfig, MSRPConfig, RTPConfig
> -from sylk.configuration.datatypes import AudioCodecs, NillablePath, Path, Port, SIPProxyAddress
> +from sylk.configuration.datatypes import AudioCodecs, NillablePath, Path, Port, SIPProxyAddress, IPAddress
> 
> 
> # Account settings extensions
> @@ -34,6 +34,7 @@
>     audio_codec_list = Setting(type=AudioCodecs, default=None, nillable=True)
>     srtp_encryption = Setting(type=SRTPEncryption, default=RTPConfig.srtp_encryption)
>     use_srtp_without_tls = Setting(type=bool, default=True)
> +    media_ip = Setting(type=IPAddress, default=RTPConfig.media_ip, nillable=True)
> 
> 
> class AccountSIPSettingsExtension(AccountSIPSettings):
> @@ -85,6 +86,7 @@
>     audio_codec_list = Setting(type=AudioCodecs, default=RTPConfig.audio_codecs)
>     port_range = Setting(type=PortRange, default=PortRange(RTPConfig.port_range.start, RTPConfig.port_range.end))
>     timeout = Setting(type=NonNegativeInteger, default=RTPConfig.timeout)
> +    media_ip = Setting(type=IPAddress, default=RTPConfig.media_ip, nillable=True)
> 
> 
> def sip_port_validator(port, sibling_port):
> diff -rN -u old-sylkserver/sylk/server.py new-sylkserver/sylk/server.py
> --- old-sylkserver/sylk/server.py	2014-11-02 14:03:30.623605360 +0200
> +++ new-sylkserver/sylk/server.py	2014-11-02 14:03:59.679749442 +0200
> @@ -25,7 +25,7 @@
> import sylk.extensions
> 
> from sylk.applications import IncomingRequestHandler
> -from sylk.configuration import ServerConfig, SIPConfig, ThorNodeConfig
> +from sylk.configuration import ServerConfig, SIPConfig, RTPConfig, ThorNodeConfig
> from sylk.configuration.settings import AccountExtension, BonjourAccountExtension, SylkServerSettingsExtension
> from sylk.log import Logger
> from sylk.session import SessionManager
> @@ -112,6 +112,7 @@
>                        tls_privkey_file=None,
>                        # rtp
>                        rtp_port_range=(settings.rtp.port_range.start, settings.rtp.port_range.end),
> +                       media_ip=settings.rtp.media_ip,
>                        # audio
>                        codecs=list(settings.rtp.audio_codec_list),
>                        # logging
> @@ -226,12 +227,14 @@
>     def _NH_SIPApplicationDidStart(self, notification):
>         settings = SIPSimpleSettings()
>         local_ip = SIPConfig.local_ip
> +        media_ip = RTPConfig.media_ip
>         log.msg("SylkServer started, listening on:")
>         for transport in settings.sip.transport_list:
>             try:
>                 log.msg("%s:%d (%s)" % (local_ip, getattr(self.engine, '%s_port' % transport), transport.upper()))
>             except TypeError:
>                 pass
> +        log.msg("Media IP: %s" % media_ip)
> 
>     def _NH_SIPApplicationWillEnd(self, notification):
>         log.msg('SIP application will end: %s' % self.end_reason)
> _______________________________________________
> SIPBeyondVoIP mailing list
> SIPBeyondVoIP at lists.ag-projects.com
> http://lists.ag-projects.com/mailman/listinfo/sipbeyondvoip

--
Saúl Ibarra Corretgé
AG Projects



-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 842 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.ag-projects.com/pipermail/sipbeyondvoip/attachments/20141117/8e497abc/attachment.pgp>


More information about the SIPBeyondVoIP mailing list