Forwarding Original Caller ID with Skype4B and Telstra SIP

So I recently had a customer request that they have an on call mobile display the number of the calling party when a line was diverted outside of business hours.

Luckily they were using a standard client to do the call forwarding and not a response group, so it was simple to redirect the call back to Telstra (the carrier) and have them present the correct caller ID

A small amount of work is required to get this working on your Sonus but its a rather simple Sip Manipulation Rule

I should point out that if you have multiple Sonus gateways, or even multiple Trunks on the same gateway. It’s important that the call exits via the same trunk it came in as Telstra need to match the outbound call up with the inbound call

Note there is one weird trick (insert clickbait here) to get Skype4B to always send the call back to the gateway that accepted the call in the first place and that’s to enable refer support (Shudders, ugh, I cant believe I just said that)

As for getting a Sonus to send the call out the same Signaling Group it came in on. The guys over at Kloud have a nice howto on that one.

Anyway, more info is available over on the Sonus wiki but that document is for presenting the B party number to Telstra. I want to forward the A party number. So I can see where the call originally came from. Instead of My desk

First off, your going to need to enable the Forward Call History on your Skype4B trunks and check it doesn’t break anything. Particularly external call transfers! 
(I currently have a case open with Sonus on this for a customer)
Update: The fix was to add another SMM for the REFER as well.

You can do this in the Skype Control Panel, or in PowerShell

Make sure you wait for the EventID 46045 showing Outbound Routing has been updated

You might also see an EventID 25091 from the mediation server if you enabled Refer

Once that is done, we can login to the Sonus and create manipulation rules to present the correct caller ID

First off we create a new Manipulation Rule under Sip > Message Manipulation > Message Rule Tables

We create a new Rule Table called Collect History-Info (you can call it whatever you want, but it makes it easier for other engineers if its the same name)

Make sure its only on Selected Messages and Invite messages only

Once that’s done, enter the new Manipulation Rule just like you would a transformation table by selecting it on the left and creating a new Header Rule

In the new window, name the rule Collect History-Info and change the header action to Modify. Below that in the header name field type History and pick History-Info from the drop down menu.

In the Rules action we are going to store the History-Info number into a variable. So change the header value to Copy Value to and press Add/Edit the variable SG User Value 1 should already be selected. (or any other SG user value if Value 1 is used)

Once you done, the Header Rule should look like this.

Now, we have the B Party number stored somewhere we can use this in our manipulation table.

Create a new Manipulation Rule with a Mandatory match for the input field of SG User Value 1 with the following regex


To explain, this bit of regex makes it so the rule will only match if the SG User Value 1 contains “sip” followed by a valid Australian e164 number. Of which we capture any numbers after +61 but before the @ symbol and stuffing those into the Original Called Number

Once that is done, we add it to our routing table From Skype

Then we kick it all into gear by enabling the SMM on the Signaling group from Skype

Now we send a properly formed 302 to the carrier so you can forward/SimRing your Skype4B client to your mobile and have the original caller ID persist so you know who is actually calling.

A word of warning. Some gateway setups don’t like forward call history. So make sure to test attended call transfers! This also doesn’t work on Response Group call forwards. They will still appear to come from the RGS number.

Hope this helps.

7 thoughts on “Forwarding Original Caller ID with Skype4B and Telstra SIP

  1. greiginsydney

    You’re dead to me James. Please don’t turn REFER on! (Have you tested transfers out of an Exchange AA? Haven’t we been here before?)

    1. Avatar photoJames "UcMadScientist" Arber Post author

      If you can find a way to force Skype4B to send the call out the same gateway it came in without using refer. I’m all ears.

  2. Arran

    Hi James, I have two Sonus Edge SBC’s each with a leg of an Ent SIP Trunk from Telstra. I’d like to know a little more of what you did in regards to the SMM Refer on the gateways. I’ve already enabled it on the SFB Trunk Configuration for the Mediation Servers.

    Using the standard diversion header (redirecting number) hasn’t had much luck with blind transfer for this customer. You maybe more helpful then TIPT support. 🙂


    1. Avatar photoJames "UcMadScientist" Arber Post author

      Hi Arran.
      I’ll grab a screenshot and post an update soon!

      1. Avatar photoJames "UcMadScientist" Arber Post author

        Hi all, for anyone coming across this in search, Our current theory as to why this doesnt work locally on the SBC or as a blind transfer is due to the fact the “302 Moved” is missing.

        I don’t have a Telstra SIP endpoint to test with these days, but as soon as I do. I’ll come back to you.

  3. Rizwan Ullah

    Hi James

    We have Ribbon SBC Swe Lite installed behind NAT and we are using Media Bypass for Ms Teams Direct Routing. We have integrated the SBC SWe Lite with Sangoma PBXact UC 100 (an asterisk based) PBX where we have 25 users. All the configuration have been done both on the Teams tenant and SBC and PBX.

    We have an issue where if the PBX user makes a call he is able to receive the audio of Teams User but Teams user cannot listen the PBX User. Similarly, if the call is being initiated by the Teams user, no one can listen to each other. Can you please help?

  4. James "UcMadScientist" Arber

    Hi Rizwan.
    You’re going to need to start looking at the Sonus Lx logs first, I’d assume that the Asterisk PBX is also trying to media bypass and an asymmetric route issue is causing problems.

    Try setting the Signalling group to Proxy instead of bypass otherwise I’d be checking the SIP Invite media addresses to see that the addresses are what you expect them as the phones may be sending their local IP address to the Teams client or some other weirdness.

    I know Switchvox uses to SIP Proxy everything (Another Asterisk based PBX that has been through Digium/Sangoma) but FreePBX perfers to bypass.

    I should dust off my old Digium certs…


Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.