Wed Jan 8 2020 09:49:51

Asterisk developer's documentation


sig_pri.h
Go to the documentation of this file.
1 #ifndef _SIG_PRI_H
2 #define _SIG_PRI_H
3 /*
4  * Asterisk -- An open source telephony toolkit.
5  *
6  * Copyright (C) 1999 - 2009, Digium, Inc.
7  *
8  * Mark Spencer <markster@digium.com>
9  *
10  * See http://www.asterisk.org for more information about
11  * the Asterisk project. Please do not directly contact
12  * any of the maintainers of this project for assistance;
13  * the project provides a web site, mailing lists and IRC
14  * channels for your use.
15  *
16  * This program is free software, distributed under the terms of
17  * the GNU General Public License Version 2. See the LICENSE file
18  * at the top of the source tree.
19  */
20 
21 /*! \file
22  *
23  * \brief Interface header for PRI signaling module
24  *
25  * \author Matthew Fredrickson <creslin@digium.com>
26  */
27 
28 #include "asterisk/channel.h"
29 #include "asterisk/frame.h"
30 #include "asterisk/event.h"
31 #include "asterisk/ccss.h"
32 #include <libpri.h>
33 #include <dahdi/user.h>
34 
35 #if defined(HAVE_PRI_CCSS)
36 /*! PRI debug message flags when normal PRI debugging is turned on at the command line. */
37 #define SIG_PRI_DEBUG_NORMAL \
38  (PRI_DEBUG_APDU | PRI_DEBUG_Q931_DUMP | PRI_DEBUG_Q931_STATE | PRI_DEBUG_Q921_STATE \
39  | PRI_DEBUG_CC)
40 
41 /*! PRI debug message flags when intense PRI debugging is turned on at the command line. */
42 #define SIG_PRI_DEBUG_INTENSE \
43  (PRI_DEBUG_APDU | PRI_DEBUG_Q931_DUMP | PRI_DEBUG_Q931_STATE | PRI_DEBUG_Q921_STATE \
44  | PRI_DEBUG_CC | PRI_DEBUG_Q921_RAW | PRI_DEBUG_Q921_DUMP)
45 
46 #else
47 
48 /*! PRI debug message flags when normal PRI debugging is turned on at the command line. */
49 #define SIG_PRI_DEBUG_NORMAL \
50  (PRI_DEBUG_APDU | PRI_DEBUG_Q931_DUMP | PRI_DEBUG_Q931_STATE | PRI_DEBUG_Q921_STATE)
51 
52 /*! PRI debug message flags when intense PRI debugging is turned on at the command line. */
53 #define SIG_PRI_DEBUG_INTENSE \
54  (PRI_DEBUG_APDU | PRI_DEBUG_Q931_DUMP | PRI_DEBUG_Q931_STATE | PRI_DEBUG_Q921_STATE \
55  | PRI_DEBUG_Q921_RAW | PRI_DEBUG_Q921_DUMP)
56 #endif /* !defined(HAVE_PRI_CCSS) */
57 
58 #if 0
59 /*! PRI debug message flags set on initial startup. */
60 #define SIG_PRI_DEBUG_DEFAULT SIG_PRI_DEBUG_NORMAL
61 #else
62 /*! PRI debug message flags set on initial startup. */
63 #define SIG_PRI_DEBUG_DEFAULT 0
64 #endif
65 
66 #define SIG_PRI_AOC_GRANT_S (1 << 0)
67 #define SIG_PRI_AOC_GRANT_D (1 << 1)
68 #define SIG_PRI_AOC_GRANT_E (1 << 2)
69 
78 };
79 
84 };
85 
86 /*! Call establishment life cycle level for simple comparisons. */
88  /*! Call does not exist. */
90  /*! Call is present but has no response yet. (SETUP) */
92  /*! Call is collecting digits for overlap dialing. (SETUP ACKNOWLEDGE) */
94  /*! Call routing is happening. (PROCEEDING) */
96  /*! Called party is being alerted of the call. (ALERTING) */
98  /*! Call is dialing 'w' deferred digits. (CONNECT) */
100  /*! Call is connected/answered. (CONNECT) */
102 };
103 
105  /*! \brief The channel is not being RESTARTed. */
107  /*!
108  * \brief The channel is being RESTARTed.
109  * \note Waiting for a RESTART ACKNOWLEDGE from the peer.
110  */
112  /*!
113  * \brief Peer may not be sending the expected RESTART ACKNOWLEDGE.
114  *
115  * \details We have already received a SETUP on this channel.
116  * If another SETUP comes in on this channel then the peer
117  * considers this channel useable. Assume that the peer is
118  * never going to give us a RESTART ACKNOWLEDGE and assume that
119  * we have received one. This is not according to Q.931, but
120  * some peers occasionally fail to send a RESTART ACKNOWLEDGE.
121  */
123 };
124 
125 struct sig_pri_span;
126 
128  /* Unlock the private in the signalling private structure. This is used for three way calling madness. */
129  void (* const unlock_private)(void *pvt);
130  /* Lock the private in the signalling private structure. ... */
131  void (* const lock_private)(void *pvt);
132  /* Function which is called back to handle any other DTMF events that are received. Called by analog_handle_event. Why is this
133  * important to use, instead of just directly using events received before they are passed into the library? Because sometimes,
134  * (CWCID) the library absorbs DTMF events received. */
135  //void (* const handle_dtmf)(void *pvt, struct ast_channel *ast, enum analog_sub analog_index, struct ast_frame **dest);
136 
137  //int (* const dial_digits)(void *pvt, enum analog_sub sub, struct analog_dialoperation *dop);
138  int (* const play_tone)(void *pvt, enum sig_pri_tone tone);
139 
140  int (* const set_echocanceller)(void *pvt, int enable);
141  int (* const train_echocanceller)(void *pvt);
142  int (* const dsp_reset_and_flush_digits)(void *pvt);
143 
144  struct ast_channel * (* const new_ast_channel)(void *pvt, int state, enum sig_pri_law law, char *exten, const struct ast_channel *chan);
145 
146  void (* const fixup_chans)(void *old_chan, void *new_chan);
147 
148  /* Note: Called with PRI lock held */
149  void (* const handle_dchan_exception)(struct sig_pri_span *pri, int index);
150  void (* const set_alarm)(void *pvt, int in_alarm);
151  void (* const set_dialing)(void *pvt, int is_dialing);
152  void (* const set_digital)(void *pvt, int is_digital);
153  void (* const set_outgoing)(void *pvt, int is_outgoing);
154  void (* const set_callerid)(void *pvt, const struct ast_party_caller *caller);
155  void (* const set_dnid)(void *pvt, const char *dnid);
156  void (* const set_rdnis)(void *pvt, const char *rdnis);
157  void (* const queue_control)(void *pvt, int subclass);
158  int (* const new_nobch_intf)(struct sig_pri_span *pri);
159  void (* const init_config)(void *pvt, struct sig_pri_span *pri);
160  const char *(* const get_orig_dialstring)(void *pvt);
161  void (* const make_cc_dialstring)(void *pvt, char *buf, size_t buf_size);
162  void (* const update_span_devstate)(struct sig_pri_span *pri);
163  void (* const dial_digits)(void *pvt, const char *dial_string);
164 
165  void (* const open_media)(void *pvt);
166 
167  /*!
168  * \brief Post an AMI B channel association event.
169  *
170  * \param pvt Private structure of the user of this module.
171  * \param chan Channel associated with the private pointer
172  *
173  * \return Nothing
174  */
175  void (* const ami_channel_event)(void *pvt, struct ast_channel *chan);
176 
177  /*! Reference the parent module. */
178  void (*module_ref)(void);
179  /*! Unreference the parent module. */
180  void (*module_unref)(void);
181 };
182 
183 #define SIG_PRI_NUM_DCHANS 4 /*!< No more than 4 d-channels */
184 #define SIG_PRI_MAX_CHANNELS 672 /*!< No more than a DS3 per trunk group */
185 
186 #define SIG_PRI DAHDI_SIG_CLEAR
187 #define SIG_BRI (0x2000000 | DAHDI_SIG_CLEAR)
188 #define SIG_BRI_PTMP (0X4000000 | DAHDI_SIG_CLEAR)
189 
190 /* QSIG channel mapping option types */
191 #define DAHDI_CHAN_MAPPING_PHYSICAL 0
192 #define DAHDI_CHAN_MAPPING_LOGICAL 1
193 
194 /* Overlap dialing option types */
195 #define DAHDI_OVERLAPDIAL_NONE 0
196 #define DAHDI_OVERLAPDIAL_OUTGOING 1
197 #define DAHDI_OVERLAPDIAL_INCOMING 2
198 #define DAHDI_OVERLAPDIAL_BOTH (DAHDI_OVERLAPDIAL_INCOMING|DAHDI_OVERLAPDIAL_OUTGOING)
199 
200 #if defined(HAVE_PRI_SERVICE_MESSAGES)
201 /*! \brief Persistent Service State */
202 #define SRVST_DBKEY "service-state"
203 /*! \brief The out-of-service SERVICE state */
204 #define SRVST_TYPE_OOS "O"
205 /*! \brief SRVST_INITIALIZED is used to indicate a channel being out-of-service
206  * The SRVST_INITIALIZED is mostly used maintain backwards compatibility but also may
207  * mean that the channel has not yet received a RESTART message. If a channel is
208  * out-of-service with this reason a RESTART message will result in the channel
209  * being put into service. */
210 #define SRVST_INITIALIZED 0
211 /*! \brief SRVST_NEAREND is used to indicate that the near end was put out-of-service */
212 #define SRVST_NEAREND (1 << 0)
213 /*! \brief SRVST_FAREND is used to indicate that the far end was taken out-of-service */
214 #define SRVST_FAREND (1 << 1)
215 /*! \brief SRVST_BOTH is used to indicate that both sides of the channel are out-of-service */
216 #define SRVST_BOTH (SRVST_NEAREND | SRVST_FAREND)
217 
218 /*! \brief The AstDB family */
219 static const char dahdi_db[] = "dahdi/registry";
220 #endif /* defined(HAVE_PRI_SERVICE_MESSAGES) */
221 
222 struct sig_pri_chan {
223  /* Options to be set by user */
224  unsigned int hidecallerid:1;
225  unsigned int hidecalleridname:1; /*!< Hide just the name not the number for legacy PBX use */
226  unsigned int immediate:1; /*!< Answer before getting digits? */
227  unsigned int priexclusive:1; /*!< Whether or not to override and use exculsive mode for channel selection */
228  unsigned int priindication_oob:1;
229  unsigned int use_callerid:1; /*!< Whether or not to use caller id on this channel */
230  unsigned int use_callingpres:1; /*!< Whether to use the callingpres the calling switch sends */
233  int stripmsd;
234  int channel; /*!< Channel Number or CRV */
235 
236  /* Options to be checked by user */
237  int cid_ani2; /*!< Automatic Number Identification number (Alternate PRI caller ID number) */
238  int cid_ton; /*!< Type Of Number (TON) */
239  int callingpres; /*!< The value of calling presentation that we're going to use when placing a PRI call */
244  /*! \brief User tag for party id's sent from this device driver. */
247 
248  /* Internal variables -- Don't touch */
249  /* Probably will need DS0 number, DS1 number, and a few other things */
250  char dialdest[256]; /* Queued up digits for overlap dialing. They will be sent out as information messages when setup ACK is received */
251 #if defined(HAVE_PRI_SETUP_KEYPAD)
252  /*! \brief Keypad digits that came in with the SETUP message. */
254 #endif /* defined(HAVE_PRI_SETUP_KEYPAD) */
255  /*! 'w' deferred dialing digits. */
257 
258 #if defined(HAVE_PRI_AOC_EVENTS)
259  struct pri_subcmd_aoc_e aoc_e;
260  int aoc_s_request_invoke_id; /*!< If an AOC-S request was present for the call, this is the invoke_id to use for the response */
261  unsigned int aoc_s_request_invoke_id_valid:1; /*!< This is set when the AOC-S invoke id is present */
262  unsigned int waiting_for_aoce:1; /*!< Delaying hangup for AOC-E msg. If this is set and AOC-E is received, continue with hangup before timeout period. */
263  unsigned int holding_aoce:1; /*!< received AOC-E msg from asterisk. holding for disconnect/release */
264 #endif /* defined(HAVE_PRI_AOC_EVENTS) */
265  unsigned int inalarm:1;
266  unsigned int alreadyhungup:1; /*!< TRUE if the call has already gone/hungup */
267  unsigned int isidlecall:1; /*!< TRUE if this is an idle call */
268  unsigned int progress:1; /*!< TRUE if the call has seen inband-information progress through the network */
269 
270  /*!
271  * \brief TRUE when this channel is allocated.
272  *
273  * \details
274  * Needed to hold an outgoing channel allocation before the
275  * owner pointer is created.
276  *
277  * \note This is one of several items to check to see if a
278  * channel is available for use.
279  */
280  unsigned int allocated:1;
281  unsigned int outgoing:1;
282  unsigned int digital:1;
283  /*! \brief TRUE if this interface has no B channel. (call hold and call waiting) */
284  unsigned int no_b_channel:1;
285 #if defined(HAVE_PRI_CALL_WAITING)
286  /*! \brief TRUE if this is a call waiting call */
287  unsigned int is_call_waiting:1;
288 #endif /* defined(HAVE_PRI_CALL_WAITING) */
289 #if defined(HAVE_PRI_SETUP_ACK_INBAND)
290  /*! TRUE if outgoing SETUP had no called digits */
291  unsigned int no_dialed_digits:1;
292 #endif /* defined(HAVE_PRI_SETUP_ACK_INBAND) */
293 
295 
296  struct sig_pri_span *pri;
297  q931_call *call; /*!< opaque libpri call control structure */
298 
299  /*! Call establishment life cycle level for simple comparisons. */
301  /*! \brief Channel reset/restart state. */
303  int prioffset; /*!< channel number in span */
304  int logicalspan; /*!< logical span number within trunk group */
305  int mastertrunkgroup; /*!< what trunk group is our master */
306 #if defined(HAVE_PRI_SERVICE_MESSAGES)
307  /*! \brief Active SRVST_DBKEY out-of-service status value. */
308  unsigned service_status;
309 #endif /* defined(HAVE_PRI_SERVICE_MESSAGES) */
310 
312  void *chan_pvt; /*!< Private structure of the user of this module. */
313 #if defined(HAVE_PRI_REVERSE_CHARGE)
314  /*!
315  * \brief Reverse charging indication
316  * \details
317  * -1 - No reverse charging,
318  * 1 - Reverse charging,
319  * 0,2-7 - Reserved for future use
320  */
322 #endif
323 };
324 
325 #if defined(HAVE_PRI_MWI)
326 /*! Maximum number of mailboxes per span. */
327 #define SIG_PRI_MAX_MWI_MAILBOXES 8
328 /*! Typical maximum length of mwi mailbox number */
329 #define SIG_PRI_MAX_MWI_MBOX_NUMBER_LEN 10 /* digits in number */
330 /*! Typical maximum length of mwi mailbox context */
331 #define SIG_PRI_MAX_MWI_CONTEXT_LEN 10
332 /*!
333  * \brief Maximum mwi_mailbox string length.
334  * \details
335  * max_length = #mailboxes * (mbox_number + '@' + context + ',')
336  * The last ',' is a null terminator instead.
337  */
338 #define SIG_PRI_MAX_MWI_MAILBOX_STR (SIG_PRI_MAX_MWI_MAILBOXES \
339  * (SIG_PRI_MAX_MWI_MBOX_NUMBER_LEN + 1 + SIG_PRI_MAX_MWI_CONTEXT_LEN + 1))
340 
341 struct sig_pri_mbox {
342  /*!
343  * \brief MWI mailbox event subscription.
344  * \note NULL if mailbox not configured.
345  */
347  /*! \brief Mailbox number */
348  const char *number;
349  /*! \brief Mailbox context. */
350  const char *context;
351 };
352 #endif /* defined(HAVE_PRI_MWI) */
353 
354 struct sig_pri_span {
355  /* Should be set by user */
356  struct ast_cc_config_params *cc_params; /*!< CC config parameters for each new call. */
357  int pritimers[PRI_MAX_TIMERS];
358  int overlapdial; /*!< In overlap dialing mode */
359  int qsigchannelmapping; /*!< QSIG channel mapping type */
360  int discardremoteholdretrieval; /*!< shall remote hold or remote retrieval notifications be discarded? */
361  int facilityenable; /*!< Enable facility IEs */
362 #if defined(HAVE_PRI_L2_PERSISTENCE)
363  /*! Layer 2 persistence option. */
365 #endif /* defined(HAVE_PRI_L2_PERSISTENCE) */
366  int dchan_logical_span[SIG_PRI_NUM_DCHANS]; /*!< Logical offset the DCHAN sits in */
367  int fds[SIG_PRI_NUM_DCHANS]; /*!< FD's for d-channels */
368 
369 #if defined(HAVE_PRI_AOC_EVENTS)
370  int aoc_passthrough_flag; /*!< Represents what AOC messages (S,D,E) are allowed to pass-through */
371  unsigned int aoce_delayhangup:1; /*!< defines whether the aoce_delayhangup option is enabled or not */
372 #endif /* defined(HAVE_PRI_AOC_EVENTS) */
373 
374 #if defined(HAVE_PRI_SERVICE_MESSAGES)
375  unsigned int enable_service_message_support:1; /*!< enable SERVICE message support */
376 #endif /* defined(HAVE_PRI_SERVICE_MESSAGES) */
377 #ifdef HAVE_PRI_INBANDDISCONNECT
378  unsigned int inbanddisconnect:1; /*!< Should we support inband audio after receiving DISCONNECT? */
379 #endif
380 #if defined(HAVE_PRI_CALL_HOLD)
381  /*! \brief TRUE if held calls are transferred on disconnect. */
382  unsigned int hold_disconnect_transfer:1;
383 #endif /* defined(HAVE_PRI_CALL_HOLD) */
384  /*!
385  * \brief TRUE if call transfer is enabled for the span.
386  * \note Support switch-side transfer (called 2BCT, RLT or other names)
387  */
388  unsigned int transfer:1;
389 #if defined(HAVE_PRI_CALL_WAITING)
390  /*! \brief TRUE if we will allow incoming ISDN call waiting calls. */
391  unsigned int allow_call_waiting_calls:1;
392 #endif /* defined(HAVE_PRI_CALL_WAITING) */
393  /*! TRUE if layer 1 alarm status is ignored */
394  unsigned int layer1_ignored:1;
395  /*!
396  * TRUE if a new call's sig_pri_chan.user_tag[] has the MSN
397  * appended to the initial_user_tag[].
398  */
399  unsigned int append_msn_to_user_tag:1;
400  /*! TRUE if a SETUP ACK message needs to open the audio path. */
401  unsigned int inband_on_setup_ack:1;
402  /*! TRUE if a PROCEEDING message needs to unsquelch the received audio. */
403  unsigned int inband_on_proceeding:1;
404  int dialplan; /*!< Dialing plan */
405  int localdialplan; /*!< Local dialing plan */
406  char internationalprefix[10]; /*!< country access code ('00' for european dialplans) */
407  char nationalprefix[10]; /*!< area access code ('0' for european dialplans) */
408  char localprefix[20]; /*!< area access code + area code ('0'+area code for european dialplans) */
409  char privateprefix[20]; /*!< for private dialplans */
410  char unknownprefix[20]; /*!< for unknown dialplans */
411  long resetinterval; /*!< Interval (in seconds) for resetting unused channels */
412 #if defined(HAVE_PRI_MWI)
413  /*! \brief Active MWI mailboxes */
415  /*!
416  * \brief Comma separated list of mailboxes to indicate MWI.
417  * \note Empty if disabled.
418  * \note Format: mailbox_number[@context]{,mailbox_number[@context]}
419  * \note String is split apart when span is started.
420  */
422 #endif /* defined(HAVE_PRI_MWI) */
423  /*!
424  * \brief Initial user tag for party id's sent from this device driver.
425  * \note String set by config file.
426  */
428  char msn_list[AST_MAX_EXTENSION]; /*!< Comma separated list of MSNs to handle. Empty if disabled. */
429  char idleext[AST_MAX_EXTENSION]; /*!< Where to idle extra calls */
430  char idlecontext[AST_MAX_CONTEXT]; /*!< What context to use for idle */
431  char idledial[AST_MAX_EXTENSION]; /*!< What to dial before dumping */
432  int minunused; /*!< Min # of channels to keep empty */
433  int minidle; /*!< Min # of "idling" calls to keep active */
434  int nodetype; /*!< Node type */
435  int switchtype; /*!< Type of switch to emulate */
436  int nsf; /*!< Network-Specific Facilities */
437  int trunkgroup; /*!< What our trunkgroup is */
438 #if defined(HAVE_PRI_CCSS)
439  int cc_ptmp_recall_mode; /*!< CC PTMP recall mode. globalRecall(0), specificRecall(1) */
440  int cc_qsig_signaling_link_req; /*!< CC Q.SIG signaling link retention (Party A) release(0), retain(1), do-not-care(2) */
441  int cc_qsig_signaling_link_rsp; /*!< CC Q.SIG signaling link retention (Party B) release(0), retain(1) */
442 #endif /* defined(HAVE_PRI_CCSS) */
443 #if defined(HAVE_PRI_CALL_WAITING)
444  /*!
445  * \brief Number of extra outgoing calls to allow on a span before
446  * considering that span congested.
447  */
449  struct {
450  int stripmsd;
451  unsigned int hidecallerid:1;
452  unsigned int hidecalleridname:1; /*!< Hide just the name not the number for legacy PBX use */
453  unsigned int immediate:1; /*!< Answer before getting digits? */
454  unsigned int priexclusive:1; /*!< Whether or not to override and use exculsive mode for channel selection */
455  unsigned int priindication_oob:1;
456  unsigned int use_callerid:1; /*!< Whether or not to use caller id on this channel */
457  unsigned int use_callingpres:1; /*!< Whether to use the callingpres the calling switch sends */
460  } ch_cfg;
461 
462  /*!
463  * \brief Number of outstanding call waiting calls.
464  * \note Must be zero to allow new calls from asterisk to
465  * immediately allocate a B channel.
466  */
468 #endif /* defined(HAVE_PRI_CALL_WAITING) */
469  int dchanavail[SIG_PRI_NUM_DCHANS]; /*!< Whether each channel is available */
470  int debug; /*!< set to true if to dump PRI event info */
471  int span; /*!< span number put into user output messages */
472  int resetting; /*!< true if span is being reset/restarted */
473  int resetpos; /*!< current position during a reset (-1 if not started) */
474  int sig; /*!< ISDN signalling type (SIG_PRI, SIG_BRI, SIG_BRI_PTMP, etc...) */
475  int new_chan_seq; /*!< New struct ast_channel sequence number */
476  /*! TRUE if we have already whined about no D channels available. */
477  unsigned int no_d_channels:1;
478 
479  /* Everything after here is internally set */
480  struct pri *dchans[SIG_PRI_NUM_DCHANS]; /*!< Actual d-channels */
481  struct pri *pri; /*!< Currently active D-channel */
482  /*!
483  * List of private structures of the user of this module for no B channel
484  * interfaces. (hold and call waiting interfaces)
485  */
487  /*!
488  * List of private structures of the user of this module for no B channel
489  * interfaces. (hold and call waiting interfaces)
490  */
492  int numchans; /*!< Num of channels we represent */
493  struct sig_pri_chan *pvts[SIG_PRI_MAX_CHANNELS];/*!< Member channel pvt structs */
494  pthread_t master; /*!< Thread of master */
495  ast_mutex_t lock; /*!< libpri access Mutex */
496  time_t lastreset; /*!< time when unused channels were last reset */
498  /*!
499  * \brief Congestion device state of the span.
500  * \details
501  * AST_DEVICE_NOT_INUSE - Span does not have all B channels in use.
502  * AST_DEVICE_BUSY - All B channels are in use.
503  * AST_DEVICE_UNAVAILABLE - Span is in alarm.
504  * \note
505  * Device name: \startverbatim DAHDI/I<span>/congestion. \endverbatim
506  */
508 #if defined(THRESHOLD_DEVSTATE_PLACEHOLDER)
509  /*! \todo An ISDN span threshold device state could be useful in determining how often a span utilization goes over a configurable threshold. */
510  /*!
511  * \brief User threshold device state of the span.
512  * \details
513  * AST_DEVICE_NOT_INUSE - There are no B channels in use.
514  * AST_DEVICE_INUSE - The number of B channels in use is less than
515  * the configured threshold but not zero.
516  * AST_DEVICE_BUSY - The number of B channels in use meets or exceeds
517  * the configured threshold.
518  * AST_DEVICE_UNAVAILABLE - Span is in alarm.
519  * \note
520  * Device name: DAHDI/I<span>/threshold
521  */
522  int threshold_devstate;
523  /*!
524  * \brief Number of B channels in use to consider the span in a busy state.
525  * \note Setting the threshold to zero is interpreted as all B channels.
526  */
527  int user_busy_threshold;
528 #endif /* defined(THRESHOLD_DEVSTATE_PLACEHOLDER) */
529 };
530 
531 void sig_pri_extract_called_num_subaddr(struct sig_pri_chan *p, const char *rdest, char *called, size_t called_buff_size);
532 int sig_pri_call(struct sig_pri_chan *p, struct ast_channel *ast, char *rdest, int timeout, int layer1);
533 
534 int sig_pri_hangup(struct sig_pri_chan *p, struct ast_channel *ast);
535 
536 int sig_pri_indicate(struct sig_pri_chan *p, struct ast_channel *chan, int condition, const void *data, size_t datalen);
537 
538 int sig_pri_answer(struct sig_pri_chan *p, struct ast_channel *ast);
539 
540 int sig_pri_is_chan_available(struct sig_pri_chan *pvt);
541 int sig_pri_available(struct sig_pri_chan **pvt, int is_specific_channel);
542 
543 void sig_pri_init_pri(struct sig_pri_span *pri);
544 
545 /* If return 0, it means this function was able to handle it (pre setup digits). If non zero, the user of this
546  * functions should handle it normally (generate inband DTMF) */
547 int sig_pri_digit_begin(struct sig_pri_chan *pvt, struct ast_channel *ast, char digit);
548 void sig_pri_dial_complete(struct sig_pri_chan *pvt, struct ast_channel *ast);
549 
550 void sig_pri_stop_pri(struct sig_pri_span *pri);
551 int sig_pri_start_pri(struct sig_pri_span *pri);
552 
553 void sig_pri_set_alarm(struct sig_pri_chan *p, int in_alarm);
554 void sig_pri_chan_alarm_notify(struct sig_pri_chan *p, int noalarm);
555 
556 int sig_pri_is_alarm_ignored(struct sig_pri_span *pri);
557 void pri_event_alarm(struct sig_pri_span *pri, int index, int before_start_pri);
558 void pri_event_noalarm(struct sig_pri_span *pri, int index, int before_start_pri);
559 
560 struct ast_channel *sig_pri_request(struct sig_pri_chan *p, enum sig_pri_law law, const struct ast_channel *requestor, int transfercapability);
561 
562 struct sig_pri_chan *sig_pri_chan_new(void *pvt_data, struct sig_pri_callback *callback, struct sig_pri_span *pri, int logicalspan, int channo, int trunkgroup);
563 void sig_pri_chan_delete(struct sig_pri_chan *doomed);
564 
565 int pri_is_up(struct sig_pri_span *pri);
566 
568 void sig_pri_cli_show_channels(int fd, struct sig_pri_span *pri);
569 void sig_pri_cli_show_spans(int fd, int span, struct sig_pri_span *pri);
570 
571 void sig_pri_cli_show_span(int fd, int *dchannels, struct sig_pri_span *pri);
572 
573 int pri_send_keypad_facility_exec(struct sig_pri_chan *p, const char *digits);
574 int pri_send_callrerouting_facility_exec(struct sig_pri_chan *p, enum ast_channel_state chanstate, const char *destination, const char *original, const char *reason);
575 
576 #if defined(HAVE_PRI_SERVICE_MESSAGES)
577 int pri_maintenance_bservice(struct pri *pri, struct sig_pri_chan *p, int changestatus);
578 #endif /* defined(HAVE_PRI_SERVICE_MESSAGES) */
579 
580 void sig_pri_fixup(struct ast_channel *oldchan, struct ast_channel *newchan, struct sig_pri_chan *pchan);
581 
582 int sig_pri_cc_agent_init(struct ast_cc_agent *agent, struct sig_pri_chan *pvt_chan);
586 int sig_pri_cc_agent_status_req(struct ast_cc_agent *agent);
591 void sig_pri_cc_agent_destructor(struct ast_cc_agent *agent);
592 
593 int sig_pri_cc_monitor_req_cc(struct ast_cc_monitor *monitor, int *available_timer_id);
598 void sig_pri_cc_monitor_destructor(void *monitor_pvt);
599 
600 int sig_pri_load(const char *cc_type_name);
601 void sig_pri_unload(void);
602 
603 #endif /* _SIG_PRI_H */
int aoc_s_request_invoke_id
Definition: sig_pri.h:260
int max_call_waiting_calls
Number of extra outgoing calls to allow on a span before considering that span congested.
Definition: sig_pri.h:448
int sig_pri_answer(struct sig_pri_chan *p, struct ast_channel *ast)
Definition: sig_pri.c:7317
int cid_ton
Definition: sig_pri.h:238
void(* module_ref)(void)
Definition: sig_pri.h:178
const char * context
Mailbox context.
Definition: sig_pri.h:350
int nodetype
Definition: sig_pri.h:434
int dchan_logical_span[SIG_PRI_NUM_DCHANS]
Definition: sig_pri.h:366
long resetinterval
Definition: sig_pri.h:411
static char exten[AST_MAX_EXTENSION]
Definition: chan_alsa.c:109
Main Channel structure associated with a channel.
Definition: channel.h:742
int logicalspan
Definition: sig_pri.h:304
ast_device_state
Device States.
Definition: devicestate.h:51
unsigned int alreadyhungup
Definition: sig_pri.h:266
unsigned int priexclusive
Definition: sig_pri.h:227
char keypad_digits[AST_MAX_EXTENSION]
Keypad digits that came in with the SETUP message.
Definition: sig_pri.h:253
int cc_qsig_signaling_link_req
Definition: sig_pri.h:440
void sig_pri_dial_complete(struct sig_pri_chan *pvt, struct ast_channel *ast)
DTMF dial string complete.
Definition: sig_pri.c:7506
int congestion_devstate
Congestion device state of the span.
Definition: sig_pri.h:507
void(* module_unref)(void)
Definition: sig_pri.h:180
int reverse_charging_indication
Reverse charging indication.
Definition: sig_pri.h:321
static const char dahdi_db[]
The AstDB family.
Definition: sig_pri.h:219
void sig_pri_fixup(struct ast_channel *oldchan, struct ast_channel *newchan, struct sig_pri_chan *pchan)
Definition: sig_pri.c:8118
unsigned int use_callingpres
Definition: sig_pri.h:230
int callingpres
Definition: sig_pri.h:239
int sig_pri_cc_agent_start_offer_timer(struct ast_cc_agent *agent)
Start the offer timer.
Definition: sig_pri.c:8186
void(*const make_cc_dialstring)(void *pvt, char *buf, size_t buf_size)
Definition: sig_pri.h:161
unsigned int priindication_oob
Definition: sig_pri.h:228
unsigned int use_callerid
Definition: sig_pri.h:229
#define MAX_MUSICCLASS
Definition: channel.h:139
char idleext[AST_MAX_EXTENSION]
Definition: sig_pri.h:429
int sig_pri_start_pri(struct sig_pri_span *pri)
Definition: sig_pri.c:7703
unsigned int hold_disconnect_transfer
TRUE if held calls are transferred on disconnect.
Definition: sig_pri.h:382
unsigned int transfer
TRUE if call transfer is enabled for the span.
Definition: sig_pri.h:388
unsigned int allow_call_waiting_calls
TRUE if we will allow incoming ISDN call waiting calls.
Definition: sig_pri.h:391
void sig_pri_init_pri(struct sig_pri_span *pri)
Definition: sig_pri.c:6451
int facilityenable
Definition: sig_pri.h:361
int sig_pri_cc_monitor_status_rsp(struct ast_cc_monitor *monitor, enum ast_device_state devstate)
Status response to an ast_cc_monitor_status_request().
Definition: sig_pri.c:8640
struct ast_channel * sig_pri_request(struct sig_pri_chan *p, enum sig_pri_law law, const struct ast_channel *requestor, int transfercapability)
Definition: sig_pri.c:1013
int sig_pri_cc_agent_callee_available(struct ast_cc_agent *agent)
Alert the caller that it is time to try recalling.
Definition: sig_pri.c:8430
char nationalprefix[10]
Definition: sig_pri.h:407
q931_call * call
Definition: sig_pri.h:297
void(*const set_rdnis)(void *pvt, const char *rdnis)
Definition: sig_pri.h:156
char idlecontext[AST_MAX_CONTEXT]
Definition: sig_pri.h:430
struct ast_channel * owner
Definition: sig_pri.h:294
sig_pri_reset_state
Definition: sig_pri.h:104
struct sig_pri_span::@120 ch_cfg
struct sig_pri_callback * calls
Definition: sig_pri.h:311
#define SIG_PRI_MAX_MWI_MAILBOXES
Definition: sig_pri.h:327
char cid_ani[AST_MAX_EXTENSION]
Definition: sig_pri.h:243
struct ast_cc_config_params * cc_params
Definition: sig_pri.h:356
unsigned int aoc_s_request_invoke_id_valid
Definition: sig_pri.h:261
unsigned int hidecalleridname
Definition: sig_pri.h:452
int sig_pri_cc_agent_status_req(struct ast_cc_agent *agent)
Request the status of the agent&#39;s device.
Definition: sig_pri.c:8305
int sig_pri_digit_begin(struct sig_pri_chan *pvt, struct ast_channel *ast, char digit)
Definition: sig_pri.c:7460
int minidle
Definition: sig_pri.h:433
void(*const fixup_chans)(void *old_chan, void *new_chan)
Definition: sig_pri.h:146
unsigned int enable_service_message_support
Definition: sig_pri.h:375
unsigned int aoce_delayhangup
Definition: sig_pri.h:371
ast_channel_state
ast_channel states
Definition: channelstate.h:35
enum sig_pri_reset_state resetting
Channel reset/restart state.
Definition: sig_pri.h:302
unsigned int isidlecall
Definition: sig_pri.h:267
unsigned int no_b_channel
TRUE if this interface has no B channel. (call hold and call waiting)
Definition: sig_pri.h:284
The channel is not being RESTARTed.
Definition: sig_pri.h:106
int sig_pri_cc_agent_party_b_free(struct ast_cc_agent *agent)
Let the caller know that the callee has become free but that the caller cannot attempt to call back b...
Definition: sig_pri.c:8374
void sig_pri_set_alarm(struct sig_pri_chan *p, int in_alarm)
Definition: sig_pri.c:187
int dialplan
Definition: sig_pri.h:404
int localdialplan
Definition: sig_pri.h:405
unsigned short transfercapability
Definition: channel.h:863
const char * number
Mailbox number.
Definition: sig_pri.h:348
char localprefix[20]
Definition: sig_pri.h:408
ast_cc_agent_response_reason
Definition: ccss.h:861
int switchtype
Definition: sig_pri.h:435
void(*const init_config)(void *pvt, struct sig_pri_span *pri)
Definition: sig_pri.h:159
unsigned int inalarm
Definition: sig_pri.h:265
int dchanavail[SIG_PRI_NUM_DCHANS]
Definition: sig_pri.h:469
int qsigchannelmapping
Definition: sig_pri.h:359
Definition: dsp.c:105
unsigned service_status
Active SRVST_DBKEY out-of-service status value.
Definition: sig_pri.h:308
int sig_pri_load(const char *cc_type_name)
Load the sig_pri submodule.
Definition: sig_pri.c:8730
void sig_pri_chan_delete(struct sig_pri_chan *doomed)
Delete the sig_pri private channel structure.
Definition: sig_pri.c:7953
unsigned int inband_on_setup_ack
Definition: sig_pri.h:401
void * chan_pvt
Definition: sig_pri.h:312
void sig_pri_cli_show_span(int fd, int *dchannels, struct sig_pri_span *pri)
Definition: sig_pri.c:8038
void sig_pri_cli_show_channels(int fd, struct sig_pri_span *pri)
Definition: sig_pri.c:7966
int mastertrunkgroup
Definition: sig_pri.h:305
ast_mutex_t lock
Definition: sig_pri.h:495
unsigned int no_d_channels
Definition: sig_pri.h:477
int cc_qsig_signaling_link_rsp
Definition: sig_pri.h:441
#define SIG_PRI_MAX_MWI_MAILBOX_STR
Maximum mwi_mailbox string length.
Definition: sig_pri.h:338
int sig_pri_call(struct sig_pri_chan *p, struct ast_channel *ast, char *rdest, int timeout, int layer1)
Definition: sig_pri.c:6641
void sig_pri_cc_agent_destructor(struct ast_cc_agent *agent)
Destroy private data on the agent.
Definition: sig_pri.c:8459
char unknownprefix[20]
Definition: sig_pri.h:410
struct sig_pri_mbox mbox[SIG_PRI_MAX_MWI_MAILBOXES]
Active MWI mailboxes.
Definition: sig_pri.h:414
General Asterisk PBX channel definitions.
void(*const set_dialing)(void *pvt, int is_dialing)
Definition: sig_pri.h:151
unsigned int inband_on_proceeding
Definition: sig_pri.h:403
int sig_pri_cc_monitor_unsuspend(struct ast_cc_monitor *monitor)
Unsuspend monitoring.
Definition: sig_pri.c:8610
sig_pri_law
Definition: sig_pri.h:80
void(*const set_dnid)(void *pvt, const char *dnid)
Definition: sig_pri.h:155
char dialdest[256]
Definition: sig_pri.h:250
int stripmsd
Definition: sig_pri.h:233
enum sig_pri_call_level call_level
Definition: sig_pri.h:300
int sig_pri_is_chan_available(struct sig_pri_chan *pvt)
Determine if a private channel structure is available.
Definition: sig_pri.c:1160
int(*const play_tone)(void *pvt, enum sig_pri_tone tone)
Definition: sig_pri.h:138
Asterisk internal frame definitions.
int(*const train_echocanceller)(void *pvt)
Definition: sig_pri.h:141
void(*const set_alarm)(void *pvt, int in_alarm)
Definition: sig_pri.h:150
#define AST_MAX_EXTENSION
Definition: channel.h:135
int cc_ptmp_recall_mode
Definition: sig_pri.h:439
void(*const lock_private)(void *pvt)
Definition: sig_pri.h:131
void(*const queue_control)(void *pvt, int subclass)
Definition: sig_pri.h:157
Caller Party information.
Definition: channel.h:368
int stripmsd
Definition: sig_pri.h:450
int pri_send_callrerouting_facility_exec(struct sig_pri_chan *p, enum ast_channel_state chanstate, const char *destination, const char *original, const char *reason)
Definition: sig_pri.c:8087
char internationalprefix[10]
Definition: sig_pri.h:406
void sig_pri_cc_monitor_destructor(void *monitor_pvt)
Destroy PRI private data on the monitor.
Definition: sig_pri.c:8708
The channel is being RESTARTed.
Definition: sig_pri.h:111
struct pri_subcmd_aoc_e aoc_e
Definition: sig_pri.h:259
struct sig_pri_callback * calls
Definition: sig_pri.h:497
int sig_pri_cc_agent_start_monitoring(struct ast_cc_agent *agent)
Begin monitoring a busy device.
Definition: sig_pri.c:8403
char privateprefix[20]
Definition: sig_pri.h:409
void * no_b_chan_end
Definition: sig_pri.h:491
void(*const handle_dchan_exception)(struct sig_pri_span *pri, int index)
Definition: sig_pri.h:149
void sig_pri_cli_show_channels_header(int fd)
Definition: sig_pri.c:7960
void sig_pri_cc_agent_req_rsp(struct ast_cc_agent *agent, enum ast_cc_agent_response_reason reason)
Response to a CC request.
Definition: sig_pri.c:8235
unsigned int holding_aoce
Definition: sig_pri.h:263
int overlapdial
Definition: sig_pri.h:358
int sig_pri_is_alarm_ignored(struct sig_pri_span *pri)
Determine if layer 1 alarms are ignored.
Definition: sig_pri.c:7920
int pri_is_up(struct sig_pri_span *pri)
Definition: sig_pri.c:1027
unsigned int use_callingpres
Definition: sig_pri.h:457
void pri_event_noalarm(struct sig_pri_span *pri, int index, int before_start_pri)
Definition: sig_pri.c:2022
struct ast_channel *(*const new_ast_channel)(void *pvt, int state, enum sig_pri_law law, char *exten, const struct ast_channel *chan)
Definition: sig_pri.h:144
void sig_pri_stop_pri(struct sig_pri_span *pri)
Stop PRI span.
Definition: sig_pri.c:7638
int(*const new_nobch_intf)(struct sig_pri_span *pri)
Definition: sig_pri.h:158
pthread_t master
Definition: sig_pri.h:494
void(*const update_span_devstate)(struct sig_pri_span *pri)
Definition: sig_pri.h:162
int(*const set_echocanceller)(void *pvt, int enable)
Definition: sig_pri.h:140
int pri_send_keypad_facility_exec(struct sig_pri_chan *p, const char *digits)
Definition: sig_pri.c:8068
int minunused
Definition: sig_pri.h:432
void sig_pri_unload(void)
Unload the sig_pri submodule.
Definition: sig_pri.c:8749
static unsigned int monitor
Definition: chan_phone.c:108
void(*const unlock_private)(void *pvt)
Definition: sig_pri.h:129
time_t lastreset
Definition: sig_pri.h:496
Event subscription.
Definition: event.c:124
unsigned int hidecallerid
Definition: sig_pri.h:451
unsigned int inbanddisconnect
Definition: sig_pri.h:378
#define SIG_PRI_NUM_DCHANS
Definition: sig_pri.h:183
struct sig_pri_chan * pvts[SIG_PRI_MAX_CHANNELS]
Definition: sig_pri.h:493
char idledial[AST_MAX_EXTENSION]
Definition: sig_pri.h:431
unsigned int immediate
Definition: sig_pri.h:226
char exten[AST_MAX_EXTENSION]
Definition: sig_pri.h:246
#define AST_MAX_CONTEXT
Definition: channel.h:136
int resetpos
Definition: sig_pri.h:473
unsigned int hidecalleridname
Definition: sig_pri.h:225
int sig_pri_cc_agent_stop_ringing(struct ast_cc_agent *agent)
Request for an agent&#39;s phone to stop ringing.
Definition: sig_pri.c:8340
unsigned int append_msn_to_user_tag
Definition: sig_pri.h:399
char initial_user_tag[AST_MAX_EXTENSION]
Initial user tag for party id&#39;s sent from this device driver.
Definition: sig_pri.h:427
void(*const open_media)(void *pvt)
Definition: sig_pri.h:165
char mwi_mailboxes[SIG_PRI_MAX_MWI_MAILBOX_STR]
Comma separated list of mailboxes to indicate MWI.
Definition: sig_pri.h:421
Call Completion Supplementary Services API.
char cid_subaddr[AST_MAX_EXTENSION]
Definition: sig_pri.h:241
char mohinterpret[MAX_MUSICCLASS]
Definition: sig_pri.h:459
int l2_persistence
Definition: sig_pri.h:364
char cid_num[AST_MAX_EXTENSION]
Definition: sig_pri.h:240
char deferred_digits[AST_MAX_EXTENSION]
Definition: sig_pri.h:256
void(*const set_digital)(void *pvt, int is_digital)
Definition: sig_pri.h:152
int numchans
Definition: sig_pri.h:492
unsigned int priindication_oob
Definition: sig_pri.h:455
int sig_pri_cc_monitor_req_cc(struct ast_cc_monitor *monitor, int *available_timer_id)
Request CCSS.
Definition: sig_pri.c:8541
void(*const dial_digits)(void *pvt, const char *dial_string)
Definition: sig_pri.h:163
unsigned int hidecallerid
Definition: sig_pri.h:224
int resetting
Definition: sig_pri.h:472
unsigned int is_call_waiting
TRUE if this is a call waiting call.
Definition: sig_pri.h:287
sig_pri_tone
Definition: sig_pri.h:70
int sig_pri_cc_agent_init(struct ast_cc_agent *agent, struct sig_pri_chan *pvt_chan)
PRI CC agent initialization.
Definition: sig_pri.c:8142
void(*const ami_channel_event)(void *pvt, struct ast_channel *chan)
Post an AMI B channel association event.
Definition: sig_pri.h:175
void sig_pri_chan_alarm_notify(struct sig_pri_chan *p, int noalarm)
Notify new alarm status.
Definition: sig_pri.c:7894
int cid_ani2
Definition: sig_pri.h:237
unsigned int priexclusive
Definition: sig_pri.h:454
#define SIG_PRI_MAX_CHANNELS
Definition: sig_pri.h:184
Peer may not be sending the expected RESTART ACKNOWLEDGE.
Definition: sig_pri.h:122
int num_call_waiting_calls
Number of outstanding call waiting calls.
Definition: sig_pri.h:467
int sig_pri_available(struct sig_pri_chan **pvt, int is_specific_channel)
Definition: sig_pri.c:7412
char user_tag[AST_MAX_EXTENSION]
User tag for party id&#39;s sent from this device driver.
Definition: sig_pri.h:245
const char *(*const get_orig_dialstring)(void *pvt)
Definition: sig_pri.h:160
int sig_pri_cc_monitor_cancel_available_timer(struct ast_cc_monitor *monitor, int *sched_id)
Cancel the running available timer.
Definition: sig_pri.c:8685
unsigned int digital
Definition: sig_pri.h:282
int discardremoteholdretrieval
Definition: sig_pri.h:360
int sig_pri_indicate(struct sig_pri_chan *p, struct ast_channel *chan, int condition, const void *data, size_t datalen)
Definition: sig_pri.c:7092
unsigned int use_callerid
Definition: sig_pri.h:456
sig_pri_call_level
Definition: sig_pri.h:87
int pritimers[PRI_MAX_TIMERS]
Definition: sig_pri.h:357
struct sig_pri_span * pri
Definition: sig_pri.h:296
unsigned int layer1_ignored
Definition: sig_pri.h:394
void(*const set_callerid)(void *pvt, const struct ast_party_caller *caller)
Definition: sig_pri.h:154
void * no_b_chan_iflist
Definition: sig_pri.h:486
int prioffset
Definition: sig_pri.h:303
void sig_pri_cli_show_spans(int fd, int span, struct sig_pri_span *pri)
Definition: sig_pri.c:8026
char cid_name[AST_MAX_EXTENSION]
Definition: sig_pri.h:242
char context[AST_MAX_CONTEXT]
Definition: sig_pri.h:458
int new_chan_seq
Definition: sig_pri.h:475
int aoc_passthrough_flag
Definition: sig_pri.h:370
unsigned int allocated
TRUE when this channel is allocated.
Definition: sig_pri.h:280
void pri_event_alarm(struct sig_pri_span *pri, int index, int before_start_pri)
Definition: sig_pri.c:2014
struct pri * dchans[SIG_PRI_NUM_DCHANS]
Definition: sig_pri.h:480
char context[AST_MAX_CONTEXT]
Definition: sig_pri.h:231
unsigned int no_dialed_digits
Definition: sig_pri.h:291
int sig_pri_cc_agent_stop_offer_timer(struct ast_cc_agent *agent)
Stop the offer timer.
Definition: sig_pri.c:8207
void sig_pri_extract_called_num_subaddr(struct sig_pri_chan *p, const char *rdest, char *called, size_t called_buff_size)
Extract the called number and subaddress from the dial string.
Definition: sig_pri.c:6555
struct ast_event_sub * sub
MWI mailbox event subscription.
Definition: sig_pri.h:346
unsigned int waiting_for_aoce
Definition: sig_pri.h:262
struct sig_pri_chan * sig_pri_chan_new(void *pvt_data, struct sig_pri_callback *callback, struct sig_pri_span *pri, int logicalspan, int channo, int trunkgroup)
Definition: sig_pri.c:7925
struct pri * pri
Definition: sig_pri.h:481
unsigned int immediate
Definition: sig_pri.h:453
int pri_maintenance_bservice(struct pri *pri, struct sig_pri_chan *p, int changestatus)
Definition: sig_pri.c:8109
char mohinterpret[MAX_MUSICCLASS]
Definition: sig_pri.h:232
void(*const set_outgoing)(void *pvt, int is_outgoing)
Definition: sig_pri.h:153
int sig_pri_hangup(struct sig_pri_chan *p, struct ast_channel *ast)
Definition: sig_pri.c:6464
int(*const dsp_reset_and_flush_digits)(void *pvt)
Definition: sig_pri.h:142
Structure for mutex and tracking information.
Definition: lock.h:121
int fds[SIG_PRI_NUM_DCHANS]
Definition: sig_pri.h:367
int channel
Definition: sig_pri.h:234
int sig_pri_cc_monitor_suspend(struct ast_cc_monitor *monitor)
Suspend monitoring.
Definition: sig_pri.c:8584
int trunkgroup
Definition: sig_pri.h:437