cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1154
Views
5
Helpful
10
Replies

Referred-by vs Diversion header

Djeten
Level 1
Level 1

Hello,

We are configuring MS Teams calling with Direct Routing.

We see that transfers to PSTN are not working. 

In the INVITE message going to PSTN, we see a Referred-By header, but our provider says that they need a Diversion header to make the transfer work.

How can I change the Referred-By header into a Diversion header, or add a Diversion header based on the Referred-by header?

Or should I ask MS Teams to add the Diversion header to the INVITE that they are sending towards us?

 

Kind regards

1 Accepted Solution

Accepted Solutions

Maybe it is not working using a stored value during the "add" operation.
Maybe you need to add an empty header first and then modify the header with another rule.

Something like that works for me (just to test, I copied something from the FROM header to the Referred-By header, but you just have to fit the rules to your needs):
voice class sip-profiles 1000
 rule 1 request INVITE sip-header From copy "(<sip:.*>)" u01
 rule 2 request INVITE sip-header Referred-By add "Referred-By: <sip:aaaa>"
 rule 3 request INVITE sip-header Referred-By modify "<sip:.*>" "\u01"

View solution in original post

10 Replies 10

b.winter
VIP
VIP

Maybe just remove the "Referred-By" Header in the outgoing INVITE to the provider.
The provider doesn't need this info technically, and he doesn't need to know, who transferred the call.

Edit:
Have you followed the configuration guide from Cisco? Or is it a config by yourself?
I have never had issues with transfers

Hey,

thanks for your reply. 

The case that we are testing is this:

Incoming call from PSTN to Teams > Forwarded to another PSTN number.

example with fictional numbers: call from pstn number +32474123456 to +3257147852 (our number), call is accepted and then transferred to another PSTN number +32478987654

If I remove the Referred-by header, the INVITE will use the original PSTN caller number +32474123456. This is not allowed because this is not a number that is hosted by this provider. So the Referred-by header (or the Diversion header) should contain the original called number +3257147852 so the provider can verify that the call is allowed.

 

 

How does your provider verify forwarded calls? (PSTN --> Teams, Teams --> forwards to external number)?
Normally, they verify it based on the PAI or PPI header. So you either have the "internal" number in one of those headers, or you just copy the number from the Referred-To header and paste it into the diversion header via SIP profiles.

Maybe you could share the config and a debug output of such a call (with debug ccsip messages active)

You don't see a PAI or PPI header, because you need to enable it. It's not magically there.
Just add a rule to add a PAI or PPI header and set the number to something from your DID range.
Or copy from the FROM, Diversion or Referred-By header and paste it into the PAI/PPI header.

Something like this:

voice class sip-profiles 2000
 rule 1 request INVITE peer-header sip From copy "sip:(.*)@" u01
 rule 2 request INVITE peer-header sip Diversion copy "sip:(.*)@" u01
 rule 3 request INVITE peer-header sip Referred-By copy "sip:(.*)@" u01
 rule 4 request INVITE sip-header P-Asserted-Identity modify "sip:.*@(.*)" "sip:\u01@\1"

Djeten
Level 1
Level 1

I have added this sip profile:

voice class sip-profiles 320
rule 1 request INVITE peer-header sip Referred-By copy "sip:(.*)" u01
rule 2 request INVITE sip-header Diversion ADD "sip:\u01"

Now I see this in the INVITE:

Djeten_0-1712154478348.png

 

 

 

In rule 1: peer-header is only used, when you wanna use the values of headers, from an incoming message.
But you are taking values from the same (outgoing) message to manipulate a different header in the same message.
Check how copy-lists works.

You need something like this:
rule 1 request INVITE sip-header sip Referred-By copy "sip:(.*)" u01
rule 2 request INVITE sip-header Diversion ADD "Diversion: sip:\u01"

Now I have configured this:

voice class sip-profiles 320
rule 1 request INVITE sip-header Referred-By copy "<sip:(.*)>" u01
rule 2 request INVITE sip-header Diversion add "Diversion:<sip:\u01>"

and this results in this line in the outgoing invite:

Diversion:<sip:\u01>

I added debug logs in attachment

 

 

Maybe it is not working using a stored value during the "add" operation.
Maybe you need to add an empty header first and then modify the header with another rule.

Something like that works for me (just to test, I copied something from the FROM header to the Referred-By header, but you just have to fit the rules to your needs):
voice class sip-profiles 1000
 rule 1 request INVITE sip-header From copy "(<sip:.*>)" u01
 rule 2 request INVITE sip-header Referred-By add "Referred-By: <sip:aaaa>"
 rule 3 request INVITE sip-header Referred-By modify "<sip:.*>" "\u01"

That worked indeed. Thanks for the assistance.

If your problem could be resolved, then I would appreciate an "accepted solution".