mod_sofia TLS status
A short overview of the current status of TLS support in mod_sofia.
Things that work:
originating calls via sip profile name, like:
sofia/default/user@remote;transport=tls or {sip_transport=tls}sofia/default/user@remote
will use TLS (or any other supported transport type)
Receiving calls works too, but i’m currently extracting the transport from the contact header and i’m not 100% sure that’s working when there’s a proxy in the middle.
What i’m working on right now:
Originating calls using a gateway. Specifying the transport using:
sofia/gateway/testgw/1234;transport=tls
already works, overriding the register transport this way is working too (e.g. registering via TLS and dialing via SCTP, not sure we really want to support that though (?)).
Using {sip_transport=…} to change the transport for dialing doesn’t work for gateways at the moment. The sip_transport variable is handled in sofia_glue_do_invite(), while the gateway params and the invite_contact are created/handled in sofia_outgoing_channel(). Fixing this means either moving code from sofia_glue…() to sofia_outgoing channel() or creating a new invite_contact for gateways in sofia_glue…(). We’ll see…
Changes so far:
– keep track of transport type in tech_pvt->transport and gateway->register_transport.
– fix handling of gateway dialing params in sofia_outgoing channel
– remove some code duplication
– transport string comparisons using strncasecmp now
– create a new invite_contact if the gateway’s register_transport and the “invite” transport differ
What needs to be done:
Check (and change) transport handling of the presence stuff.
What i’m thinking about:
Something that could be handy for (fully working) IPv6 support…
Extend / change the sofia_transport_t type and enum to a set of flags, the lower bits handling the transport protocol (TCP, UDP, SCTP, TLS) and some of the upper bits the network protocol (IP / IPv6).
E.g.:
enum {
SOFIA_TRANSPORT_UNKNOWN = 0,
SOFIA_TRANSPORT_UDP = (1 << 0),
SOFIA_TRANSPORT_TCP = (1<<1),
SOFIA_TRANSPORT_TCP_TLS = (1<<2),
SOFIA_TRANSPORT_SCTP = (1<<3),
SOFIA_TRANSPORT_SCTP_TLS = (1<<4),
SOFIA_TRANSPORT_IP6 = (1<<24)
};
#define sofia_transport_is_ip6(x) (x & SOFIA_TRANSPORT_IP6)
#define sofia_transport_type(x) (x & 0x00FFFFFF)
#define sofia_transport_proto(x) (x & 0xFF000000)
…