Hi,
If you receive an INVITE with 2 diversion headers such as (in this order):
Diversion: sip:9975@X.X.X.X:5060;privacy=off;screen=no; reason=user-busy; counter=1 Diversion: sip:1234567890@Z.Z.Z.Z:5060;privacy=off;screen=no; reason=unknown; counter=1
How is a nice way of extracting the user part from the URI of the last one? (in this case: 1234567890)
Problems I have found:
$(di{uri.user}) ---> Give mes the user part of the URI of the first header, in this case: 9975
Is there a way to tell $di to get its value from the last header instead of the first one?
This example works:
$(hdr(Diversion)[-1]{param.name,0}{s.strip,1}{s.striptail,1}{uri.user})
But I think it is very hacky...
Any better approach anyone can suggest me?
Thanks in advance.
Best regards, Joel.
Hi Joel, to the extract the username part of the last Diversion header you could modify your last example like this:
$(hdr(Diversion)[-1]{nameaddr.uri}{uri.user})
Regards,
Federico
On Sat, Jun 25, 2016 at 3:23 AM, Joel Serrano | VOZELIA joel@vozelia.com wrote:
I knew there had to be a better option! Thanks Federico :)
Best regards, Joel.
----- Original Message -----
$(hdr(Diversion)[-1]{nameaddr.uri}{uri.user})
Regards,
Federico
On Sat, Jun 25, 2016 at 3:23 AM, Joel Serrano | VOZELIA < joel@vozelia.com > wrote:
Hi,
If you receive an INVITE with 2 diversion headers such as (in this order):
How is a nice way of extracting the user part from the URI of the last one? (in this case: 1234567890)
Problems I have found:
$(di{uri.user}) ---> Give mes the user part of the URI of the first header, in this case: 9975
Is there a way to tell $di to get its value from the last header instead of the first one?
This example works:
$(hdr(Diversion)[-1]{ param.name ,0}{s.strip,1}{s.striptail,1}{uri.user})
But I think it is very hacky...
Any better approach anyone can suggest me?
Thanks in advance.
Best regards, Joel.