04-02-2024 01:22 AM
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
Solved! Go to Solution.
04-05-2024 06:38 AM - edited 04-05-2024 07:04 AM
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"
04-02-2024 01:57 AM - edited 04-02-2024 02:41 AM
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
04-02-2024 02:06 AM
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.
04-02-2024 02:46 AM - edited 04-02-2024 02:48 AM
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)
04-02-2024 03:18 AM
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"
04-03-2024 07:28 AM
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:
04-03-2024 07:46 AM
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"
04-03-2024 08:11 AM
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
04-05-2024 06:38 AM - edited 04-05-2024 07:04 AM
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"
04-09-2024 02:40 AM
That worked indeed. Thanks for the assistance.
04-09-2024 02:53 AM
If your problem could be resolved, then I would appreciate an "accepted solution".
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide