Retrieve Skype for Business PSTN Meeting ID From Database

Out of curiosity, I’ve been trying to figure out where the PSTN meeting ID was stored in the SfB database and if you are trying the same I have some bad news, it isn’t. The good news however is that it is possible to calculate the PSTN Meeting Code from two fields in the RTCLOCAL.rtc.dbo.Conference table.  I use the below SQL query to create a nicer view and show some additional information.


Select ConfId, ResourceId ,UserAtHost, ExternalConfId,PstnAuthorityId,PstnLocalId
from Resource
INNER JOIN Conference on Conference.OrganizerId = Resource.ResourceId









In order to calculate the fields we need the algorithm that Microsoft uses. I found this by de-compiling DBAnalyze.exe and I have created a simple console application that allows you to enter the PSTNAuthorityID and the PSTNLocalID and retrieve the PSTN conference code i.e. 44467


The C# code is here, next step would be to translate this into a database function. Enjoy.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication2
class Program
static void Main(string[] args)
Console.WriteLine(“Calculate PSTN ConfID”);
Console.WriteLine(“Enter AuthorityID and Push Enter”);
string Authority = Console.ReadLine();
Console.WriteLine(“Enter LocalID and Push Enter”);
string LocalId = Console.ReadLine();
string result = EncodeMeetingId(Authority, LocalId);

public static string EncodeMeetingId(string authorityId, string localId)
char[] chArray = authorityId.ToString().ToCharArray();
char[] chArray2 = localId.ToString().ToCharArray();
StringBuilder builder = new StringBuilder();
int repeatCount = 5;
builder.Append((char)(0x30 + chArray.Length));
repeatCount -= chArray.Length;
repeatCount -= chArray2.Length;
if (repeatCount > 0)
builder.Append(‘0’, repeatCount);
int num2 = builder.Length – 1;
if (builder[num2] != ‘0’)
char ch = builder[0];
builder[0] = builder[num2];
builder[num2] = ch;
for (int i = 1; i <= (num2 / 2); i++)
char ch2 = builder[i];
builder[i] = builder[num2 – i];
builder[num2 – i] = ch2;
for (int j = 1; j <= num2; j++)
int num5 = builder[j – 1] – ‘0’;
int num6 = builder[j] – ‘0’;
builder[j] = (char)(0x30 + ((num6 + num5) % 10));
return builder.ToString();