Wed Jan 8 2020 09:50:21

Asterisk developer's documentation


sig_pri.h File Reference

Interface header for PRI signaling module. More...

#include "asterisk/channel.h"
#include "asterisk/frame.h"
#include "asterisk/event.h"
#include "asterisk/ccss.h"
#include <libpri.h>
#include <dahdi/user.h>

Go to the source code of this file.

Data Structures

struct  sig_pri_callback
 
struct  sig_pri_chan
 
struct  sig_pri_mbox
 
struct  sig_pri_span
 

Macros

#define DAHDI_CHAN_MAPPING_LOGICAL   1
 
#define DAHDI_CHAN_MAPPING_PHYSICAL   0
 
#define DAHDI_OVERLAPDIAL_BOTH   (DAHDI_OVERLAPDIAL_INCOMING|DAHDI_OVERLAPDIAL_OUTGOING)
 
#define DAHDI_OVERLAPDIAL_INCOMING   2
 
#define DAHDI_OVERLAPDIAL_NONE   0
 
#define DAHDI_OVERLAPDIAL_OUTGOING   1
 
#define SIG_BRI   (0x2000000 | DAHDI_SIG_CLEAR)
 
#define SIG_BRI_PTMP   (0X4000000 | DAHDI_SIG_CLEAR)
 
#define SIG_PRI   DAHDI_SIG_CLEAR
 
#define SIG_PRI_AOC_GRANT_D   (1 << 1)
 
#define SIG_PRI_AOC_GRANT_E   (1 << 2)
 
#define SIG_PRI_AOC_GRANT_S   (1 << 0)
 
#define SIG_PRI_DEBUG_DEFAULT   0
 
#define SIG_PRI_DEBUG_INTENSE
 
#define SIG_PRI_DEBUG_NORMAL
 
#define SIG_PRI_MAX_CHANNELS   672
 
#define SIG_PRI_MAX_MWI_CONTEXT_LEN   10
 
#define SIG_PRI_MAX_MWI_MAILBOX_STR
 Maximum mwi_mailbox string length. More...
 
#define SIG_PRI_MAX_MWI_MAILBOXES   8
 
#define SIG_PRI_MAX_MWI_MBOX_NUMBER_LEN   10 /* digits in number */
 
#define SIG_PRI_NUM_DCHANS   4
 
#define SRVST_BOTH   (SRVST_NEAREND | SRVST_FAREND)
 SRVST_BOTH is used to indicate that both sides of the channel are out-of-service. More...
 
#define SRVST_DBKEY   "service-state"
 Persistent Service State. More...
 
#define SRVST_FAREND   (1 << 1)
 SRVST_FAREND is used to indicate that the far end was taken out-of-service. More...
 
#define SRVST_INITIALIZED   0
 SRVST_INITIALIZED is used to indicate a channel being out-of-service The SRVST_INITIALIZED is mostly used maintain backwards compatibility but also may mean that the channel has not yet received a RESTART message. If a channel is out-of-service with this reason a RESTART message will result in the channel being put into service. More...
 
#define SRVST_NEAREND   (1 << 0)
 SRVST_NEAREND is used to indicate that the near end was put out-of-service. More...
 
#define SRVST_TYPE_OOS   "O"
 The out-of-service SERVICE state. More...
 

Enumerations

enum  sig_pri_call_level {
  SIG_PRI_CALL_LEVEL_IDLE, SIG_PRI_CALL_LEVEL_SETUP, SIG_PRI_CALL_LEVEL_OVERLAP, SIG_PRI_CALL_LEVEL_PROCEEDING,
  SIG_PRI_CALL_LEVEL_ALERTING, SIG_PRI_CALL_LEVEL_DEFER_DIAL, SIG_PRI_CALL_LEVEL_CONNECT
}
 
enum  sig_pri_law { SIG_PRI_DEFLAW = 0, SIG_PRI_ULAW, SIG_PRI_ALAW }
 
enum  sig_pri_reset_state { SIG_PRI_RESET_IDLE, SIG_PRI_RESET_ACTIVE, SIG_PRI_RESET_NO_ACK }
 
enum  sig_pri_tone {
  SIG_PRI_TONE_RINGTONE = 0, SIG_PRI_TONE_STUTTER, SIG_PRI_TONE_CONGESTION, SIG_PRI_TONE_DIALTONE,
  SIG_PRI_TONE_DIALRECALL, SIG_PRI_TONE_INFO, SIG_PRI_TONE_BUSY
}
 

Functions

void pri_event_alarm (struct sig_pri_span *pri, int index, int before_start_pri)
 
void pri_event_noalarm (struct sig_pri_span *pri, int index, int before_start_pri)
 
int pri_is_up (struct sig_pri_span *pri)
 
int pri_maintenance_bservice (struct pri *pri, struct sig_pri_chan *p, int changestatus)
 
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 pri_send_keypad_facility_exec (struct sig_pri_chan *p, const char *digits)
 
int sig_pri_answer (struct sig_pri_chan *p, struct ast_channel *ast)
 
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, char *rdest, int timeout, int layer1)
 
int sig_pri_cc_agent_callee_available (struct ast_cc_agent *agent)
 Alert the caller that it is time to try recalling. More...
 
void sig_pri_cc_agent_destructor (struct ast_cc_agent *agent)
 Destroy private data on the agent. More...
 
int sig_pri_cc_agent_init (struct ast_cc_agent *agent, struct sig_pri_chan *pvt_chan)
 PRI CC agent initialization. More...
 
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 because he is either busy or there is congestion on his line. More...
 
void sig_pri_cc_agent_req_rsp (struct ast_cc_agent *agent, enum ast_cc_agent_response_reason reason)
 Response to a CC request. More...
 
int sig_pri_cc_agent_start_monitoring (struct ast_cc_agent *agent)
 Begin monitoring a busy device. More...
 
int sig_pri_cc_agent_start_offer_timer (struct ast_cc_agent *agent)
 Start the offer timer. More...
 
int sig_pri_cc_agent_status_req (struct ast_cc_agent *agent)
 Request the status of the agent's device. More...
 
int sig_pri_cc_agent_stop_offer_timer (struct ast_cc_agent *agent)
 Stop the offer timer. More...
 
int sig_pri_cc_agent_stop_ringing (struct ast_cc_agent *agent)
 Request for an agent's phone to stop ringing. More...
 
int sig_pri_cc_monitor_cancel_available_timer (struct ast_cc_monitor *monitor, int *sched_id)
 Cancel the running available timer. More...
 
void sig_pri_cc_monitor_destructor (void *monitor_pvt)
 Destroy PRI private data on the monitor. More...
 
int sig_pri_cc_monitor_req_cc (struct ast_cc_monitor *monitor, int *available_timer_id)
 Request CCSS. More...
 
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(). More...
 
int sig_pri_cc_monitor_suspend (struct ast_cc_monitor *monitor)
 Suspend monitoring. More...
 
int sig_pri_cc_monitor_unsuspend (struct ast_cc_monitor *monitor)
 Unsuspend monitoring. More...
 
void sig_pri_chan_alarm_notify (struct sig_pri_chan *p, int noalarm)
 Notify new alarm status. More...
 
void sig_pri_chan_delete (struct sig_pri_chan *doomed)
 Delete the sig_pri private channel structure. More...
 
struct sig_pri_chansig_pri_chan_new (void *pvt_data, struct sig_pri_callback *callback, struct sig_pri_span *pri, int logicalspan, int channo, int trunkgroup)
 
void sig_pri_cli_show_channels (int fd, struct sig_pri_span *pri)
 
void sig_pri_cli_show_channels_header (int fd)
 
void sig_pri_cli_show_span (int fd, int *dchannels, struct sig_pri_span *pri)
 
void sig_pri_cli_show_spans (int fd, int span, struct sig_pri_span *pri)
 
void sig_pri_dial_complete (struct sig_pri_chan *pvt, struct ast_channel *ast)
 DTMF dial string complete. More...
 
int sig_pri_digit_begin (struct sig_pri_chan *pvt, struct ast_channel *ast, char digit)
 
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. More...
 
void sig_pri_fixup (struct ast_channel *oldchan, struct ast_channel *newchan, struct sig_pri_chan *pchan)
 
int sig_pri_hangup (struct sig_pri_chan *p, struct ast_channel *ast)
 
int sig_pri_indicate (struct sig_pri_chan *p, struct ast_channel *chan, int condition, const void *data, size_t datalen)
 
void sig_pri_init_pri (struct sig_pri_span *pri)
 
int sig_pri_is_alarm_ignored (struct sig_pri_span *pri)
 Determine if layer 1 alarms are ignored. More...
 
int sig_pri_is_chan_available (struct sig_pri_chan *pvt)
 Determine if a private channel structure is available. More...
 
int sig_pri_load (const char *cc_type_name)
 Load the sig_pri submodule. More...
 
struct ast_channelsig_pri_request (struct sig_pri_chan *p, enum sig_pri_law law, const struct ast_channel *requestor, int transfercapability)
 
void sig_pri_set_alarm (struct sig_pri_chan *p, int in_alarm)
 
int sig_pri_start_pri (struct sig_pri_span *pri)
 
void sig_pri_stop_pri (struct sig_pri_span *pri)
 Stop PRI span. More...
 
void sig_pri_unload (void)
 Unload the sig_pri submodule. More...
 

Variables

static const char dahdi_db [] = "dahdi/registry"
 The AstDB family. More...
 

Detailed Description

Interface header for PRI signaling module.

Author
Matthew Fredrickson cresl.nosp@m.in@d.nosp@m.igium.nosp@m..com

Definition in file sig_pri.h.

Macro Definition Documentation

#define DAHDI_CHAN_MAPPING_LOGICAL   1

Definition at line 192 of file sig_pri.h.

Referenced by process_dahdi(), and sig_pri_start_pri().

#define DAHDI_CHAN_MAPPING_PHYSICAL   0

Definition at line 191 of file sig_pri.h.

Referenced by dahdi_chan_conf_default(), and process_dahdi().

#define DAHDI_OVERLAPDIAL_BOTH   (DAHDI_OVERLAPDIAL_INCOMING|DAHDI_OVERLAPDIAL_OUTGOING)

Definition at line 198 of file sig_pri.h.

Referenced by process_dahdi().

#define DAHDI_OVERLAPDIAL_INCOMING   2
#define DAHDI_OVERLAPDIAL_NONE   0

Definition at line 195 of file sig_pri.h.

Referenced by process_dahdi().

#define DAHDI_OVERLAPDIAL_OUTGOING   1

Definition at line 196 of file sig_pri.h.

Referenced by dahdi_read(), pri_dchannel(), process_dahdi(), and sig_pri_start_pri().

#define SIG_BRI   (0x2000000 | DAHDI_SIG_CLEAR)

Definition at line 187 of file sig_pri.h.

#define SIG_BRI_PTMP   (0X4000000 | DAHDI_SIG_CLEAR)

Definition at line 188 of file sig_pri.h.

#define SIG_PRI   DAHDI_SIG_CLEAR

Definition at line 186 of file sig_pri.h.

#define SIG_PRI_AOC_GRANT_D   (1 << 1)
#define SIG_PRI_AOC_GRANT_E   (1 << 2)
#define SIG_PRI_AOC_GRANT_S   (1 << 0)
#define SIG_PRI_DEBUG_DEFAULT   0

PRI debug message flags set on initial startup.

Definition at line 63 of file sig_pri.h.

Referenced by sig_pri_start_pri().

#define SIG_PRI_DEBUG_INTENSE
Value:
(PRI_DEBUG_APDU | PRI_DEBUG_Q931_DUMP | PRI_DEBUG_Q931_STATE | PRI_DEBUG_Q921_STATE \
| PRI_DEBUG_CC | PRI_DEBUG_Q921_RAW | PRI_DEBUG_Q921_DUMP)

PRI debug message flags when intense PRI debugging is turned on at the command line.

Definition at line 42 of file sig_pri.h.

Referenced by handle_pri_debug().

#define SIG_PRI_DEBUG_NORMAL
Value:
(PRI_DEBUG_APDU | PRI_DEBUG_Q931_DUMP | PRI_DEBUG_Q931_STATE | PRI_DEBUG_Q921_STATE \
| PRI_DEBUG_CC)

PRI debug message flags when normal PRI debugging is turned on at the command line.

Definition at line 37 of file sig_pri.h.

Referenced by handle_pri_debug().

#define SIG_PRI_MAX_CHANNELS   672

No more than a DS3 per trunk group

Definition at line 184 of file sig_pri.h.

#define SIG_PRI_MAX_MWI_CONTEXT_LEN   10

Typical maximum length of mwi mailbox context

Definition at line 331 of file sig_pri.h.

#define SIG_PRI_MAX_MWI_MAILBOX_STR
Value:
#define SIG_PRI_MAX_MWI_CONTEXT_LEN
Definition: sig_pri.h:331
#define SIG_PRI_MAX_MWI_MAILBOXES
Definition: sig_pri.h:327
#define SIG_PRI_MAX_MWI_MBOX_NUMBER_LEN
Definition: sig_pri.h:329

Maximum mwi_mailbox string length.

max_length = #mailboxes * (mbox_number + '@' + context + ',') The last ',' is a null terminator instead.

Definition at line 338 of file sig_pri.h.

#define SIG_PRI_MAX_MWI_MAILBOXES   8

Maximum number of mailboxes per span.

Definition at line 327 of file sig_pri.h.

#define SIG_PRI_MAX_MWI_MBOX_NUMBER_LEN   10 /* digits in number */

Typical maximum length of mwi mailbox number

Definition at line 329 of file sig_pri.h.

#define SRVST_BOTH   (SRVST_NEAREND | SRVST_FAREND)

SRVST_BOTH is used to indicate that both sides of the channel are out-of-service.

Definition at line 216 of file sig_pri.h.

#define SRVST_DBKEY   "service-state"

Persistent Service State.

Definition at line 202 of file sig_pri.h.

Referenced by destroy_all_channels(), handle_pri_service_generic(), mkintf(), and pri_dchannel().

#define SRVST_FAREND   (1 << 1)

SRVST_FAREND is used to indicate that the far end was taken out-of-service.

Definition at line 214 of file sig_pri.h.

Referenced by mkintf(), pri_check_restart(), and pri_dchannel().

#define SRVST_INITIALIZED   0

SRVST_INITIALIZED is used to indicate a channel being out-of-service The SRVST_INITIALIZED is mostly used maintain backwards compatibility but also may mean that the channel has not yet received a RESTART message. If a channel is out-of-service with this reason a RESTART message will result in the channel being put into service.

Definition at line 210 of file sig_pri.h.

#define SRVST_NEAREND   (1 << 0)

SRVST_NEAREND is used to indicate that the near end was put out-of-service.

Definition at line 212 of file sig_pri.h.

Referenced by handle_pri_service_generic(), mkintf(), pri_check_restart(), and pri_dchannel().

#define SRVST_TYPE_OOS   "O"

The out-of-service SERVICE state.

Definition at line 204 of file sig_pri.h.

Referenced by handle_pri_service_generic(), and pri_dchannel().

Enumeration Type Documentation

Call establishment life cycle level for simple comparisons.

Enumerator
SIG_PRI_CALL_LEVEL_IDLE 

Call does not exist.

SIG_PRI_CALL_LEVEL_SETUP 

Call is present but has no response yet. (SETUP)

SIG_PRI_CALL_LEVEL_OVERLAP 

Call is collecting digits for overlap dialing. (SETUP ACKNOWLEDGE)

SIG_PRI_CALL_LEVEL_PROCEEDING 

Call routing is happening. (PROCEEDING)

SIG_PRI_CALL_LEVEL_ALERTING 

Called party is being alerted of the call. (ALERTING)

SIG_PRI_CALL_LEVEL_DEFER_DIAL 

Call is dialing 'w' deferred digits. (CONNECT)

SIG_PRI_CALL_LEVEL_CONNECT 

Call is connected/answered. (CONNECT)

Definition at line 87 of file sig_pri.h.

87  {
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 };
Enumerator
SIG_PRI_DEFLAW 
SIG_PRI_ULAW 
SIG_PRI_ALAW 

Definition at line 80 of file sig_pri.h.

80  {
81  SIG_PRI_DEFLAW = 0,
84 };
Enumerator
SIG_PRI_RESET_IDLE 

The channel is not being RESTARTed.

SIG_PRI_RESET_ACTIVE 

The channel is being RESTARTed.

Note
Waiting for a RESTART ACKNOWLEDGE from the peer.
SIG_PRI_RESET_NO_ACK 

Peer may not be sending the expected RESTART ACKNOWLEDGE.

We have already received a SETUP on this channel. If another SETUP comes in on this channel then the peer considers this channel useable. Assume that the peer is never going to give us a RESTART ACKNOWLEDGE and assume that we have received one. This is not according to Q.931, but some peers occasionally fail to send a RESTART ACKNOWLEDGE.

Definition at line 104 of file sig_pri.h.

104  {
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 };
The channel is not being RESTARTed.
Definition: sig_pri.h:106
The channel is being RESTARTed.
Definition: sig_pri.h:111
Peer may not be sending the expected RESTART ACKNOWLEDGE.
Definition: sig_pri.h:122
Enumerator
SIG_PRI_TONE_RINGTONE 
SIG_PRI_TONE_STUTTER 
SIG_PRI_TONE_CONGESTION 
SIG_PRI_TONE_DIALTONE 
SIG_PRI_TONE_DIALRECALL 
SIG_PRI_TONE_INFO 
SIG_PRI_TONE_BUSY 

Definition at line 70 of file sig_pri.h.

Function Documentation

void pri_event_alarm ( struct sig_pri_span pri,
int  index,
int  before_start_pri 
)

Definition at line 2014 of file sig_pri.c.

References DCHAN_NOTINALARM, DCHAN_UP, sig_pri_span::dchanavail, and pri_find_dchan().

Referenced by my_handle_dchan_exception(), and prepare_pri().

2015 {
2016  pri->dchanavail[index] &= ~(DCHAN_NOTINALARM | DCHAN_UP);
2017  if (!before_start_pri) {
2018  pri_find_dchan(pri);
2019  }
2020 }
#define DCHAN_NOTINALARM
Definition: sig_pri.c:108
int dchanavail[SIG_PRI_NUM_DCHANS]
Definition: sig_pri.h:469
static void pri_find_dchan(struct sig_pri_span *pri)
Definition: sig_pri.c:1067
#define DCHAN_UP
Definition: sig_pri.c:109
void pri_event_noalarm ( struct sig_pri_span pri,
int  index,
int  before_start_pri 
)

Definition at line 2022 of file sig_pri.c.

References DCHAN_NOTINALARM, sig_pri_span::dchanavail, and sig_pri_span::dchans.

Referenced by my_handle_dchan_exception(), and prepare_pri().

2023 {
2024  pri->dchanavail[index] |= DCHAN_NOTINALARM;
2025  if (!before_start_pri)
2026  pri_restart(pri->dchans[index]);
2027 }
#define DCHAN_NOTINALARM
Definition: sig_pri.c:108
int dchanavail[SIG_PRI_NUM_DCHANS]
Definition: sig_pri.h:469
struct pri * dchans[SIG_PRI_NUM_DCHANS]
Definition: sig_pri.h:480
int pri_is_up ( struct sig_pri_span pri)

Definition at line 1027 of file sig_pri.c.

References DCHAN_AVAILABLE, sig_pri_span::dchanavail, and SIG_PRI_NUM_DCHANS.

Referenced by pri_dchannel().

1028 {
1029  int x;
1030  for (x = 0; x < SIG_PRI_NUM_DCHANS; x++) {
1031  if (pri->dchanavail[x] == DCHAN_AVAILABLE)
1032  return 1;
1033  }
1034  return 0;
1035 }
int dchanavail[SIG_PRI_NUM_DCHANS]
Definition: sig_pri.h:469
#define DCHAN_AVAILABLE
Definition: sig_pri.c:119
#define SIG_PRI_NUM_DCHANS
Definition: sig_pri.h:183
int pri_maintenance_bservice ( struct pri *  pri,
struct sig_pri_chan p,
int  changestatus 
)

Definition at line 8109 of file sig_pri.c.

References sig_pri_chan::channel, PRI_SPAN, and PVT_TO_CHANNEL().

Referenced by handle_pri_service_generic().

8110 {
8111  int channel = PVT_TO_CHANNEL(p);
8112  int span = PRI_SPAN(channel);
8113 
8114  return pri_maintenance_service(pri, span, channel, changestatus);
8115 }
#define PRI_SPAN(p)
Definition: sig_pri.c:113
static unsigned int PVT_TO_CHANNEL(struct sig_pri_chan *p)
Definition: sig_pri.c:149
struct sig_pri_span * pri
Definition: sig_pri.c:2288
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 at line 8087 of file sig_pri.c.

References ast_log(), sig_pri_chan::call, LOG_DEBUG, sig_pri_chan::pri, sig_pri_span::pri, pri_grab(), pri_rel(), sig_pri_lock_private(), and sig_pri_unlock_private().

Referenced by dahdi_send_callrerouting_facility_exec().

8088 {
8089  int res;
8090 
8092 
8093  if (!p->pri || !p->call) {
8094  ast_log(LOG_DEBUG, "Unable to find pri or call on channel!\n");
8096  return -1;
8097  }
8098 
8099  pri_grab(p, p->pri);
8100  res = pri_callrerouting_facility(p->pri->pri, p->call, destination, original, reason);
8101  pri_rel(p->pri);
8102 
8104 
8105  return res;
8106 }
static int pri_grab(struct sig_pri_chan *p, struct sig_pri_span *pri)
Definition: sig_pri.c:342
q931_call * call
Definition: sig_pri.h:297
#define LOG_DEBUG
Definition: logger.h:122
static void pri_rel(struct sig_pri_span *pri)
Definition: sig_pri.c:144
void ast_log(int level, const char *file, int line, const char *function, const char *fmt,...)
Used for sending a log message This is the standard logger function. Probably the only way you will i...
Definition: logger.c:1207
static void sig_pri_unlock_private(struct sig_pri_chan *p)
Definition: sig_pri.c:330
static void sig_pri_lock_private(struct sig_pri_chan *p)
Definition: sig_pri.c:336
struct sig_pri_span * pri
Definition: sig_pri.h:296
struct pri * pri
Definition: sig_pri.h:481
int pri_send_keypad_facility_exec ( struct sig_pri_chan p,
const char *  digits 
)

Definition at line 8068 of file sig_pri.c.

References ast_debug, sig_pri_chan::call, sig_pri_chan::pri, sig_pri_span::pri, pri_grab(), pri_rel(), sig_pri_lock_private(), and sig_pri_unlock_private().

Referenced by dahdi_send_keypad_facility_exec().

8069 {
8071 
8072  if (!p->pri || !p->call) {
8073  ast_debug(1, "Unable to find pri or call on channel!\n");
8075  return -1;
8076  }
8077 
8078  pri_grab(p, p->pri);
8079  pri_keypad_facility(p->pri->pri, p->call, digits);
8080  pri_rel(p->pri);
8081 
8083 
8084  return 0;
8085 }
static int pri_grab(struct sig_pri_chan *p, struct sig_pri_span *pri)
Definition: sig_pri.c:342
q931_call * call
Definition: sig_pri.h:297
static void pri_rel(struct sig_pri_span *pri)
Definition: sig_pri.c:144
#define ast_debug(level,...)
Log a DEBUG message.
Definition: logger.h:236
static void sig_pri_unlock_private(struct sig_pri_chan *p)
Definition: sig_pri.c:330
static void sig_pri_lock_private(struct sig_pri_chan *p)
Definition: sig_pri.c:336
struct sig_pri_span * pri
Definition: sig_pri.h:296
struct pri * pri
Definition: sig_pri.h:481
int sig_pri_answer ( struct sig_pri_chan p,
struct ast_channel ast 
)

Definition at line 7317 of file sig_pri.c.

References sig_pri_chan::aoc_s_request_invoke_id, sig_pri_chan::aoc_s_request_invoke_id_valid, ast_setstate(), AST_STATE_UP, sig_pri_chan::call, sig_pri_chan::call_level, sig_pri_chan::digital, sig_pri_chan::pri, sig_pri_span::pri, pri_grab(), pri_rel(), SIG_PRI_CALL_LEVEL_CONNECT, sig_pri_open_media(), and sig_pri_set_dialing().

Referenced by dahdi_answer().

7318 {
7319  int res;
7320 
7321  /* Send a pri acknowledge */
7322  pri_grab(p, p->pri);
7323 #if defined(HAVE_PRI_AOC_EVENTS)
7325  /* if AOC-S was requested and the invoke id is still present on answer. That means
7326  * no AOC-S rate list was provided, so send a NULL response which will indicate that
7327  * AOC-S is not available */
7328  pri_aoc_s_request_response_send(p->pri->pri, p->call,
7329  p->aoc_s_request_invoke_id, NULL);
7331  }
7332 #endif /* defined(HAVE_PRI_AOC_EVENTS) */
7335  }
7336  sig_pri_set_dialing(p, 0);
7337  sig_pri_open_media(p);
7338  res = pri_answer(p->pri->pri, p->call, 0, !p->digital);
7339  pri_rel(p->pri);
7340  ast_setstate(ast, AST_STATE_UP);
7341  return res;
7342 }
int aoc_s_request_invoke_id
Definition: sig_pri.h:260
static int pri_grab(struct sig_pri_chan *p, struct sig_pri_span *pri)
Definition: sig_pri.c:342
q931_call * call
Definition: sig_pri.h:297
unsigned int aoc_s_request_invoke_id_valid
Definition: sig_pri.h:261
static void pri_rel(struct sig_pri_span *pri)
Definition: sig_pri.c:144
static void sig_pri_open_media(struct sig_pri_chan *p)
Definition: sig_pri.c:984
enum sig_pri_call_level call_level
Definition: sig_pri.h:300
static void sig_pri_set_dialing(struct sig_pri_chan *p, int is_dialing)
Definition: sig_pri.c:164
int ast_setstate(struct ast_channel *chan, enum ast_channel_state)
Change the state of a channel.
Definition: channel.c:7119
unsigned int digital
Definition: sig_pri.h:282
struct sig_pri_span * pri
Definition: sig_pri.h:296
struct pri * pri
Definition: sig_pri.h:481
int sig_pri_available ( struct sig_pri_chan **  pvt,
int  is_specific_channel 
)

Definition at line 7412 of file sig_pri.c.

References sig_pri_chan::allocated, ast_mutex_lock, ast_mutex_unlock, HAVE_PRI_CALL_WAITING, sig_pri_span::lock, sig_pri_span::num_call_waiting_calls, sig_pri_chan::pri, sig_pri_span::pri, sig_pri_available_check(), and sig_pri_cw_available().

Referenced by available().

7413 {
7414  struct sig_pri_chan *p = *pvt;
7415  struct sig_pri_span *pri;
7416 
7417  if (!p->pri) {
7418  /* Something is wrong here. A PRI channel without the pri pointer? */
7419  return 0;
7420  }
7421  pri = p->pri;
7422 
7423  ast_mutex_lock(&pri->lock);
7424  if (
7425 #if defined(HAVE_PRI_CALL_WAITING)
7426  /*
7427  * Only do call waiting calls if we have any
7428  * call waiting call outstanding. We do not
7429  * want new calls to steal a B channel
7430  * freed for an earlier call waiting call.
7431  */
7432  !pri->num_call_waiting_calls &&
7433 #endif /* defined(HAVE_PRI_CALL_WAITING) */
7435  p->allocated = 1;
7436  ast_mutex_unlock(&pri->lock);
7437  return 1;
7438  }
7439 
7440 #if defined(HAVE_PRI_CALL_WAITING)
7441  if (!is_specific_channel) {
7442  struct sig_pri_chan *cw;
7443 
7444  cw = sig_pri_cw_available(pri);
7445  if (cw) {
7446  /* We have a call waiting interface to use instead. */
7447  cw->allocated = 1;
7448  *pvt = cw;
7449  ast_mutex_unlock(&pri->lock);
7450  return 1;
7451  }
7452  }
7453 #endif /* defined(HAVE_PRI_CALL_WAITING) */
7454  ast_mutex_unlock(&pri->lock);
7455  return 0;
7456 }
#define HAVE_PRI_CALL_WAITING
Definition: autoconfig.h:580
static struct sig_pri_chan * sig_pri_cw_available(struct sig_pri_span *pri)
Definition: sig_pri.c:7379
#define ast_mutex_lock(a)
Definition: lock.h:155
ast_mutex_t lock
Definition: sig_pri.h:495
int num_call_waiting_calls
Number of outstanding call waiting calls.
Definition: sig_pri.h:467
struct sig_pri_span * pri
Definition: sig_pri.h:296
unsigned int allocated
TRUE when this channel is allocated.
Definition: sig_pri.h:280
static int sig_pri_available_check(struct sig_pri_chan *pvt)
Definition: sig_pri.c:7354
struct pri * pri
Definition: sig_pri.h:481
#define ast_mutex_unlock(a)
Definition: lock.h:156
int sig_pri_call ( struct sig_pri_chan p,
struct ast_channel ast,
char *  rdest,
int  timeout,
int  layer1 
)
Note
Parsing must remain in sync with sig_pri_extract_called_num_subaddr().

Definition at line 6641 of file sig_pri.c.

References ast_channel::_state, ao2_ref, sig_pri_span::append_msn_to_user_tag, args, AST_APP_ARG, ast_app_parse_options(), ast_assert, ast_cc_get_monitor_by_recall_core_id(), ast_cc_is_recall(), ast_channel_get_device_name(), AST_CHANNEL_NAME, ast_copy_string(), AST_DECLARE_APP_ARGS, ast_free, ast_log(), AST_NONSTANDARD_APP_ARGS, ast_party_subaddress_init(), ast_setstate(), AST_STATE_DIALING, AST_STATE_DOWN, AST_STATE_RESERVED, ast_strdup, ast_strlen_zero(), ast_test_flag, ast_transfercapability2str(), ast_verb, sig_pri_chan::call, sig_pri_chan::call_level, ast_channel::caller, sig_pri_cc_monitor_instance::cc_id, sig_pri_chan::channel, ast_channel::connected, sig_pri_chan::deferred_digits, sig_pri_chan::dialdest, sig_pri_span::dialplan, dialplan2str(), sig_pri_chan::digital, ext, sig_pri_span::facilityenable, sig_pri_chan::hidecallerid, sig_pri_chan::hidecalleridname, ast_party_caller::id, ast_party_connected_line::id, sig_pri_span::initial_user_tag, sig_pri_span::internationalprefix, sig_pri_chan::is_call_waiting, IS_DIGITAL, sig_pri_span::localdialplan, LOG_DEBUG, LOG_ERROR, LOG_WARNING, monitor, ast_party_id::name, ast_channel::name, sig_pri_span::nationalprefix, sig_pri_chan::no_dialed_digits, sig_pri_span::nodetype, ast_party_id::number, OPT_AOC_REQUEST, OPT_ARG_AOC_REQUEST, OPT_ARG_ARRAY_SIZE, OPT_ARG_KEYPAD, OPT_KEYPAD, OPT_REVERSE_CHARGE, sig_pri_chan::owner, pbx_builtin_getvar_helper(), ast_party_number::presentation, sig_pri_cc_monitor_instance::pri, sig_pri_chan::pri, sig_pri_span::pri, pri_grab(), pri_rel(), PRI_TRANS_CAP_DIGITAL, sig_pri_chan::priexclusive, ast_cc_monitor::private_data, PVT_TO_CHANNEL(), S_COR, SIG_PRI_CALL_LEVEL_SETUP, sig_pri_call_opts, sig_pri_cc_type_name, sig_pri_party_subaddress_from_ast(), sig_pri_redirecting_update(), sig_pri_set_dialing(), sig_pri_set_digital(), sig_pri_set_outgoing(), ast_party_name::str, ast_party_number::str, ast_party_subaddress::str, sig_pri_chan::stripmsd, ast_party_id::subaddress, ast_party_id::tag, ast_channel::transfercapability, ast_party_subaddress::type, sig_pri_chan::use_callingpres, sig_pri_chan::user_tag, ast_party_name::valid, ast_party_number::valid, and ast_party_subaddress::valid.

Referenced by dahdi_call().

6642 {
6643  char dest[256]; /* must be same length as p->dialdest */
6644  struct ast_party_subaddress dialed_subaddress; /* Called subaddress */
6645  struct pri_sr *sr;
6646  char *c, *l, *n, *s;
6647 #ifdef SUPPORT_USERUSER
6648  const char *useruser;
6649 #endif
6650  int core_id;
6651  int pridialplan;
6652  int dp_strip;
6653  int prilocaldialplan;
6654  int ldp_strip;
6655  int exclusive;
6656 #if defined(HAVE_PRI_SETUP_KEYPAD)
6657  const char *keypad;
6658 #endif /* defined(HAVE_PRI_SETUP_KEYPAD) */
6660  AST_APP_ARG(group); /* channel/group token */
6661  AST_APP_ARG(ext); /* extension token */
6662  AST_APP_ARG(opts); /* options token */
6663  AST_APP_ARG(other); /* Any remining unused arguments */
6664  );
6665  struct ast_flags opts;
6666  char *opt_args[OPT_ARG_ARRAY_SIZE];
6667 
6668  ast_log(LOG_DEBUG, "CALLER NAME: %s NUM: %s\n",
6669  S_COR(ast->connected.id.name.valid, ast->connected.id.name.str, ""),
6670  S_COR(ast->connected.id.number.valid, ast->connected.id.number.str, ""));
6671 
6672  if (!p->pri) {
6673  ast_log(LOG_ERROR, "Could not find pri on channel %d\n", p->channel);
6674  return -1;
6675  }
6676 
6677  if ((ast->_state != AST_STATE_DOWN) && (ast->_state != AST_STATE_RESERVED)) {
6678  ast_log(LOG_WARNING, "sig_pri_call called on %s, neither down nor reserved\n", ast->name);
6679  return -1;
6680  }
6681 
6682  p->dialdest[0] = '\0';
6683  sig_pri_set_outgoing(p, 1);
6684 
6685  ast_copy_string(dest, rdest, sizeof(dest));
6686  AST_NONSTANDARD_APP_ARGS(args, dest, '/');
6687  if (ast_app_parse_options(sig_pri_call_opts, &opts, opt_args, args.opts)) {
6688  /* General invalid option syntax. */
6689  return -1;
6690  }
6691 
6692  c = args.ext;
6693  if (!c) {
6694  c = "";
6695  }
6696 
6697  /* setup dialed_subaddress if found */
6698  ast_party_subaddress_init(&dialed_subaddress);
6699  s = strchr(c, ':');
6700  if (s) {
6701  *s = '\0';
6702  s++;
6703  /* prefix */
6704  /* 'n' = NSAP */
6705  /* 'u' = User Specified */
6706  /* Default = NSAP */
6707  switch (*s) {
6708  case 'U':
6709  case 'u':
6710  s++;
6711  dialed_subaddress.type = 2;
6712  break;
6713  case 'N':
6714  case 'n':
6715  s++;
6716  /* default already covered with ast_party_subaddress_init */
6717  break;
6718  }
6719  dialed_subaddress.str = s;
6720  dialed_subaddress.valid = 1;
6721  }
6722 
6723  l = NULL;
6724  n = NULL;
6725  if (!p->hidecallerid) {
6726  if (ast->connected.id.number.valid) {
6727  /* If we get to the end of this loop without breaking, there's no
6728  * calleridnum. This is done instead of testing for "unknown" or
6729  * the thousands of other ways that the calleridnum could be
6730  * invalid. */
6731  for (l = ast->connected.id.number.str; l && *l; l++) {
6732  if (strchr("0123456789", *l)) {
6733  l = ast->connected.id.number.str;
6734  break;
6735  }
6736  }
6737  } else {
6738  l = NULL;
6739  }
6740  if (!p->hidecalleridname) {
6741  n = ast->connected.id.name.valid ? ast->connected.id.name.str : NULL;
6742  }
6743  }
6744 
6745  if (strlen(c) < p->stripmsd) {
6746  ast_log(LOG_WARNING, "Number '%s' is shorter than stripmsd (%d)\n", c, p->stripmsd);
6747  return -1;
6748  }
6749 
6750  /* Extract any 'w' deferred digits. */
6751  s = strchr(c + p->stripmsd, 'w');
6752  if (s) {
6753  *s++ = '\0';
6754  ast_copy_string(p->deferred_digits, s, sizeof(p->deferred_digits));
6755  /*
6756  * Since we have a 'w', this means that there will not be any
6757  * more normal dialed digits. Therefore, the sending complete
6758  * ie needs to be sent with any normal digits.
6759  */
6760  } else {
6761  p->deferred_digits[0] = '\0';
6762  }
6763 
6764  pri_grab(p, p->pri);
6765  if (!(p->call = pri_new_call(p->pri->pri))) {
6766  ast_log(LOG_WARNING, "Unable to create call on channel %d\n", p->channel);
6767  pri_rel(p->pri);
6768  return -1;
6769  }
6770  if (!(sr = pri_sr_new())) {
6771  ast_log(LOG_WARNING, "Failed to allocate setup request on channel %d\n",
6772  p->channel);
6773  pri_destroycall(p->pri->pri, p->call);
6774  p->call = NULL;
6775  pri_rel(p->pri);
6776  return -1;
6777  }
6778 
6779  sig_pri_set_digital(p, IS_DIGITAL(ast->transfercapability)); /* push up to parent for EC */
6780 
6781 #if defined(HAVE_PRI_CALL_WAITING)
6782  if (p->is_call_waiting) {
6783  /*
6784  * Indicate that this is a call waiting call.
6785  * i.e., Normal call but with no B channel.
6786  */
6787  pri_sr_set_channel(sr, 0, 0, 1);
6788  } else
6789 #endif /* defined(HAVE_PRI_CALL_WAITING) */
6790  {
6791  /* Should the picked channel be used exclusively? */
6792  if (p->priexclusive || p->pri->nodetype == PRI_NETWORK) {
6793  exclusive = 1;
6794  } else {
6795  exclusive = 0;
6796  }
6797  pri_sr_set_channel(sr, PVT_TO_CHANNEL(p), exclusive, 1);
6798  }
6799 
6800  pri_sr_set_bearer(sr, p->digital ? PRI_TRANS_CAP_DIGITAL : ast->transfercapability,
6801  (p->digital ? -1 : layer1));
6802 
6803  if (p->pri->facilityenable)
6804  pri_facility_enable(p->pri->pri);
6805 
6806  ast_verb(3, "Requested transfer capability: 0x%.2x - %s\n", (unsigned)ast->transfercapability, ast_transfercapability2str(ast->transfercapability));
6807  dp_strip = 0;
6808  pridialplan = p->pri->dialplan - 1;
6809  if (pridialplan == -2 || pridialplan == -3) { /* compute dynamically */
6810  if (strncmp(c + p->stripmsd, p->pri->internationalprefix, strlen(p->pri->internationalprefix)) == 0) {
6811  if (pridialplan == -2) {
6812  dp_strip = strlen(p->pri->internationalprefix);
6813  }
6814  pridialplan = PRI_INTERNATIONAL_ISDN;
6815  } else if (strncmp(c + p->stripmsd, p->pri->nationalprefix, strlen(p->pri->nationalprefix)) == 0) {
6816  if (pridialplan == -2) {
6817  dp_strip = strlen(p->pri->nationalprefix);
6818  }
6819  pridialplan = PRI_NATIONAL_ISDN;
6820  } else {
6821  pridialplan = PRI_LOCAL_ISDN;
6822  }
6823  }
6824  while (c[p->stripmsd] > '9' && c[p->stripmsd] != '*' && c[p->stripmsd] != '#') {
6825  switch (c[p->stripmsd]) {
6826  case 'U':
6827  pridialplan = (PRI_TON_UNKNOWN << 4) | (pridialplan & 0xf);
6828  break;
6829  case 'I':
6830  pridialplan = (PRI_TON_INTERNATIONAL << 4) | (pridialplan & 0xf);
6831  break;
6832  case 'N':
6833  pridialplan = (PRI_TON_NATIONAL << 4) | (pridialplan & 0xf);
6834  break;
6835  case 'L':
6836  pridialplan = (PRI_TON_NET_SPECIFIC << 4) | (pridialplan & 0xf);
6837  break;
6838  case 'S':
6839  pridialplan = (PRI_TON_SUBSCRIBER << 4) | (pridialplan & 0xf);
6840  break;
6841  case 'V':
6842  pridialplan = (PRI_TON_ABBREVIATED << 4) | (pridialplan & 0xf);
6843  break;
6844  case 'R':
6845  pridialplan = (PRI_TON_RESERVED << 4) | (pridialplan & 0xf);
6846  break;
6847  case 'u':
6848  pridialplan = PRI_NPI_UNKNOWN | (pridialplan & 0xf0);
6849  break;
6850  case 'e':
6851  pridialplan = PRI_NPI_E163_E164 | (pridialplan & 0xf0);
6852  break;
6853  case 'x':
6854  pridialplan = PRI_NPI_X121 | (pridialplan & 0xf0);
6855  break;
6856  case 'f':
6857  pridialplan = PRI_NPI_F69 | (pridialplan & 0xf0);
6858  break;
6859  case 'n':
6860  pridialplan = PRI_NPI_NATIONAL | (pridialplan & 0xf0);
6861  break;
6862  case 'p':
6863  pridialplan = PRI_NPI_PRIVATE | (pridialplan & 0xf0);
6864  break;
6865  case 'r':
6866  pridialplan = PRI_NPI_RESERVED | (pridialplan & 0xf0);
6867  break;
6868  default:
6869  if (isalpha(c[p->stripmsd])) {
6870  ast_log(LOG_WARNING, "Unrecognized pridialplan %s modifier: %c\n",
6871  c[p->stripmsd] > 'Z' ? "NPI" : "TON", c[p->stripmsd]);
6872  }
6873  break;
6874  }
6875  c++;
6876  }
6877 #if defined(HAVE_PRI_SETUP_KEYPAD)
6878  if (ast_test_flag(&opts, OPT_KEYPAD)
6879  && !ast_strlen_zero(opt_args[OPT_ARG_KEYPAD])) {
6880  /* We have a keypad facility digits option with digits. */
6881  keypad = opt_args[OPT_ARG_KEYPAD];
6882  pri_sr_set_keypad_digits(sr, keypad);
6883  } else {
6884  keypad = NULL;
6885  }
6886  if (!keypad || !ast_strlen_zero(c + p->stripmsd + dp_strip))
6887 #endif /* defined(HAVE_PRI_SETUP_KEYPAD) */
6888  {
6889  char *called = c + p->stripmsd + dp_strip;
6890 
6891  pri_sr_set_called(sr, called, pridialplan, s ? 1 : 0);
6892 #if defined(HAVE_PRI_SETUP_ACK_INBAND)
6893  p->no_dialed_digits = !called[0];
6894 #endif /* defined(HAVE_PRI_SETUP_ACK_INBAND) */
6895  }
6896 
6897 #if defined(HAVE_PRI_SUBADDR)
6898  if (dialed_subaddress.valid) {
6899  struct pri_party_subaddress subaddress;
6900 
6901  memset(&subaddress, 0, sizeof(subaddress));
6902  sig_pri_party_subaddress_from_ast(&subaddress, &dialed_subaddress);
6903  pri_sr_set_called_subaddress(sr, &subaddress);
6904  }
6905 #endif /* defined(HAVE_PRI_SUBADDR) */
6906 #if defined(HAVE_PRI_REVERSE_CHARGE)
6907  if (ast_test_flag(&opts, OPT_REVERSE_CHARGE)) {
6908  pri_sr_set_reversecharge(sr, PRI_REVERSECHARGE_REQUESTED);
6909  }
6910 #endif /* defined(HAVE_PRI_REVERSE_CHARGE) */
6911 #if defined(HAVE_PRI_AOC_EVENTS)
6912  if (ast_test_flag(&opts, OPT_AOC_REQUEST)
6913  && !ast_strlen_zero(opt_args[OPT_ARG_AOC_REQUEST])) {
6914  if (strchr(opt_args[OPT_ARG_AOC_REQUEST], 's')) {
6915  pri_sr_set_aoc_charging_request(sr, PRI_AOC_REQUEST_S);
6916  }
6917  if (strchr(opt_args[OPT_ARG_AOC_REQUEST], 'd')) {
6918  pri_sr_set_aoc_charging_request(sr, PRI_AOC_REQUEST_D);
6919  }
6920  if (strchr(opt_args[OPT_ARG_AOC_REQUEST], 'e')) {
6921  pri_sr_set_aoc_charging_request(sr, PRI_AOC_REQUEST_E);
6922  }
6923  }
6924 #endif /* defined(HAVE_PRI_AOC_EVENTS) */
6925 
6926  /* Setup the user tag for party id's from this device for this call. */
6927  if (p->pri->append_msn_to_user_tag) {
6928  snprintf(p->user_tag, sizeof(p->user_tag), "%s_%s", p->pri->initial_user_tag,
6929  p->pri->nodetype == PRI_NETWORK
6930  ? c + p->stripmsd + dp_strip
6931  : S_COR(ast->connected.id.number.valid,
6932  ast->connected.id.number.str, ""));
6933  } else {
6934  ast_copy_string(p->user_tag, p->pri->initial_user_tag, sizeof(p->user_tag));
6935  }
6936 
6937  /*
6938  * Replace the caller id tag from the channel creation
6939  * with the actual tag value.
6940  */
6941  ast_free(ast->caller.id.tag);
6942  ast->caller.id.tag = ast_strdup(p->user_tag);
6943 
6944  ldp_strip = 0;
6945  prilocaldialplan = p->pri->localdialplan - 1;
6946  if ((l != NULL) && (prilocaldialplan == -2 || prilocaldialplan == -3)) { /* compute dynamically */
6947  if (strncmp(l, p->pri->internationalprefix, strlen(p->pri->internationalprefix)) == 0) {
6948  if (prilocaldialplan == -2) {
6949  ldp_strip = strlen(p->pri->internationalprefix);
6950  }
6951  prilocaldialplan = PRI_INTERNATIONAL_ISDN;
6952  } else if (strncmp(l, p->pri->nationalprefix, strlen(p->pri->nationalprefix)) == 0) {
6953  if (prilocaldialplan == -2) {
6954  ldp_strip = strlen(p->pri->nationalprefix);
6955  }
6956  prilocaldialplan = PRI_NATIONAL_ISDN;
6957  } else {
6958  prilocaldialplan = PRI_LOCAL_ISDN;
6959  }
6960  }
6961  if (l != NULL) {
6962  while (*l > '9' && *l != '*' && *l != '#') {
6963  switch (*l) {
6964  case 'U':
6965  prilocaldialplan = (PRI_TON_UNKNOWN << 4) | (prilocaldialplan & 0xf);
6966  break;
6967  case 'I':
6968  prilocaldialplan = (PRI_TON_INTERNATIONAL << 4) | (prilocaldialplan & 0xf);
6969  break;
6970  case 'N':
6971  prilocaldialplan = (PRI_TON_NATIONAL << 4) | (prilocaldialplan & 0xf);
6972  break;
6973  case 'L':
6974  prilocaldialplan = (PRI_TON_NET_SPECIFIC << 4) | (prilocaldialplan & 0xf);
6975  break;
6976  case 'S':
6977  prilocaldialplan = (PRI_TON_SUBSCRIBER << 4) | (prilocaldialplan & 0xf);
6978  break;
6979  case 'V':
6980  prilocaldialplan = (PRI_TON_ABBREVIATED << 4) | (prilocaldialplan & 0xf);
6981  break;
6982  case 'R':
6983  prilocaldialplan = (PRI_TON_RESERVED << 4) | (prilocaldialplan & 0xf);
6984  break;
6985  case 'u':
6986  prilocaldialplan = PRI_NPI_UNKNOWN | (prilocaldialplan & 0xf0);
6987  break;
6988  case 'e':
6989  prilocaldialplan = PRI_NPI_E163_E164 | (prilocaldialplan & 0xf0);
6990  break;
6991  case 'x':
6992  prilocaldialplan = PRI_NPI_X121 | (prilocaldialplan & 0xf0);
6993  break;
6994  case 'f':
6995  prilocaldialplan = PRI_NPI_F69 | (prilocaldialplan & 0xf0);
6996  break;
6997  case 'n':
6998  prilocaldialplan = PRI_NPI_NATIONAL | (prilocaldialplan & 0xf0);
6999  break;
7000  case 'p':
7001  prilocaldialplan = PRI_NPI_PRIVATE | (prilocaldialplan & 0xf0);
7002  break;
7003  case 'r':
7004  prilocaldialplan = PRI_NPI_RESERVED | (prilocaldialplan & 0xf0);
7005  break;
7006  default:
7007  if (isalpha(*l)) {
7009  "Unrecognized prilocaldialplan %s modifier: %c\n",
7010  *l > 'Z' ? "NPI" : "TON", *l);
7011  }
7012  break;
7013  }
7014  l++;
7015  }
7016  }
7017  pri_sr_set_caller(sr, l ? (l + ldp_strip) : NULL, n, prilocaldialplan,
7018  p->use_callingpres ? ast->connected.id.number.presentation : (l ? PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN : PRES_NUMBER_NOT_AVAILABLE));
7019 
7020 #if defined(HAVE_PRI_SUBADDR)
7021  if (ast->connected.id.subaddress.valid) {
7022  struct pri_party_subaddress subaddress;
7023 
7024  memset(&subaddress, 0, sizeof(subaddress));
7026  pri_sr_set_caller_subaddress(sr, &subaddress);
7027  }
7028 #endif /* defined(HAVE_PRI_SUBADDR) */
7029 
7031 
7032 #ifdef SUPPORT_USERUSER
7033  /* User-user info */
7034  useruser = pbx_builtin_getvar_helper(p->owner, "USERUSERINFO");
7035  if (useruser)
7036  pri_sr_set_useruser(sr, useruser);
7037 #endif
7038 
7039 #if defined(HAVE_PRI_CCSS)
7040  if (ast_cc_is_recall(ast, &core_id, sig_pri_cc_type_name)) {
7041  struct ast_cc_monitor *monitor;
7042  char device_name[AST_CHANNEL_NAME];
7043 
7044  /* This is a CC recall call. */
7045  ast_channel_get_device_name(ast, device_name, sizeof(device_name));
7046  monitor = ast_cc_get_monitor_by_recall_core_id(core_id, device_name);
7047  if (monitor) {
7048  struct sig_pri_cc_monitor_instance *instance;
7049 
7050  instance = monitor->private_data;
7051 
7052  /* If this fails then we have monitor instance ambiguity. */
7053  ast_assert(p->pri == instance->pri);
7054 
7055  if (pri_cc_call(p->pri->pri, instance->cc_id, p->call, sr)) {
7056  /* The CC recall call failed for some reason. */
7057  ast_log(LOG_WARNING, "Unable to setup CC recall call to device %s\n",
7058  device_name);
7059  ao2_ref(monitor, -1);
7060  pri_destroycall(p->pri->pri, p->call);
7061  p->call = NULL;
7062  pri_rel(p->pri);
7063  pri_sr_free(sr);
7064  return -1;
7065  }
7066  ao2_ref(monitor, -1);
7067  } else {
7068  core_id = -1;
7069  }
7070  } else
7071 #endif /* defined(HAVE_PRI_CCSS) */
7072  {
7073  core_id = -1;
7074  }
7075  if (core_id == -1 && pri_setup(p->pri->pri, p->call, sr)) {
7076  ast_log(LOG_WARNING, "Unable to setup call to %s (using %s)\n",
7077  c + p->stripmsd + dp_strip, dialplan2str(p->pri->dialplan));
7078  pri_destroycall(p->pri->pri, p->call);
7079  p->call = NULL;
7080  pri_rel(p->pri);
7081  pri_sr_free(sr);
7082  return -1;
7083  }
7085  pri_sr_free(sr);
7087  sig_pri_set_dialing(p, 1);
7088  pri_rel(p->pri);
7089  return 0;
7090 }
int nodetype
Definition: sig_pri.h:434
char * str
Subscriber phone number (Malloced)
Definition: channel.h:241
struct ast_party_connected_line connected
Channel Connected Line ID information.
Definition: channel.h:811
unsigned int priexclusive
Definition: sig_pri.h:227
#define IS_DIGITAL(cap)
Definition: transcap.h:43
struct ast_party_caller caller
Channel Caller ID information.
Definition: channel.h:804
static int pri_grab(struct sig_pri_chan *p, struct sig_pri_span *pri)
Definition: sig_pri.c:342
unsigned int use_callingpres
Definition: sig_pri.h:230
int presentation
Q.931 presentation-indicator and screening-indicator encoded fields.
Definition: channel.h:245
static void sig_pri_party_subaddress_from_ast(struct pri_party_subaddress *pri_subaddress, const struct ast_party_subaddress *ast_subaddress)
Definition: sig_pri.c:773
#define ast_strdup(a)
Definition: astmm.h:109
struct ast_party_id id
Connected party ID.
Definition: channel.h:403
#define ast_test_flag(p, flag)
Definition: utils.h:63
struct ast_party_name name
Subscriber name.
Definition: channel.h:290
int facilityenable
Definition: sig_pri.h:361
#define LOG_WARNING
Definition: logger.h:144
char nationalprefix[10]
Definition: sig_pri.h:407
q931_call * call
Definition: sig_pri.h:297
int ast_app_parse_options(const struct ast_app_option *options, struct ast_flags *flags, char **args, char *optstr)
Parses a string containing application options and sets flags/arguments.
Definition: app.c:2101
static void sig_pri_set_outgoing(struct sig_pri_chan *p, int is_outgoing)
Definition: sig_pri.c:179
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application&#39;s arguments.
Definition: app.h:572
struct ast_channel * owner
Definition: sig_pri.h:294
char * str
Subscriber name (Malloced)
Definition: channel.h:214
unsigned char valid
TRUE if the subaddress information is valid/present.
Definition: channel.h:278
#define ast_assert(a)
Definition: utils.h:738
int dialplan
Definition: sig_pri.h:404
int localdialplan
Definition: sig_pri.h:405
unsigned short transfercapability
Definition: channel.h:863
#define LOG_DEBUG
Definition: logger.h:122
const char * ext
Definition: http.c:112
static void pri_rel(struct sig_pri_span *pri)
Definition: sig_pri.c:144
#define ast_verb(level,...)
Definition: logger.h:243
int ast_cc_is_recall(struct ast_channel *chan, int *core_id, const char *const monitor_type)
Decide if a call to a particular channel is a CC recall.
Definition: ccss.c:3172
struct sig_pri_span * pri
Asterisk span D channel control structure.
Definition: sig_pri.c:89
static unsigned int PVT_TO_CHANNEL(struct sig_pri_chan *p)
Definition: sig_pri.c:149
const char * pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name)
Return a pointer to the value of the corresponding channel variable.
Definition: pbx.c:10475
struct ast_party_id id
Caller party ID.
Definition: channel.h:370
static void sig_pri_set_digital(struct sig_pri_chan *p, int is_digital)
Definition: sig_pri.c:171
char dialdest[256]
Definition: sig_pri.h:250
int stripmsd
Definition: sig_pri.h:233
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Definition: strings.h:63
enum sig_pri_call_level call_level
Definition: sig_pri.h:300
#define ao2_ref(o, delta)
Definition: astobj2.h:472
#define S_COR(a, b, c)
returns the equivalent of logic or for strings, with an additional boolean check: second one if not e...
Definition: strings.h:83
char internationalprefix[10]
Definition: sig_pri.h:406
struct ast_party_subaddress subaddress
Subscriber subaddress.
Definition: channel.h:294
#define LOG_ERROR
Definition: logger.h:155
static struct @350 args
static unsigned int monitor
Definition: chan_phone.c:108
#define PRI_TRANS_CAP_DIGITAL
Definition: isdn_lib.h:818
enum ast_channel_state _state
Definition: channel.h:839
const ast_string_field name
Definition: channel.h:787
void ast_log(int level, const char *file, int line, const char *function, const char *fmt,...)
Used for sending a log message This is the standard logger function. Probably the only way you will i...
Definition: logger.c:1207
#define ast_free(a)
Definition: astmm.h:97
unsigned int hidecalleridname
Definition: sig_pri.h:225
unsigned int append_msn_to_user_tag
Definition: sig_pri.h:399
#define AST_CHANNEL_NAME
Definition: channel.h:137
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
static char * dialplan2str(int dialplan)
Definition: sig_pri.c:1614
static void sig_pri_redirecting_update(struct sig_pri_chan *pvt, struct ast_channel *ast)
Definition: sig_pri.c:890
char deferred_digits[AST_MAX_EXTENSION]
Definition: sig_pri.h:256
Structure used to handle boolean flags.
Definition: utils.h:200
char * tag
User-set &quot;tag&quot;.
Definition: channel.h:304
static void sig_pri_set_dialing(struct sig_pri_chan *p, int is_dialing)
Definition: sig_pri.c:164
unsigned int hidecallerid
Definition: sig_pri.h:224
unsigned int is_call_waiting
TRUE if this is a call waiting call.
Definition: sig_pri.h:287
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Definition: strings.h:223
void ast_party_subaddress_init(struct ast_party_subaddress *init)
Initialize the given subaddress structure.
Definition: channel.c:2034
char user_tag[AST_MAX_EXTENSION]
User tag for party id&#39;s sent from this device driver.
Definition: sig_pri.h:245
int ast_setstate(struct ast_channel *chan, enum ast_channel_state)
Change the state of a channel.
Definition: channel.c:7119
unsigned int digital
Definition: sig_pri.h:282
char * ast_transfercapability2str(int transfercapability) attribute_const
Gives the string form of a given transfer capability.
Definition: channel.c:1041
int ast_channel_get_device_name(struct ast_channel *chan, char *device_name, size_t name_buffer_length)
Get a device name given its channel structure.
Definition: channel.c:9776
struct sig_pri_span * pri
Definition: sig_pri.h:296
static const char * sig_pri_cc_type_name
Definition: sig_pri.c:99
#define AST_APP_ARG(name)
Define an application argument.
Definition: app.h:555
void * private_data
Data that is private to a monitor technology.
Definition: ccss.h:544
unsigned char valid
TRUE if the name information is valid/present.
Definition: channel.h:229
Information needed to specify a subaddress in a call.
Definition: channel.h:257
#define AST_NONSTANDARD_APP_ARGS(args, parse, sep)
Performs the &#39;nonstandard&#39; argument separation process for an application.
Definition: app.h:619
struct ast_cc_monitor * ast_cc_get_monitor_by_recall_core_id(const int core_id, const char *const device_name)
Get the associated monitor given the device name and core_id.
Definition: ccss.c:3253
unsigned int no_dialed_digits
Definition: sig_pri.h:291
unsigned char valid
TRUE if the number information is valid/present.
Definition: channel.h:247
struct pri * pri
Definition: sig_pri.h:481
int channel
Definition: sig_pri.h:234
struct ast_party_number number
Subscriber phone number.
Definition: channel.h:292
static struct ast_app_option sig_pri_call_opts[128]
Definition: sig_pri.c:6638
int sig_pri_cc_agent_callee_available ( struct ast_cc_agent agent)

Alert the caller that it is time to try recalling.

Since
1.8
Parameters
agentCC core agent control.

The core will call this function when it receives notice that a monitored party has become available.

The agent's job is to send a message to the caller to notify it of such a change. If the agent is able to discern that the caller is currently unavailable, then the agent should react by calling the ast_cc_caller_unavailable function.

Return values
0on success.
-1on error.

Definition at line 8430 of file sig_pri.c.

References ast_mutex_lock, ast_mutex_unlock, sig_pri_cc_agent_prv::cc_id, sig_pri_span::lock, sig_pri_cc_agent_prv::pri, sig_pri_span::pri, and ast_cc_agent::private_data.

8431 {
8432  struct sig_pri_cc_agent_prv *cc_pvt;
8433 
8434  cc_pvt = agent->private_data;
8435  ast_mutex_lock(&cc_pvt->pri->lock);
8436  pri_cc_remote_user_free(cc_pvt->pri->pri, cc_pvt->cc_id);
8437  ast_mutex_unlock(&cc_pvt->pri->lock);
8438  return 0;
8439 }
void * private_data
Definition: ccss.h:854
#define ast_mutex_lock(a)
Definition: lock.h:155
ast_mutex_t lock
Definition: sig_pri.h:495
struct sig_pri_span * pri
Definition: sig_pri.c:80
struct pri * pri
Definition: sig_pri.h:481
#define ast_mutex_unlock(a)
Definition: lock.h:156
void sig_pri_cc_agent_destructor ( struct ast_cc_agent agent)

Destroy private data on the agent.

Since
1.8
Parameters
agentCC core agent control.

The core will call this function upon completion or failure of CC.

Note
The agent private_data pointer may be NULL if the agent constructor failed.
Returns
Nothing

Definition at line 8459 of file sig_pri.c.

References ast_free, ast_mutex_lock, ast_mutex_unlock, sig_pri_cc_agent_prv::cc_id, sig_pri_cc_agent_prv::cc_request_response_pending, sig_pri_span::lock, sig_pri_cc_agent_prv::pri, sig_pri_span::pri, and ast_cc_agent::private_data.

Referenced by dahdi_pri_cc_agent_destructor().

8460 {
8461  struct sig_pri_cc_agent_prv *cc_pvt;
8462  int res;
8463 
8464  cc_pvt = agent->private_data;
8465  if (!cc_pvt) {
8466  /* The agent constructor probably failed. */
8467  return;
8468  }
8469  ast_mutex_lock(&cc_pvt->pri->lock);
8470  res = -1;
8471  if (cc_pvt->cc_request_response_pending) {
8472  res = pri_cc_req_rsp(cc_pvt->pri->pri, cc_pvt->cc_id, 2/* short_term_denial */);
8473  }
8474  if (res) {
8475  pri_cc_cancel(cc_pvt->pri->pri, cc_pvt->cc_id);
8476  }
8477  ast_mutex_unlock(&cc_pvt->pri->lock);
8478  ast_free(cc_pvt);
8479 }
void * private_data
Definition: ccss.h:854
#define ast_mutex_lock(a)
Definition: lock.h:155
ast_mutex_t lock
Definition: sig_pri.h:495
struct sig_pri_span * pri
Definition: sig_pri.c:80
#define ast_free(a)
Definition: astmm.h:97
unsigned char cc_request_response_pending
Definition: sig_pri.c:84
struct pri * pri
Definition: sig_pri.h:481
#define ast_mutex_unlock(a)
Definition: lock.h:156
int sig_pri_cc_agent_init ( struct ast_cc_agent agent,
struct sig_pri_chan pvt_chan 
)

PRI CC agent initialization.

Since
1.8
Parameters
agentCC core agent control.
pvt_chanOriginal channel the agent will attempt to recall.

This callback is called when the CC core is initialized. Agents should allocate any private data necessary for the call and assign it to the private_data on the agent. Additionally, if any ast_cc_agent_flags are pertinent to the specific agent type, they should be set in this function as well.

Return values
0on success.
-1on error.

Definition at line 8142 of file sig_pri.c.

References ast_calloc, ast_free, ast_mutex_lock, ast_mutex_unlock, sig_pri_chan::call, sig_pri_cc_agent_prv::cc_id, sig_pri_span::lock, sig_pri_cc_agent_prv::pri, sig_pri_chan::pri, sig_pri_span::pri, and ast_cc_agent::private_data.

Referenced by dahdi_pri_cc_agent_init().

8143 {
8144  struct sig_pri_cc_agent_prv *cc_pvt;
8145 
8146  cc_pvt = ast_calloc(1, sizeof(*cc_pvt));
8147  if (!cc_pvt) {
8148  return -1;
8149  }
8150 
8151  ast_mutex_lock(&pvt_chan->pri->lock);
8152  cc_pvt->pri = pvt_chan->pri;
8153  cc_pvt->cc_id = pri_cc_available(pvt_chan->pri->pri, pvt_chan->call);
8154  ast_mutex_unlock(&pvt_chan->pri->lock);
8155  if (cc_pvt->cc_id == -1) {
8156  ast_free(cc_pvt);
8157  return -1;
8158  }
8159  agent->private_data = cc_pvt;
8160  return 0;
8161 }
void * private_data
Definition: ccss.h:854
q931_call * call
Definition: sig_pri.h:297
#define ast_mutex_lock(a)
Definition: lock.h:155
ast_mutex_t lock
Definition: sig_pri.h:495
struct sig_pri_span * pri
Definition: sig_pri.c:80
#define ast_free(a)
Definition: astmm.h:97
#define ast_calloc(a, b)
Definition: astmm.h:82
struct sig_pri_span * pri
Definition: sig_pri.h:296
struct pri * pri
Definition: sig_pri.h:481
#define ast_mutex_unlock(a)
Definition: lock.h:156
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 because he is either busy or there is congestion on his line.

Since
1.8
Parameters
agentCC core agent control.

This is something that really only affects a scenario where a phone places a call over ISDN PTMP to Asterisk, who then connects over PTMP again to the ISDN network. For most agent types, there is no need to implement this callback at all because they don't really need to actually do anything in this situation. If you're having trouble understanding what the purpose of this callback is, then you can be safe simply not implementing it.

Return values
0on success.
-1on error.

Definition at line 8374 of file sig_pri.c.

References ast_mutex_lock, ast_mutex_unlock, sig_pri_cc_agent_prv::cc_id, sig_pri_span::lock, sig_pri_cc_agent_prv::pri, sig_pri_span::pri, and ast_cc_agent::private_data.

8375 {
8376  struct sig_pri_cc_agent_prv *cc_pvt;
8377 
8378  cc_pvt = agent->private_data;
8379  ast_mutex_lock(&cc_pvt->pri->lock);
8380  pri_cc_b_free(cc_pvt->pri->pri, cc_pvt->cc_id);
8381  ast_mutex_unlock(&cc_pvt->pri->lock);
8382  return 0;
8383 }
void * private_data
Definition: ccss.h:854
#define ast_mutex_lock(a)
Definition: lock.h:155
ast_mutex_t lock
Definition: sig_pri.h:495
struct sig_pri_span * pri
Definition: sig_pri.c:80
struct pri * pri
Definition: sig_pri.h:481
#define ast_mutex_unlock(a)
Definition: lock.h:156
void sig_pri_cc_agent_req_rsp ( struct ast_cc_agent agent,
enum ast_cc_agent_response_reason  reason 
)

Response to a CC request.

Since
1.8
Parameters
agentCC core agent control.
reasonCC request response status.

When the core receives knowledge that a called party has accepted a CC request, it will call this callback. The core may also call this if there is some error when attempting to process the incoming CC request.

The duty of this is to issue a propper response to a CC request from the caller by acknowledging receipt of that request or rejecting it.

Returns
Nothing

Definition at line 8235 of file sig_pri.c.

References AST_CC_AGENT_RESPONSE_FAILURE_INVALID, AST_CC_AGENT_RESPONSE_FAILURE_TOO_MANY, AST_CC_AGENT_RESPONSE_SUCCESS, ast_cc_failed(), ast_mutex_lock, ast_mutex_unlock, sig_pri_cc_agent_prv::cc_id, sig_pri_cc_agent_prv::cc_request_response_pending, ast_cc_agent::core_id, sig_pri_span::lock, sig_pri_cc_agent_prv::pri, sig_pri_span::pri, ast_cc_agent::private_data, sig_pri_cc_type_name, and status.

8236 {
8237  struct sig_pri_cc_agent_prv *cc_pvt;
8238  int res;
8239  int status;
8240  const char *failed_msg;
8241  static const char *failed_to_send = "Failed to send the CC request response.";
8242  static const char *not_accepted = "The core declined the CC request.";
8243 
8244  cc_pvt = agent->private_data;
8245  ast_mutex_lock(&cc_pvt->pri->lock);
8246  if (cc_pvt->cc_request_response_pending) {
8247  cc_pvt->cc_request_response_pending = 0;
8248 
8249  /* Convert core response reason to ISDN response status. */
8250  status = 2;/* short_term_denial */
8251  switch (reason) {
8253  status = 0;/* success */
8254  break;
8256  status = 2;/* short_term_denial */
8257  break;
8259  status = 5;/* queue_full */
8260  break;
8261  }
8262 
8263  res = pri_cc_req_rsp(cc_pvt->pri->pri, cc_pvt->cc_id, status);
8264  if (!status) {
8265  /* CC core request was accepted. */
8266  if (res) {
8267  failed_msg = failed_to_send;
8268  } else {
8269  failed_msg = NULL;
8270  }
8271  } else {
8272  /* CC core request was declined. */
8273  if (res) {
8274  failed_msg = failed_to_send;
8275  } else {
8276  failed_msg = not_accepted;
8277  }
8278  }
8279  } else {
8280  failed_msg = NULL;
8281  }
8282  ast_mutex_unlock(&cc_pvt->pri->lock);
8283  if (failed_msg) {
8284  ast_cc_failed(agent->core_id, "%s agent: %s", sig_pri_cc_type_name, failed_msg);
8285  }
8286 }
int ast_cc_failed(int core_id, const char *const debug,...)
Indicate failure has occurred.
Definition: ccss.c:3613
void * private_data
Definition: ccss.h:854
#define ast_mutex_lock(a)
Definition: lock.h:155
ast_mutex_t lock
Definition: sig_pri.h:495
struct sig_pri_span * pri
Definition: sig_pri.c:80
unsigned int core_id
Definition: ccss.h:832
unsigned char cc_request_response_pending
Definition: sig_pri.c:84
static const char * sig_pri_cc_type_name
Definition: sig_pri.c:99
struct pri * pri
Definition: sig_pri.h:481
jack_status_t status
Definition: app_jack.c:143
#define ast_mutex_unlock(a)
Definition: lock.h:156
int sig_pri_cc_agent_start_monitoring ( struct ast_cc_agent agent)

Begin monitoring a busy device.

Since
1.8
Parameters
agentCC core agent control.

The core will call this callback if the callee becomes available but the caller has reported that he is busy. The agent should begin monitoring the caller's device. When the caller becomes available again, the agent should call ast_cc_agent_caller_available.

Return values
0on success.
-1on error.

Definition at line 8403 of file sig_pri.c.

8404 {
8405  /* libpri already knows when and how it needs to monitor Party A. */
8406  return 0;
8407 }
int sig_pri_cc_agent_start_offer_timer ( struct ast_cc_agent agent)

Start the offer timer.

Since
1.8
Parameters
agentCC core agent control.

This is called by the core when the caller hangs up after a call for which CC may be requested. The agent should begin the timer as configured.

The primary reason why this functionality is left to the specific agent implementations is due to the differing use of schedulers throughout the code. Some channel drivers may already have a scheduler context they wish to use, and amongst those, some may use the ast_sched API while others may use the ast_sched_thread API, which are incompatible.

Return values
0on success.
-1on error.

Definition at line 8186 of file sig_pri.c.

8187 {
8188  /* libpri maintains it's own offer timer in the form of T_RETENTION. */
8189  return 0;
8190 }
int sig_pri_cc_agent_status_req ( struct ast_cc_agent agent)

Request the status of the agent's device.

Since
1.8
Parameters
agentCC core agent control.

Asynchronous request for the status of any caller which may be a valid caller for the CC transaction. Status responses should be made using the ast_cc_status_response function.

Return values
0on success.
-1on error.

Definition at line 8305 of file sig_pri.c.

References ast_mutex_lock, ast_mutex_unlock, sig_pri_cc_agent_prv::cc_id, sig_pri_span::lock, sig_pri_cc_agent_prv::pri, sig_pri_span::pri, and ast_cc_agent::private_data.

8306 {
8307  struct sig_pri_cc_agent_prv *cc_pvt;
8308 
8309  cc_pvt = agent->private_data;
8310  ast_mutex_lock(&cc_pvt->pri->lock);
8311  pri_cc_status_req(cc_pvt->pri->pri, cc_pvt->cc_id);
8312  ast_mutex_unlock(&cc_pvt->pri->lock);
8313  return 0;
8314 }
void * private_data
Definition: ccss.h:854
#define ast_mutex_lock(a)
Definition: lock.h:155
ast_mutex_t lock
Definition: sig_pri.h:495
struct sig_pri_span * pri
Definition: sig_pri.c:80
struct pri * pri
Definition: sig_pri.h:481
#define ast_mutex_unlock(a)
Definition: lock.h:156
int sig_pri_cc_agent_stop_offer_timer ( struct ast_cc_agent agent)

Stop the offer timer.

Since
1.8
Parameters
agentCC core agent control.

This callback is called by the CC core when the caller has requested CC.

Return values
0on success.
-1on error.

Definition at line 8207 of file sig_pri.c.

8208 {
8209  /* libpri maintains it's own offer timer in the form of T_RETENTION. */
8210  return 0;
8211 }
int sig_pri_cc_agent_stop_ringing ( struct ast_cc_agent agent)

Request for an agent's phone to stop ringing.

Since
1.8
Parameters
agentCC core agent control.

The usefulness of this is quite limited. The only specific known case for this is if Asterisk requests CC over an ISDN PTMP link as the TE side. If other phones are in the same recall group as the Asterisk server, and one of those phones picks up the recall notice, then Asterisk will receive a "stop ringing" notification from the NT side of the PTMP link. This indication needs to be passed to the phone on the other side of the Asterisk server which originally placed the call so that it will stop ringing. Since the phone may be of any type, it is necessary to have a callback that the core can know about.

Return values
0on success.
-1on error.

Definition at line 8340 of file sig_pri.c.

References ast_mutex_lock, ast_mutex_unlock, sig_pri_cc_agent_prv::cc_id, sig_pri_span::lock, sig_pri_cc_agent_prv::pri, sig_pri_span::pri, and ast_cc_agent::private_data.

8341 {
8342  struct sig_pri_cc_agent_prv *cc_pvt;
8343 
8344  cc_pvt = agent->private_data;
8345  ast_mutex_lock(&cc_pvt->pri->lock);
8346  pri_cc_stop_alerting(cc_pvt->pri->pri, cc_pvt->cc_id);
8347  ast_mutex_unlock(&cc_pvt->pri->lock);
8348  return 0;
8349 }
void * private_data
Definition: ccss.h:854
#define ast_mutex_lock(a)
Definition: lock.h:155
ast_mutex_t lock
Definition: sig_pri.h:495
struct sig_pri_span * pri
Definition: sig_pri.c:80
struct pri * pri
Definition: sig_pri.h:481
#define ast_mutex_unlock(a)
Definition: lock.h:156
int sig_pri_cc_monitor_cancel_available_timer ( struct ast_cc_monitor monitor,
int *  sched_id 
)

Cancel the running available timer.

Since
1.8
Parameters
monitorCC core monitor control.
sched_idAvailable timer scheduler id to cancel. Will never be NULL for a device monitor.

In most cases, this function will likely consist of just a call to AST_SCHED_DEL. It might have been possible to do this within the core, but unfortunately the mixture of sched_thread and sched usage in Asterisk prevents such usage.

Return values
0on success
-1on failure.

Definition at line 8685 of file sig_pri.c.

8686 {
8687  /*
8688  * libpri maintains it's own available timer as one of:
8689  * T_CCBS2/T_CCBS5/T_CCBS6/QSIG_CCBS_T2
8690  * T_CCNR2/T_CCNR5/T_CCNR6/QSIG_CCNR_T2
8691  */
8692  return 0;
8693 }
void sig_pri_cc_monitor_destructor ( void *  monitor_pvt)

Destroy PRI private data on the monitor.

Since
1.8
Parameters
monitor_pvtCC device monitor private data pointer.

Implementers of this callback are responsible for destroying all heap-allocated data in the monitor's private_data pointer, including the private_data itself.

Definition at line 8708 of file sig_pri.c.

References ao2_ref, and ao2_unlink.

8709 {
8710  struct sig_pri_cc_monitor_instance *instance;
8711 
8712  instance = monitor_pvt;
8713  if (!instance) {
8714  return;
8715  }
8716  ao2_unlink(sig_pri_cc_monitors, instance);
8717  ao2_ref(instance, -1);
8718 }
#define ao2_ref(o, delta)
Definition: astobj2.h:472
static struct ao2_container * sig_pri_cc_monitors
Definition: sig_pri.c:101
#define ao2_unlink(arg1, arg2)
Definition: astobj2.h:817
int sig_pri_cc_monitor_req_cc ( struct ast_cc_monitor monitor,
int *  available_timer_id 
)

Request CCSS.

Since
1.8
Parameters
monitorCC core monitor control.
available_timer_idWhere to put the available timer scheduler id. Will never be NULL for a device monitor.

Perform whatever steps are necessary in order to request CC. In addition, the monitor implementation is responsible for starting the available timer in this callback. The scheduler ID for the callback must be stored in the parent_link's child_avail_id field.

Return values
0on success
-1on failure.

Definition at line 8541 of file sig_pri.c.

References AST_CC_CCBS, AST_CC_CCNR, ast_mutex_lock, ast_mutex_unlock, sig_pri_cc_monitor_instance::cc_id, sig_pri_span::lock, sig_pri_cc_monitor_instance::pri, sig_pri_span::pri, ast_cc_monitor::private_data, and ast_cc_monitor::service_offered.

8542 {
8543  struct sig_pri_cc_monitor_instance *instance;
8544  int cc_mode;
8545  int res;
8546 
8547  switch (monitor->service_offered) {
8548  case AST_CC_CCBS:
8549  cc_mode = 0;/* CCBS */
8550  break;
8551  case AST_CC_CCNR:
8552  cc_mode = 1;/* CCNR */
8553  break;
8554  default:
8555  /* CC service not supported by ISDN. */
8556  return -1;
8557  }
8558 
8559  instance = monitor->private_data;
8560 
8561  /* libpri handles it's own available timer. */
8562  ast_mutex_lock(&instance->pri->lock);
8563  res = pri_cc_req(instance->pri->pri, instance->cc_id, cc_mode);
8564  ast_mutex_unlock(&instance->pri->lock);
8565 
8566  return res;
8567 }
#define ast_mutex_lock(a)
Definition: lock.h:155
struct sig_pri_span * pri
Asterisk span D channel control structure.
Definition: sig_pri.c:89
ast_mutex_t lock
Definition: sig_pri.h:495
void * private_data
Data that is private to a monitor technology.
Definition: ccss.h:544
enum ast_cc_service_type service_offered
Definition: ccss.h:515
struct pri * pri
Definition: sig_pri.h:481
#define ast_mutex_unlock(a)
Definition: lock.h:156
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().

Since
1.8
Parameters
monitorCC core monitor control.
devstateCurrent status of a Party A device.

Alert a monitor as to the status of the agent for which the monitor had previously requested a status request.

Note
Zero or more responses may come as a result.
Return values
0on success
-1on failure.

Definition at line 8640 of file sig_pri.c.

References AST_DEVICE_BUSY, AST_DEVICE_INUSE, AST_DEVICE_NOT_INUSE, AST_DEVICE_UNKNOWN, ast_mutex_lock, ast_mutex_unlock, sig_pri_cc_monitor_instance::cc_id, sig_pri_span::lock, sig_pri_cc_monitor_instance::pri, sig_pri_span::pri, and ast_cc_monitor::private_data.

8641 {
8642  struct sig_pri_cc_monitor_instance *instance;
8643  int cc_status;
8644 
8645  switch (devstate) {
8646  case AST_DEVICE_UNKNOWN:
8647  case AST_DEVICE_NOT_INUSE:
8648  cc_status = 0;/* free */
8649  break;
8650  case AST_DEVICE_BUSY:
8651  case AST_DEVICE_INUSE:
8652  cc_status = 1;/* busy */
8653  break;
8654  default:
8655  /* Don't know how to interpret this device state into free/busy status. */
8656  return 0;
8657  }
8658  instance = monitor->private_data;
8659  ast_mutex_lock(&instance->pri->lock);
8660  pri_cc_status_req_rsp(instance->pri->pri, instance->cc_id, cc_status);
8661  ast_mutex_unlock(&instance->pri->lock);
8662 
8663  return 0;
8664 }
#define ast_mutex_lock(a)
Definition: lock.h:155
struct sig_pri_span * pri
Asterisk span D channel control structure.
Definition: sig_pri.c:89
ast_mutex_t lock
Definition: sig_pri.h:495
void * private_data
Data that is private to a monitor technology.
Definition: ccss.h:544
struct pri * pri
Definition: sig_pri.h:481
#define ast_mutex_unlock(a)
Definition: lock.h:156
int sig_pri_cc_monitor_suspend ( struct ast_cc_monitor monitor)

Suspend monitoring.

Since
1.8
Parameters
monitorCC core monitor control.

Implementers must perform the necessary steps to suspend monitoring.

Return values
0on success
-1on failure.

Definition at line 8584 of file sig_pri.c.

References ast_mutex_lock, ast_mutex_unlock, sig_pri_cc_monitor_instance::cc_id, sig_pri_span::lock, sig_pri_cc_monitor_instance::pri, sig_pri_span::pri, and ast_cc_monitor::private_data.

8585 {
8586  struct sig_pri_cc_monitor_instance *instance;
8587 
8588  instance = monitor->private_data;
8589  ast_mutex_lock(&instance->pri->lock);
8590  pri_cc_status(instance->pri->pri, instance->cc_id, 1/* busy */);
8591  ast_mutex_unlock(&instance->pri->lock);
8592 
8593  return 0;
8594 }
#define ast_mutex_lock(a)
Definition: lock.h:155
struct sig_pri_span * pri
Asterisk span D channel control structure.
Definition: sig_pri.c:89
ast_mutex_t lock
Definition: sig_pri.h:495
void * private_data
Data that is private to a monitor technology.
Definition: ccss.h:544
struct pri * pri
Definition: sig_pri.h:481
#define ast_mutex_unlock(a)
Definition: lock.h:156
int sig_pri_cc_monitor_unsuspend ( struct ast_cc_monitor monitor)

Unsuspend monitoring.

Since
1.8
Parameters
monitorCC core monitor control.

Perform the necessary steps to unsuspend monitoring.

Return values
0on success
-1on failure.

Definition at line 8610 of file sig_pri.c.

References ast_mutex_lock, ast_mutex_unlock, sig_pri_cc_monitor_instance::cc_id, sig_pri_span::lock, sig_pri_cc_monitor_instance::pri, sig_pri_span::pri, and ast_cc_monitor::private_data.

8611 {
8612  struct sig_pri_cc_monitor_instance *instance;
8613 
8614  instance = monitor->private_data;
8615  ast_mutex_lock(&instance->pri->lock);
8616  pri_cc_status(instance->pri->pri, instance->cc_id, 0/* free */);
8617  ast_mutex_unlock(&instance->pri->lock);
8618 
8619  return 0;
8620 }
#define ast_mutex_lock(a)
Definition: lock.h:155
struct sig_pri_span * pri
Asterisk span D channel control structure.
Definition: sig_pri.c:89
ast_mutex_t lock
Definition: sig_pri.h:495
void * private_data
Data that is private to a monitor technology.
Definition: ccss.h:544
struct pri * pri
Definition: sig_pri.h:481
#define ast_mutex_unlock(a)
Definition: lock.h:156
void sig_pri_chan_alarm_notify ( struct sig_pri_chan p,
int  noalarm 
)

Notify new alarm status.

Parameters
pChannel private pointer.
noalarmNon-zero if not in alarm mode.
Note
Assumes the sig_pri_lock_private(p) is already obtained.
Returns
Nothing

Definition at line 7894 of file sig_pri.c.

References ast_channel::_softhangup, AST_SOFTHANGUP_DEV, sig_pri_chan::call, sig_pri_chan::owner, sig_pri_chan::pri, sig_pri_span::pri, pri_grab(), pri_rel(), sig_pri_set_alarm(), and sig_pri_span_devstate_changed().

Referenced by dahdi_handle_event(), and handle_init_event().

7895 {
7896  pri_grab(p, p->pri);
7897  sig_pri_set_alarm(p, !noalarm);
7898  if (!noalarm) {
7899  if (pri_get_timer(p->pri->pri, PRI_TIMER_T309) < 0) {
7900  /* T309 is not enabled : destroy calls when alarm occurs */
7901  if (p->call) {
7902  pri_destroycall(p->pri->pri, p->call);
7903  p->call = NULL;
7904  }
7905  if (p->owner)
7907  }
7908  }
7910  pri_rel(p->pri);
7911 }
static int pri_grab(struct sig_pri_chan *p, struct sig_pri_span *pri)
Definition: sig_pri.c:342
q931_call * call
Definition: sig_pri.h:297
struct ast_channel * owner
Definition: sig_pri.h:294
void sig_pri_set_alarm(struct sig_pri_chan *p, int in_alarm)
Definition: sig_pri.c:187
static void sig_pri_span_devstate_changed(struct sig_pri_span *pri)
Definition: sig_pri.c:246
static void pri_rel(struct sig_pri_span *pri)
Definition: sig_pri.c:144
int _softhangup
Definition: channel.h:832
struct sig_pri_span * pri
Definition: sig_pri.h:296
struct pri * pri
Definition: sig_pri.h:481
void sig_pri_chan_delete ( struct sig_pri_chan doomed)

Delete the sig_pri private channel structure.

Since
1.8
Parameters
doomedsig_pri private channel structure to delete.
Returns
Nothing

Definition at line 7953 of file sig_pri.c.

References ast_free.

Referenced by destroy_dahdi_pvt().

7954 {
7955  ast_free(doomed);
7956 }
#define ast_free(a)
Definition: astmm.h:97
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 at line 7925 of file sig_pri.c.

References ast_calloc, sig_pri_chan::calls, sig_pri_chan::chan_pvt, sig_pri_chan::logicalspan, sig_pri_chan::mastertrunkgroup, sig_pri_chan::pri, and sig_pri_chan::prioffset.

Referenced by dahdi_new_pri_nobch_channel(), and mkintf().

7926 {
7927  struct sig_pri_chan *p;
7928 
7929  p = ast_calloc(1, sizeof(*p));
7930  if (!p)
7931  return p;
7932 
7933  p->logicalspan = logicalspan;
7934  p->prioffset = channo;
7935  p->mastertrunkgroup = trunkgroup;
7936 
7937  p->calls = callback;
7938  p->chan_pvt = pvt_data;
7939 
7940  p->pri = pri;
7941 
7942  return p;
7943 }
int logicalspan
Definition: sig_pri.h:304
struct sig_pri_callback * calls
Definition: sig_pri.h:311
void * chan_pvt
Definition: sig_pri.h:312
int mastertrunkgroup
Definition: sig_pri.h:305
#define ast_calloc(a, b)
Definition: astmm.h:82
struct sig_pri_span * pri
Definition: sig_pri.h:296
int prioffset
Definition: sig_pri.h:303
void sig_pri_cli_show_channels ( int  fd,
struct sig_pri_span pri 
)

Definition at line 7966 of file sig_pri.c.

References ast_channel_unlock, ast_cli(), ast_mutex_lock, ast_mutex_unlock, sig_pri_chan::call, sig_pri_chan::call_level, sig_pri_chan::channel, sig_pri_span::lock, ast_channel::name, sig_pri_chan::no_b_channel, sig_pri_span::numchans, sig_pri_chan::owner, sig_pri_span::pvts, sig_pri_call_level2str(), sig_pri_is_chan_available(), sig_pri_lock_owner(), sig_pri_lock_private(), SIG_PRI_SC_LINE, sig_pri_unlock_private(), and sig_pri_span::span.

Referenced by handle_pri_show_channels().

7967 {
7968  char line[256];
7969  int idx;
7970  struct sig_pri_chan *pvt;
7971 
7972  ast_mutex_lock(&pri->lock);
7973  for (idx = 0; idx < pri->numchans; ++idx) {
7974  if (!pri->pvts[idx]) {
7975  continue;
7976  }
7977  pvt = pri->pvts[idx];
7978  sig_pri_lock_private(pvt);
7979  sig_pri_lock_owner(pri, idx);
7980  if (pvt->no_b_channel && sig_pri_is_chan_available(pvt)) {
7981  /* Don't show held/call-waiting channels if they are not in use. */
7983  continue;
7984  }
7985 
7986  snprintf(line, sizeof(line), SIG_PRI_SC_LINE,
7987  pri->span,
7988  pvt->channel,
7989  pvt->no_b_channel ? "No" : "Yes",/* Has media */
7990  sig_pri_is_chan_available(pvt) ? "Yes" : "No",
7992  pvt->call ? "Yes" : "No",
7993  pvt->owner ? pvt->owner->name : "");
7994 
7995  if (pvt->owner) {
7996  ast_channel_unlock(pvt->owner);
7997  }
7999 
8000  ast_mutex_unlock(&pri->lock);
8001  ast_cli(fd, "%s\n", line);
8002  ast_mutex_lock(&pri->lock);
8003  }
8004  ast_mutex_unlock(&pri->lock);
8005 }
#define SIG_PRI_SC_LINE
Definition: sig_pri.c:7959
q931_call * call
Definition: sig_pri.h:297
struct ast_channel * owner
Definition: sig_pri.h:294
unsigned int no_b_channel
TRUE if this interface has no B channel. (call hold and call waiting)
Definition: sig_pri.h:284
#define ast_mutex_lock(a)
Definition: lock.h:155
void ast_cli(int fd, const char *fmt,...)
Definition: cli.c:105
ast_mutex_t lock
Definition: sig_pri.h:495
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
static const char * sig_pri_call_level2str(enum sig_pri_call_level level)
Definition: sig_pri.c:123
const ast_string_field name
Definition: channel.h:787
struct sig_pri_chan * pvts[SIG_PRI_MAX_CHANNELS]
Definition: sig_pri.h:493
#define ast_channel_unlock(chan)
Definition: channel.h:2467
static void sig_pri_unlock_private(struct sig_pri_chan *p)
Definition: sig_pri.c:330
int numchans
Definition: sig_pri.h:492
static void sig_pri_lock_owner(struct sig_pri_span *pri, int chanpos)
Definition: sig_pri.c:1183
static void sig_pri_lock_private(struct sig_pri_chan *p)
Definition: sig_pri.c:336
int channel
Definition: sig_pri.h:234
#define ast_mutex_unlock(a)
Definition: lock.h:156
void sig_pri_cli_show_channels_header ( int  fd)

Definition at line 7960 of file sig_pri.c.

References ast_cli(), and SIG_PRI_SC_HEADER.

Referenced by handle_pri_show_channels().

7961 {
7962  ast_cli(fd, SIG_PRI_SC_HEADER, "PRI", "", "B", "Chan", "Call", "PRI", "Channel");
7963  ast_cli(fd, SIG_PRI_SC_HEADER, "Span", "Chan", "Chan", "Idle", "Level", "Call", "Name");
7964 }
#define SIG_PRI_SC_HEADER
Definition: sig_pri.c:7958
void ast_cli(int fd, const char *fmt,...)
Definition: cli.c:105
void sig_pri_cli_show_span ( int  fd,
int *  dchannels,
struct sig_pri_span pri 
)

Definition at line 8038 of file sig_pri.c.

References ast_cli(), ast_mutex_lock, ast_mutex_unlock, ast_std_free(), build_status(), DAHDI_OVERLAPDIAL_INCOMING, sig_pri_span::dchanavail, sig_pri_span::dchans, sig_pri_span::lock, sig_pri_span::overlapdial, sig_pri_span::pri, pri_order(), SIG_PRI_NUM_DCHANS, and status.

Referenced by handle_pri_show_span().

8039 {
8040  int x;
8041  char status[256];
8042 
8043  for (x = 0; x < SIG_PRI_NUM_DCHANS; x++) {
8044  if (pri->dchans[x]) {
8045 #ifdef PRI_DUMP_INFO_STR
8046  char *info_str = NULL;
8047 #endif
8048  ast_cli(fd, "%s D-channel: %d\n", pri_order(x), dchannels[x]);
8049  build_status(status, sizeof(status), pri->dchanavail[x], pri->dchans[x] == pri->pri);
8050  ast_cli(fd, "Status: %s\n", status);
8051  ast_mutex_lock(&pri->lock);
8052 #ifdef PRI_DUMP_INFO_STR
8053  info_str = pri_dump_info_str(pri->pri);
8054  if (info_str) {
8055  ast_cli(fd, "%s", info_str);
8056  ast_std_free(info_str);
8057  }
8058 #else
8059  pri_dump_info(pri->pri);
8060 #endif
8061  ast_mutex_unlock(&pri->lock);
8062  ast_cli(fd, "Overlap Recv: %s\n\n", (pri->overlapdial & DAHDI_OVERLAPDIAL_INCOMING)?"Yes":"No");
8063  ast_cli(fd, "\n");
8064  }
8065  }
8066 }
void ast_std_free(void *ptr)
#define DAHDI_OVERLAPDIAL_INCOMING
Definition: sig_pri.h:197
static const char * pri_order(int level)
Definition: sig_pri.c:1037
#define ast_mutex_lock(a)
Definition: lock.h:155
int dchanavail[SIG_PRI_NUM_DCHANS]
Definition: sig_pri.h:469
void ast_cli(int fd, const char *fmt,...)
Definition: cli.c:105
ast_mutex_t lock
Definition: sig_pri.h:495
int overlapdial
Definition: sig_pri.h:358
#define SIG_PRI_NUM_DCHANS
Definition: sig_pri.h:183
static void build_status(char *s, size_t len, int status, int active)
Definition: sig_pri.c:8007
struct pri * dchans[SIG_PRI_NUM_DCHANS]
Definition: sig_pri.h:480
struct pri * pri
Definition: sig_pri.h:481
jack_status_t status
Definition: app_jack.c:143
#define ast_mutex_unlock(a)
Definition: lock.h:156
void sig_pri_cli_show_spans ( int  fd,
int  span,
struct sig_pri_span pri 
)

Definition at line 8026 of file sig_pri.c.

References ast_cli(), build_status(), sig_pri_span::dchanavail, sig_pri_span::dchans, sig_pri_span::pri, SIG_PRI_NUM_DCHANS, and status.

Referenced by handle_pri_show_spans().

8027 {
8028  char status[256];
8029  int x;
8030  for (x = 0; x < SIG_PRI_NUM_DCHANS; x++) {
8031  if (pri->dchans[x]) {
8032  build_status(status, sizeof(status), pri->dchanavail[x], pri->dchans[x] == pri->pri);
8033  ast_cli(fd, "PRI span %d/%d: %s\n", span, x, status);
8034  }
8035  }
8036 }
int dchanavail[SIG_PRI_NUM_DCHANS]
Definition: sig_pri.h:469
void ast_cli(int fd, const char *fmt,...)
Definition: cli.c:105
#define SIG_PRI_NUM_DCHANS
Definition: sig_pri.h:183
static void build_status(char *s, size_t len, int status, int active)
Definition: sig_pri.c:8007
struct pri * dchans[SIG_PRI_NUM_DCHANS]
Definition: sig_pri.h:480
struct pri * pri
Definition: sig_pri.h:481
jack_status_t status
Definition: app_jack.c:143
void sig_pri_dial_complete ( struct sig_pri_chan pvt,
struct ast_channel ast 
)

DTMF dial string complete.

Since
1.8.11
Parameters
pvtsig_pri private channel structure.
astAsterisk channel
Note
Channel and private lock are already held.
Returns
Nothing

Definition at line 7506 of file sig_pri.c.

References AST_CONTROL_ANSWER, AST_FRAME_CONTROL, ast_queue_frame(), sig_pri_chan::call_level, sig_pri_chan::calls, sig_pri_chan::chan_pvt, ast_frame_subclass::integer, sig_pri_callback::queue_control, SIG_PRI_CALL_LEVEL_CONNECT, SIG_PRI_CALL_LEVEL_DEFER_DIAL, sig_pri_open_media(), sig_pri_set_dialing(), sig_pri_set_echocanceller(), and ast_frame::subclass.

Referenced by dahdi_handle_event().

7507 {
7508  /* If we just completed 'w' deferred dialing digits, we need to answer now. */
7511 
7512  sig_pri_open_media(pvt);
7513  {
7514  struct ast_frame f = {AST_FRAME_CONTROL, };
7515 
7516  if (pvt->calls->queue_control) {
7518  }
7519 
7521  ast_queue_frame(ast, &f);
7522  }
7523  sig_pri_set_dialing(pvt, 0);
7524  /* Enable echo cancellation if it's not on already */
7525  sig_pri_set_echocanceller(pvt, 1);
7526  }
7527 }
union ast_frame_subclass subclass
Definition: frame.h:146
struct sig_pri_callback * calls
Definition: sig_pri.h:311
void * chan_pvt
Definition: sig_pri.h:312
static void sig_pri_open_media(struct sig_pri_chan *p)
Definition: sig_pri.c:984
enum sig_pri_call_level call_level
Definition: sig_pri.h:300
void(*const queue_control)(void *pvt, int subclass)
Definition: sig_pri.h:157
int ast_queue_frame(struct ast_channel *chan, struct ast_frame *f)
Queue one or more frames to a channel&#39;s frame queue.
Definition: channel.c:1558
static struct ast_format f[]
Definition: format_g726.c:181
static void sig_pri_set_dialing(struct sig_pri_chan *p, int is_dialing)
Definition: sig_pri.c:164
Data structure associated with a single frame of data.
Definition: frame.h:142
static int sig_pri_set_echocanceller(struct sig_pri_chan *p, int enable)
Definition: sig_pri.c:921
int sig_pri_digit_begin ( struct sig_pri_chan pvt,
struct ast_channel ast,
char  digit 
)

Definition at line 7460 of file sig_pri.c.

References ast_channel::_state, ast_debug, ast_log(), AST_STATE_DIALING, sig_pri_chan::call, sig_pri_chan::call_level, sig_pri_chan::dialdest, len(), LOG_WARNING, sig_pri_chan::pri, sig_pri_span::pri, pri_grab(), pri_rel(), sig_pri_call_level2str(), SIG_PRI_CALL_LEVEL_CONNECT, SIG_PRI_CALL_LEVEL_OVERLAP, SIG_PRI_CALL_LEVEL_PROCEEDING, and sig_pri_span::span.

Referenced by dahdi_digit_begin().

7461 {
7462  if (ast->_state == AST_STATE_DIALING) {
7464  unsigned int len;
7465 
7466  len = strlen(pvt->dialdest);
7467  if (len < sizeof(pvt->dialdest) - 1) {
7468  ast_debug(1, "Queueing digit '%c' since setup_ack not yet received\n",
7469  digit);
7470  pvt->dialdest[len++] = digit;
7471  pvt->dialdest[len] = '\0';
7472  } else {
7474  "Span %d: Deferred digit buffer overflow for digit '%c'.\n",
7475  pvt->pri->span, digit);
7476  }
7477  return 0;
7478  }
7480  pri_grab(pvt, pvt->pri);
7481  pri_information(pvt->pri->pri, pvt->call, digit);
7482  pri_rel(pvt->pri);
7483  return 0;
7484  }
7487  "Span %d: Digit '%c' may be ignored by peer. (Call level:%u(%s))\n",
7488  pvt->pri->span, digit, pvt->call_level,
7490  }
7491  }
7492  return 1;
7493 }
static int pri_grab(struct sig_pri_chan *p, struct sig_pri_span *pri)
Definition: sig_pri.c:342
#define LOG_WARNING
Definition: logger.h:144
q931_call * call
Definition: sig_pri.h:297
static void pri_rel(struct sig_pri_span *pri)
Definition: sig_pri.c:144
#define ast_debug(level,...)
Log a DEBUG message.
Definition: logger.h:236
char dialdest[256]
Definition: sig_pri.h:250
enum sig_pri_call_level call_level
Definition: sig_pri.h:300
static const char * sig_pri_call_level2str(enum sig_pri_call_level level)
Definition: sig_pri.c:123
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
enum ast_channel_state _state
Definition: channel.h:839
void ast_log(int level, const char *file, int line, const char *function, const char *fmt,...)
Used for sending a log message This is the standard logger function. Probably the only way you will i...
Definition: logger.c:1207
struct sig_pri_span * pri
Definition: sig_pri.h:296
struct pri * pri
Definition: sig_pri.h:481
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.

Since
1.8
Parameters
psig_pri channel structure.
rdestDial string buffer to extract called number and subaddress.
calledBuffer to fill with extracted <number>[:<subaddress>]
called_buff_sizeSize of buffer to fill.
Note
Parsing must remain in sync with sig_pri_call().
Returns
Nothing

Definition at line 6555 of file sig_pri.c.

References args, AST_APP_ARG, AST_DECLARE_APP_ARGS, AST_NONSTANDARD_APP_ARGS, ast_strdupa, ast_strlen_zero(), ext, and sig_pri_chan::stripmsd.

Referenced by dahdi_request().

6556 {
6557  char *dial;
6558  char *number;
6559  char *subaddr;
6561  AST_APP_ARG(group); /* channel/group token */
6562  AST_APP_ARG(ext); /* extension token */
6563  //AST_APP_ARG(opts); /* options token */
6564  AST_APP_ARG(other); /* Any remining unused arguments */
6565  );
6566 
6567  /* Get private copy of dial string and break it up. */
6568  dial = ast_strdupa(rdest);
6569  AST_NONSTANDARD_APP_ARGS(args, dial, '/');
6570 
6571  number = args.ext;
6572  if (!number) {
6573  number = "";
6574  }
6575 
6576  /* Find and extract dialed_subaddress */
6577  subaddr = strchr(number, ':');
6578  if (subaddr) {
6579  *subaddr++ = '\0';
6580 
6581  /* Skip subaddress type prefix. */
6582  switch (*subaddr) {
6583  case 'U':
6584  case 'u':
6585  case 'N':
6586  case 'n':
6587  ++subaddr;
6588  break;
6589  default:
6590  break;
6591  }
6592  }
6593 
6594  /* Skip type-of-number/dial-plan prefix characters. */
6595  if (strlen(number) < p->stripmsd) {
6596  number = "";
6597  } else {
6598  char *deferred;
6599 
6600  number += p->stripmsd;
6601  deferred = strchr(number, 'w');
6602  if (deferred) {
6603  /* Remove any 'w' deferred digits. */
6604  *deferred = '\0';
6605  }
6606  while (isalpha(*number)) {
6607  ++number;
6608  }
6609  }
6610 
6611  /* Fill buffer with extracted number and subaddress. */
6612  if (ast_strlen_zero(subaddr)) {
6613  /* Put in called number only since there is no subaddress. */
6614  snprintf(called, called_buff_size, "%s", number);
6615  } else {
6616  /* Put in called number and subaddress. */
6617  snprintf(called, called_buff_size, "%s:%s", number, subaddr);
6618  }
6619 }
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application&#39;s arguments.
Definition: app.h:572
const char * ext
Definition: http.c:112
Number structure.
Definition: app_followme.c:109
int stripmsd
Definition: sig_pri.h:233
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Definition: strings.h:63
#define ast_strdupa(s)
duplicate a string in memory from the stack
Definition: utils.h:663
static struct @350 args
#define AST_APP_ARG(name)
Define an application argument.
Definition: app.h:555
#define AST_NONSTANDARD_APP_ARGS(args, parse, sep)
Performs the &#39;nonstandard&#39; argument separation process for an application.
Definition: app.h:619
void sig_pri_fixup ( struct ast_channel oldchan,
struct ast_channel newchan,
struct sig_pri_chan pchan 
)

Definition at line 8118 of file sig_pri.c.

References sig_pri_chan::owner.

Referenced by dahdi_fixup().

8119 {
8120  if (pchan->owner == oldchan) {
8121  pchan->owner = newchan;
8122  }
8123 }
struct ast_channel * owner
Definition: sig_pri.h:294
int sig_pri_hangup ( struct sig_pri_chan p,
struct ast_channel ast 
)

Definition at line 6464 of file sig_pri.c.

References sig_pri_chan::allocated, sig_pri_chan::alreadyhungup, sig_pri_chan::aoc_e, sig_pri_chan::aoc_s_request_invoke_id_valid, ast_atomic_fetchadd_int(), ast_debug, ast_log(), ast_strlen_zero(), sig_pri_chan::call, sig_pri_chan::call_level, sig_pri_chan::channel, sig_pri_chan::cid_name, sig_pri_chan::cid_num, sig_pri_chan::cid_subaddr, sig_pri_chan::exten, ast_channel::hangupcause, sig_pri_chan::holding_aoce, sig_pri_chan::is_call_waiting, LOG_WARNING, sig_pri_span::num_call_waiting_calls, sig_pri_chan::owner, pbx_builtin_getvar_helper(), sig_pri_chan::pri, sig_pri_span::pri, pri_grab(), pri_rel(), sig_pri_chan::progress, SIG_PRI_CALL_LEVEL_IDLE, sig_pri_set_dialing(), sig_pri_set_digital(), sig_pri_set_outgoing(), sig_pri_span_devstate_changed(), ast_channel::tech_pvt, sig_pri_chan::user_tag, and sig_pri_chan::waiting_for_aoce.

Referenced by dahdi_hangup().

6465 {
6466  ast_debug(1, "%s %d\n", __FUNCTION__, p->channel);
6467  if (!ast->tech_pvt) {
6468  ast_log(LOG_WARNING, "Asked to hangup channel not connected\n");
6469  return 0;
6470  }
6471 
6472  sig_pri_set_outgoing(p, 0);
6473  sig_pri_set_digital(p, 0); /* push up to parent for EC*/
6474 #if defined(HAVE_PRI_CALL_WAITING)
6475  if (p->is_call_waiting) {
6476  p->is_call_waiting = 0;
6478  }
6479 #endif /* defined(HAVE_PRI_CALL_WAITING) */
6481  p->progress = 0;
6482  p->cid_num[0] = '\0';
6483  p->cid_subaddr[0] = '\0';
6484  p->cid_name[0] = '\0';
6485  p->user_tag[0] = '\0';
6486  p->exten[0] = '\0';
6487  sig_pri_set_dialing(p, 0);
6488 
6489  /* Make sure we really have a call */
6490  pri_grab(p, p->pri);
6491  if (p->call) {
6492 #if defined(SUPPORT_USERUSER)
6493  const char *useruser = pbx_builtin_getvar_helper(ast, "USERUSERINFO");
6494 
6495  if (!ast_strlen_zero(useruser)) {
6496  pri_call_set_useruser(p->call, useruser);
6497  }
6498 #endif /* defined(SUPPORT_USERUSER) */
6499 
6500 #if defined(HAVE_PRI_AOC_EVENTS)
6501  if (p->holding_aoce) {
6502  pri_aoc_e_send(p->pri->pri, p->call, &p->aoc_e);
6503  }
6504 #endif /* defined(HAVE_PRI_AOC_EVENTS) */
6505 
6506  if (p->alreadyhungup) {
6507  ast_debug(1, "Already hungup... Calling hangup once, and clearing call\n");
6508 
6509  pri_hangup(p->pri->pri, p->call, -1);
6510  p->call = NULL;
6511  } else {
6512  const char *cause = pbx_builtin_getvar_helper(ast,"PRI_CAUSE");
6513  int icause = ast->hangupcause ? ast->hangupcause : -1;
6514 
6515  p->alreadyhungup = 1;
6516  if (!ast_strlen_zero(cause)) {
6517  if (atoi(cause)) {
6518  icause = atoi(cause);
6519  }
6520  }
6521  ast_debug(1,
6522  "Not yet hungup... Calling hangup with cause %d, and clearing call\n",
6523  icause);
6524 
6525  pri_hangup(p->pri->pri, p->call, icause);
6526  }
6527  }
6528 #if defined(HAVE_PRI_AOC_EVENTS)
6530  p->holding_aoce = 0;
6531  p->waiting_for_aoce = 0;
6532 #endif /* defined(HAVE_PRI_AOC_EVENTS) */
6533 
6534  p->allocated = 0;
6535  p->owner = NULL;
6536 
6538  pri_rel(p->pri);
6539  return 0;
6540 }
unsigned int alreadyhungup
Definition: sig_pri.h:266
static int pri_grab(struct sig_pri_chan *p, struct sig_pri_span *pri)
Definition: sig_pri.c:342
void * tech_pvt
Definition: channel.h:744
#define LOG_WARNING
Definition: logger.h:144
q931_call * call
Definition: sig_pri.h:297
static void sig_pri_set_outgoing(struct sig_pri_chan *p, int is_outgoing)
Definition: sig_pri.c:179
unsigned int progress
Definition: sig_pri.h:268
struct ast_channel * owner
Definition: sig_pri.h:294
unsigned int aoc_s_request_invoke_id_valid
Definition: sig_pri.h:261
static void sig_pri_span_devstate_changed(struct sig_pri_span *pri)
Definition: sig_pri.c:246
static void pri_rel(struct sig_pri_span *pri)
Definition: sig_pri.c:144
int ast_atomic_fetchadd_int(volatile int *p, int v)
Atomically add v to *p and return * the previous value of *p. This can be used to handle reference co...
Definition: lock.h:603
const char * pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name)
Return a pointer to the value of the corresponding channel variable.
Definition: pbx.c:10475
#define ast_debug(level,...)
Log a DEBUG message.
Definition: logger.h:236
static void sig_pri_set_digital(struct sig_pri_chan *p, int is_digital)
Definition: sig_pri.c:171
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Definition: strings.h:63
enum sig_pri_call_level call_level
Definition: sig_pri.h:300
struct pri_subcmd_aoc_e aoc_e
Definition: sig_pri.h:259
unsigned int holding_aoce
Definition: sig_pri.h:263
void ast_log(int level, const char *file, int line, const char *function, const char *fmt,...)
Used for sending a log message This is the standard logger function. Probably the only way you will i...
Definition: logger.c:1207
char exten[AST_MAX_EXTENSION]
Definition: sig_pri.h:246
char cid_subaddr[AST_MAX_EXTENSION]
Definition: sig_pri.h:241
char cid_num[AST_MAX_EXTENSION]
Definition: sig_pri.h:240
static void sig_pri_set_dialing(struct sig_pri_chan *p, int is_dialing)
Definition: sig_pri.c:164
unsigned int is_call_waiting
TRUE if this is a call waiting call.
Definition: sig_pri.h:287
int num_call_waiting_calls
Number of outstanding call waiting calls.
Definition: sig_pri.h:467
char user_tag[AST_MAX_EXTENSION]
User tag for party id&#39;s sent from this device driver.
Definition: sig_pri.h:245
int hangupcause
Definition: channel.h:849
struct sig_pri_span * pri
Definition: sig_pri.h:296
char cid_name[AST_MAX_EXTENSION]
Definition: sig_pri.h:242
unsigned int allocated
TRUE when this channel is allocated.
Definition: sig_pri.h:280
unsigned int waiting_for_aoce
Definition: sig_pri.h:262
struct pri * pri
Definition: sig_pri.h:481
int channel
Definition: sig_pri.h:234
int sig_pri_indicate ( struct sig_pri_chan p,
struct ast_channel chan,
int  condition,
const void *  data,
size_t  datalen 
)

Definition at line 7092 of file sig_pri.c.

References ast_channel::_softhangup, ast_channel::_state, sig_pri_span::aoc_passthrough_flag, AST_AOC_D, ast_aoc_decode(), ast_aoc_destroy_decoded(), AST_AOC_E, ast_aoc_get_msg_type(), ast_aoc_get_termination_request(), AST_AOC_REQUEST, AST_AOC_S, AST_CAUSE_INVALID_NUMBER_FORMAT, AST_CAUSE_NORMAL_CLEARING, AST_CAUSE_SWITCH_CONGESTION, AST_CAUSE_USER_BUSY, AST_CONTROL_AOC, AST_CONTROL_BUSY, AST_CONTROL_CONGESTION, AST_CONTROL_CONNECTED_LINE, AST_CONTROL_HOLD, AST_CONTROL_INCOMPLETE, AST_CONTROL_PROCEEDING, AST_CONTROL_PROGRESS, AST_CONTROL_REDIRECTING, AST_CONTROL_RINGING, AST_CONTROL_SRCUPDATE, AST_CONTROL_UNHOLD, ast_debug, ast_log(), ast_moh_start(), ast_moh_stop(), ast_setstate(), AST_SOFTHANGUP_DEV, ast_softhangup_nolock(), AST_STATE_RING, AST_STATE_RINGING, AST_STATE_UP, sig_pri_chan::call, sig_pri_chan::call_level, ast_channel::connected, DAHDI_OVERLAPDIAL_INCOMING, sig_pri_chan::digital, ast_channel::hangupcause, ast_party_connected_line::id, LOG_DEBUG, sig_pri_chan::mohinterpret, ast_channel::name, sig_pri_chan::no_b_channel, sig_pri_chan::outgoing, sig_pri_span::overlapdial, sig_pri_chan::pri, sig_pri_span::pri, pri_grab(), pri_rel(), sig_pri_chan::priindication_oob, sig_pri_chan::prioffset, sig_pri_chan::progress, PVT_TO_CHANNEL(), sig_pri_aoc_d_from_ast(), sig_pri_aoc_e_from_ast(), SIG_PRI_AOC_GRANT_D, SIG_PRI_AOC_GRANT_E, SIG_PRI_AOC_GRANT_S, sig_pri_aoc_s_from_ast(), SIG_PRI_CALL_LEVEL_ALERTING, SIG_PRI_CALL_LEVEL_CONNECT, SIG_PRI_CALL_LEVEL_PROCEEDING, sig_pri_party_id_from_ast(), sig_pri_play_tone(), sig_pri_redirecting_update(), sig_pri_set_digital(), SIG_PRI_TONE_BUSY, SIG_PRI_TONE_CONGESTION, SIG_PRI_TONE_RINGTONE, and sig_pri_chan::waiting_for_aoce.

Referenced by dahdi_indicate().

7093 {
7094  int res = -1;
7095 
7096  switch (condition) {
7097  case AST_CONTROL_BUSY:
7098  if (p->priindication_oob || p->no_b_channel) {
7101  res = 0;
7102  break;
7103  }
7107  p->progress = 1;/* No need to send plain PROGRESS after this. */
7108  if (p->pri && p->pri->pri) {
7109  pri_grab(p, p->pri);
7110 #ifdef HAVE_PRI_PROG_W_CAUSE
7111  pri_progress_with_cause(p->pri->pri, p->call, PVT_TO_CHANNEL(p), 1, chan->hangupcause);
7112 #else
7113  pri_progress(p->pri->pri,p->call, PVT_TO_CHANNEL(p), 1);
7114 #endif
7115  pri_rel(p->pri);
7116  }
7117  }
7118  break;
7119  case AST_CONTROL_RINGING:
7122  if (p->pri && p->pri->pri) {
7123  pri_grab(p, p->pri);
7124  pri_acknowledge(p->pri->pri,p->call, PVT_TO_CHANNEL(p),
7125  p->no_b_channel || p->digital ? 0 : 1);
7126  pri_rel(p->pri);
7127  }
7128  }
7130  if (chan->_state != AST_STATE_UP) {
7131  if (chan->_state != AST_STATE_RING)
7133  }
7134  break;
7136  ast_debug(1,"Received AST_CONTROL_PROCEEDING on %s\n",chan->name);
7139  if (p->pri && p->pri->pri) {
7140  pri_grab(p, p->pri);
7141  pri_proceeding(p->pri->pri,p->call, PVT_TO_CHANNEL(p), 0);
7142  pri_rel(p->pri);
7143  }
7144  }
7145  /* don't continue in ast_indicate */
7146  res = 0;
7147  break;
7148  case AST_CONTROL_PROGRESS:
7149  ast_debug(1,"Received AST_CONTROL_PROGRESS on %s\n",chan->name);
7150  sig_pri_set_digital(p, 0); /* Digital-only calls isn't allowing any inband progress messages */
7152  && !p->no_b_channel) {
7153  p->progress = 1;/* No need to send plain PROGRESS again. */
7154  if (p->pri && p->pri->pri) {
7155  pri_grab(p, p->pri);
7156 #ifdef HAVE_PRI_PROG_W_CAUSE
7157  pri_progress_with_cause(p->pri->pri,p->call, PVT_TO_CHANNEL(p), 1, -1); /* no cause at all */
7158 #else
7159  pri_progress(p->pri->pri,p->call, PVT_TO_CHANNEL(p), 1);
7160 #endif
7161  pri_rel(p->pri);
7162  }
7163  }
7164  /* don't continue in ast_indicate */
7165  res = 0;
7166  break;
7168  /* If we are connected or if we support overlap dialing, wait for additional digits */
7170  res = 0;
7171  break;
7172  }
7173  /* Otherwise, treat as congestion */
7175  /* Falls through */
7177  if (p->priindication_oob || p->no_b_channel) {
7178  /* There are many cause codes that generate an AST_CONTROL_CONGESTION. */
7179  switch (chan->hangupcause) {
7180  case AST_CAUSE_USER_BUSY:
7182  case 0:/* Cause has not been set. */
7183  /* Supply a more appropriate cause. */
7185  break;
7186  default:
7187  break;
7188  }
7190  res = 0;
7191  break;
7192  }
7195  /* There are many cause codes that generate an AST_CONTROL_CONGESTION. */
7196  switch (chan->hangupcause) {
7197  case AST_CAUSE_USER_BUSY:
7199  case 0:/* Cause has not been set. */
7200  /* Supply a more appropriate cause. */
7202  break;
7203  default:
7204  break;
7205  }
7206  p->progress = 1;/* No need to send plain PROGRESS after this. */
7207  if (p->pri && p->pri->pri) {
7208  pri_grab(p, p->pri);
7209 #ifdef HAVE_PRI_PROG_W_CAUSE
7210  pri_progress_with_cause(p->pri->pri, p->call, PVT_TO_CHANNEL(p), 1, chan->hangupcause);
7211 #else
7212  pri_progress(p->pri->pri,p->call, PVT_TO_CHANNEL(p), 1);
7213 #endif
7214  pri_rel(p->pri);
7215  }
7216  }
7217  break;
7218  case AST_CONTROL_HOLD:
7219  if (p->pri && !strcasecmp(p->mohinterpret, "passthrough")) {
7220  pri_grab(p, p->pri);
7221  res = pri_notify(p->pri->pri, p->call, p->prioffset, PRI_NOTIFY_REMOTE_HOLD);
7222  pri_rel(p->pri);
7223  } else
7224  ast_moh_start(chan, data, p->mohinterpret);
7225  break;
7226  case AST_CONTROL_UNHOLD:
7227  if (p->pri && !strcasecmp(p->mohinterpret, "passthrough")) {
7228  pri_grab(p, p->pri);
7229  res = pri_notify(p->pri->pri, p->call, p->prioffset, PRI_NOTIFY_REMOTE_RETRIEVAL);
7230  pri_rel(p->pri);
7231  } else
7232  ast_moh_stop(chan);
7233  break;
7234  case AST_CONTROL_SRCUPDATE:
7235  res = 0;
7236  break;
7237  case -1:
7238  res = sig_pri_play_tone(p, -1);
7239  break;
7241  ast_debug(1, "Received AST_CONTROL_CONNECTED_LINE on %s\n", chan->name);
7242  if (p->pri) {
7243  struct pri_party_connected_line connected;
7244 
7245  pri_grab(p, p->pri);
7246  memset(&connected, 0, sizeof(connected));
7248 
7249  pri_connected_line_update(p->pri->pri, p->call, &connected);
7250  pri_rel(p->pri);
7251  }
7252  break;
7254  ast_debug(1, "Received AST_CONTROL_REDIRECTING on %s\n", chan->name);
7255  if (p->pri) {
7256  pri_grab(p, p->pri);
7257  sig_pri_redirecting_update(p, chan);
7258  pri_rel(p->pri);
7259  }
7260  break;
7261  case AST_CONTROL_AOC:
7262 #if defined(HAVE_PRI_AOC_EVENTS)
7263  {
7264  struct ast_aoc_decoded *decoded
7265  = ast_aoc_decode((struct ast_aoc_encoded *) data, datalen, chan);
7266  ast_debug(1, "Received AST_CONTROL_AOC on %s\n", chan->name);
7267  if (decoded && p->pri) {
7268  pri_grab(p, p->pri);
7269  switch (ast_aoc_get_msg_type(decoded)) {
7270  case AST_AOC_S:
7272  sig_pri_aoc_s_from_ast(p, decoded);
7273  }
7274  break;
7275  case AST_AOC_D:
7277  sig_pri_aoc_d_from_ast(p, decoded);
7278  }
7279  break;
7280  case AST_AOC_E:
7282  sig_pri_aoc_e_from_ast(p, decoded);
7283  }
7284  /* if hangup was delayed for this AOC-E msg, waiting_for_aoc
7285  * will be set. A hangup is already occuring via a timeout during
7286  * this delay. Instead of waiting for that timeout to occur, go ahead
7287  * and initiate the softhangup since the delay is no longer necessary */
7288  if (p->waiting_for_aoce) {
7289  p->waiting_for_aoce = 0;
7291  "Received final AOC-E msg, continue with hangup on %s\n",
7292  chan->name);
7294  }
7295  break;
7296  case AST_AOC_REQUEST:
7297  /* We do not pass through AOC requests, So unless this
7298  * is an AOC termination request it will be ignored */
7299  if (ast_aoc_get_termination_request(decoded)) {
7300  pri_hangup(p->pri->pri, p->call, -1);
7301  }
7302  break;
7303  default:
7304  break;
7305  }
7306  pri_rel(p->pri);
7307  }
7308  ast_aoc_destroy_decoded(decoded);
7309  }
7310 #endif /* defined(HAVE_PRI_AOC_EVENTS) */
7311  break;
7312  }
7313 
7314  return res;
7315 }
#define DAHDI_OVERLAPDIAL_INCOMING
Definition: sig_pri.h:197
struct ast_party_connected_line connected
Channel Connected Line ID information.
Definition: channel.h:811
static int pri_grab(struct sig_pri_chan *p, struct sig_pri_span *pri)
Definition: sig_pri.c:342
struct ast_party_id id
Connected party ID.
Definition: channel.h:403
#define AST_CAUSE_SWITCH_CONGESTION
Definition: causes.h:122
unsigned int priindication_oob
Definition: sig_pri.h:228
static void sig_pri_aoc_s_from_ast(struct sig_pri_chan *pvt, struct ast_aoc_decoded *decoded)
Definition: sig_pri.c:3475
static int sig_pri_play_tone(struct sig_pri_chan *p, enum sig_pri_tone tone)
Definition: sig_pri.c:935
q931_call * call
Definition: sig_pri.h:297
unsigned int progress
Definition: sig_pri.h:268
void * ast_aoc_destroy_decoded(struct ast_aoc_decoded *decoded)
free an ast_aoc_decoded object
Definition: aoc.c:176
unsigned int no_b_channel
TRUE if this interface has no B channel. (call hold and call waiting)
Definition: sig_pri.h:284
#define SIG_PRI_AOC_GRANT_S
Definition: sig_pri.h:66
#define LOG_DEBUG
Definition: logger.h:122
#define AST_CAUSE_INVALID_NUMBER_FORMAT
Definition: causes.h:115
static void sig_pri_aoc_e_from_ast(struct sig_pri_chan *pvt, struct ast_aoc_decoded *decoded)
Definition: sig_pri.c:3657
void ast_moh_stop(struct ast_channel *chan)
Turn off music on hold on a given channel.
Definition: channel.c:8051
static void pri_rel(struct sig_pri_span *pri)
Definition: sig_pri.c:144
static unsigned int PVT_TO_CHANNEL(struct sig_pri_chan *p)
Definition: sig_pri.c:149
#define ast_debug(level,...)
Log a DEBUG message.
Definition: logger.h:236
struct ast_aoc_decoded * ast_aoc_decode(struct ast_aoc_encoded *encoded, size_t size, struct ast_channel *chan)
decodes an encoded aoc payload.
Definition: aoc.c:318
static void sig_pri_set_digital(struct sig_pri_chan *p, int is_digital)
Definition: sig_pri.c:171
enum sig_pri_call_level call_level
Definition: sig_pri.h:300
#define AST_CAUSE_NORMAL_CLEARING
Definition: causes.h:105
int overlapdial
Definition: sig_pri.h:358
static void sig_pri_party_id_from_ast(struct pri_party_id *pri_id, const struct ast_party_id *ast_id)
Definition: sig_pri.c:869
enum ast_channel_state _state
Definition: channel.h:839
const ast_string_field name
Definition: channel.h:787
int ast_moh_start(struct ast_channel *chan, const char *mclass, const char *interpclass)
Turn on music on hold on a given channel.
Definition: channel.c:8040
void ast_log(int level, const char *file, int line, const char *function, const char *fmt,...)
Used for sending a log message This is the standard logger function. Probably the only way you will i...
Definition: logger.c:1207
int ast_aoc_get_termination_request(struct ast_aoc_decoded *decoded)
get whether or not the AST_AOC_REQUEST message as a termination request.
Definition: aoc.c:948
int _softhangup
Definition: channel.h:832
int ast_softhangup_nolock(struct ast_channel *chan, int reason)
Softly hangup up a channel (no channel lock)
Definition: channel.c:2733
static void sig_pri_redirecting_update(struct sig_pri_chan *pvt, struct ast_channel *ast)
Definition: sig_pri.c:890
#define AST_CAUSE_USER_BUSY
Definition: causes.h:106
int ast_setstate(struct ast_channel *chan, enum ast_channel_state)
Change the state of a channel.
Definition: channel.c:7119
unsigned int digital
Definition: sig_pri.h:282
int hangupcause
Definition: channel.h:849
struct sig_pri_span * pri
Definition: sig_pri.h:296
Definition: aoc.h:64
Definition: aoc.h:66
static int connected
Definition: cdr_pgsql.c:57
enum ast_aoc_type ast_aoc_get_msg_type(struct ast_aoc_decoded *decoded)
get the message type, AOC-D, AOC-E, or AOC Request
Definition: aoc.c:761
int prioffset
Definition: sig_pri.h:303
#define SIG_PRI_AOC_GRANT_E
Definition: sig_pri.h:68
unsigned int outgoing
Definition: sig_pri.h:281
int aoc_passthrough_flag
Definition: sig_pri.h:370
static void sig_pri_aoc_d_from_ast(struct sig_pri_chan *pvt, struct ast_aoc_decoded *decoded)
Definition: sig_pri.c:3574
union ast_frame::@172 data
#define SIG_PRI_AOC_GRANT_D
Definition: sig_pri.h:67
unsigned int waiting_for_aoce
Definition: sig_pri.h:262
struct pri * pri
Definition: sig_pri.h:481
char mohinterpret[MAX_MUSICCLASS]
Definition: sig_pri.h:232
Definition: aoc.h:65
void sig_pri_init_pri ( struct sig_pri_span pri)

Definition at line 6451 of file sig_pri.c.

References ast_mutex_init, AST_PTHREADT_NULL, sig_pri_span::fds, sig_pri_span::lock, sig_pri_span::master, and SIG_PRI_NUM_DCHANS.

Referenced by dahdi_restart(), and load_module().

6452 {
6453  int i;
6454 
6455  memset(pri, 0, sizeof(*pri));
6456 
6457  ast_mutex_init(&pri->lock);
6458 
6459  pri->master = AST_PTHREADT_NULL;
6460  for (i = 0; i < SIG_PRI_NUM_DCHANS; i++)
6461  pri->fds[i] = -1;
6462 }
ast_mutex_t lock
Definition: sig_pri.h:495
#define AST_PTHREADT_NULL
Definition: lock.h:65
pthread_t master
Definition: sig_pri.h:494
#define SIG_PRI_NUM_DCHANS
Definition: sig_pri.h:183
#define ast_mutex_init(pmutex)
Definition: lock.h:152
int fds[SIG_PRI_NUM_DCHANS]
Definition: sig_pri.h:367
int sig_pri_is_alarm_ignored ( struct sig_pri_span pri)

Determine if layer 1 alarms are ignored.

Parameters
pChannel private pointer.
Returns
TRUE if the alarm is ignored.

Definition at line 7920 of file sig_pri.c.

References sig_pri_span::layer1_ignored.

Referenced by handle_alarms(), handle_clear_alarms(), my_handle_dchan_exception(), and sig_pri_set_alarm().

7921 {
7922  return pri->layer1_ignored;
7923 }
unsigned int layer1_ignored
Definition: sig_pri.h:394
int sig_pri_is_chan_available ( struct sig_pri_chan pvt)

Determine if a private channel structure is available.

Since
1.8
Parameters
pvtChannel to determine if available.
Returns
TRUE if the channel is available.

Definition at line 1160 of file sig_pri.c.

References sig_pri_chan::service_status, and sig_pri_is_chan_in_use().

Referenced by dahdi_pri_update_span_devstate(), pri_dchannel(), pri_find_empty_chan(), pri_find_empty_nobch(), pri_fixup_principle(), sig_pri_available_check(), sig_pri_cli_show_channels(), and sig_pri_handle_retrieve().

1161 {
1162  return !sig_pri_is_chan_in_use(pvt)
1163 #if defined(HAVE_PRI_SERVICE_MESSAGES)
1164  /* And not out-of-service */
1165  && !pvt->service_status
1166 #endif /* defined(HAVE_PRI_SERVICE_MESSAGES) */
1167  ;
1168 }
unsigned service_status
Active SRVST_DBKEY out-of-service status value.
Definition: sig_pri.h:308
static int sig_pri_is_chan_in_use(struct sig_pri_chan *pvt)
Definition: sig_pri.c:1146
int sig_pri_load ( const char *  cc_type_name)

Load the sig_pri submodule.

Since
1.8
Parameters
cc_type_nameCC type name to use when looking up agent/monitor.
Return values
0on success.
-1on error.

Definition at line 8730 of file sig_pri.c.

References ao2_container_alloc, sig_pri_cc_monitor_instance_cmp_fn(), sig_pri_cc_monitor_instance_hash_fn(), and sig_pri_cc_type_name.

Referenced by load_module().

8731 {
8732 #if defined(HAVE_PRI_CCSS)
8733  sig_pri_cc_type_name = cc_type_name;
8736  if (!sig_pri_cc_monitors) {
8737  return -1;
8738  }
8739 #endif /* defined(HAVE_PRI_CCSS) */
8740  return 0;
8741 }
static int sig_pri_cc_monitor_instance_hash_fn(const void *obj, const int flags)
Definition: sig_pri.c:8493
static struct ao2_container * sig_pri_cc_monitors
Definition: sig_pri.c:101
#define ao2_container_alloc(arg1, arg2, arg3)
Definition: astobj2.h:734
static const char * sig_pri_cc_type_name
Definition: sig_pri.c:99
static int sig_pri_cc_monitor_instance_cmp_fn(void *obj, void *arg, int flags)
Definition: sig_pri.c:8513
struct ast_channel* sig_pri_request ( struct sig_pri_chan p,
enum sig_pri_law  law,
const struct ast_channel requestor,
int  transfercapability 
)

Definition at line 1013 of file sig_pri.c.

References ast_log(), AST_STATE_RESERVED, sig_pri_chan::channel, sig_pri_chan::exten, LOG_DEBUG, sig_pri_new_ast_channel(), and sig_pri_set_outgoing().

Referenced by dahdi_request(), and pri_dchannel().

1014 {
1015  struct ast_channel *ast;
1016 
1017  ast_log(LOG_DEBUG, "%s %d\n", __FUNCTION__, p->channel);
1018 
1019  sig_pri_set_outgoing(p, 1);
1020  ast = sig_pri_new_ast_channel(p, AST_STATE_RESERVED, law, transfercapability, p->exten, requestor);
1021  if (!ast) {
1022  sig_pri_set_outgoing(p, 0);
1023  }
1024  return ast;
1025 }
Main Channel structure associated with a channel.
Definition: channel.h:742
static void sig_pri_set_outgoing(struct sig_pri_chan *p, int is_outgoing)
Definition: sig_pri.c:179
unsigned short transfercapability
Definition: channel.h:863
#define LOG_DEBUG
Definition: logger.h:122
void ast_log(int level, const char *file, int line, const char *function, const char *fmt,...)
Used for sending a log message This is the standard logger function. Probably the only way you will i...
Definition: logger.c:1207
char exten[AST_MAX_EXTENSION]
Definition: sig_pri.h:246
static struct ast_channel * sig_pri_new_ast_channel(struct sig_pri_chan *p, int state, enum sig_pri_law law, int transfercapability, char *exten, const struct ast_channel *requestor)
Definition: sig_pri.c:943
int channel
Definition: sig_pri.h:234
void sig_pri_set_alarm ( struct sig_pri_chan p,
int  in_alarm 
)

Definition at line 187 of file sig_pri.c.

References sig_pri_chan::calls, sig_pri_chan::chan_pvt, sig_pri_chan::inalarm, sig_pri_chan::pri, sig_pri_chan::resetting, sig_pri_callback::set_alarm, sig_pri_is_alarm_ignored(), and SIG_PRI_RESET_IDLE.

Referenced by mkintf(), pri_dchannel(), and sig_pri_chan_alarm_notify().

188 {
189  if (sig_pri_is_alarm_ignored(p->pri)) {
190  /* Always set not in alarm */
191  in_alarm = 0;
192  }
193 
194  /*
195  * Clear the channel restart state when the channel alarm
196  * changes to prevent the state from getting stuck when the link
197  * goes down.
198  */
200 
201  p->inalarm = in_alarm;
202  if (p->calls->set_alarm) {
203  p->calls->set_alarm(p->chan_pvt, in_alarm);
204  }
205 }
struct sig_pri_callback * calls
Definition: sig_pri.h:311
enum sig_pri_reset_state resetting
Channel reset/restart state.
Definition: sig_pri.h:302
The channel is not being RESTARTed.
Definition: sig_pri.h:106
unsigned int inalarm
Definition: sig_pri.h:265
void * chan_pvt
Definition: sig_pri.h:312
void(*const set_alarm)(void *pvt, int in_alarm)
Definition: sig_pri.h:150
int sig_pri_is_alarm_ignored(struct sig_pri_span *pri)
Determine if layer 1 alarms are ignored.
Definition: sig_pri.c:7920
struct sig_pri_span * pri
Definition: sig_pri.h:296
int sig_pri_start_pri ( struct sig_pri_span pri)

Definition at line 7703 of file sig_pri.c.

References ARRAY_LEN, AST_EVENT_IE_CONTEXT, AST_EVENT_IE_END, AST_EVENT_IE_MAILBOX, AST_EVENT_IE_PLTYPE_STR, AST_EVENT_MWI, ast_event_subscribe(), ast_event_unsubscribe(), ast_log(), ast_mutex_init, ast_pthread_create_background, ast_str_alloca, ast_str_buffer(), ast_str_set(), ast_strip(), ast_strlen_zero(), sig_pri_span::cc_ptmp_recall_mode, sig_pri_span::cc_qsig_signaling_link_req, sig_pri_span::cc_qsig_signaling_link_rsp, sig_pri_mbox::context, DAHDI_CHAN_MAPPING_LOGICAL, DAHDI_OVERLAPDIAL_OUTGOING, sig_pri_span::dchans, sig_pri_span::enable_service_message_support, errno, sig_pri_span::fds, sig_pri_span::inbanddisconnect, sig_pri_span::l2_persistence, sig_pri_span::lock, LOG_ERROR, sig_pri_span::master, sig_pri_span::mbox, sig_pri_span::mwi_mailboxes, sig_pri_span::nodetype, sig_pri_span::nsf, sig_pri_mbox::number, sig_pri_span::overlapdial, sig_pri_span::pri, pri_dchannel(), sig_pri_span::pritimers, sig_pri_span::qsigchannelmapping, sig_pri_span::resetpos, sig_pri_span::sig, SIG_BRI, SIG_BRI_PTMP, sig_pri_cc_type_name, SIG_PRI_DEBUG_DEFAULT, sig_pri_mwi_cache_update(), sig_pri_mwi_event_cb(), SIG_PRI_NUM_DCHANS, sig_pri_sort_pri_chans(), sig_pri_span::span, strsep(), sig_pri_mbox::sub, and sig_pri_span::switchtype.

Referenced by setup_dahdi_int().

7704 {
7705  int x;
7706  int i;
7707 #if defined(HAVE_PRI_MWI)
7708  char *saveptr;
7709  char *mbox_number;
7710  char *mbox_context;
7711  struct ast_str *mwi_description = ast_str_alloca(64);
7712 #endif /* defined(HAVE_PRI_MWI) */
7713 
7714 #if defined(HAVE_PRI_MWI)
7715  /* Prepare the mbox[] for use. */
7716  for (i = 0; i < ARRAY_LEN(pri->mbox); ++i) {
7717  if (pri->mbox[i].sub) {
7718  pri->mbox[i].sub = ast_event_unsubscribe(pri->mbox[i].sub);
7719  }
7720  }
7721 #endif /* defined(HAVE_PRI_MWI) */
7722 
7723  ast_mutex_init(&pri->lock);
7725 
7726 #if defined(HAVE_PRI_MWI)
7727  /*
7728  * Split the mwi_mailboxes configuration string into the mbox[]:
7729  * mailbox_number[@context]{,mailbox_number[@context]}
7730  */
7731  i = 0;
7732  saveptr = pri->mwi_mailboxes;
7733  while (i < ARRAY_LEN(pri->mbox)) {
7734  mbox_number = strsep(&saveptr, ",");
7735  if (!mbox_number) {
7736  break;
7737  }
7738  /* Split the mailbox_number and context */
7739  mbox_context = strchr(mbox_number, '@');
7740  if (mbox_context) {
7741  *mbox_context++ = '\0';
7742  mbox_context = ast_strip(mbox_context);
7743  }
7744  mbox_number = ast_strip(mbox_number);
7745  if (ast_strlen_zero(mbox_number)) {
7746  /* There is no mailbox number. Skip it. */
7747  continue;
7748  }
7749  if (ast_strlen_zero(mbox_context)) {
7750  /* There was no context so use the default. */
7751  mbox_context = "default";
7752  }
7753 
7754  /* Fill the mbox[] element. */
7755  ast_str_set(&mwi_description, -1, "%s span %d[%d] MWI mailbox %s@%s",
7756  sig_pri_cc_type_name, pri->span, i, mbox_number, mbox_context);
7758  ast_str_buffer(mwi_description), pri,
7762  if (!pri->mbox[i].sub) {
7763  ast_log(LOG_ERROR, "%s span %d could not subscribe to MWI events for %s@%s.",
7764  sig_pri_cc_type_name, pri->span, mbox_number, mbox_context);
7765  continue;
7766  }
7767  pri->mbox[i].number = mbox_number;
7768  pri->mbox[i].context = mbox_context;
7769  ++i;
7770  }
7771 #endif /* defined(HAVE_PRI_MWI) */
7772 
7773  for (i = 0; i < SIG_PRI_NUM_DCHANS; i++) {
7774  if (pri->fds[i] == -1) {
7775  break;
7776  }
7777 
7778  switch (pri->sig) {
7779  case SIG_BRI:
7780  pri->dchans[i] = pri_new_bri(pri->fds[i], 1, pri->nodetype, pri->switchtype);
7781  break;
7782  case SIG_BRI_PTMP:
7783  pri->dchans[i] = pri_new_bri(pri->fds[i], 0, pri->nodetype, pri->switchtype);
7784  break;
7785  default:
7786  pri->dchans[i] = pri_new(pri->fds[i], pri->nodetype, pri->switchtype);
7787 #if defined(HAVE_PRI_SERVICE_MESSAGES)
7788  if (pri->enable_service_message_support) {
7789  pri_set_service_message_support(pri->dchans[i], 1);
7790  }
7791 #endif /* defined(HAVE_PRI_SERVICE_MESSAGES) */
7792  break;
7793  }
7794 
7795  pri_set_overlapdial(pri->dchans[i], (pri->overlapdial & DAHDI_OVERLAPDIAL_OUTGOING) ? 1 : 0);
7796 #ifdef HAVE_PRI_PROG_W_CAUSE
7797  pri_set_chan_mapping_logical(pri->dchans[i], pri->qsigchannelmapping == DAHDI_CHAN_MAPPING_LOGICAL);
7798 #endif
7799 #ifdef HAVE_PRI_INBANDDISCONNECT
7800  pri_set_inbanddisconnect(pri->dchans[i], pri->inbanddisconnect);
7801 #endif
7802  /* Enslave to master if appropriate */
7803  if (i)
7804  pri_enslave(pri->dchans[0], pri->dchans[i]);
7805  if (!pri->dchans[i]) {
7806  if (pri->fds[i] > 0)
7807  close(pri->fds[i]);
7808  pri->fds[i] = -1;
7809  ast_log(LOG_ERROR, "Unable to create PRI structure\n");
7810  return -1;
7811  }
7812  pri_set_debug(pri->dchans[i], SIG_PRI_DEBUG_DEFAULT);
7813  pri_set_nsf(pri->dchans[i], pri->nsf);
7814 #ifdef PRI_GETSET_TIMERS
7815  for (x = 0; x < PRI_MAX_TIMERS; x++) {
7816  if (pri->pritimers[x] != 0)
7817  pri_set_timer(pri->dchans[i], x, pri->pritimers[x]);
7818  }
7819 #endif
7820  }
7821 
7822  /* Assume primary is the one we use */
7823  pri->pri = pri->dchans[0];
7824 
7825 #if defined(HAVE_PRI_CALL_HOLD)
7826  pri_hold_enable(pri->pri, 1);
7827 #endif /* defined(HAVE_PRI_CALL_HOLD) */
7828 #if defined(HAVE_PRI_CALL_REROUTING)
7829  pri_reroute_enable(pri->pri, 1);
7830 #endif /* defined(HAVE_PRI_CALL_REROUTING) */
7831 #if defined(HAVE_PRI_HANGUP_FIX)
7832  pri_hangup_fix_enable(pri->pri, 1);
7833 #endif /* defined(HAVE_PRI_HANGUP_FIX) */
7834 #if defined(HAVE_PRI_CCSS)
7835  pri_cc_enable(pri->pri, 1);
7836  pri_cc_recall_mode(pri->pri, pri->cc_ptmp_recall_mode);
7837  pri_cc_retain_signaling_req(pri->pri, pri->cc_qsig_signaling_link_req);
7838  pri_cc_retain_signaling_rsp(pri->pri, pri->cc_qsig_signaling_link_rsp);
7839 #endif /* defined(HAVE_PRI_CCSS) */
7840 #if defined(HAVE_PRI_TRANSFER)
7841  pri_transfer_enable(pri->pri, 1);
7842 #endif /* defined(HAVE_PRI_TRANSFER) */
7843 #if defined(HAVE_PRI_AOC_EVENTS)
7844  pri_aoc_events_enable(pri->pri, 1);
7845 #endif /* defined(HAVE_PRI_AOC_EVENTS) */
7846 #if defined(HAVE_PRI_CALL_WAITING)
7847  pri_connect_ack_enable(pri->pri, 1);
7848 #endif /* defined(HAVE_PRI_CALL_WAITING) */
7849 #if defined(HAVE_PRI_MCID)
7850  pri_mcid_enable(pri->pri, 1);
7851 #endif /* defined(HAVE_PRI_MCID) */
7852 #if defined(HAVE_PRI_L2_PERSISTENCE)
7853  pri_persistent_layer2_option(pri->pri, pri->l2_persistence);
7854 #endif /* defined(HAVE_PRI_L2_PERSISTENCE) */
7855 
7856  pri->resetpos = -1;
7857  if (ast_pthread_create_background(&pri->master, NULL, pri_dchannel, pri)) {
7858  for (i = 0; i < SIG_PRI_NUM_DCHANS; i++) {
7859  if (!pri->dchans[i])
7860  break;
7861  if (pri->fds[i] > 0)
7862  close(pri->fds[i]);
7863  pri->fds[i] = -1;
7864  }
7865  ast_log(LOG_ERROR, "Unable to spawn D-channel: %s\n", strerror(errno));
7866  return -1;
7867  }
7868 
7869 #if defined(HAVE_PRI_MWI)
7870  /*
7871  * Send the initial MWI indications from the event cache for this span.
7872  *
7873  * If we were loaded after app_voicemail the event would already be in
7874  * the cache. If we were loaded before app_voicemail the event would not
7875  * be in the cache yet and app_voicemail will send the event when it
7876  * gets loaded.
7877  */
7879 #endif /* defined(HAVE_PRI_MWI) */
7880 
7881  return 0;
7882 }
static void sig_pri_mwi_cache_update(struct sig_pri_span *pri)
Definition: sig_pri.c:7602
const char * context
Mailbox context.
Definition: sig_pri.h:350
int nodetype
Definition: sig_pri.h:434
int cc_qsig_signaling_link_req
Definition: sig_pri.h:440
#define ARRAY_LEN(a)
Definition: isdn_lib.c:42
char * strsep(char **str, const char *delims)
#define SIG_BRI_PTMP
Definition: chan_dahdi.c:366
static void sig_pri_sort_pri_chans(struct sig_pri_span *pri)
Definition: sig_pri.c:7698
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
Definition: strings.h:497
unsigned int enable_service_message_support
Definition: sig_pri.h:375
#define DAHDI_OVERLAPDIAL_OUTGOING
Definition: sig_pri.h:196
const char * number
Mailbox number.
Definition: sig_pri.h:348
#define ast_str_alloca(init_len)
Definition: strings.h:608
int switchtype
Definition: sig_pri.h:435
int qsigchannelmapping
Definition: sig_pri.h:359
static void sig_pri_mwi_event_cb(const struct ast_event *event, void *userdata)
Definition: sig_pri.c:7572
ast_mutex_t lock
Definition: sig_pri.h:495
#define ast_pthread_create_background(a, b, c, d)
Definition: utils.h:426
int cc_qsig_signaling_link_rsp
Definition: sig_pri.h:441
int ast_str_set(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Set a dynamic string using variable arguments.
Definition: strings.h:874
Context IE Used by AST_EVENT_MWI Payload type: str.
Definition: event_defs.h:121
struct sig_pri_mbox mbox[SIG_PRI_MAX_MWI_MAILBOXES]
Active MWI mailboxes.
Definition: sig_pri.h:414
static force_inline int attribute_pure ast_strlen_zero(const char *s)
Definition: strings.h:63
int cc_ptmp_recall_mode
Definition: sig_pri.h:439
char * ast_strip(char *s)
Strip leading/trailing whitespace from a string.
Definition: strings.h:155
int overlapdial
Definition: sig_pri.h:358
#define LOG_ERROR
Definition: logger.h:155
pthread_t master
Definition: sig_pri.h:494
The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field ...
Definition: strings.h:364
unsigned int inbanddisconnect
Definition: sig_pri.h:378
#define SIG_PRI_NUM_DCHANS
Definition: sig_pri.h:183
void ast_log(int level, const char *file, int line, const char *function, const char *fmt,...)
Used for sending a log message This is the standard logger function. Probably the only way you will i...
Definition: logger.c:1207
int errno
int resetpos
Definition: sig_pri.h:473
static void * pri_dchannel(void *vpri)
Definition: sig_pri.c:4596
char mwi_mailboxes[SIG_PRI_MAX_MWI_MAILBOX_STR]
Comma separated list of mailboxes to indicate MWI.
Definition: sig_pri.h:421
int l2_persistence
Definition: sig_pri.h:364
struct ast_event_sub * ast_event_subscribe(enum ast_event_type event_type, ast_event_cb_t cb, const char *description, void *userdata,...)
Subscribe to events.
Definition: event.c:909
#define SIG_BRI
Definition: chan_dahdi.c:365
int pritimers[PRI_MAX_TIMERS]
Definition: sig_pri.h:357
static const char * sig_pri_cc_type_name
Definition: sig_pri.c:99
#define DAHDI_CHAN_MAPPING_LOGICAL
Definition: sig_pri.h:192
#define ast_mutex_init(pmutex)
Definition: lock.h:152
struct pri * dchans[SIG_PRI_NUM_DCHANS]
Definition: sig_pri.h:480
#define SIG_PRI_DEBUG_DEFAULT
Definition: sig_pri.h:63
struct ast_event_sub * sub
MWI mailbox event subscription.
Definition: sig_pri.h:346
struct ast_event_sub * ast_event_unsubscribe(struct ast_event_sub *event_sub)
Un-subscribe from events.
Definition: event.c:987
struct pri * pri
Definition: sig_pri.h:481
int fds[SIG_PRI_NUM_DCHANS]
Definition: sig_pri.h:367
Mailbox name.
Definition: event_defs.h:83
void sig_pri_stop_pri ( struct sig_pri_span pri)

Stop PRI span.

Since
1.8
Parameters
priPRI span control structure.
Returns
Nothing

Definition at line 7638 of file sig_pri.c.

References ARRAY_LEN, ast_event_unsubscribe(), sig_pri_span::mbox, and sig_pri_mbox::sub.

Referenced by __unload_module().

7639 {
7640 #if defined(HAVE_PRI_MWI)
7641  int idx;
7642 #endif /* defined(HAVE_PRI_MWI) */
7643 
7644 #if defined(HAVE_PRI_MWI)
7645  for (idx = 0; idx < ARRAY_LEN(pri->mbox); ++idx) {
7646  if (pri->mbox[idx].sub) {
7647  pri->mbox[idx].sub = ast_event_unsubscribe(pri->mbox[idx].sub);
7648  }
7649  }
7650 #endif /* defined(HAVE_PRI_MWI) */
7651 }
#define ARRAY_LEN(a)
Definition: isdn_lib.c:42
struct sig_pri_mbox mbox[SIG_PRI_MAX_MWI_MAILBOXES]
Active MWI mailboxes.
Definition: sig_pri.h:414
struct ast_event_sub * sub
MWI mailbox event subscription.
Definition: sig_pri.h:346
struct ast_event_sub * ast_event_unsubscribe(struct ast_event_sub *event_sub)
Un-subscribe from events.
Definition: event.c:987
void sig_pri_unload ( void  )

Unload the sig_pri submodule.

Since
1.8
Returns
Nothing

Definition at line 8749 of file sig_pri.c.

References ao2_ref.

Referenced by __unload_module().

8750 {
8751 #if defined(HAVE_PRI_CCSS)
8752  if (sig_pri_cc_monitors) {
8754  sig_pri_cc_monitors = NULL;
8755  }
8756 #endif /* defined(HAVE_PRI_CCSS) */
8757 }
#define ao2_ref(o, delta)
Definition: astobj2.h:472
static struct ao2_container * sig_pri_cc_monitors
Definition: sig_pri.c:101

Variable Documentation

const char dahdi_db[] = "dahdi/registry"
static

The AstDB family.

Definition at line 219 of file sig_pri.h.

Referenced by destroy_all_channels(), handle_pri_service_generic(), mkintf(), and pri_dchannel().