View Full Version : TQ31facility and pika 6.6 API

07-26-10, 03:27 AM
previously we have used TQ31facility to achieve call transfers on PRI trunks. It seems, TQ31facility is no more present under 6.6 version of API. Is there any substitute for it? How one can send raw facilities to the switch to rich suplementary services?
Thanks in advance

07-26-10, 08:39 AM
Hi Jarek,

Although I certainly could be wrong, I don't remember a TQ931Facility structure ever being present. This type of functionality can be exercised as you mentioned through the raw messaging. Below is the basic idea:

Fill in a generic Q931 message and set the messageType to the facility message type as per the switch. (for example, for the AT&T switch the FACILITY message is 0x62)

typedef struct Q931Message
TDecodedMessage common; /* MONTECARLO INTERNAL ONLY */
PK_U8 messageType; /* Message type (eg. SETUP, DISC) */
PK_U8 protDisc; /* Protocol discriminator */
PK_U8 callRefLen; /* Call reference length */
PK_U8 callRefFlag; /* Call refenence flag */
PK_U16 callRefVal; /* Call reference value */
PK_U16 ieDataLength; /* Raw message data */
PK_U32 correlationID; /* Call correlation ID */
} TQ931Message, *PQ931Message;

2) Add the IEs you want. This show the construction of a facility IE.

TQ931GenericIE ie;
ie.id = PK_Q931_FACILITY;
ie.length = 21;
ie.data[0] = 0x91;
ie.data[1] = 0xA1;
ie.data[2] = 0x12;
ie.data[19] = 0x00;
ie.data[20] = 0x02;

// Insert the facility IE into the message
status = PK_Q931_AddRawIE(&msg, &ie);
if (status != PK_SUCCESS) {
// handle the error

To handle an incoming message determine its type by the messageType field and then process the message appropriately retrieving the IEs you are interested in as shown in the code below. (Note: There is also a function called PK_Q931_GetIEInfo () that tells you what IEs are available on a particular message.)

In the event handler

void handleQ931Messages ()
If (setup) processSetupMessage ();
Else if (alert) processAlertMessage ();
Else if (XXXXX) processXXXXXMessage ();

void ProcessXXXXXMessage(TQ931Message *msg)
TQ931GenericIE ie = { 0 };
ie.id = PK_Q931_FACILITY; // this is a facilty IE - not a facility message!
// Retrieve the first occurrence of a facility IE
PK_STATUS status = PK_Q931_GetRawIE(msg, &ie, 0);
if (status == PK_SUCCESS) {
// process the ie
if (status != PK_Q931_ERR_IE_NOT_PRESENT) {
// handle the error

There are sometimes some twists but this is the basic idea. Hope it helps.


07-26-10, 08:51 AM
Hi Mark,
thank you for your kind response. It is clear now.