root/src/ftmod/ftmod_sangoma_boost/sigboost.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. boost_full_event

   1 /****************************************************************************
   2  * sigboost.h     $Revision: 1.13 $
   3  *
   4  * Definitions for the sigboost interface.
   5  *
   6  * WARNING WARNING WARNING
   7  *
   8  * This file is used by sangoma_mgd and perhaps other programs. Any changes 
   9  * to this file must be coordinated with other user programs,
  10  *
  11  * Copyright (C) 2005  Xygnada Technology, Inc.
  12  * 
  13 ****************************************************************************/
  14 #ifndef _SIGBOOST_H_
  15 #define _SIGBOOST_H_
  16 
  17 #define SIGBOOST_VERSION 103
  18 
  19 // handy to define integer types that actually work on both Lin and Win
  20 #include <freetdm.h>
  21 
  22 enum    e_sigboost_event_id_values
  23 {
  24         SIGBOOST_EVENT_CALL_START                       = 0x80, /*128*/
  25         SIGBOOST_EVENT_CALL_START_ACK                   = 0x81, /*129*/
  26         SIGBOOST_EVENT_CALL_START_NACK                  = 0x82, /*130*/
  27         SIGBOOST_EVENT_CALL_START_NACK_ACK              = 0x83, /*131*/
  28         SIGBOOST_EVENT_CALL_ANSWERED                    = 0x84, /*132*/
  29         SIGBOOST_EVENT_CALL_STOPPED                     = 0x85, /*133*/
  30         SIGBOOST_EVENT_CALL_STOPPED_ACK                 = 0x86, /*134*/
  31         SIGBOOST_EVENT_SYSTEM_RESTART                   = 0x87, /*135*/
  32         SIGBOOST_EVENT_SYSTEM_RESTART_ACK               = 0x88, /*136*/
  33        /* CALL_RELEASED is aimed to fix a race condition that became obvious
  34         * when the boost socket was replaced by direct function calls
  35         * and the channel hunting was moved to freetdm, the problem is
  36         * we can get CALL_STOPPED msg and reply with CALL_STOPPED_ACK
  37         * but the signaling module will still (in PRI) send RELEASE and
  38         * wait for RELEASE_COMPLETE from the isdn network before
  39         * marking the channel as available, therefore freetdm should
  40         * also not mark the channel as available until CALL_RELEASED
  41         * is received, for socket mode we can continue working as usual
  42         * with CALL_STOPPED being the last step because the hunting is
  43         * done in the signaling module.
  44         * */
  45         SIGBOOST_EVENT_CALL_RELEASED                    = 0x51, /* 81 */
  46         SIGBOOST_EVENT_CALL_PROGRESS                    = 0x50, /*decimal  80*/
  47         /* Following IDs are ss7boost to sangoma_mgd only. */
  48         SIGBOOST_EVENT_HEARTBEAT                        = 0x89, /*137*/
  49         SIGBOOST_EVENT_INSERT_CHECK_LOOP                = 0x8a, /*138*/
  50         SIGBOOST_EVENT_REMOVE_CHECK_LOOP                = 0x8b, /*139*/
  51         SIGBOOST_EVENT_AUTO_CALL_GAP_ABATE              = 0x8c, /*140*/
  52         SIGBOOST_EVENT_DIGIT_IN                                 = 0x8d, /*141*/
  53 };
  54 
  55 #define BOOST_DECODE_EVENT_ID(id) \
  56         (id==SIGBOOST_EVENT_CALL_START)?"SIGBOOST_EVENT_CALL_START": \
  57         (id==SIGBOOST_EVENT_CALL_START_ACK)?"SIGBOOST_EVENT_CALL_START_ACK": \
  58         (id==SIGBOOST_EVENT_CALL_START_NACK)?"SIGBOOST_EVENT_CALL_START_NACK": \
  59         (id==SIGBOOST_EVENT_CALL_ANSWERED)?"SIGBOOST_EVENT_CALL_ANSWERED": \
  60         (id==SIGBOOST_EVENT_CALL_STOPPED)?"SIGBOOST_EVENT_CALL_STOPPED": \
  61         (id==SIGBOOST_EVENT_CALL_STOPPED_ACK)?"SIGBOOST_EVENT_CALL_STOPPED_ACK": \
  62         (id==SIGBOOST_EVENT_SYSTEM_RESTART)?"SIGBOOST_EVENT_SYSTEM_RESTART": \
  63         (id==SIGBOOST_EVENT_SYSTEM_RESTART_ACK)?"SIGBOOST_EVENT_SYSTEM_RESTART_ACK": \
  64         (id==SIGBOOST_EVENT_CALL_RELEASED)?"SIGBOOST_EVENT_CALL_RELEASED": \
  65         (id==SIGBOOST_EVENT_CALL_PROGRESS)?"SIGBOOST_EVENT_CALL_PROGRESS": \
  66         (id==SIGBOOST_EVENT_HEARTBEAT)?"SIGBOOST_EVENT_HEARTBEAT": \
  67         (id==SIGBOOST_EVENT_INSERT_CHECK_LOOP)?"SIGBOOST_EVENT_INSERT_CHECK_LOOP": \
  68         (id==SIGBOOST_EVENT_REMOVE_CHECK_LOOP)?"SIGBOOST_EVENT_REMOVE_CHECK_LOOP": \
  69         (id==SIGBOOST_EVENT_AUTO_CALL_GAP_ABATE)?"SIGBOOST_EVENT_AUTO_CALL_GAP_ABATE": \
  70         (id==SIGBOOST_EVENT_DIGIT_IN)?"SIGBOOST_EVENT_DIGIT_IN": "Unknown"
  71 
  72 enum    e_sigboost_release_cause_values
  73 {
  74         SIGBOOST_RELEASE_CAUSE_UNDEFINED                = 0,
  75         SIGBOOST_RELEASE_CAUSE_NORMAL                   = 16,
  76         /* probable elimination */
  77         //SIGBOOST_RELEASE_CAUSE_BUSY                   = 0x91, /* 145 */
  78         //SIGBOOST_RELEASE_CAUSE_CALLED_NOT_EXIST       = 0x92, /* 146 */
  79         //SIGBOOST_RELEASE_CAUSE_CIRCUIT_RESET          = 0x93, /* 147 */
  80         //SIGBOOST_RELEASE_CAUSE_NOANSWER               = 0x94, /* 148 */
  81 };
  82 
  83 enum    e_sigboost_call_setup_ack_nack_cause_values
  84 {
  85         //SIGBOOST_CALL_SETUP_NACK_ALL_CKTS_BUSY                = 34,  /* Q.850 value - don't use */
  86         SIGBOOST_CALL_SETUP_NACK_ALL_CKTS_BUSY          = 117,  /* non Q.850 value indicates local all ckt busy 
  87                                                                    causing sangoma_mgd to perform automatic call 
  88                                                                    gapping*/
  89         SIGBOOST_CALL_SETUP_NACK_TEST_CKT_BUSY          = 17,  /* Q.850 value */
  90         SIGBOOST_CALL_SETUP_NACK_INVALID_NUMBER         = 28,  /* Q.850 value */
  91         SIGBOOST_CALL_SETUP_CSUPID_DBL_USE              = 200, /* unused Q.850 value */
  92 };
  93 
  94 
  95 enum    e_sigboost_huntgroup_values
  96 {
  97         SIGBOOST_HUNTGRP_SEQ_ASC        = 0x00, /* sequential with lowest available first */
  98         SIGBOOST_HUNTGRP_SEQ_DESC       = 0x01, /* sequential with highest available first */
  99         SIGBOOST_HUNTGRP_RR_ASC         = 0x02, /* round-robin with lowest available first */
 100         SIGBOOST_HUNTGRP_RR_DESC        = 0x03, /* round-robin with highest available first */
 101 };
 102 
 103 enum e_sigboost_event_info_par_values
 104 {
 105         SIGBOOST_EVI_SPARE                                              = 0x00, 
 106         SIGBOOST_EVI_ALERTING                                   = 0x01, 
 107         SIGBOOST_EVI_PROGRESS                                   = 0x02, 
 108 };
 109 
 110 enum e_sigboost_progress_flags
 111 {
 112         SIGBOOST_PROGRESS_RING = (1 << 0),
 113         SIGBOOST_PROGRESS_MEDIA = (1 << 1)
 114 };
 115 
 116 #define MAX_DIALED_DIGITS       31
 117 
 118 /* Next two defines are used to create the range of values for call_setup_id
 119  * in the t_sigboost structure.
 120  * 0..((CORE_MAX_SPANS * CORE_MAX_CHAN_PER_SPAN) - 1) */
 121 #define CORE_MAX_SPANS          200
 122 #define CORE_MAX_CHAN_PER_SPAN  32
 123 #define MAX_PENDING_CALLS       CORE_MAX_SPANS * CORE_MAX_CHAN_PER_SPAN
 124 /* 0..(MAX_PENDING_CALLS-1) is range of call_setup_id below */
 125 
 126 /* Should only be used by server */
 127 #define MAX_CALL_SETUP_ID   0xFFFF
 128 
 129 #define SIZE_CUSTOM     900
 130 #define SIZE_RDNIS  SIZE_CUSTOM
 131 
 132 
 133 #pragma pack(1)
 134 
 135 typedef struct
 136 {
 137         uint8_t                 capability;
 138         uint8_t                 uil1p;
 139 } t_sigboost_bearer;
 140 
 141 typedef struct
 142 {
 143         uint8_t                 digits_count;
 144         char                    digits [MAX_DIALED_DIGITS + 1]; /* it's a null terminated string */
 145         uint8_t                 npi;
 146         uint8_t                 ton;
 147         uint8_t                 screening_ind;
 148         uint8_t                 presentation_ind;
 149 }t_sigboost_digits;
 150 
 151 typedef struct
 152 {
 153         uint16_t                version;
 154         uint32_t                event_id;
 155         /* delete sequence numbers - SCTP does not need them */
 156         uint32_t                fseqno;
 157         uint32_t                bseqno;
 158         uint16_t                call_setup_id;
 159         uint32_t                trunk_group;
 160         uint8_t                 span;
 161         uint8_t                 chan;
 162         uint32_t                flags;
 163         /* struct timeval       tv; */ 
 164         t_sigboost_digits called;
 165         t_sigboost_digits calling;
 166         t_sigboost_digits rdnis;
 167         /* ref. Q.931 Table 4-11 and Q.951 Section 3 */
 168         char                    calling_name[MAX_DIALED_DIGITS + 1];
 169         t_sigboost_bearer       bearer;
 170         uint8_t                 hunt_group;
 171         uint16_t                custom_data_size;
 172         char                    custom_data[SIZE_CUSTOM]; /* it's a null terminated string */
 173 
 174 } t_sigboost_callstart;
 175 
 176 #define called_number_digits_count              called.digits_count
 177 #define called_number_digits                    called.digits
 178 #define calling_number_digits_count             calling.digits_count
 179 #define calling_number_digits                   calling.digits
 180 #define calling_number_screening_ind    calling.screening_ind
 181 #define calling_number_presentation             calling.presentation_ind
 182 
 183 #define isup_in_rdnis_size                              custom_data_size
 184 #define isup_in_rdnis                                   custom_data
 185 
 186 
 187 #define MIN_SIZE_CALLSTART_MSG  sizeof(t_sigboost_callstart) - SIZE_CUSTOM
 188 
 189 typedef struct
 190 {
 191         uint16_t                version;
 192         uint32_t                event_id;
 193         /* delete sequence numbers - SCTP does not need them */
 194         uint32_t                fseqno;
 195         uint32_t                bseqno;
 196         uint16_t                call_setup_id;
 197         uint32_t                trunk_group;
 198         uint8_t                 span;
 199         uint8_t                 chan;
 200         uint32_t                flags;
 201         /* struct timeval       tv; */ 
 202         uint8_t                 release_cause;
 203 } t_sigboost_short;
 204 #pragma pack()
 205 
 206 
 207 static __inline__ int boost_full_event(int event_id)
 208 {
 209         switch (event_id) {
 210         case SIGBOOST_EVENT_CALL_START:
 211         case SIGBOOST_EVENT_DIGIT_IN:
 212         case SIGBOOST_EVENT_CALL_PROGRESS:
 213                 return 1;
 214         default:
 215                 break;
 216         }
 217 
 218         return 0;
 219 }
 220 
 221 #endif

/* [<][>][^][v][top][bottom][index][help] */