Closed pali closed 4 years ago
I don't think this is trivial to get fully correct, with all the escaping, multi-byte encoding (UTF-8), handling both quoted and unquoted etc. And even if being correct it might not match what others implement, so it might be necessary to add work-arounds too. Given that there is currently no use for this kind of functionality in Net::SIP itself I better stay away from this now.
I don't think this is trivial to get fully correct
I know. And I thought that this could be reason why main Net::SIP module should provide such function, so other projects do not have to implement it... and because it is non-trivial they may implement it incorrectly and invent a new incompatible implementation.
Given that there is currently no use for this kind of functionality in Net::SIP itself
I think that in Net::SIP source code there are some places where is this splitting used via regex (and maybe also incorrectly...).
Net::SIP::Util already provides
sip_uri2parts
helper function which can parseaddr-spec
orname-addr
and extract from itdomain
,user
,$proto
and other uri parameters. But it does not extract nor returndisplay-name
from, which is the only additional part inname-addr
when comparing with plainaddr-spec
.For SIP applications
display-name
is useful as it contain string which can be displayed to user. So it would be nice if some Net::SIP provides generic helper functions for constructing SIPname-addr
from valuesdomain
,display-name
,user
,proto
,params
and also reverse function which returns these values from SIPname-addr
string (likesip_uri2parts
, but with alsodisplay-name
).