GRUU – Globally Routable User-Agent URI

GRUU is a type of SIP (Session Initiation Protocol) URI (Uniform Resource Identifier) that is used to identify and route communications sessions in a VoIP network. It enables a user to be reached at a specific device or location, even if the user has multiple devices or locations.

In traditional telephone networks, a user’s telephone number is a unique identifier that can be used to reach that user at a specific device or location. However, in a SIP network, where users can have multiple devices using a single AOR (address of record) such as GRUU addresses this issue by providing a way for users to be reached at a specific device or location, even if their IP address or network location changes.

There are some cases when it is required to identify a single instance of a SIP user. Let’s suppose you are making a transfer and the user has more than one device with the same AOR, in the target it is better to use a SIP instance identifier than the IP address. IP addresses are not so NAT friendly.  Also, in the REFER rather than forking the next INVITE to all registered devices it is possible to route to an specific device specifying the temporary or permanent GRUU.

Lab – Using GRUU with OpenSIPS and Blink

The free softphone Blink ( supports GRUU.
OpenSIPS also supports GRUU.

To activate, change the module parameter.

modparam("registrar", "disable_gruu", 0)

After changing this module parameter you will see in he 200OK of the register the temporary GRUU (temp-gruu=”sip:tgruu….) and the public gruu (pub-gruu=”sip…). Now you can route by the new URIs.

2023/01/27 13:56:38.821684 ->
SIP/2.0 200 OK
Via: SIP/2.0/UDP;received=;rport=63523;branch=z9hG4bKPjfc5e9377637a4af7a2c0276486bf89ac
To: "Flavio Goncalves" <>;tag=a067.ad68745297904767ba5e92957a0613ae
From: "Flavio Goncalves" <>;tag=e1794c2b31b04c83a78a03de9e8f0878
Call-ID: f31c9b20962143399f52f20ccbeaafaf
Contact: <sip:alice@;ob>;expires=12, <sip:14297635@>;expires=600;pub-gruu=";gr=urn:uuid:fbd61308-0
Server: OpenSIPS (3.2.10 (x86_64/linux))
Content-Length: 0

For sequential requests it is important now that you can route properly. Looking at the ACK below you will notice that the address in the RURI is not the final address, but the GRUU.

2023/01/27 14:15:47.520837 ->
ACK;gr=urn:uuid:fbd61308-01db-4f37-bc8c-0be1cd33cd8f SIP/2.0
Via: SIP/2.0/UDP;rport;branch=z9hG4bKPj762eec6221574c13a201e4b55717e1b8
Max-Forwards: 70
From: "bob" <>;tag=c72cfe7516434b8d864918366a4bdc69
To: <>;tag=2b45621a6a35482e97a16046c2e0ef74
Call-ID: 7457248f27d4475fbf5d062106e4af1d
CSeq: 24702 ACK
Route: <sip:;lr;did=7ca.7d91344>
Content-Length: 0

So, for sequential requests with GRUU support, you need to do a lookup before sending.

if (has_totag()) {
  if($(ru{uri.param,gr})!=null) {

In the snippet above, we are checking for the presence of the parameter gr in the request URI. If gr is present we do a lookup to find the IP address of the specific instance.

In conclusion, GRUU is a powerful solution for maintaining reliable and consistent communication in a VoIP network. It allows users to be reached at a specific device or location, regardless of their IP address or network location. It is essential in some advanced scenarios such as transfers. Implementing GRUU in a VoIP network can be easily done using open-source SIP servers, and is an excellent choice for businesses and individuals looking for a cost-effective and flexible communication solution.

Leave a Reply

Your email address will not be published. Required fields are marked *