Skip to content

Diversion header

When a call is forwarded, the number in the request URI is no longer the number the caller dialled. The Diversion header (RFC 5806) carries the originally called number and the reason for the redirection, so the next network can bill, route or display the call correctly. Some regulators require it on every forwarded call.

The switch adds Diversion in two places: on calls to vendors, controlled by the connection, and on DID calls delivered to your own accounts, controlled by the account’s incoming routing.

With Enable Diversion on the vendor connection (Advanced Parameters tab, SIP connections only), the outgoing INVITE gets a Diversion header when one of these is true:

  1. The call is a Follow Me leg. The account was called and forwarded the call to a Follow Me number. The header carries the number the caller dialled, or the account’s DID if the call came in through one, with reason=follow-me.
  2. The caller sent a Diversion header. The switch takes the number and parameters of the last Diversion header of the incoming INVITE. Without a reason parameter it adds reason=unconditional.

Diversion Header Tr. Rule on the Number Translation tab rewrites the number before it is sent, for example to add a country code. The host part of the header is always the switch’s own address. Without Enable Diversion, no Diversion header reaches the vendor, unless you list it in pass-through headers.

When a DID call is delivered to an account’s device or trunk, Fwd DID Mode in the account’s Incoming Routing decides how the DID is passed on:

Fwd DID Mode Effect
Diversion Header (default) The DID goes into a Diversion header with reason=unconditional
Forward DID in URI The DID is added to the request URI
Off The DID is not passed on

See Trunks and incoming routing.

Screenshot "admin-panel/connection-advanced-parameters" has not been generated yet — see scripts/screenshots/screens.yml.
  • Connection — a route to a vendor (SIP host, port, protocol, codecs) used by routing to send calls.
  • DID — Direct Inward Dialing: a phone number bought from a vendor and assigned to an account to receive calls.
  • Translation Rule — a regular-expression rule that rewrites the called or calling number before rating or routing.
  • Trunk — a SIP link between two systems carrying many simultaneous calls; in FlySIP usually an IP-authenticated account or a vendor connection.

A customer’s DID is forwarded to a mobile number

Section titled “A customer’s DID is forwarded to a mobile number”

The DID rings the account, the account’s Follow Me sends the call to a vendor. Turn on Enable Diversion on that vendor’s connection: the vendor sees the DID in Diversion with reason=follow-me, while From keeps the caller’s number.

A customer’s PBX forwards calls through you

Section titled “A customer’s PBX forwards calls through you”

The PBX already sends Diversion. Turn on Enable Diversion on the vendor connection to pass it on with its original reason. Without the option the switch drops it.

The vendor wants the diverting number in national format

Section titled “The vendor wants the diverting number in national format”

Keep Enable Diversion on and add a Diversion Header Tr. Rule, for example one that strips the country code. The rule changes only the Diversion number, not the CLI or CLD.