32#include <dahdi/user.h>
34#if defined(HAVE_PRI_CCSS)
36#define SIG_PRI_DEBUG_NORMAL \
37 (PRI_DEBUG_APDU | PRI_DEBUG_Q931_STATE | PRI_DEBUG_Q921_STATE | PRI_DEBUG_CC)
41#define SIG_PRI_DEBUG_NORMAL \
42 (PRI_DEBUG_APDU | PRI_DEBUG_Q931_STATE | PRI_DEBUG_Q921_STATE)
47#define SIG_PRI_DEBUG_DEFAULT (SIG_PRI_DEBUG_NORMAL | PRI_DEBUG_Q931_DUMP)
50#define SIG_PRI_DEBUG_DEFAULT 0
53#define SIG_PRI_AOC_GRANT_S (1 << 0)
54#define SIG_PRI_AOC_GRANT_D (1 << 1)
55#define SIG_PRI_AOC_GRANT_E (1 << 2)
78#if defined(HAVE_PRI_CALL_HOLD)
80 SIG_PRI_MOH_SIGNALING_HOLD,
91#if defined(HAVE_PRI_CALL_HOLD)
93 SIG_PRI_MOH_STATE_HOLD_REQ,
95 SIG_PRI_MOH_STATE_PEND_UNHOLD,
97 SIG_PRI_MOH_STATE_HOLD,
99 SIG_PRI_MOH_STATE_RETRIEVE_REQ,
101 SIG_PRI_MOH_STATE_PEND_HOLD,
103 SIG_PRI_MOH_STATE_RETRIEVE_FAIL,
117#if defined(HAVE_PRI_CALL_HOLD)
119 SIG_PRI_MOH_EVENT_HOLD_ACK,
121 SIG_PRI_MOH_EVENT_HOLD_REJ,
123 SIG_PRI_MOH_EVENT_RETRIEVE_ACK,
125 SIG_PRI_MOH_EVENT_RETRIEVE_REJ,
127 SIG_PRI_MOH_EVENT_REMOTE_RETRIEVE_ACK,
208 void (*
const set_dnid)(
void *pvt,
const char *dnid);
239#define SIG_PRI_NUM_DCHANS 4
240#define SIG_PRI_MAX_CHANNELS 672
242#define SIG_PRI DAHDI_SIG_CLEAR
243#define SIG_BRI (0x2000000 | DAHDI_SIG_CLEAR)
244#define SIG_BRI_PTMP (0X4000000 | DAHDI_SIG_CLEAR)
247#define DAHDI_CHAN_MAPPING_PHYSICAL 0
248#define DAHDI_CHAN_MAPPING_LOGICAL 1
251#define DAHDI_OVERLAPDIAL_NONE 0
252#define DAHDI_OVERLAPDIAL_OUTGOING 1
253#define DAHDI_OVERLAPDIAL_INCOMING 2
254#define DAHDI_OVERLAPDIAL_BOTH (DAHDI_OVERLAPDIAL_INCOMING|DAHDI_OVERLAPDIAL_OUTGOING)
256#if defined(HAVE_PRI_SERVICE_MESSAGES)
258#define SRVST_DBKEY "service-state"
260#define SRVST_TYPE_OOS "O"
266#define SRVST_INITIALIZED 0
268#define SRVST_NEAREND (1 << 0)
270#define SRVST_FAREND (1 << 1)
272#define SRVST_BOTH (SRVST_NEAREND | SRVST_FAREND)
275static const char dahdi_db[] =
"dahdi/registry";
307#if defined(HAVE_PRI_SETUP_KEYPAD)
317#if defined(HAVE_PRI_AOC_EVENTS)
318 struct pri_subcmd_aoc_e aoc_e;
319 int aoc_s_request_invoke_id;
320 unsigned int aoc_s_request_invoke_id_valid:1;
321 unsigned int waiting_for_aoce:1;
322 unsigned int holding_aoce:1;
344#if defined(HAVE_PRI_CALL_WAITING)
346 unsigned int is_call_waiting:1;
348#if defined(HAVE_PRI_SETUP_ACK_INBAND)
350 unsigned int no_dialed_digits:1;
362#if defined(HAVE_PRI_TRANSFER)
364 struct xfer_rsp_data *xfer_data;
369#if defined(HAVE_PRI_SERVICE_MESSAGES)
371 unsigned service_status;
375#if defined(HAVE_PRI_REVERSE_CHARGE)
383 int reverse_charging_indication;
387#if defined(HAVE_PRI_MWI)
389#define SIG_PRI_MAX_MWI_MAILBOXES 8
391#define SIG_PRI_MAX_MWI_VM_NUMBER_LEN 10
393#define SIG_PRI_MAX_MWI_MBOX_NUMBER_LEN 10
395#define SIG_PRI_MAX_MWI_CONTEXT_LEN 10
402#define SIG_PRI_MAX_MWI_VM_NUMBER_STR (SIG_PRI_MAX_MWI_MAILBOXES \
403 * (SIG_PRI_MAX_MWI_VM_NUMBER_LEN + 1))
409#define SIG_PRI_MAX_MWI_VM_MAILBOX (SIG_PRI_MAX_MWI_MBOX_NUMBER_LEN \
410 + 1 + SIG_PRI_MAX_MWI_CONTEXT_LEN)
417#define SIG_PRI_MAX_MWI_MAILBOX_STR (SIG_PRI_MAX_MWI_MAILBOXES \
418 * (SIG_PRI_MAX_MWI_VM_MAILBOX + 1))
427 const char *uniqueid;
431 const char *vm_number;
452#if defined(HAVE_PRI_L2_PERSISTENCE)
459#if defined(HAVE_PRI_AOC_EVENTS)
460 int aoc_passthrough_flag;
461 unsigned int aoce_delayhangup:1;
464#if defined(HAVE_PRI_SERVICE_MESSAGES)
465 unsigned int enable_service_message_support:1;
467#ifdef HAVE_PRI_INBANDDISCONNECT
468 unsigned int inbanddisconnect:1;
470#if defined(HAVE_PRI_CALL_HOLD)
472 unsigned int hold_disconnect_transfer:1;
479#if defined(HAVE_PRI_CALL_WAITING)
481 unsigned int allow_call_waiting_calls:1;
494#if defined(HAVE_PRI_MCID)
496 unsigned int mcid_send:1;
500#if defined(HAVE_PRI_DATETIME_SEND)
516#if defined(HAVE_PRI_DISPLAY_TEXT)
517 unsigned long display_flags_send;
518 unsigned long display_flags_receive;
520#if defined(HAVE_PRI_MWI)
522 struct sig_pri_mbox
mbox[SIG_PRI_MAX_MWI_MAILBOXES];
529 char mwi_mailboxes[SIG_PRI_MAX_MWI_MAILBOX_STR];
536 char mwi_vm_boxes[SIG_PRI_MAX_MWI_VM_NUMBER_STR];
542 char mwi_vm_numbers[SIG_PRI_MAX_MWI_VM_NUMBER_STR];
559#if defined(HAVE_PRI_CCSS)
560 int cc_ptmp_recall_mode;
561 int cc_qsig_signaling_link_req;
562 int cc_qsig_signaling_link_rsp;
564#if defined(HAVE_PRI_CALL_WAITING)
569 int max_call_waiting_calls;
572 unsigned int hidecallerid:1;
573 unsigned int hidecalleridname:1;
574 unsigned int immediate:1;
575 unsigned int priexclusive:1;
576 unsigned int priindication_oob:1;
577 unsigned int use_callerid:1;
578 unsigned int use_callingpres:1;
588 int num_call_waiting_calls;
628#if defined(THRESHOLD_DEVSTATE_PLACEHOLDER)
642 int threshold_devstate;
647 int user_busy_threshold;
701#if defined(HAVE_PRI_SERVICE_MESSAGES)
702int pri_maintenance_bservice(
struct pri *pri,
struct sig_pri_chan *p,
int changestatus);
706#if defined(HAVE_PRI_DISPLAY_TEXT)
static const char * mbox(struct ast_vm_user *vmu, int id)
Call Completion Supplementary Services API.
ast_cc_agent_response_reason
static char mohinterpret[MAX_MUSICCLASS]
General Asterisk PBX channel definitions.
#define AST_MAX_EXTENSION
ast_channel_state
ast_channel states
ast_device_state
Device States.
Asterisk internal frame definitions.
struct stasis_forward * sub
int sig_pri_is_chan_available(struct sig_pri_chan *pvt)
#define SIG_PRI_MAX_CHANNELS
void sig_pri_unload(void)
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)
int sig_pri_ami_show_spans(struct mansession *s, const char *show_cmd, struct sig_pri_span *pri, const int *dchannels, const char *action_id)
int pri_is_up(struct sig_pri_span *pri)
int sig_pri_cc_agent_status_req(struct ast_cc_agent *agent)
@ SIG_PRI_MOH_STATE_NOTIFY
struct sig_pri_callback sig_pri_callbacks
@ SIG_PRI_MOH_EVENT_RESET
@ SIG_PRI_MOH_EVENT_UNHOLD
int sig_pri_indicate(struct sig_pri_chan *p, struct ast_channel *chan, int condition, const void *data, size_t datalen)
void sig_pri_extract_called_num_subaddr(struct sig_pri_chan *p, const char *rdest, char *called, size_t called_buff_size)
#define SIG_PRI_NUM_DCHANS
int sig_pri_cc_agent_start_offer_timer(struct ast_cc_agent *agent)
int sig_pri_hangup(struct sig_pri_chan *p, struct ast_channel *ast)
int sig_pri_cc_monitor_unsuspend(struct ast_cc_monitor *monitor)
int sig_pri_available(struct sig_pri_chan **pvt, int is_specific_channel)
int sig_pri_call(struct sig_pri_chan *p, struct ast_channel *ast, const char *rdest, int timeout, int layer1)
int sig_pri_is_alarm_ignored(struct sig_pri_span *pri)
int sig_pri_cc_monitor_req_cc(struct ast_cc_monitor *monitor, int *available_timer_id)
int sig_pri_start_pri(struct sig_pri_span *pri)
int sig_pri_cc_monitor_cancel_available_timer(struct ast_cc_monitor *monitor, int *sched_id)
void sig_pri_cli_show_channels(int fd, struct sig_pri_span *pri)
void sig_pri_cc_agent_req_rsp(struct ast_cc_agent *agent, enum ast_cc_agent_response_reason reason)
int sig_pri_cc_monitor_suspend(struct ast_cc_monitor *monitor)
@ SIG_PRI_RESET_NO_ACK
Peer may not be sending the expected RESTART ACKNOWLEDGE.
@ SIG_PRI_RESET_ACTIVE
The channel is being RESTARTed.
@ SIG_PRI_RESET_IDLE
The channel is not being RESTARTed.
void sig_pri_stop_pri(struct sig_pri_span *pri)
void sig_pri_cc_agent_destructor(struct ast_cc_agent *agent)
void sig_pri_cli_show_spans(int fd, int span, struct sig_pri_span *pri)
void sig_pri_init_pri(struct sig_pri_span *pri)
int sig_pri_cc_agent_start_monitoring(struct ast_cc_agent *agent)
int sig_pri_cc_agent_init(struct ast_cc_agent *agent, struct sig_pri_chan *pvt_chan)
void sig_pri_chan_alarm_notify(struct sig_pri_chan *p, int noalarm)
int sig_pri_load(const char *cc_type_name)
@ SIG_PRI_CALL_LEVEL_IDLE
@ SIG_PRI_CALL_LEVEL_CONNECT
@ SIG_PRI_CALL_LEVEL_OVERLAP
@ SIG_PRI_CALL_LEVEL_PROCEEDING
@ SIG_PRI_CALL_LEVEL_DEFER_DIAL
@ SIG_PRI_CALL_LEVEL_ALERTING
@ SIG_PRI_CALL_LEVEL_SETUP
@ SIG_PRI_MOH_SIGNALING_MOH
@ SIG_PRI_MOH_SIGNALING_NOTIFY
int sig_pri_cc_agent_callee_available(struct ast_cc_agent *agent)
struct ast_channel * sig_pri_request(struct sig_pri_chan *p, enum sig_pri_law law, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, int transfercapability)
void sig_pri_fixup(struct ast_channel *oldchan, struct ast_channel *newchan, struct sig_pri_chan *pchan)
void sig_pri_cc_monitor_destructor(void *monitor_pvt)
void sig_pri_dial_complete(struct sig_pri_chan *pvt, struct ast_channel *ast)
struct sig_pri_chan * sig_pri_chan_new(void *pvt_data, struct sig_pri_span *pri, int logicalspan, int channo, int trunkgroup)
void pri_event_noalarm(struct sig_pri_span *pri, int index, int before_start_pri)
void sig_pri_cli_show_span(int fd, int *dchannels, struct sig_pri_span *pri)
void sig_pri_chan_delete(struct sig_pri_chan *doomed)
int sig_pri_answer(struct sig_pri_chan *p, struct ast_channel *ast)
@ SIG_PRI_TONE_CONGESTION
@ SIG_PRI_TONE_DIALRECALL
void pri_event_alarm(struct sig_pri_span *pri, int index, int before_start_pri)
int sig_pri_cc_agent_stop_offer_timer(struct ast_cc_agent *agent)
void sig_pri_cli_show_channels_header(int fd)
void sig_pri_set_alarm(struct sig_pri_chan *p, int in_alarm)
int sig_pri_cc_agent_party_b_free(struct ast_cc_agent *agent)
int sig_pri_cc_monitor_status_rsp(struct ast_cc_monitor *monitor, enum ast_device_state devstate)
int sig_pri_cc_agent_stop_ringing(struct ast_cc_agent *agent)
int sig_pri_digit_begin(struct sig_pri_chan *pvt, struct ast_channel *ast, char digit)
int pri_send_keypad_facility_exec(struct sig_pri_chan *p, const char *digits)
Structure to pass both assignedid values to channel drivers.
Main Channel structure associated with a channel.
unsigned short transfercapability
char exten[AST_MAX_EXTENSION]
Structure for mutex and tracking information.
Caller Party information.
In case you didn't read that giant block of text above the mansession_session struct,...
int(*const set_echocanceller)(void *pvt, int enable)
void(*const set_rdnis)(void *pvt, const char *rdnis)
void(*const deadlock_avoidance_private)(void *pvt)
void(*const set_digital)(void *pvt, int is_digital)
void(*const dial_digits)(void *pvt, const char *dial_string)
void(*const unlock_private)(void *pvt)
void(*const init_config)(void *pvt, struct sig_pri_span *pri)
int(*const play_tone)(void *pvt, enum sig_pri_tone tone)
const char *(*const get_orig_dialstring)(void *pvt)
void(*const make_cc_dialstring)(void *pvt, char *buf, size_t buf_size)
void(* destroy_later)(struct sig_pri_span *pri)
int(*const new_nobch_intf)(struct sig_pri_span *pri)
int(*const train_echocanceller)(void *pvt)
void(*const set_callerid)(void *pvt, const struct ast_party_caller *caller)
void(*const set_dnid)(void *pvt, const char *dnid)
void(*const set_outgoing)(void *pvt, int is_outgoing)
void(*const set_dialing)(void *pvt, int is_dialing)
void(*const set_alarm)(void *pvt, int in_alarm)
void(*const ami_channel_event)(void *pvt, struct ast_channel *chan)
Post an AMI B channel association event.
void(*const handle_dchan_exception)(struct sig_pri_span *pri, int index)
void(*const queue_control)(void *pvt, int subclass)
void(*const update_span_devstate)(struct sig_pri_span *pri)
struct ast_channel *(*const new_ast_channel)(void *pvt, int state, enum sig_pri_law law, char *exten, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor)
int(*const dsp_reset_and_flush_digits)(void *pvt)
void(*const lock_private)(void *pvt)
void(* module_unref)(void)
void(*const open_media)(void *pvt)
void(*const fixup_chans)(void *old_chan, void *new_chan)
char user_tag[AST_MAX_EXTENSION *2]
User tag for party id's sent from this device driver.
char cid_subaddr[AST_MAX_EXTENSION]
struct sig_pri_span * pri
char cid_num[AST_MAX_EXTENSION]
enum sig_pri_reset_state resetting
Channel reset/restart state.
unsigned int allocated
TRUE when this channel is allocated.
char moh_suggested[MAX_MUSICCLASS]
unsigned int use_callingpres
unsigned int priexclusive
char exten[AST_MAX_EXTENSION]
unsigned int hidecallerid
struct ast_channel * owner
enum sig_pri_call_level call_level
char deferred_digits[AST_MAX_EXTENSION]
unsigned int priindication_oob
unsigned int hidecalleridname
char context[AST_MAX_CONTEXT]
enum sig_pri_moh_state moh_state
char cid_name[AST_MAX_EXTENSION]
unsigned int no_b_channel
TRUE if this interface has no B channel. (call hold and call waiting)
unsigned int use_callerid
char cid_ani[AST_MAX_EXTENSION]
unsigned int alreadyhungup
char mohinterpret[MAX_MUSICCLASS]
struct sig_pri_chan * pvts[SIG_PRI_MAX_CHANNELS]
char idleext[AST_MAX_EXTENSION]
enum sig_pri_moh_signaling moh_signaling
unsigned int inband_on_setup_ack
char msn_list[AST_MAX_EXTENSION]
int discardremoteholdretrieval
unsigned int inband_on_proceeding
int fds[SIG_PRI_NUM_DCHANS]
unsigned int append_msn_to_user_tag
int pritimers[PRI_MAX_TIMERS]
unsigned int layer1_ignored
struct pri * dchans[SIG_PRI_NUM_DCHANS]
unsigned int no_d_channels
char idlecontext[AST_MAX_CONTEXT]
enum sig_pri_colp_signaling colp_send
int dchanavail[SIG_PRI_NUM_DCHANS]
int congestion_devstate
Congestion device state of the span.
struct ast_cc_config_params * cc_params
unsigned int force_restart_unavailable_chans
TRUE if forcing RESTART when receive cause 44 on this span.
unsigned int transfer
TRUE if call transfer is enabled for the span.
char internationalprefix[10]
int dchan_logical_span[SIG_PRI_NUM_DCHANS]
char idledial[AST_MAX_EXTENSION]
char initial_user_tag[AST_MAX_EXTENSION]
Initial user tag for party id's sent from this device driver.