Enum lookup => How to choose transport?

Hi Gang

I’m trying to revive enum DNS usage, but I stumbled into an issue with pjsip (probaby also with chan_sip but I was not aware of it when I used this).

An ENUM NAPTR entry can contain different protocols and priorities.
sip+E2U => UDP
sip+E2T => TCP
sips+E2T => TLS

function ENUMLOOKUP only returns the resulting sip URI, not the transport to use.

But usually I do not define an transport in the endpoint used the send out such calls. The endpoint is very simple:


and nothing else.

Call is initiated with Dial(PJSIP/default/sip:${enumresult})

${enumresult} is “+e164number@domain”

But as far as I see, if I dont specify transport=transport-udp in my [default] endpoint, then the wrong one might be selected.

So, how is pjsip determining what transport to use? Even which IP protocol to use towards teh destination?

Or would the NAPTR record als need to also return the transport as part of the URI?

eg +enumnumber@domain;transport=udp ?

I am in control of the domain name under which those e164 NAPTR entries are published, so I could add the transport.


It does a DNS lookup on the hostname and depending on the result chooses appropriately based on the available configured transports. It follows this RFC[1] but with a slight tweak of favoring IPv6.

[1] RFC 3263 - Session Initiation Protocol (SIP): Locating SIP Servers

Thank you, so maybe it does more than I expected…

Looking at an example on my e164.ch playground: 10800 IN NAPTR 100 10 “u” “sip+E2U” “!^(.*)$!\1@woody.ch!” .

I would have expected this to result in +4166123456789@woody.ch for Transport E2U => udp

But when I check what asterisk did in my experiment… it tried TSL via IPv6?

So, why tls? is asterisk performing a second NAPTR lookup on the URI received from the ENUM lookup? There indeed, SIPS+D2T is the prefered method.

|woody.ch.||465|IN|NAPTR|10 100 s SIPS+D2T _sips._tcp.woody.ch.|
|woody.ch.||465|IN|NAPTR|40 100 s IAX+D2U _iax._udp.woody.ch.|
|woody.ch.||465|IN|NAPTR|30 100 s SIP+D2T _sip._tcp.woody.ch.|
|woody.ch.||465|IN|NAPTR|20 100 s SIP+D2U _sip._udp.woody.ch.|

Well indeed, that would be even better.


PJSIP has no idea of ENUM stuff or any of that, it just knows to dial SIP URI and does the normal lookup process.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.