cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2504
Views
15
Helpful
4
Replies

JTAPI ID and TAPI ID - Extracting one from the other

estillman
Level 1
Level 1

Hi

 

I have a third-party application called InGenius that is logging its unique call id in Decimal format. It appears to be in all instances the 'dwCallID' which is created using the formula below (from DevNet).

 

My challenge is find the Global Call ID used to create the TAPI ID. It looks like a simple bit of algebra but I cannot figure out t fhe ormula. 

 

For example: TAPI id is X 

What is the Global Call ID?

(another application provides us the JTAPI id in Hex, if that helps)

 

From DevNet:

 

JTAPI CallID calculation formula

JTAPI Calculates CallID using the below logic:- JTAPI Call Id = First 8 bits for CallManagerID and 24 bits for CallID -> ((callManagerID & 0x00ff) << 24) | (globalCallID & 0x00ffffff)

For example, if the CallManagerID= 1 (0x01) and the CallID=3884 (0x00000F2C), then using the above formula JTAPI CallID becomes 0x01000F2C which is 16781100 in decimal.

TAPI CallID calculation formula

TAPI Calculates CallID using the below logic:- TAPI CALLID = First 10 bits for CallManagerID and 22 bits for CallID -> ((callManagerID & 0x03ff) << 22) | (globalCallID & 0x003fffff)

For example, if the CallManagerID= 1 (0x01) and the CallID= 0x00000F2C, then using the above formula TAPI CallID becomes 0x00400F2C.

From this we can find, TAPI CallID is different from that of JTAPI CallID.

2 Accepted Solutions

Accepted Solutions

davidn#
Cisco Employee
Cisco Employee

Hi estillman,
If you're looking for a formula used to compute the GlobalCallID then I don't think it's available to the public. GlobalCallID is unique for each call and can be used for billing purposes. Here is the excerpts from the CDR Admin guide:

The Unified Communications Manager allocates a global call identifier (GlobalCallID_callId) each time that a Cisco Unified IP Phone is taken off hook or a call is received from a gateway. The GlobalCallID_callId is allocated sequentially on a Unified Communications Manager server, independent of calls running on other call servers in the cluster. Unified Communications Manager writes the GlobalCallID_callId value to a disk file for every 1,000th call. When Unified Communications Manager restarts for any reason, it assigns the next 1000th number to the next GlobalCallID_callId.

For example, when a successful call gets made, the GlobalCallID_callId value in the CDR specifies 1001. For the next call, the GlobalCallID_callId value specifies 1002, and so on. When Unified Communications Manager restarts, the value for the next call in the CDR gets assigned 2001. The numbers continue sequentially from there until Unified Communications Manager restarts again. For the next restart, the GlobalCallID_callId value specifies 3001.
The maximum value that gets assigned to the GlobalCallID_callId is limited to 24 bits. When this limitation occurs, the GlobalCallID_callId value gets reset to 1.

Hope that helps.

Regards,

 

David

View solution in original post

The dwCallId contains the CallManager Id (typically 1 or a small number) and the CUCM Global Call ID in different portions of the 32 bit DWORD.  From the doc example 0x00400F2C:

<-CCM ID-><--------GCID-------->
00000000010000000000111100101100

To extract the GCID, you need to perform a bit-wise AND operation masking the first 10 bits:

<-CCM ID-><--------GCID-------->
00000000010000000000111100101100
AND
00000000001111111111111111111111
|
v
00000000000000000000111100101100

Which is 0xF2C hexadecimal, 3884 decimal.

Extracting the CallManager ID is similar.  Start by AND-ing with a mask of the last 22 bits:

<-CCM ID-><--------GCID-------->
00000000010000000000111100101100
AND
11111111110000000000000000000000
|
v
00000000010000000000000000000000

You will then need to remove the 22 trailing zeros, i.e. a bit-wise right-shift of 22 places:

00000000010000000000000000000000
--------------------->0000000001

Which of course is 0x0000000001 hexadecimal, 1 decimal.

This code snippet should work for Python:

dwCallId  = 0x00400F2C
gcid_mask = 0b00000000001111111111111111111111
cmid_mask = 0b11111111110000000000000000000000

gcid = dwCallId & gcid_mask
cmid = (dwCallId & cmid_mask) >> 22
print(f'CCM ID: {cmid} / GCID: {gcid}')

And for C++

#include <iostream>
using namespace std;

int main() {
uint dwCallId = 0x00400F2C;
uint gcid_mask = 0b00000000001111111111111111111111;
uint cmid_mask = 0b11111111110000000000000000000000;

uint gcid = dwCallId & gcid_mask;
uint cmid = (dwCallId & cmid_mask) >> 22;

cout<<"CMID: " << cmid <<" / "<< "GCID: " << gcid <<endl;

return 0;
}

 

 

 

View solution in original post

4 Replies 4

davidn#
Cisco Employee
Cisco Employee

Hi estillman,
If you're looking for a formula used to compute the GlobalCallID then I don't think it's available to the public. GlobalCallID is unique for each call and can be used for billing purposes. Here is the excerpts from the CDR Admin guide:

The Unified Communications Manager allocates a global call identifier (GlobalCallID_callId) each time that a Cisco Unified IP Phone is taken off hook or a call is received from a gateway. The GlobalCallID_callId is allocated sequentially on a Unified Communications Manager server, independent of calls running on other call servers in the cluster. Unified Communications Manager writes the GlobalCallID_callId value to a disk file for every 1,000th call. When Unified Communications Manager restarts for any reason, it assigns the next 1000th number to the next GlobalCallID_callId.

For example, when a successful call gets made, the GlobalCallID_callId value in the CDR specifies 1001. For the next call, the GlobalCallID_callId value specifies 1002, and so on. When Unified Communications Manager restarts, the value for the next call in the CDR gets assigned 2001. The numbers continue sequentially from there until Unified Communications Manager restarts again. For the next restart, the GlobalCallID_callId value specifies 3001.
The maximum value that gets assigned to the GlobalCallID_callId is limited to 24 bits. When this limitation occurs, the GlobalCallID_callId value gets reset to 1.

Hope that helps.

Regards,

 

David

The dwCallId contains the CallManager Id (typically 1 or a small number) and the CUCM Global Call ID in different portions of the 32 bit DWORD.  From the doc example 0x00400F2C:

<-CCM ID-><--------GCID-------->
00000000010000000000111100101100

To extract the GCID, you need to perform a bit-wise AND operation masking the first 10 bits:

<-CCM ID-><--------GCID-------->
00000000010000000000111100101100
AND
00000000001111111111111111111111
|
v
00000000000000000000111100101100

Which is 0xF2C hexadecimal, 3884 decimal.

Extracting the CallManager ID is similar.  Start by AND-ing with a mask of the last 22 bits:

<-CCM ID-><--------GCID-------->
00000000010000000000111100101100
AND
11111111110000000000000000000000
|
v
00000000010000000000000000000000

You will then need to remove the 22 trailing zeros, i.e. a bit-wise right-shift of 22 places:

00000000010000000000000000000000
--------------------->0000000001

Which of course is 0x0000000001 hexadecimal, 1 decimal.

This code snippet should work for Python:

dwCallId  = 0x00400F2C
gcid_mask = 0b00000000001111111111111111111111
cmid_mask = 0b11111111110000000000000000000000

gcid = dwCallId & gcid_mask
cmid = (dwCallId & cmid_mask) >> 22
print(f'CCM ID: {cmid} / GCID: {gcid}')

And for C++

#include <iostream>
using namespace std;

int main() {
uint dwCallId = 0x00400F2C;
uint gcid_mask = 0b00000000001111111111111111111111;
uint cmid_mask = 0b11111111110000000000000000000000;

uint gcid = dwCallId & gcid_mask;
uint cmid = (dwCallId & cmid_mask) >> 22;

cout<<"CMID: " << cmid <<" / "<< "GCID: " << gcid <<endl;

return 0;
}

 

 

 

Thank you Everyone !!

estillman
Level 1
Level 1

Thank you so Much!!

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: