I’m looking for clarity on the RFC interpretation around the use of the # in the user part of a sip uri. eg: sip:12345678#123@asterisk.org
sip.js say it should be encoded to its url friendly counterpart %23. However this means that the Asterisk dial plan must match %23. Other clients and phones allow sending # in the user part of the uri, so now Asterisk dial plan must look out for both.
I believe Asterisk doesn’t have the limitation on Dial() command. Correct?
The SIP RFC doesn’t make specific mention to the # character, but mentions that characters out of range of the reserved characters - _ . ! ~ * ’ ( ) should encoded, but, the only place that I saw # being specified with and example is the tel URL RFC, this says that the # is a pause character, and it just says that it could be copied to the sip url as-is. It does not mention encoding. It also mentions the it shouldn’t be the first character.
What is the correct handing of the # character in the user portion of a SIP URI?
According to the sip-implementors list[1] it should be escaped. Dial() itself doesn’t care about any of it. It’s the responsibility of the underlying channel driver, such as chan_sip or chan_pjsip. The PJSIP stack is more strict on things and automatically escapes it. It also unescapes it on ingress back to ‘#’ so you don’t have to care about it.
You are using an obsolete TEL: URI RFC. RFC 3966 does not define pause characters, but, even in RFC 2806, it is a dtmf-digit. RFC 3966 only allows it in local numbers and has a SHOULD NOT constraint on their use.