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.

2 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. James "UcMadScientist" ArberJames "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.


Leave a Reply

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