55 #ifndef PRI_EVENT_FACILITY
56 #error "Upgrade your libpri"
60 #undef SUPPORT_USERUSER
75 #define FORCE_RESTART_UNAVAIL_CHANS 1
77 #if defined(HAVE_PRI_CCSS)
108 #define DCHAN_NOTINALARM (1 << 0)
109 #define DCHAN_UP (1 << 1)
112 #define PRI_CHANNEL(p) ((p) & 0xff)
113 #define PRI_SPAN(p) (((p) >> 8) & 0xff)
114 #define PRI_EXPLICIT (1 << 16)
115 #define PRI_CIS_CALL (1 << 17)
116 #define PRI_HELD_CALL (1 << 18)
119 #define DCHAN_AVAILABLE (DCHAN_NOTINALARM | DCHAN_UP)
152 ast_debug(5,
"prioffset: %d mastertrunkgroup: %d logicalspan: %d result: %d\n",
216 #if defined(HAVE_PRI_CCSS)
353 pthread_kill(pri->
master, SIGURG);
371 switch (pri_reason) {
372 case PRI_REDIR_FORWARD_ON_BUSY:
375 case PRI_REDIR_FORWARD_ON_NO_REPLY:
378 case PRI_REDIR_DEFLECTION:
381 case PRI_REDIR_UNCONDITIONAL:
384 case PRI_REDIR_UNKNOWN:
406 switch (ast_reason) {
408 pri_reason = PRI_REDIR_FORWARD_ON_BUSY;
411 pri_reason = PRI_REDIR_FORWARD_ON_NO_REPLY;
414 pri_reason = PRI_REDIR_UNCONDITIONAL;
417 pri_reason = PRI_REDIR_DEFLECTION;
421 pri_reason = PRI_REDIR_UNKNOWN;
439 int ast_presentation;
441 switch (pri_presentation) {
442 case PRI_PRES_ALLOWED | PRI_PRES_USER_NUMBER_UNSCREENED:
445 case PRI_PRES_ALLOWED | PRI_PRES_USER_NUMBER_PASSED_SCREEN:
448 case PRI_PRES_ALLOWED | PRI_PRES_USER_NUMBER_FAILED_SCREEN:
451 case PRI_PRES_ALLOWED | PRI_PRES_NETWORK_NUMBER:
455 case PRI_PRES_RESTRICTED | PRI_PRES_USER_NUMBER_UNSCREENED:
458 case PRI_PRES_RESTRICTED | PRI_PRES_USER_NUMBER_PASSED_SCREEN:
461 case PRI_PRES_RESTRICTED | PRI_PRES_USER_NUMBER_FAILED_SCREEN:
464 case PRI_PRES_RESTRICTED | PRI_PRES_NETWORK_NUMBER:
468 case PRI_PRES_UNAVAILABLE | PRI_PRES_USER_NUMBER_UNSCREENED:
469 case PRI_PRES_UNAVAILABLE | PRI_PRES_USER_NUMBER_PASSED_SCREEN:
470 case PRI_PRES_UNAVAILABLE | PRI_PRES_USER_NUMBER_FAILED_SCREEN:
471 case PRI_PRES_UNAVAILABLE | PRI_PRES_NETWORK_NUMBER:
480 return ast_presentation;
494 int pri_presentation;
496 switch (ast_presentation) {
498 pri_presentation = PRI_PRES_ALLOWED | PRI_PRES_USER_NUMBER_UNSCREENED;
501 pri_presentation = PRI_PRES_ALLOWED | PRI_PRES_USER_NUMBER_PASSED_SCREEN;
504 pri_presentation = PRI_PRES_ALLOWED | PRI_PRES_USER_NUMBER_FAILED_SCREEN;
507 pri_presentation = PRI_PRES_ALLOWED | PRI_PRES_NETWORK_NUMBER;
511 pri_presentation = PRI_PRES_RESTRICTED | PRI_PRES_USER_NUMBER_UNSCREENED;
514 pri_presentation = PRI_PRES_RESTRICTED | PRI_PRES_USER_NUMBER_PASSED_SCREEN;
517 pri_presentation = PRI_PRES_RESTRICTED | PRI_PRES_USER_NUMBER_FAILED_SCREEN;
520 pri_presentation = PRI_PRES_RESTRICTED | PRI_PRES_NETWORK_NUMBER;
527 pri_presentation = PRES_NUMBER_NOT_AVAILABLE;
531 pri_presentation = PRI_PRES_RESTRICTED | PRI_PRES_USER_NUMBER_UNSCREENED;
535 return pri_presentation;
551 switch (pri_char_set) {
553 case PRI_CHAR_SET_UNKNOWN:
556 case PRI_CHAR_SET_ISO8859_1:
559 case PRI_CHAR_SET_WITHDRAWN:
562 case PRI_CHAR_SET_ISO8859_2:
565 case PRI_CHAR_SET_ISO8859_3:
568 case PRI_CHAR_SET_ISO8859_4:
571 case PRI_CHAR_SET_ISO8859_5:
574 case PRI_CHAR_SET_ISO8859_7:
577 case PRI_CHAR_SET_ISO10646_BMPSTRING:
580 case PRI_CHAR_SET_ISO10646_UTF_8STRING:
601 switch (ast_char_set) {
604 pri_char_set = PRI_CHAR_SET_UNKNOWN;
607 pri_char_set = PRI_CHAR_SET_ISO8859_1;
610 pri_char_set = PRI_CHAR_SET_WITHDRAWN;
613 pri_char_set = PRI_CHAR_SET_ISO8859_2;
616 pri_char_set = PRI_CHAR_SET_ISO8859_3;
619 pri_char_set = PRI_CHAR_SET_ISO8859_4;
622 pri_char_set = PRI_CHAR_SET_ISO8859_5;
625 pri_char_set = PRI_CHAR_SET_ISO8859_7;
628 pri_char_set = PRI_CHAR_SET_ISO10646_BMPSTRING;
631 pri_char_set = PRI_CHAR_SET_ISO10646_UTF_8STRING;
638 #if defined(HAVE_PRI_SUBADDR)
653 if (pri_subaddress->length <= 0) {
658 if (!pri_subaddress->type) {
660 ast_subaddress->
str =
ast_strdup((
char *) pri_subaddress->data);
668 cnum =
ast_malloc(2 * pri_subaddress->length + 1);
675 len = pri_subaddress->length - 1;
676 for (x = 0; x <
len; ++x) {
677 ptr += sprintf(ptr,
"%02x", (
unsigned)pri_subaddress->data[x]);
680 if (pri_subaddress->odd_even_indicator) {
682 sprintf(ptr,
"%01x", (
unsigned)((pri_subaddress->data[len]) >> 4));
685 sprintf(ptr,
"%02x", (
unsigned)pri_subaddress->data[len]);
687 ast_subaddress->
str = cnum;
689 ast_subaddress->
type = pri_subaddress->type;
691 ast_subaddress->
valid = 1;
695 #if defined(HAVE_PRI_SUBADDR)
702 }
else if (c < (
'9' + 1)) {
704 }
else if (c <
'A') {
706 }
else if (c < (
'F' + 1)) {
708 }
else if (c <
'a') {
710 }
else if (c < (
'f' + 1)) {
719 #if defined(HAVE_PRI_SUBADDR)
738 int len = strlen(src);
740 if (len > (2 * maxlen)) {
744 res = len / 2 + len % 2;
760 #if defined(HAVE_PRI_SUBADDR)
776 pri_subaddress->type = ast_subaddress->
type;
777 if (!ast_subaddress->
type) {
780 sizeof(pri_subaddress->data));
781 pri_subaddress->length = strlen((
char *) pri_subaddress->data);
782 pri_subaddress->odd_even_indicator = 0;
783 pri_subaddress->valid = 1;
791 ast_subaddress->
str,
sizeof(pri_subaddress->data));
793 pri_subaddress->length = length;
795 length = strlen(ast_subaddress->
str);
796 if (length > 2 *
sizeof(pri_subaddress->data)) {
797 pri_subaddress->odd_even_indicator = 0;
799 pri_subaddress->odd_even_indicator = (length & 1);
801 pri_subaddress->valid = 1;
821 if (!ast_name->
valid) {
846 if (!ast_number->
valid) {
849 pri_number->valid = 1;
851 pri_number->plan = ast_number->
plan;
873 #if defined(HAVE_PRI_SUBADDR)
892 struct pri_party_redirecting pri_redirecting;
896 memset(&pri_redirecting, 0,
sizeof(pri_redirecting));
902 pri_redirecting_update(pvt->
pri->
pri, pvt->
call, &pri_redirecting);
1047 return "Quaternary";
1080 if (pri->
dchans[idx] == old) {
1097 if (old && oldslot != newslot) {
1099 "Span %d: No D-channels up! Switching selected D-channel from %s to %s.\n",
1108 if (old && oldslot != newslot) {
1110 "Switching selected D-channel from %s (fd %d) to %s (fd %d)!\n",
1163 #if defined(HAVE_PRI_SERVICE_MESSAGES)
1273 for (idx = 0; idx < pri->
numchans; ++idx) {
1301 pri_hangup(pri->
pri, call, cause);
1306 pri_hangup(pri->
pri, call, cause);
1349 for (x = 0; x < pri->
numchans; ++x) {
1371 for (x = 0; x < pri->
numchans; x++) {
1401 if (principle < 0 || pri->numchans <= principle) {
1409 if (pri->
pvts[principle] && pri->
pvts[principle]->
call == call) {
1415 for (x = 0; x < pri->
numchans; x++) {
1424 new_chan = pri->
pvts[principle];
1425 old_chan = pri->
pvts[x];
1432 ast_verb(3,
"Moving call (%s) from channel %d to %d.\n",
1437 "Can't move call (%s) from channel %d to %d. It is already in use.\n",
1441 if (old_chan->
owner) {
1452 old_chan->
owner = NULL;
1455 old_chan->
call = NULL;
1458 #if defined(HAVE_PRI_AOC_EVENTS)
1469 #if defined(HAVE_PRI_CALL_WAITING)
1472 #if defined(HAVE_PRI_SETUP_ACK_INBAND)
1476 #if defined(HAVE_PRI_AOC_EVENTS)
1487 #if defined(HAVE_PRI_CALL_WAITING)
1490 #if defined(HAVE_PRI_SETUP_ACK_INBAND)
1497 #if defined(HAVE_PRI_REVERSE_CHARGE)
1500 #if defined(HAVE_PRI_SETUP_KEYPAD)
1504 #if defined(HAVE_PRI_AOC_EVENTS)
1536 if (new_chan->
owner) {
1541 if (new_chan->
owner) {
1548 ast_verb(3,
"Call specified, but not found.\n");
1600 switch (redirectingreason) {
1608 return "UNCONDITIONAL";
1610 return "NOREDIRECT";
1616 if (dialplan == -1) {
1617 return(
"Dynamically set dialplan in ISDN");
1619 return (pri_plan2str(dialplan));
1637 case PRI_INTERNATIONAL_ISDN:
1640 case PRI_NATIONAL_ISDN:
1643 case PRI_LOCAL_ISDN:
1644 snprintf(buf, size,
"%s%s", pri->
localprefix, number);
1653 snprintf(buf, size,
"%s", number);
1694 #if defined(HAVE_PRI_SERVICE_MESSAGES)
1704 #if defined(HAVE_PRI_SERVICE_MESSAGES)
1708 "Span %d: channel %d out-of-service (reason: %s), not sending RESTART\n",
1727 #if defined(HAVE_PRI_CALL_WAITING)
1779 if (backwards && (x < 0))
1781 if (!backwards && (x >= pri->
numchans))
1786 ast_debug(1,
"Found empty available channel %d/%d\n",
1798 #if defined(HAVE_PRI_CALL_HOLD)
1815 for (idx = 0; idx < pri->
numchans; ++idx) {
1819 ast_debug(1,
"Found empty available no B channel interface\n");
1841 int timeout_ms = 30000;
1843 struct timeval start;
1845 ast_verb(3,
"Initiating idle call on channel %s\n", chan->
name);
1875 ast_verb(4,
"Idle channel '%s' busy, waiting...\n", chan->
name);
1878 ast_verb(4,
"Idle channel '%s' congested, waiting...\n", chan->
name);
1908 ast_log(
LOG_WARNING,
"Channel became a zombie before simple switch could be started (%s)\n", chan->
name);
1913 ast_verb(3,
"Starting simple switch on '%s'\n", chan->
name);
1919 len = strlen(exten);
1943 ast_verb(3,
"Going to extension s|1 because of empty extension received on overlap call\n");
1966 #if defined(JIRA_ASTERISK_15594)
2017 if (!before_start_pri) {
2025 if (!before_start_pri)
2026 pri_restart(pri->
dchans[index]);
2047 ast_name->
valid = 1;
2071 ast_number->
plan = pri_number->plan;
2073 ast_number->
valid = 1;
2092 if (pri_id->name.valid) {
2095 if (pri_id->number.valid) {
2098 #if defined(HAVE_PRI_SUBADDR)
2099 if (pri_id->subaddress.valid) {
2121 const struct pri_party_redirecting *pri_redirecting,
2129 ast_redirecting->
count = pri_redirecting->count;
2153 pattern = strtok_r(msn_list,
",", &list_tail);
2160 pattern = strtok_r(NULL,
",", &list_tail);
2166 #if defined(HAVE_PRI_MCID)
2213 #if defined(HAVE_PRI_SUBADDR)
2216 static const char subaddress[] =
"Subaddr";
2229 #if defined(HAVE_PRI_MCID)
2286 #if defined(HAVE_PRI_TRANSFER)
2296 #if defined(HAVE_PRI_TRANSFER)
2315 #if defined(HAVE_PRI_CALL_HOLD) || defined(HAVE_PRI_TRANSFER)
2328 #if defined(HAVE_PRI_CALL_HOLD) || defined(HAVE_PRI_TRANSFER)
2349 struct attempt_xfer_call {
2357 struct attempt_xfer_call *call_1;
2358 struct attempt_xfer_call *call_2;
2359 struct attempt_xfer_call *swap_call;
2360 struct attempt_xfer_call c1;
2361 struct attempt_xfer_call c2;
2363 c1.pri = call_1_pri;
2364 c1.held = call_1_held;
2367 c2.pri = call_2_pri;
2368 c2.held = call_2_held;
2373 if (call_1->chanpos < 0 || call_2->chanpos < 0) {
2377 rsp_callback(data, 0);
2383 if (!call_1->held && call_2->held) {
2399 call_1->ast = pri->
pvts[call_1->chanpos]->
owner;
2400 call_2->ast = pri->
pvts[call_2->chanpos]->
owner;
2401 if (!call_1->ast || !call_2->ast) {
2413 rsp_callback(data, 0);
2442 rsp_callback(data, 0);
2447 ast_verb(3,
"TRANSFERRING %s to %s\n", call_1->ast->name, call_2->ast->name);
2463 &call_2->ast->connected,
2466 &call_1->ast->connected,
2485 rsp_callback(data, retval ? 0 : 1);
2491 #if defined(HAVE_PRI_CCSS)
2509 return (agent_prv_1 && agent_prv_1->
pri == agent_prv_2->
pri
2514 #if defined(HAVE_PRI_CCSS)
2543 #if defined(HAVE_PRI_CCSS)
2560 return (monitor_1->
pri == monitor_2->
pri
2565 #if defined(HAVE_PRI_CCSS)
2593 #if defined(HAVE_PRI_CCSS)
2607 if (monitor_instance->
cc_id != -1) {
2609 pri_cc_cancel(monitor_instance->
pri->
pri, monitor_instance->
cc_id);
2616 #if defined(HAVE_PRI_CCSS)
2643 monitor_instance =
ao2_alloc(
sizeof(*monitor_instance) + strlen(device_name),
2645 if (!monitor_instance) {
2650 monitor_instance->
pri =
pri;
2652 strcpy(monitor_instance->
name, device_name);
2656 ao2_link(sig_pri_cc_monitors, monitor_instance);
2657 return monitor_instance;
2661 #if defined(HAVE_PRI_CCSS)
2690 pvt = pri->
pvts[chanpos];
2693 if (core_id == -1) {
2704 switch (monitor_policy) {
2723 monitor->
cc_id = -1;
2756 #if defined(HAVE_PRI_CCSS)
2774 if (core_id == -1) {
2785 #if defined(HAVE_PRI_CCSS)
2796 switch (monitor_policy) {
2837 #if defined(HAVE_PRI_CCSS)
2868 monitor->
cc_id = -1;
2876 #if defined(HAVE_PRI_AOC_EVENTS)
2890 return PRI_AOC_CHARGED_ITEM_NOT_AVAILABLE;
2892 return PRI_AOC_CHARGED_ITEM_SPECIAL_ARRANGEMENT;
2894 return PRI_AOC_CHARGED_ITEM_BASIC_COMMUNICATION;
2896 return PRI_AOC_CHARGED_ITEM_CALL_ATTEMPT;
2898 return PRI_AOC_CHARGED_ITEM_CALL_SETUP;
2900 return PRI_AOC_CHARGED_ITEM_USER_USER_INFO;
2902 return PRI_AOC_CHARGED_ITEM_SUPPLEMENTARY_SERVICE;
2904 return PRI_AOC_CHARGED_ITEM_NOT_AVAILABLE;
2908 #if defined(HAVE_PRI_AOC_EVENTS)
2921 case PRI_AOC_CHARGED_ITEM_NOT_AVAILABLE:
2923 case PRI_AOC_CHARGED_ITEM_SPECIAL_ARRANGEMENT:
2925 case PRI_AOC_CHARGED_ITEM_BASIC_COMMUNICATION:
2927 case PRI_AOC_CHARGED_ITEM_CALL_ATTEMPT:
2929 case PRI_AOC_CHARGED_ITEM_CALL_SETUP:
2931 case PRI_AOC_CHARGED_ITEM_USER_USER_INFO:
2933 case PRI_AOC_CHARGED_ITEM_SUPPLEMENTARY_SERVICE:
2940 #if defined(HAVE_PRI_AOC_EVENTS)
2952 return PRI_AOC_MULTIPLIER_THOUSANDTH;
2954 return PRI_AOC_MULTIPLIER_HUNDREDTH;
2956 return PRI_AOC_MULTIPLIER_TENTH;
2958 return PRI_AOC_MULTIPLIER_ONE;
2960 return PRI_AOC_MULTIPLIER_TEN;
2962 return PRI_AOC_MULTIPLIER_HUNDRED;
2964 return PRI_AOC_MULTIPLIER_THOUSAND;
2966 return PRI_AOC_MULTIPLIER_ONE;
2971 #if defined(HAVE_PRI_AOC_EVENTS)
2982 case PRI_AOC_MULTIPLIER_THOUSANDTH:
2984 case PRI_AOC_MULTIPLIER_HUNDREDTH:
2986 case PRI_AOC_MULTIPLIER_TENTH:
2988 case PRI_AOC_MULTIPLIER_ONE:
2990 case PRI_AOC_MULTIPLIER_TEN:
2992 case PRI_AOC_MULTIPLIER_HUNDRED:
2994 case PRI_AOC_MULTIPLIER_THOUSAND:
3002 #if defined(HAVE_PRI_AOC_EVENTS)
3017 return PRI_AOC_TIME_SCALE_HUNDREDTH_SECOND;
3019 return PRI_AOC_TIME_SCALE_TENTH_SECOND;
3021 return PRI_AOC_TIME_SCALE_SECOND;
3023 return PRI_AOC_TIME_SCALE_TEN_SECOND;
3025 return PRI_AOC_TIME_SCALE_MINUTE;
3027 return PRI_AOC_TIME_SCALE_HOUR;
3029 return PRI_AOC_TIME_SCALE_DAY;
3034 #if defined(HAVE_PRI_AOC_EVENTS)
3048 case PRI_AOC_TIME_SCALE_HUNDREDTH_SECOND:
3050 case PRI_AOC_TIME_SCALE_TENTH_SECOND:
3052 case PRI_AOC_TIME_SCALE_SECOND:
3054 case PRI_AOC_TIME_SCALE_TEN_SECOND:
3056 case PRI_AOC_TIME_SCALE_MINUTE:
3058 case PRI_AOC_TIME_SCALE_HOUR:
3060 case PRI_AOC_TIME_SCALE_DAY:
3067 #if defined(HAVE_PRI_AOC_EVENTS)
3087 size_t encoded_size = 0;
3090 if (!owner || !aoc_s) {
3098 for (idx = 0; idx < aoc_s->num_items; ++idx) {
3106 switch (aoc_s->item[idx].rate_type) {
3107 case PRI_AOC_RATE_TYPE_DURATION:
3110 aoc_s->item[idx].rate.duration.amount.cost,
3112 aoc_s->item[idx].rate.duration.currency,
3113 aoc_s->item[idx].rate.duration.time.length,
3115 aoc_s->item[idx].rate.duration.granularity.length,
3117 aoc_s->item[idx].rate.duration.charging_type);
3119 case PRI_AOC_RATE_TYPE_FLAT:
3122 aoc_s->item[idx].rate.flat.amount.cost,
3124 aoc_s->item[idx].rate.flat.currency);
3126 case PRI_AOC_RATE_TYPE_VOLUME:
3129 aoc_s->item[idx].rate.volume.unit,
3130 aoc_s->item[idx].rate.volume.amount.cost,
3132 aoc_s->item[idx].rate.volume.currency);
3134 case PRI_AOC_RATE_TYPE_SPECIAL_CODE:
3137 aoc_s->item[idx].rate.special);
3139 case PRI_AOC_RATE_TYPE_FREE:
3142 case PRI_AOC_RATE_TYPE_FREE_FROM_BEGINNING:
3151 if (passthrough && (encoded =
ast_aoc_encode(decoded, &encoded_size, owner))) {
3162 #if defined(HAVE_PRI_AOC_EVENTS)
3184 request = aoc_request->charging_request;
3186 if (request & PRI_AOC_REQUEST_S) {
3194 pri_aoc_s_request_response_send(pvt->
pri->
pri,
3196 aoc_request->invoke_id,
3201 if (request & PRI_AOC_REQUEST_D) {
3203 pri_aoc_de_request_response_send(pvt->
pri->
pri,
3205 PRI_AOC_REQ_RSP_CHARGING_INFO_FOLLOWS,
3206 aoc_request->invoke_id);
3208 pri_aoc_de_request_response_send(pvt->
pri->
pri,
3210 PRI_AOC_REQ_RSP_ERROR_NOT_AVAILABLE,
3211 aoc_request->invoke_id);
3215 if (request & PRI_AOC_REQUEST_E) {
3217 pri_aoc_de_request_response_send(pvt->
pri->
pri,
3219 PRI_AOC_REQ_RSP_CHARGING_INFO_FOLLOWS,
3220 aoc_request->invoke_id);
3222 pri_aoc_de_request_response_send(pvt->
pri->
pri,
3224 PRI_AOC_REQ_RSP_ERROR_NOT_AVAILABLE,
3225 aoc_request->invoke_id);
3231 #if defined(HAVE_PRI_AOC_EVENTS)
3251 size_t encoded_size = 0;
3254 if (!owner || !aoc_d) {
3258 switch (aoc_d->charge) {
3259 case PRI_AOC_DE_CHARGE_CURRENCY:
3262 case PRI_AOC_DE_CHARGE_UNITS:
3265 case PRI_AOC_DE_CHARGE_FREE:
3277 switch (aoc_d->billing_accumulation) {
3279 ast_debug(1,
"AOC-D billing accumulation has unknown value: %d\n",
3280 aoc_d->billing_accumulation);
3290 switch (aoc_d->billing_id) {
3291 case PRI_AOC_D_BILLING_ID_NORMAL:
3294 case PRI_AOC_D_BILLING_ID_REVERSE:
3297 case PRI_AOC_D_BILLING_ID_CREDIT_CARD:
3300 case PRI_AOC_D_BILLING_ID_NOT_AVAILABLE:
3306 switch (aoc_d->charge) {
3307 case PRI_AOC_DE_CHARGE_CURRENCY:
3309 aoc_d->recorded.money.amount.cost,
3311 aoc_d->recorded.money.currency);
3313 case PRI_AOC_DE_CHARGE_UNITS:
3316 for (i = 0; i < aoc_d->recorded.unit.num_items; ++i) {
3319 (aoc_d->recorded.unit.item[i].number >= 0 ? 1 : 0),
3320 aoc_d->recorded.unit.item[i].number,
3321 (aoc_d->recorded.unit.item[i].type >= 0 ? 1 : 0),
3322 aoc_d->recorded.unit.item[i].type);
3328 if (passthrough && (encoded =
ast_aoc_encode(decoded, &encoded_size, owner))) {
3339 #if defined(HAVE_PRI_AOC_EVENTS)
3360 size_t encoded_size = 0;
3367 switch (aoc_e->charge) {
3368 case PRI_AOC_DE_CHARGE_CURRENCY:
3371 case PRI_AOC_DE_CHARGE_UNITS:
3374 case PRI_AOC_DE_CHARGE_FREE:
3386 switch (aoc_e->associated.charging_type) {
3387 case PRI_AOC_E_CHARGING_ASSOCIATION_NUMBER:
3388 if (!aoc_e->associated.charge.number.valid) {
3393 case PRI_AOC_E_CHARGING_ASSOCIATION_ID:
3400 switch (aoc_e->billing_id) {
3401 case PRI_AOC_E_BILLING_ID_NORMAL:
3404 case PRI_AOC_E_BILLING_ID_REVERSE:
3407 case PRI_AOC_E_BILLING_ID_CREDIT_CARD:
3410 case PRI_AOC_E_BILLING_ID_CALL_FORWARDING_UNCONDITIONAL:
3413 case PRI_AOC_E_BILLING_ID_CALL_FORWARDING_BUSY:
3416 case PRI_AOC_E_BILLING_ID_CALL_FORWARDING_NO_REPLY:
3419 case PRI_AOC_E_BILLING_ID_CALL_DEFLECTION:
3422 case PRI_AOC_E_BILLING_ID_CALL_TRANSFER:
3425 case PRI_AOC_E_BILLING_ID_NOT_AVAILABLE:
3431 switch (aoc_e->charge) {
3432 case PRI_AOC_DE_CHARGE_CURRENCY:
3434 aoc_e->recorded.money.amount.cost,
3436 aoc_e->recorded.money.currency);
3438 case PRI_AOC_DE_CHARGE_UNITS:
3441 for (i = 0; i < aoc_e->recorded.unit.num_items; ++i) {
3444 (aoc_e->recorded.unit.item[i].number >= 0 ? 1 : 0),
3445 aoc_e->recorded.unit.item[i].number,
3446 (aoc_e->recorded.unit.item[i].type >= 0 ? 1 : 0),
3447 aoc_e->recorded.unit.item[i].type);
3452 if (passthrough && owner && (encoded =
ast_aoc_encode(decoded, &encoded_size, owner))) {
3463 #if defined(HAVE_PRI_AOC_EVENTS)
3477 struct pri_subcmd_aoc_s aoc_s = { 0, };
3490 aoc_s.item[idx].rate_type = PRI_AOC_RATE_TYPE_DURATION;
3492 aoc_s.item[idx].rate.duration.amount.multiplier =
3495 aoc_s.item[idx].rate.duration.time.scale =
3498 aoc_s.item[idx].rate.duration.granularity.scale =
3505 sizeof(aoc_s.item[idx].rate.duration.currency));
3509 aoc_s.item[idx].rate_type = PRI_AOC_RATE_TYPE_FLAT;
3511 aoc_s.item[idx].rate.flat.amount.multiplier =
3517 sizeof(aoc_s.item[idx].rate.flat.currency));
3521 aoc_s.item[idx].rate_type = PRI_AOC_RATE_TYPE_VOLUME;
3524 aoc_s.item[idx].rate.volume.amount.multiplier =
3530 sizeof(aoc_s.item[idx].rate.volume.currency));
3534 aoc_s.item[idx].rate_type = PRI_AOC_RATE_TYPE_SPECIAL_CODE;
3538 aoc_s.item[idx].rate_type = PRI_AOC_RATE_TYPE_FREE;
3541 aoc_s.item[idx].rate_type = PRI_AOC_RATE_TYPE_FREE_FROM_BEGINNING;
3545 aoc_s.item[idx].rate_type = PRI_AOC_RATE_TYPE_NOT_AVAILABLE;
3549 aoc_s.num_items = idx;
3557 pri_aoc_s_send(pvt->
pri->
pri, pvt->
call, &aoc_s);
3562 #if defined(HAVE_PRI_AOC_EVENTS)
3576 struct pri_subcmd_aoc_d aoc_d = { 0, };
3582 aoc_d.billing_id = PRI_AOC_D_BILLING_ID_NORMAL;
3585 aoc_d.billing_id = PRI_AOC_D_BILLING_ID_REVERSE;
3588 aoc_d.billing_id = PRI_AOC_D_BILLING_ID_CREDIT_CARD;
3592 aoc_d.billing_id = PRI_AOC_D_BILLING_ID_NOT_AVAILABLE;
3598 aoc_d.charge = PRI_AOC_DE_CHARGE_FREE;
3603 aoc_d.charge = PRI_AOC_DE_CHARGE_CURRENCY;
3607 ast_copy_string(aoc_d.recorded.money.currency, currency_name,
sizeof(aoc_d.recorded.money.currency));
3615 aoc_d.charge = PRI_AOC_DE_CHARGE_UNITS;
3619 aoc_d.recorded.unit.item[i].number = entry->
amount;
3621 aoc_d.recorded.unit.item[i].number = -1;
3624 aoc_d.recorded.unit.item[i].type = entry->
type;
3626 aoc_d.recorded.unit.item[i].type = -1;
3628 aoc_d.recorded.unit.num_items++;
3637 aoc_d.charge = PRI_AOC_DE_CHARGE_NOT_AVAILABLE;
3641 pri_aoc_d_send(pvt->
pri->
pri, pvt->
call, &aoc_d);
3645 #if defined(HAVE_PRI_AOC_EVENTS)
3659 struct pri_subcmd_aoc_e *aoc_e = &pvt->
aoc_e;
3662 memset(aoc_e, 0,
sizeof(*aoc_e));
3667 aoc_e->associated.charge.number.valid = 1;
3670 sizeof(aoc_e->associated.charge.number.str));
3672 aoc_e->associated.charging_type = PRI_AOC_E_CHARGING_ASSOCIATION_NUMBER;
3675 aoc_e->associated.charge.id = ca->
charge.
id;
3676 aoc_e->associated.charging_type = PRI_AOC_E_CHARGING_ASSOCIATION_ID;
3685 aoc_e->billing_id = PRI_AOC_E_BILLING_ID_NORMAL;
3688 aoc_e->billing_id = PRI_AOC_E_BILLING_ID_REVERSE;
3691 aoc_e->billing_id = PRI_AOC_E_BILLING_ID_CREDIT_CARD;
3694 aoc_e->billing_id = PRI_AOC_E_BILLING_ID_CALL_FORWARDING_UNCONDITIONAL;
3697 aoc_e->billing_id = PRI_AOC_E_BILLING_ID_CALL_FORWARDING_BUSY;
3700 aoc_e->billing_id = PRI_AOC_E_BILLING_ID_CALL_FORWARDING_NO_REPLY;
3703 aoc_e->billing_id = PRI_AOC_E_BILLING_ID_CALL_DEFLECTION;
3706 aoc_e->billing_id = PRI_AOC_E_BILLING_ID_CALL_TRANSFER;
3710 aoc_e->billing_id = PRI_AOC_E_BILLING_ID_NOT_AVAILABLE;
3716 aoc_e->charge = PRI_AOC_DE_CHARGE_FREE;
3721 aoc_e->charge = PRI_AOC_DE_CHARGE_CURRENCY;
3725 ast_copy_string(aoc_e->recorded.money.currency, currency_name,
sizeof(aoc_e->recorded.money.currency));
3733 aoc_e->charge = PRI_AOC_DE_CHARGE_UNITS;
3737 aoc_e->recorded.unit.item[i].number = entry->
amount;
3739 aoc_e->recorded.unit.item[i].number = -1;
3742 aoc_e->recorded.unit.item[i].type = entry->
type;
3744 aoc_e->recorded.unit.item[i].type = -1;
3746 aoc_e->recorded.unit.num_items++;
3753 aoc_e->charge = PRI_AOC_DE_CHARGE_NOT_AVAILABLE;
3759 #if defined(HAVE_PRI_AOC_EVENTS)
3779 size_t encoded_size;
3780 struct timeval whentohangup = { 0, };
3783 pvt = pri->
pvts[chanpos];
3790 goto cleanup_termination_request;
3797 goto cleanup_termination_request;
3801 whentohangup.tv_usec = (ms % 1000) * 1000;
3802 whentohangup.tv_sec = ms / 1000;
3806 goto cleanup_termination_request;
3813 cleanup_termination_request:
3852 const struct pri_subcommands *subcmds, q931_call *call_rsp)
3855 #if defined(HAVE_PRI_CCSS)
3864 for (index = 0; index < subcmds->counter_subcmd; ++index) {
3865 const struct pri_subcommand *subcmd = &subcmds->subcmd[index];
3867 switch (subcmd->cmd) {
3868 #if defined(STATUS_REQUEST_PLACE_HOLDER)
3869 case PRI_SUBCMD_STATUS_REQ:
3870 case PRI_SUBCMD_STATUS_REQ_RSP:
3874 #if defined(HAVE_PRI_CCSS)
3875 case PRI_SUBCMD_CC_REQ:
3878 pri_cc_cancel(pri->
pri, subcmd->u.cc_request.cc_id);
3882 if (pri_cc_req_rsp(pri->
pri, subcmd->u.cc_request.cc_id,
3884 pri_cc_cancel(pri->
pri, subcmd->u.cc_request.cc_id);
3896 if (pri_cc_req_rsp(pri->
pri, subcmd->u.cc_request.cc_id,
3898 pri_cc_cancel(pri->
pri, subcmd->u.cc_request.cc_id);
3906 #if defined(HAVE_PRI_CCSS)
3907 case PRI_SUBCMD_CC_REQ_RSP:
3909 subcmd->u.cc_request_rsp.cc_id);
3911 pri_cc_cancel(pri->
pri, subcmd->u.cc_request_rsp.cc_id);
3914 switch (subcmd->u.cc_request_rsp.status) {
3928 pri_facility_error2str(subcmd->u.cc_request_rsp.fail_code));
3933 ast_verb(2,
"core_id:%d %s CC request reject: %s\n", monitor->
core_id,
3935 pri_facility_reject2str(subcmd->u.cc_request_rsp.fail_code));
3940 ast_verb(2,
"core_id:%d %s CC request unknown status %d\n",
3942 subcmd->u.cc_request_rsp.status);
3950 #if defined(HAVE_PRI_CCSS)
3951 case PRI_SUBCMD_CC_REMOTE_USER_FREE:
3953 subcmd->u.cc_remote_user_free.cc_id);
3955 pri_cc_cancel(pri->
pri, subcmd->u.cc_remote_user_free.cc_id);
3963 #if defined(HAVE_PRI_CCSS)
3964 case PRI_SUBCMD_CC_B_FREE:
3966 subcmd->u.cc_b_free.cc_id);
3968 pri_cc_cancel(pri->
pri, subcmd->u.cc_b_free.cc_id);
3975 #if defined(HAVE_PRI_CCSS)
3976 case PRI_SUBCMD_CC_STATUS_REQ:
3978 subcmd->u.cc_status_req.cc_id);
3980 pri_cc_cancel(pri->
pri, subcmd->u.cc_status_req.cc_id);
3987 #if defined(HAVE_PRI_CCSS)
3988 case PRI_SUBCMD_CC_STATUS_REQ_RSP:
3991 pri_cc_cancel(pri->
pri, subcmd->u.cc_status_req_rsp.cc_id);
4000 #if defined(HAVE_PRI_CCSS)
4001 case PRI_SUBCMD_CC_STATUS:
4004 pri_cc_cancel(pri->
pri, subcmd->u.cc_status.cc_id);
4007 if (subcmd->u.cc_status.status) {
4017 #if defined(HAVE_PRI_CCSS)
4018 case PRI_SUBCMD_CC_CANCEL:
4020 subcmd->u.cc_cancel.is_agent);
4023 #if defined(HAVE_PRI_CCSS)
4024 case PRI_SUBCMD_CC_STOP_ALERTING:
4026 subcmd->u.cc_stop_alerting.cc_id);
4028 pri_cc_cancel(pri->
pri, subcmd->u.cc_stop_alerting.cc_id);
4035 #if defined(HAVE_PRI_AOC_EVENTS)
4036 case PRI_SUBCMD_AOC_E:
4043 "Unknown CIS subcommand(%d) in %s event on span %d.\n",
4044 subcmd->cmd, pri_event2str(event_id), pri->
span);
4050 #if defined(HAVE_PRI_AOC_EVENTS)
4077 for (i = 0; i < subcmds->counter_subcmd; ++i) {
4078 const struct pri_subcommand *subcmd = &subcmds->subcmd[i];
4079 if (subcmd->cmd == PRI_SUBCMD_AOC_E) {
4108 int channel,
const struct pri_subcommands *subcmds, q931_call *call_rsp)
4113 #if defined(HAVE_PRI_TRANSFER)
4120 for (index = 0; index < subcmds->counter_subcmd; ++index) {
4121 const struct pri_subcommand *subcmd = &subcmds->subcmd[index];
4123 switch (subcmd->cmd) {
4124 case PRI_SUBCMD_CONNECTED_LINE:
4129 int caller_id_update;
4137 caller_id_update = 0;
4142 caller_id_update = 1;
4149 caller_id_update = 1;
4154 #if defined(HAVE_PRI_SUBADDR)
4159 caller_id_update = 1;
4162 if (caller_id_update) {
4170 ast_caller.
id = ast_connected.
id;
4171 ast_caller.
ani = ast_connected.
id;
4175 if (event_id != PRI_EVENT_RING) {
4186 case PRI_SUBCMD_REDIRECTING:
4198 if (event_id != PRI_EVENT_RING) {
4207 #if defined(HAVE_PRI_CALL_REROUTING)
4208 case PRI_SUBCMD_REROUTING:
4212 struct pri_party_redirecting pri_deflection;
4216 "Span %d: %s tried CallRerouting/CallDeflection to '%s' without call!\n",
4217 pri->
span, owner->
name, subcmd->u.rerouting.deflection.to.number.str);
4223 "Span %d: %s tried CallRerouting/CallDeflection to empty number!\n",
4225 pri_rerouting_rsp(pri->
pri, call_rsp, subcmd->u.rerouting.invoke_id,
4226 PRI_REROUTING_RSP_INVALID_NUMBER);
4231 ast_verb(3,
"Span %d: %s is CallRerouting/CallDeflection to '%s'.\n",
4232 pri->
span, owner->
name, subcmd->u.rerouting.deflection.to.number.str);
4240 pri_rerouting_rsp(pri->
pri, call_rsp, subcmd->u.rerouting.invoke_id,
4241 PRI_REROUTING_RSP_OK_CLEAR);
4243 pri_deflection = subcmd->u.rerouting.deflection;
4246 switch (subcmd->u.rerouting.subscription_option) {
4250 pri_deflection.to.number.presentation =
4251 PRI_PRES_RESTRICTED | PRI_PRES_USER_NUMBER_UNSCREENED;
4252 pri_deflection.to.number.plan =
4253 (PRI_TON_UNKNOWN << 4) | PRI_NPI_E163_E164;
4254 pri_deflection.to.number.str[0] =
'\0';
4271 subcmd->u.rerouting.deflection.to.number.str);
4280 #if defined(HAVE_PRI_CCSS)
4281 case PRI_SUBCMD_CC_AVAILABLE:
4288 case PRI_EVENT_RINGING:
4291 case PRI_EVENT_HANGUP_REQ:
4302 pri_cc_cancel(pri->
pri, subcmd->u.cc_available.cc_id);
4307 pri_cc_cancel(pri->
pri, subcmd->u.cc_available.cc_id);
4311 #if defined(HAVE_PRI_CCSS)
4312 case PRI_SUBCMD_CC_CALL:
4331 #if defined(HAVE_PRI_CCSS)
4332 case PRI_SUBCMD_CC_CANCEL:
4334 subcmd->u.cc_cancel.is_agent);
4337 #if defined(HAVE_PRI_TRANSFER)
4338 case PRI_SUBCMD_TRANSFER_CALL:
4342 "Call transfer subcommand without call to send response!\n");
4348 xfer_rsp.
call = call_rsp;
4349 xfer_rsp.
invoke_id = subcmd->u.transfer.invoke_id;
4351 subcmd->u.
transfer.call_1, subcmd->u.transfer.is_call_1_held,
4352 subcmd->u.transfer.call_2, subcmd->u.transfer.is_call_2_held,
4357 #if defined(HAVE_PRI_AOC_EVENTS)
4358 case PRI_SUBCMD_AOC_S:
4368 #if defined(HAVE_PRI_AOC_EVENTS)
4369 case PRI_SUBCMD_AOC_D:
4380 #if defined(HAVE_PRI_AOC_EVENTS)
4381 case PRI_SUBCMD_AOC_E:
4392 #if defined(HAVE_PRI_AOC_EVENTS)
4393 case PRI_SUBCMD_AOC_CHARGING_REQ:
4403 #if defined(HAVE_PRI_AOC_EVENTS)
4404 case PRI_SUBCMD_AOC_CHARGING_REQ_RSP:
4410 if (subcmd->u.aoc_request_response.valid_aoc_s) {
4421 #if defined(HAVE_PRI_MCID)
4422 case PRI_SUBCMD_MCID_REQ:
4431 #if defined(HAVE_PRI_MCID)
4432 case PRI_SUBCMD_MCID_RSP:
4438 "Unknown call subcommand(%d) in %s event on channel %d/%d on span %d.\n",
4439 subcmd->cmd, pri_event2str(event_id),
PRI_SPAN(channel),
4446 #if defined(HAVE_PRI_CALL_HOLD)
4468 if (chanpos_old < 0) {
4483 goto done_with_private;
4490 goto done_with_owner;
4493 if (chanpos_new < 0) {
4495 goto done_with_owner;
4500 if (chanpos_new < 0) {
4518 if (chanpos_new < 0) {
4529 #if defined(HAVE_PRI_CALL_HOLD)
4548 pri_retrieve_rej(pri->
pri, ev->retrieve.call,
4549 PRI_CAUSE_RESOURCE_UNAVAIL_UNSPECIFIED);
4554 pri_retrieve_rej(pri->
pri, ev->retrieve.call,
4555 PRI_CAUSE_RESOURCE_UNAVAIL_UNSPECIFIED);
4563 if (ev->retrieve.flexible
4573 pri_retrieve_rej(pri->
pri, ev->retrieve.call,
4574 ev->retrieve.flexible ? PRI_CAUSE_NORMAL_CIRCUIT_CONGESTION
4575 : PRI_CAUSE_REQUESTED_CHAN_UNAVAIL);
4581 pri_retrieve_rej(pri->
pri, ev->retrieve.call,
4582 PRI_CAUSE_REQUESTED_CHAN_UNAVAIL);
4587 ev->retrieve.subcmds, ev->retrieve.call);
4590 pri_retrieve_ack(pri->
pri, ev->retrieve.call,
4600 struct pollfd fds[SIG_PRI_NUM_DCHANS];
4606 struct timeval tv, lowest, *next;
4616 char calledtonstr[10];
4617 struct timeval lastidle = { 0, 0 };
4626 gettimeofday(&lastidle, NULL);
4627 pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
4631 cc = strchr(pri->
idleext,
'@');
4650 fds[i].fd = pri->
fds[i];
4651 fds[i].events = POLLIN | POLLPRI;
4677 for (x = pri->
numchans; x >= 0; x--) {
4680 if (haveidles < pri->minunused) {
4691 if (nextidle > -1) {
4722 gettimeofday(&lastidle, NULL);
4724 }
else if ((haveidles < pri->minunused) &&
4725 (activeidles > pri->
minidle)) {
4728 for (x = pri->
numchans; x >= 0; x--) {
4736 (activeidles <= pri->minidle))
4758 next = pri_schedule_next(pri->
dchans[i]);
4762 if (tv.tv_sec < 0) {
4777 pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
4778 pthread_testcancel();
4780 res = poll(fds, numdchans, lowest.tv_sec * 1000 + lowest.tv_usec / 1000);
4781 pthread_testcancel();
4782 pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
4790 e = pri_schedule_run(pri->
dchans[which]);
4794 }
else if (res > -1) {
4798 if (fds[which].revents & POLLPRI) {
4800 }
else if (fds[which].revents & POLLIN) {
4801 e = pri_check_event(pri->
dchans[which]);
4806 }
else if (
errno != EINTR)
4812 pri->
span, pri_event2str(e->e));
4815 if (e->e != PRI_EVENT_DCHAN_DOWN) {
4827 if ((e->e != PRI_EVENT_DCHAN_UP) && (e->e != PRI_EVENT_DCHAN_DOWN) && (pri->
pri != pri->
dchans[which]))
4832 case PRI_EVENT_DCHAN_UP:
4848 for (i = 0; i < pri->
numchans; i++) {
4855 case PRI_EVENT_DCHAN_DOWN:
4867 for (i = 0; i < pri->
numchans; i++) {
4871 if (pri_get_timer(p->
pri->
pri, PRI_TIMER_T309) < 0) {
4886 case PRI_EVENT_RESTART:
4887 if (e->restart.channel > -1 &&
PRI_CHANNEL(e->restart.channel) != 0xFF) {
4891 "Span %d: Restart requested on odd/unavailable channel number %d/%d\n",
4896 #if defined(HAVE_PRI_SERVICE_MESSAGES)
4902 "Span %d: Channel %d/%d out-of-service (reason: %s), ignoring RESTART\n",
4911 ast_verb(3,
"Span %d: Channel %d/%d restarted\n", pri->
span,
4915 pri_destroycall(pri->
pri, pri->
pvts[chanpos]->
call);
4925 ast_verb(3,
"Restart requested on entire span %d\n", pri->
span);
4926 for (x = 0; x < pri->
numchans; x++)
4940 case PRI_EVENT_KEYPAD_DIGIT:
4949 "Span %d: Received keypad digits for unknown call.\n", pri->
span);
4954 e->digit.subcmds, e->digit.call);
4959 int digitlen = strlen(e->digit.digits);
4962 for (i = 0; i < digitlen; i++) {
4971 case PRI_EVENT_INFO_RECEIVED:
4980 "Span %d: Received INFORMATION for unknown call.\n", pri->
span);
4985 e->ring.subcmds, e->ring.call);
4990 int digitlen = strlen(e->ring.callednum);
4993 for (i = 0; i < digitlen; i++) {
5001 #if defined(HAVE_PRI_SERVICE_MESSAGES)
5002 case PRI_EVENT_SERVICE:
5005 ast_log(
LOG_WARNING,
"Received service change status %d on unconfigured channel %d/%d span %d\n",
5006 e->service_ack.changestatus,
PRI_SPAN(e->service_ack.channel),
PRI_CHANNEL(e->service_ack.channel), pri->
span);
5008 char db_chan_name[20];
5014 snprintf(db_chan_name,
sizeof(db_chan_name),
"%s/%d:%d",
dahdi_db, pri->
span, ch);
5016 switch (e->service.changestatus) {
5022 snprintf(db_answer,
sizeof(db_answer),
"%s:%u",
5042 ast_log(
LOG_NOTICE,
"Channel %d/%d span %d (logical: %d) received a change of service message, status '%d'\n",
5046 case PRI_EVENT_SERVICE_ACK:
5049 ast_log(
LOG_WARNING,
"Received service acknowledge change status '%d' on unconfigured channel %d/%d span %d\n",
5050 e->service_ack.changestatus,
PRI_SPAN(e->service_ack.channel),
PRI_CHANNEL(e->service_ack.channel), pri->
span);
5052 ast_debug(2,
"Channel %d/%d span %d received a change os service acknowledgement message, status '%d'\n",
5053 PRI_SPAN(e->service_ack.channel),
PRI_CHANNEL(e->service_ack.channel), pri->
span, e->service_ack.changestatus);
5057 case PRI_EVENT_RING:
5062 "Ignoring call to '%s' on span %d. Its not in the MSN list: %s\n",
5064 pri_destroycall(pri->
pri, e->ring.call);
5076 "Span %d: Got SETUP with duplicate call ptr (%p). Dropping call.\n",
5077 pri->
span, e->ring.call);
5078 pri_hangup(pri->
pri, e->ring.call, PRI_CAUSE_NORMAL_TEMPORARY_FAILURE);
5081 if (e->ring.channel == -1 ||
PRI_CHANNEL(e->ring.channel) == 0xFF) {
5084 }
else if (
PRI_CHANNEL(e->ring.channel) == 0x00) {
5086 #if defined(HAVE_PRI_CALL_WAITING)
5091 pri_hangup(pri->
pri, e->ring.call, PRI_CAUSE_NORMAL_CIRCUIT_CONGESTION);
5094 #if defined(HAVE_PRI_CALL_WAITING)
5098 pri_hangup(pri->
pri, e->ring.call, PRI_CAUSE_NORMAL_CIRCUIT_CONGESTION);
5109 "Span %d: SETUP on unconfigured channel %d/%d\n",
5126 "Span %d: Second SETUP while waiting for RESTART ACKNOWLEDGE on channel %d/%d\n",
5141 "Span %d: SETUP requested unavailable channel %d/%d. Attempting to renegotiate.\n",
5147 #if defined(ALWAYS_PICK_CHANNEL)
5148 if (e->ring.flexible) {
5152 if (chanpos < 0 && e->ring.flexible) {
5158 if (e->ring.flexible) {
5159 pri_hangup(pri->
pri, e->ring.call, PRI_CAUSE_NORMAL_CIRCUIT_CONGESTION);
5161 pri_hangup(pri->
pri, e->ring.call, PRI_CAUSE_REQUESTED_CHAN_UNAVAIL);
5169 pri->
pvts[chanpos]->
call = e->ring.call;
5173 e->ring.redirectingnum, e->ring.callingplanrdnis);
5178 e->ring.callingnum, e->ring.callingplan);
5185 pri, e->ring.callingani, e->ring.callingplanani);
5191 #if defined(HAVE_PRI_SUBADDR)
5192 if (e->ring.calling.subaddress.valid) {
5197 &e->ring.calling.subaddress);
5198 if (calling_subaddress.
str) {
5200 calling_subaddress.
str,
5207 pri->
pvts[chanpos]->
cid_ton = e->ring.callingplan;
5209 if (e->ring.ani2 >= 0) {
5227 ? plancallingnum : e->ring.callednum);
5240 ast_verb(3,
"Going to extension s|1 because of immediate=yes\n");
5256 ast_verb(3,
"Going to extension s|1 because of Complete received\n");
5264 int could_match_more;
5268 switch (e->ring.layer1) {
5269 case PRI_LAYER_1_ALAW:
5272 case PRI_LAYER_1_ULAW:
5281 could_match_more = !e->ring.complete
5286 need_dialtone = could_match_more
5302 }
else if (pri->
switchtype == PRI_SWITCH_GR303_TMC) {
5307 #if defined(HAVE_PRI_SETUP_ACK_INBAND)
5308 pri_setup_ack(pri->
pri, e->ring.call,
5311 pri_need_more_info(pri->
pri, e->ring.call,
5317 if (could_match_more) {
5332 #if defined(HAVE_PRI_SUBADDR)
5333 if (e->ring.calling.subaddress.valid) {
5338 &e->ring.calling.subaddress);
5339 if (!e->ring.calling.subaddress.type
5341 (
char *) e->ring.calling.subaddress.data)) {
5344 (
char *) e->ring.calling.subaddress.
data);
5348 if (e->ring.called_subaddress.valid) {
5353 &e->ring.called_subaddress);
5354 if (!e->ring.called_subaddress.type
5356 (
char *) e->ring.called_subaddress.data)) {
5359 (
char *) e->ring.called_subaddress.
data);
5368 if (e->ring.ani2 >= 0) {
5369 snprintf(ani2str,
sizeof(ani2str),
"%d", e->ring.ani2);
5373 #ifdef SUPPORT_USERUSER
5379 snprintf(calledtonstr,
sizeof(calledtonstr),
"%d", e->ring.calledplan);
5385 if (e->ring.redirectingreason >= 0) {
5389 #if defined(HAVE_PRI_REVERSE_CHARGE)
5392 #if defined(HAVE_PRI_SETUP_KEYPAD)
5394 e->ring.keypad_digits,
5399 e->ring.subcmds, e->ring.call);
5401 #if !defined(HAVE_PRI_SETUP_ACK_INBAND)
5402 if (need_dialtone) {
5405 #ifdef HAVE_PRI_PROG_W_CAUSE
5406 pri_progress_with_cause(pri->
pri, e->ring.call,
5409 pri_progress(pri->
pri, e->ring.call,
5416 ast_verb(3,
"Accepting overlap call from '%s' to '%s' on channel %d/%d, span %d\n",
5417 plancallingnum,
S_OR(pri->
pvts[chanpos]->
exten,
"<unspecified>"),
5429 pri_hangup(pri->
pri, e->ring.call, PRI_CAUSE_SWITCH_CONGESTION);
5459 #if defined(HAVE_PRI_SUBADDR)
5460 if (e->ring.calling.subaddress.valid) {
5465 &e->ring.calling.subaddress);
5466 if (!e->ring.calling.subaddress.type
5468 (
char *) e->ring.calling.subaddress.data)) {
5471 (
char *) e->ring.calling.subaddress.
data);
5475 if (e->ring.called_subaddress.valid) {
5480 &e->ring.called_subaddress);
5481 if (!e->ring.called_subaddress.type
5483 (
char *) e->ring.called_subaddress.data)) {
5486 (
char *) e->ring.called_subaddress.
data);
5495 if (e->ring.ani2 >= 0) {
5496 snprintf(ani2str,
sizeof(ani2str),
"%d", e->ring.ani2);
5500 #ifdef SUPPORT_USERUSER
5506 if (e->ring.redirectingreason >= 0) {
5510 #if defined(HAVE_PRI_REVERSE_CHARGE)
5513 #if defined(HAVE_PRI_SETUP_KEYPAD)
5515 e->ring.keypad_digits,
5519 snprintf(calledtonstr,
sizeof(calledtonstr),
"%d", e->ring.calledplan);
5526 e->ring.subcmds, e->ring.call);
5529 ast_verb(3,
"Accepting call from '%s' to '%s' on channel %d/%d, span %d\n",
5530 plancallingnum, pri->
pvts[chanpos]->
exten,
5543 pri_hangup(pri->
pri, e->ring.call, PRI_CAUSE_SWITCH_CONGESTION);
5553 "Span %d: Extension %s@%s does not exist. Rejecting call from '%s'.\n",
5556 pri_hangup(pri->
pri, e->ring.call, PRI_CAUSE_UNALLOCATED);
5565 case PRI_EVENT_RINGING:
5579 e->ringing.subcmds, e->ringing.call);
5594 #ifdef PRI_PROGRESS_MASK
5595 && (e->ringing.progressmask
5596 & (PRI_PROG_CALL_NOT_E2E_ISDN | PRI_PROG_INBAND_AVAILABLE))
5598 && e->ringing.progress == 8
5608 #ifdef SUPPORT_USERUSER
5616 e->ringing.useruserinfo);
5624 case PRI_EVENT_PROGRESS:
5627 e->proceeding.call);
5631 e->proceeding.call);
5637 e->proceeding.subcmds, e->proceeding.call);
5639 if (e->proceeding.cause > -1) {
5640 ast_verb(3,
"PROGRESS with cause code %d received\n", e->proceeding.cause);
5645 ast_verb(3,
"PROGRESS with 'user busy' received, signaling AST_CONTROL_BUSY instead of AST_CONTROL_PROGRESS\n");
5655 #ifdef PRI_PROGRESS_MASK
5656 && (e->proceeding.progressmask
5657 & (PRI_PROG_CALL_NOT_E2E_ISDN | PRI_PROG_INBAND_AVAILABLE))
5659 && e->proceeding.progress == 8
5664 "Queuing frame from PRI_EVENT_PROGRESS on channel %d/%d span %d\n",
5674 case PRI_EVENT_PROCEEDING:
5677 e->proceeding.call);
5681 e->proceeding.call);
5687 e->proceeding.subcmds, e->proceeding.call);
5691 "Queuing frame from PRI_EVENT_PROCEEDING on channel %d/%d span %d\n",
5698 #ifdef PRI_PROGRESS_MASK
5707 && (e->proceeding.progressmask & PRI_PROG_INBAND_AVAILABLE)
5709 && e->proceeding.progress == 8
5728 case PRI_EVENT_FACILITY:
5731 #if defined(HAVE_PRI_CALL_REROUTING)
5733 e->facility.subcall);
5747 #if defined(HAVE_PRI_CALL_REROUTING)
5749 e->facility.subcmds, e->facility.subcall);
5752 e->facility.subcmds, e->facility.call);
5756 case PRI_EVENT_ANSWER:
5758 #if defined(HAVE_PRI_CALL_WAITING)
5760 pri_connect_ack(pri->
pri, e->answer.call, 0);
5770 #if defined(HAVE_PRI_CALL_WAITING)
5780 if (0 <= new_chanpos) {
5784 if (new_chanpos < 0) {
5790 "Span %d: Channel not available for call waiting call.\n",
5794 e->answer.subcmds, e->answer.call);
5812 pri_hangup(pri->
pri, e->answer.call, PRI_CAUSE_NORMAL_CIRCUIT_CONGESTION);
5819 chanpos = new_chanpos;
5825 pri_connect_ack(pri->
pri, e->answer.call, 0);
5830 #if defined(HAVE_PRI_CALL_WAITING)
5837 e->answer.subcmds, e->answer.call);
5841 "Span %d: Channel %d/%d dialing deferred digit string: %s\n",
5861 #ifdef SUPPORT_USERUSER
5869 e->answer.useruserinfo);
5877 #if defined(HAVE_PRI_CALL_WAITING)
5878 case PRI_EVENT_CONNECT_ACK:
5881 e->connect_ack.call);
5885 e->connect_ack.call);
5892 e->connect_ack.subcmds, e->connect_ack.call);
5898 case PRI_EVENT_HANGUP:
5902 pri_hangup(pri->
pri, e->hangup.call, e->hangup.cause);
5911 pri_hangup(pri->
pri, e->hangup.call, e->hangup.cause);
5916 e->hangup.subcmds, e->hangup.call);
5917 switch (e->hangup.cause) {
5918 case PRI_CAUSE_INVALID_CALL_REFERENCE:
5923 pri_hangup(pri->
pri, e->hangup.call, e->hangup.cause);
5932 switch (e->hangup.cause) {
5933 case PRI_CAUSE_USER_BUSY:
5934 case PRI_CAUSE_NORMAL_CIRCUIT_CONGESTION:
5959 switch (e->hangup.cause) {
5960 case PRI_CAUSE_USER_BUSY:
5963 case PRI_CAUSE_CALL_REJECTED:
5964 case PRI_CAUSE_NETWORK_OUT_OF_ORDER:
5965 case PRI_CAUSE_NORMAL_CIRCUIT_CONGESTION:
5966 case PRI_CAUSE_SWITCH_CONGESTION:
5967 case PRI_CAUSE_DESTINATION_OUT_OF_ORDER:
5968 case PRI_CAUSE_NORMAL_TEMPORARY_FAILURE:
5979 #if defined(HAVE_PRI_AOC_EVENTS)
5996 pri_hangup(pri->
pri, pri->
pvts[chanpos]->
call, e->hangup.cause);
5999 ast_verb(3,
"Span %d: Channel %d/%d got hangup, cause %d\n",
6004 pri_hangup(pri->
pri, pri->
pvts[chanpos]->
call, e->hangup.cause);
6007 #if defined(FORCE_RESTART_UNAVAIL_CHANS)
6008 if (e->hangup.cause == PRI_CAUSE_REQUESTED_CHAN_UNAVAIL
6012 "Span %d: Forcing restart of channel %d/%d since channel reported in use\n",
6019 if (e->hangup.aoc_units > -1)
6020 ast_verb(3,
"Channel %d/%d, span %d received AOC-E charging %d unit%s\n",
6023 #ifdef SUPPORT_USERUSER
6031 e->hangup.useruserinfo);
6040 case PRI_EVENT_HANGUP_REQ:
6044 pri_hangup(pri->
pri, e->hangup.call, e->hangup.cause);
6053 pri_hangup(pri->
pri, e->hangup.call, e->hangup.cause);
6058 e->hangup.subcmds, e->hangup.call);
6059 #if defined(HAVE_PRI_CALL_HOLD)
6060 if (e->hangup.call_active && e->hangup.call_held
6065 e->hangup.call_active, 0, NULL, NULL)) {
6071 switch (e->hangup.cause) {
6072 case PRI_CAUSE_USER_BUSY:
6073 case PRI_CAUSE_NORMAL_CIRCUIT_CONGESTION:
6076 case PRI_CAUSE_INVALID_CALL_REFERENCE:
6083 pri_hangup(pri->
pri, e->hangup.call, e->hangup.cause);
6107 switch (e->hangup.cause) {
6108 case PRI_CAUSE_USER_BUSY:
6111 case PRI_CAUSE_CALL_REJECTED:
6112 case PRI_CAUSE_NETWORK_OUT_OF_ORDER:
6113 case PRI_CAUSE_NORMAL_CIRCUIT_CONGESTION:
6114 case PRI_CAUSE_SWITCH_CONGESTION:
6115 case PRI_CAUSE_DESTINATION_OUT_OF_ORDER:
6116 case PRI_CAUSE_NORMAL_TEMPORARY_FAILURE:
6127 #if defined(HAVE_PRI_AOC_EVENTS)
6132 pri_get_timer(pri->
pri, PRI_TIMER_T305) / 2);
6144 ast_verb(3,
"Span %d: Channel %d/%d got hangup request, cause %d\n",
6152 pri_hangup(pri->
pri, pri->
pvts[chanpos]->
call, e->hangup.cause);
6155 #if defined(FORCE_RESTART_UNAVAIL_CHANS)
6156 if (e->hangup.cause == PRI_CAUSE_REQUESTED_CHAN_UNAVAIL
6160 "Span %d: Forcing restart of channel %d/%d since channel reported in use\n",
6168 #ifdef SUPPORT_USERUSER
6176 e->hangup.useruserinfo);
6185 case PRI_EVENT_HANGUP_ACK:
6198 ast_verb(3,
"Span %d: Channel %d/%d got hangup ACK\n", pri->
span,
6201 #ifdef SUPPORT_USERUSER
6209 e->hangup.useruserinfo);
6217 case PRI_EVENT_CONFIG_ERR:
6220 case PRI_EVENT_RESTART_ACK:
6226 for (x = 0; x < pri->
numchans; x++) {
6232 "Span %d: Assuming restart ack is for channel %d/%d\n",
6237 "Span %d: Got restart ack on channel %d/%d with owner\n",
6244 "Span %d: Channel %d/%d successfully restarted\n",
6255 "Span %d: Restart ACK on strange channel %d/%d\n",
6264 "Span %d: Unexpected or late restart ack on channel %d/%d (Ignoring)\n",
6272 "Span %d: Got restart ack on channel %d/%d with owner\n",
6279 "Span %d: Channel %d/%d successfully restarted\n",
6287 case PRI_EVENT_SETUP_ACK:
6300 e->setup_ack.subcmds, e->setup_ack.call);
6307 for (x = 0; x <
len; ++x) {
6309 pri_information(pri->
pri, pri->
pvts[chanpos]->
call,
6335 && ((e->setup_ack.progressmask & PRI_PROG_INBAND_AVAILABLE)
6351 case PRI_EVENT_NOTIFY:
6353 #if defined(HAVE_PRI_CALL_HOLD)
6361 #if defined(HAVE_PRI_CALL_HOLD)
6382 #if defined(HAVE_PRI_CALL_HOLD)
6384 e->notify.subcmds, e->notify.call);
6387 e->notify.subcmds, NULL);
6389 switch (e->notify.info) {
6390 case PRI_NOTIFY_REMOTE_HOLD:
6395 case PRI_NOTIFY_REMOTE_RETRIEVAL:
6403 #if defined(HAVE_PRI_CALL_HOLD)
6404 case PRI_EVENT_HOLD:
6407 pri_hold_rej(pri->
pri, e->hold.call,
6408 PRI_CAUSE_RESOURCE_UNAVAIL_UNSPECIFIED);
6410 pri_hold_ack(pri->
pri, e->hold.call);
6414 #if defined(HAVE_PRI_CALL_HOLD)
6415 case PRI_EVENT_HOLD_ACK:
6419 #if defined(HAVE_PRI_CALL_HOLD)
6420 case PRI_EVENT_HOLD_REJ:
6424 #if defined(HAVE_PRI_CALL_HOLD)
6425 case PRI_EVENT_RETRIEVE:
6430 #if defined(HAVE_PRI_CALL_HOLD)
6431 case PRI_EVENT_RETRIEVE_ACK:
6435 #if defined(HAVE_PRI_CALL_HOLD)
6436 case PRI_EVENT_RETRIEVE_REJ:
6455 memset(pri, 0,
sizeof(*pri));
6474 #if defined(HAVE_PRI_CALL_WAITING)
6492 #if defined(SUPPORT_USERUSER)
6496 pri_call_set_useruser(p->
call, useruser);
6500 #if defined(HAVE_PRI_AOC_EVENTS)
6507 ast_debug(1,
"Already hungup... Calling hangup once, and clearing call\n");
6518 icause = atoi(cause);
6522 "Not yet hungup... Calling hangup with cause %d, and clearing call\n",
6528 #if defined(HAVE_PRI_AOC_EVENTS)
6577 subaddr = strchr(number,
':');
6595 if (strlen(number) < p->
stripmsd) {
6601 deferred = strchr(number,
'w');
6606 while (isalpha(*number)) {
6614 snprintf(called, called_buff_size,
"%s", number);
6617 snprintf(called, called_buff_size,
"%s:%s", number, subaddr);
6646 char *c, *l, *n, *s;
6647 #ifdef SUPPORT_USERUSER
6648 const char *useruser;
6653 int prilocaldialplan;
6656 #if defined(HAVE_PRI_SETUP_KEYPAD)
6711 dialed_subaddress.
type = 2;
6719 dialed_subaddress.
str = s;
6720 dialed_subaddress.
valid = 1;
6732 if (strchr(
"0123456789", *l)) {
6765 if (!(p->
call = pri_new_call(p->
pri->
pri))) {
6770 if (!(sr = pri_sr_new())) {
6781 #if defined(HAVE_PRI_CALL_WAITING)
6787 pri_sr_set_channel(sr, 0, 0, 1);
6804 pri_facility_enable(p->
pri->
pri);
6809 if (pridialplan == -2 || pridialplan == -3) {
6811 if (pridialplan == -2) {
6814 pridialplan = PRI_INTERNATIONAL_ISDN;
6816 if (pridialplan == -2) {
6819 pridialplan = PRI_NATIONAL_ISDN;
6821 pridialplan = PRI_LOCAL_ISDN;
6827 pridialplan = (PRI_TON_UNKNOWN << 4) | (pridialplan & 0xf);
6830 pridialplan = (PRI_TON_INTERNATIONAL << 4) | (pridialplan & 0xf);
6833 pridialplan = (PRI_TON_NATIONAL << 4) | (pridialplan & 0xf);
6836 pridialplan = (PRI_TON_NET_SPECIFIC << 4) | (pridialplan & 0xf);
6839 pridialplan = (PRI_TON_SUBSCRIBER << 4) | (pridialplan & 0xf);
6842 pridialplan = (PRI_TON_ABBREVIATED << 4) | (pridialplan & 0xf);
6845 pridialplan = (PRI_TON_RESERVED << 4) | (pridialplan & 0xf);
6848 pridialplan = PRI_NPI_UNKNOWN | (pridialplan & 0xf0);
6851 pridialplan = PRI_NPI_E163_E164 | (pridialplan & 0xf0);
6854 pridialplan = PRI_NPI_X121 | (pridialplan & 0xf0);
6857 pridialplan = PRI_NPI_F69 | (pridialplan & 0xf0);
6860 pridialplan = PRI_NPI_NATIONAL | (pridialplan & 0xf0);
6863 pridialplan = PRI_NPI_PRIVATE | (pridialplan & 0xf0);
6866 pridialplan = PRI_NPI_RESERVED | (pridialplan & 0xf0);
6877 #if defined(HAVE_PRI_SETUP_KEYPAD)
6882 pri_sr_set_keypad_digits(sr, keypad);
6889 char *called = c + p->
stripmsd + dp_strip;
6891 pri_sr_set_called(sr, called, pridialplan, s ? 1 : 0);
6892 #if defined(HAVE_PRI_SETUP_ACK_INBAND)
6897 #if defined(HAVE_PRI_SUBADDR)
6898 if (dialed_subaddress.
valid) {
6899 struct pri_party_subaddress subaddress;
6901 memset(&subaddress, 0,
sizeof(subaddress));
6903 pri_sr_set_called_subaddress(sr, &subaddress);
6906 #if defined(HAVE_PRI_REVERSE_CHARGE)
6908 pri_sr_set_reversecharge(sr, PRI_REVERSECHARGE_REQUESTED);
6911 #if defined(HAVE_PRI_AOC_EVENTS)
6914 if (strchr(opt_args[OPT_ARG_AOC_REQUEST],
's')) {
6915 pri_sr_set_aoc_charging_request(sr, PRI_AOC_REQUEST_S);
6917 if (strchr(opt_args[OPT_ARG_AOC_REQUEST],
'd')) {
6918 pri_sr_set_aoc_charging_request(sr, PRI_AOC_REQUEST_D);
6920 if (strchr(opt_args[OPT_ARG_AOC_REQUEST],
'e')) {
6921 pri_sr_set_aoc_charging_request(sr, PRI_AOC_REQUEST_E);
6946 if ((l != NULL) && (prilocaldialplan == -2 || prilocaldialplan == -3)) {
6948 if (prilocaldialplan == -2) {
6951 prilocaldialplan = PRI_INTERNATIONAL_ISDN;
6953 if (prilocaldialplan == -2) {
6956 prilocaldialplan = PRI_NATIONAL_ISDN;
6958 prilocaldialplan = PRI_LOCAL_ISDN;
6962 while (*l >
'9' && *l !=
'*' && *l !=
'#') {
6965 prilocaldialplan = (PRI_TON_UNKNOWN << 4) | (prilocaldialplan & 0xf);
6968 prilocaldialplan = (PRI_TON_INTERNATIONAL << 4) | (prilocaldialplan & 0xf);
6971 prilocaldialplan = (PRI_TON_NATIONAL << 4) | (prilocaldialplan & 0xf);
6974 prilocaldialplan = (PRI_TON_NET_SPECIFIC << 4) | (prilocaldialplan & 0xf);
6977 prilocaldialplan = (PRI_TON_SUBSCRIBER << 4) | (prilocaldialplan & 0xf);
6980 prilocaldialplan = (PRI_TON_ABBREVIATED << 4) | (prilocaldialplan & 0xf);
6983 prilocaldialplan = (PRI_TON_RESERVED << 4) | (prilocaldialplan & 0xf);
6986 prilocaldialplan = PRI_NPI_UNKNOWN | (prilocaldialplan & 0xf0);
6989 prilocaldialplan = PRI_NPI_E163_E164 | (prilocaldialplan & 0xf0);
6992 prilocaldialplan = PRI_NPI_X121 | (prilocaldialplan & 0xf0);
6995 prilocaldialplan = PRI_NPI_F69 | (prilocaldialplan & 0xf0);
6998 prilocaldialplan = PRI_NPI_NATIONAL | (prilocaldialplan & 0xf0);
7001 prilocaldialplan = PRI_NPI_PRIVATE | (prilocaldialplan & 0xf0);
7004 prilocaldialplan = PRI_NPI_RESERVED | (prilocaldialplan & 0xf0);
7009 "Unrecognized prilocaldialplan %s modifier: %c\n",
7010 *l >
'Z' ?
"NPI" :
"TON", *l);
7017 pri_sr_set_caller(sr, l ? (l + ldp_strip) : NULL, n, prilocaldialplan,
7020 #if defined(HAVE_PRI_SUBADDR)
7022 struct pri_party_subaddress subaddress;
7024 memset(&subaddress, 0,
sizeof(subaddress));
7026 pri_sr_set_caller_subaddress(sr, &subaddress);
7032 #ifdef SUPPORT_USERUSER
7036 pri_sr_set_useruser(sr, useruser);
7039 #if defined(HAVE_PRI_CCSS)
7075 if (core_id == -1 && pri_setup(p->
pri->
pri, p->
call, sr)) {
7096 switch (condition) {
7110 #ifdef HAVE_PRI_PROG_W_CAUSE
7136 ast_debug(1,
"Received AST_CONTROL_PROCEEDING on %s\n",chan->
name);
7149 ast_debug(1,
"Received AST_CONTROL_PROGRESS on %s\n",chan->
name);
7156 #ifdef HAVE_PRI_PROG_W_CAUSE
7209 #ifdef HAVE_PRI_PROG_W_CAUSE
7241 ast_debug(1,
"Received AST_CONTROL_CONNECTED_LINE on %s\n", chan->
name);
7243 struct pri_party_connected_line connected;
7246 memset(&connected, 0,
sizeof(connected));
7249 pri_connected_line_update(p->
pri->
pri, p->
call, &connected);
7254 ast_debug(1,
"Received AST_CONTROL_REDIRECTING on %s\n", chan->
name);
7262 #if defined(HAVE_PRI_AOC_EVENTS)
7266 ast_debug(1,
"Received AST_CONTROL_AOC on %s\n", chan->
name);
7267 if (decoded && p->
pri) {
7291 "Received final AOC-E msg, continue with hangup on %s\n",
7323 #if defined(HAVE_PRI_AOC_EVENTS)
7328 pri_aoc_s_request_response_send(p->
pri->
pri, p->
call,
7366 #if defined(HAVE_PRI_CALL_WAITING)
7392 for (idx = 0; idx < pri->
numchans; ++idx) {
7402 cw = pri->
pvts[idx];
7440 #if defined(HAVE_PRI_CALL_WAITING)
7441 if (!is_specific_channel) {
7467 if (len <
sizeof(pvt->
dialdest) - 1) {
7468 ast_debug(1,
"Queueing digit '%c' since setup_ack not yet received\n",
7474 "Span %d: Deferred digit buffer overflow for digit '%c'.\n",
7481 pri_information(pvt->
pri->
pri, pvt->
call, digit);
7487 "Span %d: Digit '%c' may be ignored by peer. (Call level:%u(%s))\n",
7529 #if defined(HAVE_PRI_MWI)
7544 struct pri_party_id mailbox;
7546 ast_debug(1,
"Send MWI indication for %s@%s num_messages:%d\n", mbox_number,
7547 mbox_context, num_messages);
7549 memset(&mailbox, 0,
sizeof(mailbox));
7550 mailbox.number.valid = 1;
7551 mailbox.number.presentation = PRES_ALLOWED_USER_NUMBER_NOT_SCREENED;
7552 mailbox.number.plan = (PRI_TON_UNKNOWN << 4) | PRI_NPI_UNKNOWN;
7553 ast_copy_string(mailbox.number.str, mbox_number,
sizeof(mailbox.number.str));
7556 pri_mwi_indicate(pri->
pri, &mailbox, 1 , num_messages, NULL, NULL, -1, 0);
7561 #if defined(HAVE_PRI_MWI)
7575 const char *mbox_context;
7576 const char *mbox_number;
7592 #if defined(HAVE_PRI_MWI)
7640 #if defined(HAVE_PRI_MWI)
7644 #if defined(HAVE_PRI_MWI)
7707 #if defined(HAVE_PRI_MWI)
7714 #if defined(HAVE_PRI_MWI)
7726 #if defined(HAVE_PRI_MWI)
7734 mbox_number =
strsep(&saveptr,
",");
7739 mbox_context = strchr(mbox_number,
'@');
7741 *mbox_context++ =
'\0';
7751 mbox_context =
"default";
7755 ast_str_set(&mwi_description, -1,
"%s span %d[%d] MWI mailbox %s@%s",
7763 ast_log(
LOG_ERROR,
"%s span %d could not subscribe to MWI events for %s@%s.",
7774 if (pri->
fds[i] == -1) {
7787 #if defined(HAVE_PRI_SERVICE_MESSAGES)
7789 pri_set_service_message_support(pri->
dchans[i], 1);
7796 #ifdef HAVE_PRI_PROG_W_CAUSE
7799 #ifdef HAVE_PRI_INBANDDISCONNECT
7806 if (pri->
fds[i] > 0)
7814 #ifdef PRI_GETSET_TIMERS
7815 for (x = 0; x < PRI_MAX_TIMERS; x++) {
7825 #if defined(HAVE_PRI_CALL_HOLD)
7826 pri_hold_enable(pri->
pri, 1);
7828 #if defined(HAVE_PRI_CALL_REROUTING)
7829 pri_reroute_enable(pri->
pri, 1);
7831 #if defined(HAVE_PRI_HANGUP_FIX)
7832 pri_hangup_fix_enable(pri->
pri, 1);
7834 #if defined(HAVE_PRI_CCSS)
7835 pri_cc_enable(pri->
pri, 1);
7840 #if defined(HAVE_PRI_TRANSFER)
7841 pri_transfer_enable(pri->
pri, 1);
7843 #if defined(HAVE_PRI_AOC_EVENTS)
7844 pri_aoc_events_enable(pri->
pri, 1);
7846 #if defined(HAVE_PRI_CALL_WAITING)
7847 pri_connect_ack_enable(pri->
pri, 1);
7849 #if defined(HAVE_PRI_MCID)
7850 pri_mcid_enable(pri->
pri, 1);
7852 #if defined(HAVE_PRI_L2_PERSISTENCE)
7861 if (pri->
fds[i] > 0)
7869 #if defined(HAVE_PRI_MWI)
7899 if (pri_get_timer(p->
pri->
pri, PRI_TIMER_T309) < 0) {
7937 p->
calls = callback;
7958 #define SIG_PRI_SC_HEADER "%-4s %4s %-4s %-4s %-10s %-4s %s\n"
7959 #define SIG_PRI_SC_LINE "%4d %4d %-4s %-4s %-10s %-4s %s"
7973 for (idx = 0; idx < pri->
numchans; ++idx) {
7974 if (!pri->
pvts[idx]) {
7977 pvt = pri->
pvts[idx];
7992 pvt->
call ?
"Yes" :
"No",
8009 if (!s || len < 1) {
8014 strncat(s,
"In Alarm, ", len - strlen(s) - 1);
8016 strncat(s,
"Up", len - strlen(s) - 1);
8018 strncat(s,
"Down", len - strlen(s) - 1);
8020 strncat(s,
", Active", len - strlen(s) - 1);
8022 strncat(s,
", Standby", len - strlen(s) - 1);
8033 ast_cli(fd,
"PRI span %d/%d: %s\n", span, x, status);
8045 #ifdef PRI_DUMP_INFO_STR
8046 char *info_str = NULL;
8050 ast_cli(fd,
"Status: %s\n", status);
8052 #ifdef PRI_DUMP_INFO_STR
8053 info_str = pri_dump_info_str(pri->
pri);
8059 pri_dump_info(pri->
pri);
8073 ast_debug(1,
"Unable to find pri or call on channel!\n");
8079 pri_keypad_facility(p->
pri->
pri, p->
call, digits);
8100 res = pri_callrerouting_facility(p->
pri->
pri, p->
call, destination, original, reason);
8108 #if defined(HAVE_PRI_SERVICE_MESSAGES)
8114 return pri_maintenance_service(pri, span, channel, changestatus);
8120 if (pchan->
owner == oldchan) {
8121 pchan->
owner = newchan;
8125 #if defined(HAVE_PRI_CCSS)
8152 cc_pvt->
pri = pvt_chan->
pri;
8155 if (cc_pvt->
cc_id == -1) {
8164 #if defined(HAVE_PRI_CCSS)
8193 #if defined(HAVE_PRI_CCSS)
8214 #if defined(HAVE_PRI_CCSS)
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.";
8263 res = pri_cc_req_rsp(cc_pvt->
pri->
pri, cc_pvt->
cc_id, status);
8267 failed_msg = failed_to_send;
8274 failed_msg = failed_to_send;
8276 failed_msg = not_accepted;
8289 #if defined(HAVE_PRI_CCSS)
8311 pri_cc_status_req(cc_pvt->
pri->
pri, cc_pvt->
cc_id);
8317 #if defined(HAVE_PRI_CCSS)
8346 pri_cc_stop_alerting(cc_pvt->
pri->
pri, cc_pvt->
cc_id);
8352 #if defined(HAVE_PRI_CCSS)
8386 #if defined(HAVE_PRI_CCSS)
8410 #if defined(HAVE_PRI_CCSS)
8436 pri_cc_remote_user_free(cc_pvt->
pri->
pri, cc_pvt->
cc_id);
8442 #if defined(HAVE_PRI_CCSS)
8472 res = pri_cc_req_rsp(cc_pvt->
pri->
pri, cc_pvt->
cc_id, 2);
8482 #if defined(HAVE_PRI_CCSS)
8497 return monitor_instance->
core_id;
8501 #if defined(HAVE_PRI_CCSS)
8522 #if defined(HAVE_PRI_CCSS)
8563 res = pri_cc_req(instance->
pri->
pri, instance->
cc_id, cc_mode);
8570 #if defined(HAVE_PRI_CCSS)
8590 pri_cc_status(instance->
pri->
pri, instance->
cc_id, 1);
8597 #if defined(HAVE_PRI_CCSS)
8616 pri_cc_status(instance->
pri->
pri, instance->
cc_id, 0);
8623 #if defined(HAVE_PRI_CCSS)
8660 pri_cc_status_req_rsp(instance->
pri->
pri, instance->
cc_id, cc_status);
8667 #if defined(HAVE_PRI_CCSS)
8696 #if defined(HAVE_PRI_CCSS)
8712 instance = monitor_pvt;
8732 #if defined(HAVE_PRI_CCSS)
8736 if (!sig_pri_cc_monitors) {
8751 #if defined(HAVE_PRI_CCSS)
8752 if (sig_pri_cc_monitors) {
8753 ao2_ref(sig_pri_cc_monitors, -1);
8754 sig_pri_cc_monitors = NULL;
int aoc_s_request_invoke_id
int max_call_waiting_calls
Number of extra outgoing calls to allow on a span before considering that span congested.
struct ast_aoc_s_entry * ast_aoc_s_get_rate_info(struct ast_aoc_decoded *decoded, unsigned int entry_number)
get a specific AOC-S rate entry.
int sig_pri_answer(struct sig_pri_chan *p, struct ast_channel *ast)
int ast_cc_monitor_failed(int core_id, const char *const monitor_name, const char *const debug,...)
Indicate that a failure has occurred on a specific monitor.
static void sig_pri_mwi_cache_update(struct sig_pri_span *pri)
static void sig_pri_party_id_convert(struct ast_party_id *ast_id, const struct pri_party_id *pri_id, struct sig_pri_span *pri)
union ast_frame_subclass subclass
int ast_hangup(struct ast_channel *chan)
Hang up a channel.
const char * context
Mailbox context.
Information needed to identify an endpoint in a call.
static void sig_pri_fixup_chans(struct sig_pri_chan *old_chan, struct sig_pri_chan *new_chan)
static void sig_pri_handle_dchan_exception(struct sig_pri_span *pri, int index)
void ast_party_connected_line_init(struct ast_party_connected_line *init)
Initialize the given connected line structure.
int presentation
Q.931 encoded presentation-indicator encoded field.
void ast_std_free(void *ptr)
int dchan_logical_span[SIG_PRI_NUM_DCHANS]
#define ast_channel_lock(chan)
int ast_matchmore_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Looks to see if adding anything to this extension might match something. (exists ^ canmatch) ...
#define DAHDI_OVERLAPDIAL_INCOMING
static char exten[AST_MAX_EXTENSION]
#define SIG_PRI_SC_HEADER
int ast_aoc_s_add_rate_duration(struct ast_aoc_decoded *decoded, enum ast_aoc_s_charged_item charged_item, unsigned int amount, enum ast_aoc_currency_multiplier multiplier, const char *currency_name, unsigned long time, enum ast_aoc_time_scale time_scale, unsigned long granularity_time, enum ast_aoc_time_scale granularity_time_scale, int step_function)
Add AOC-S duration rate entry.
Main Channel structure associated with a channel.
ast_device_state
Device States.
static void sig_pri_mcid_event(struct sig_pri_span *pri, const struct pri_subcmd_mcid_req *mcid, struct ast_channel *owner)
unsigned int alreadyhungup
int plan
Q.931 Type-Of-Number and Numbering-Plan encoded fields.
static int detect_aoc_e_subcmd(const struct pri_subcommands *subcmds)
char * str
Subscriber phone number (Malloced)
static void * pri_ss_thread(void *data)
#define AST_APP_OPTION_ARG(option, flagno, argno)
Declares an application option that accepts an argument.
General Asterisk channel transcoding definitions.
struct ast_party_connected_line connected
Channel Connected Line ID information.
unsigned int priexclusive
char keypad_digits[AST_MAX_EXTENSION]
Keypad digits that came in with the SETUP message.
int cc_qsig_signaling_link_req
Asterisk main include file. File version handling, generic pbx functions.
void sig_pri_dial_complete(struct sig_pri_chan *pvt, struct ast_channel *ast)
DTMF dial string complete.
#define ao2_link(arg1, arg2)
#define AST_APP_OPTIONS(holder, options...)
Declares an array of options for an application.
char * str
Subscriber phone number (Malloced)
void ast_channel_set_caller_event(struct ast_channel *chan, const struct ast_party_caller *caller, const struct ast_set_party_caller *update)
Set the caller id information in the Asterisk channel and generate an AMI event if the caller id name...
struct ast_frame ast_null_frame
struct ast_party_caller caller
Channel Caller ID information.
void(* module_unref)(void)
int reverse_charging_indication
Reverse charging indication.
static void sig_pri_send_mwi_indication(struct sig_pri_span *pri, const char *mbox_number, const char *mbox_context, int num_messages)
char * strsep(char **str, const char *delims)
static const char dahdi_db[]
The AstDB family.
static int pri_grab(struct sig_pri_chan *p, struct sig_pri_span *pri)
void sig_pri_fixup(struct ast_channel *oldchan, struct ast_channel *newchan, struct sig_pri_chan *pchan)
int ast_aoc_set_termination_request(struct ast_aoc_decoded *decoded)
Mark the AST_AOC_REQUEST message as a termination request.
static void sig_pri_party_name_from_ast(struct pri_party_name *pri_name, const struct ast_party_name *ast_name)
static void sig_pri_dsp_reset_and_flush_digits(struct sig_pri_chan *p)
int ast_cc_failed(int core_id, const char *const debug,...)
Indicate failure has occurred.
unsigned int use_callingpres
const ast_string_field uniqueid
static char * redirectingreason2str(int redirectingreason)
int presentation
Q.931 presentation-indicator and screening-indicator encoded fields.
static void sig_pri_party_subaddress_from_ast(struct pri_party_subaddress *pri_subaddress, const struct ast_party_subaddress *ast_subaddress)
CallerID (and other GR30) management and generation Includes code and algorithms from the Zapata libr...
#define ast_pthread_create_detached(a, b, c, d)
int ast_aoc_add_unit_entry(struct ast_aoc_decoded *decoded, const unsigned int amount_is_present, const unsigned int amount, const unsigned int type_is_present, const unsigned int type)
Adds a unit entry into the list of units.
int ast_cc_get_current_core_id(struct ast_channel *chan)
Get the core id for the current call.
struct ast_party_id id
Connected party ID.
static int ast_to_pri_presentation(int ast_presentation)
int sig_pri_cc_agent_start_offer_timer(struct ast_cc_agent *agent)
Start the offer timer.
const char * ast_describe_caller_presentation(int data)
Convert caller ID pres value to explanatory string.
void(*const make_cc_dialstring)(void *pvt, char *buf, size_t buf_size)
#define ast_test_flag(p, flag)
#define AST_CAUSE_SWITCH_CONGESTION
void ast_channel_setwhentohangup_tv(struct ast_channel *chan, struct timeval offset)
Set when to hang a channel up.
unsigned int priindication_oob
unsigned int use_callerid
char idleext[AST_MAX_EXTENSION]
struct ast_party_name name
Subscriber name.
int sig_pri_start_pri(struct sig_pri_span *pri)
struct ast_party_id from
Who is redirecting the call (Sent to the party the call is redirected toward)
#define AST_CAUSE_UNALLOCATED
unsigned int hold_disconnect_transfer
TRUE if held calls are transferred on disconnect.
static void sig_pri_aoc_s_from_ast(struct sig_pri_chan *pvt, struct ast_aoc_decoded *decoded)
void(* xfer_rsp_callback)(void *data, int is_successful)
Protocol callback to indicate if transfer will happen.
char context[AST_MAX_CONTEXT]
static void sig_pri_sort_pri_chans(struct sig_pri_span *pri)
unsigned int transfer
TRUE if call transfer is enabled for the span.
unsigned int allow_call_waiting_calls
TRUE if we will allow incoming ISDN call waiting calls.
struct ast_aoc_duration_rate duration
#define DEADLOCK_AVOIDANCE(lock)
void sig_pri_init_pri(struct sig_pri_span *pri)
Interface header for PRI signaling module.
enum ast_pbx_result ast_pbx_start(struct ast_channel *c)
Create a new thread and start the PBX.
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().
struct ast_channel * sig_pri_request(struct sig_pri_chan *p, enum sig_pri_law law, const struct ast_channel *requestor, int transfercapability)
static int ast_to_pri_reason(enum AST_REDIRECTING_REASON ast_reason)
static int sig_pri_play_tone(struct sig_pri_chan *p, enum sig_pri_tone tone)
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
int sig_pri_cc_agent_callee_available(struct ast_cc_agent *agent)
Alert the caller that it is time to try recalling.
int ast_aoc_s_add_rate_flat(struct ast_aoc_decoded *decoded, enum ast_aoc_s_charged_item charged_item, unsigned int amount, enum ast_aoc_currency_multiplier multiplier, const char *currency_name)
Add AOC-S flat rate entry.
int ast_party_id_presentation(const struct ast_party_id *id)
Determine the overall presentation value for the given party.
#define ao2_callback(c, flags, cb_fn, arg)
void ast_verbose(const char *fmt,...)
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.
static void sig_pri_set_outgoing(struct sig_pri_chan *p, int is_outgoing)
void(*const set_rdnis)(void *pvt, const char *rdnis)
int ast_cc_agent_caller_busy(int core_id, const char *const debug,...)
Indicate that the caller is busy.
char idlecontext[AST_MAX_CONTEXT]
#define SRVST_TYPE_OOS
The out-of-service SERVICE state.
static void sig_pri_dial_digits(struct sig_pri_chan *p, const char *dial_string)
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
struct ast_channel * owner
static int pri_gendigittimeout
#define HAVE_PRI_CALL_WAITING
struct sig_pri_span::@120 ch_cfg
static int sig_pri_attempt_transfer(struct sig_pri_span *pri, q931_call *call_1_pri, int call_1_held, q931_call *call_2_pri, int call_2_held, xfer_rsp_callback rsp_callback, void *data)
static void sig_pri_aoc_e_from_pri(const struct pri_subcmd_aoc_e *aoc_e, struct ast_channel *owner, int passthrough)
struct sig_pri_callback * calls
int ast_cc_agent_status_response(int core_id, enum ast_device_state devstate)
Response with a caller's current status.
enum ast_aoc_total_type ast_aoc_get_total_type(struct ast_aoc_decoded *decoded)
get the type of total for a AOC-D message
int ast_cc_monitor_request_acked(int core_id, const char *const debug,...)
Indicate that an outbound entity has accepted our CC request.
char cid_ani[AST_MAX_EXTENSION]
unsigned int aoc_s_request_invoke_id_valid
unsigned int hidecalleridname
static int ast_to_pri_char_set(enum AST_PARTY_CHAR_SET ast_char_set)
int sig_pri_cc_agent_status_req(struct ast_cc_agent *agent)
Request the status of the agent's device.
static void pri_check_restart(struct sig_pri_span *pri)
#define HAVE_PRI_SETUP_ACK_INBAND
struct ast_aoc_charging_association_number number
int sig_pri_digit_begin(struct sig_pri_chan *pvt, struct ast_channel *ast, char digit)
struct ast_frame * ast_read(struct ast_channel *chan)
Reads a frame.
int ast_cc_monitor_party_b_free(int core_id)
Alert a caller that though the callee has become free, the caller himself is not and may not call bac...
struct ast_party_redirecting redirecting
Redirecting/Diversion information.
enum ast_cc_service_type service
void(*const fixup_chans)(void *old_chan, void *new_chan)
#define AST_PRES_USER_NUMBER_FAILED_SCREEN
int char_set
Character set the name is using.
void * ast_aoc_destroy_decoded(struct ast_aoc_decoded *decoded)
free an ast_aoc_decoded object
struct ast_event * ast_event_get_cached(enum ast_event_type,...)
Retrieve an event from the cache.
unsigned int enable_service_message_support
unsigned int aoce_delayhangup
int ast_ignore_pattern(const char *context, const char *pattern)
Checks to see if a number should be ignored.
ast_channel_state
ast_channel states
static int sig_pri_cc_available(struct sig_pri_span *pri, int chanpos, long cc_id, enum ast_cc_service_type service)
char * str
Subscriber name (Malloced)
enum sig_pri_reset_state resetting
Channel reset/restart state.
int ast_aoc_s_add_rate_special_charge_code(struct ast_aoc_decoded *decoded, enum ast_aoc_s_charged_item charged_item, unsigned int code)
Add AOC-S special rate entry.
#define DAHDI_OVERLAPDIAL_OUTGOING
static enum AST_PARTY_CHAR_SET pri_to_ast_char_set(int pri_char_set)
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
unsigned char valid
TRUE if the subaddress information is valid/present.
unsigned int no_b_channel
TRUE if this interface has no B channel. (call hold and call waiting)
static void sig_pri_set_dnid(struct sig_pri_chan *p, const char *dnid)
The channel is not being RESTARTed.
int sig_pri_cc_agent_party_b_free(struct ast_cc_agent *agent)
Let the caller know that the callee has become free but that the caller cannot attempt to call back b...
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
Number of new messages Used by: AST_EVENT_MWI Payload type: UINT.
struct ast_str * ast_str_create(size_t init_len)
Create a malloc'ed dynamic length string.
static const char * pri_order(int level)
static struct sig_pri_chan * sig_pri_cw_available(struct sig_pri_span *pri)
void sig_pri_set_alarm(struct sig_pri_chan *p, int in_alarm)
uint8_t charging_type
Charging interval type.
#define ast_mutex_lock(a)
static void sig_pri_init_config(struct sig_pri_chan *pvt, struct sig_pri_span *pri)
unsigned short transfercapability
const char * number
Mailbox number.
#define ast_str_alloca(init_len)
int64_t ast_tvdiff_ms(struct timeval end, struct timeval start)
Computes the difference (in milliseconds) between two struct timeval instances.
void ast_party_id_free(struct ast_party_id *doomed)
Destroy the party id contents.
void ast_party_connected_line_free(struct ast_party_connected_line *doomed)
Destroy the connected line information contents.
int ast_aoc_s_add_rate_volume(struct ast_aoc_decoded *decoded, enum ast_aoc_s_charged_item charged_item, enum ast_aoc_volume_unit volume_unit, unsigned int amount, enum ast_aoc_currency_multiplier multiplier, const char *currency_name)
Add AOC-S volume rate entry.
ast_aoc_currency_multiplier
Defines the currency multiplier for an aoc message.
ast_cc_agent_response_reason
Generic File Format Support. Should be included by clients of the file handling routines. File service providers should instead include mod_format.h.
void(*const init_config)(void *pvt, struct sig_pri_span *pri)
#define SIG_PRI_AOC_GRANT_S
int dchanavail[SIG_PRI_NUM_DCHANS]
int ast_aoc_manager_event(const struct ast_aoc_decoded *decoded, struct ast_channel *chan)
generate AOC manager event for an AOC-S, AOC-D, or AOC-E msg
int ast_queue_cc_frame(struct ast_channel *chan, const char *const monitor_type, const char *const dialstring, enum ast_cc_service_type service, void *private_data)
Queue an AST_CONTROL_CC frame.
char * str
Malloced subaddress string.
int ast_cc_agent_accept_request(int core_id, const char *const debug,...)
Accept inbound CC request.
unsigned service_status
Active SRVST_DBKEY out-of-service status value.
int ast_aoc_s_add_rate_free(struct ast_aoc_decoded *decoded, enum ast_aoc_s_charged_item charged_item, int from_beginning)
Add AOC-S indicating charge item is free.
int sig_pri_load(const char *cc_type_name)
Load the sig_pri submodule.
void ast_cli(int fd, const char *fmt,...)
#define AST_CAUSE_INVALID_NUMBER_FORMAT
int ast_cc_agent_recalling(int core_id, const char *const debug,...)
Tell the CC core that a caller is currently recalling.
void sig_pri_chan_delete(struct sig_pri_chan *doomed)
Delete the sig_pri private channel structure.
static void sig_pri_aoc_e_from_ast(struct sig_pri_chan *pvt, struct ast_aoc_decoded *decoded)
static void sig_pri_mwi_event_cb(const struct ast_event *event, void *userdata)
unsigned int inband_on_setup_ack
static void sig_pri_span_devstate_changed(struct sig_pri_span *pri)
static void sig_pri_handle_retrieve(struct sig_pri_span *pri, pri_event *ev)
void ast_moh_stop(struct ast_channel *chan)
Turn off music on hold on a given channel.
#define AST_PRES_NETWORK_NUMBER
void sig_pri_cli_show_span(int fd, int *dchannels, struct sig_pri_span *pri)
static void pri_rel(struct sig_pri_span *pri)
static void sig_pri_handle_subcmds(struct sig_pri_span *pri, int chanpos, int event_id, int channel, const struct pri_subcommands *subcmds, q931_call *call_rsp)
unsigned char odd_even_indicator
TRUE if odd number of address signals.
#define ast_verb(level,...)
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.
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...
struct sig_pri_span * pri
Asterisk span D channel control structure.
ast_cc_monitor_policies
The various possibilities for cc_monitor_policy values.
int ast_canmatch_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Looks for a valid matching extension.
void sig_pri_cli_show_channels(int fd, struct sig_pri_span *pri)
static unsigned int PVT_TO_CHANNEL(struct sig_pri_chan *p)
const char * pbx_builtin_getvar_helper(struct ast_channel *chan, const char *name)
Return a pointer to the value of the corresponding channel variable.
static void sig_pri_transfer_rsp(void *data, int is_successful)
struct ast_cc_config_params * ast_channel_get_cc_config_params(struct ast_channel *chan)
Get the CCSS parameters from a channel.
#define AST_PRES_RESTRICTED
unsigned int no_d_channels
enum ast_cc_monitor_policies ast_get_cc_monitor_policy(struct ast_cc_config_params *config)
Get the cc_monitor_policy.
#define ast_pthread_create_background(a, b, c, d)
static void pri_queue_control(struct sig_pri_span *pri, int chanpos, int subclass)
int ast_aoc_set_association_number(struct ast_aoc_decoded *decoded, const char *num, uint8_t plan)
set the charging accociation number for an AOC-E message
int cc_qsig_signaling_link_rsp
static void pri_find_dchan(struct sig_pri_span *pri)
unsigned int ast_aoc_s_get_count(struct ast_aoc_decoded *decoded)
get the number rates associated with an AOC-S message
int sig_pri_call(struct sig_pri_chan *p, struct ast_channel *ast, char *rdest, int timeout, int layer1)
static enum ast_aoc_s_charged_item sig_pri_aoc_charged_item_to_ast(enum PRI_AOC_CHARGED_ITEM value)
static enum PRI_AOC_TIME_SCALE sig_pri_aoc_scale_to_pri(enum ast_aoc_time_scale value)
int ast_str_set(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Set a dynamic string using variable arguments.
struct ast_party_id id
Caller party ID.
static int sig_pri_aoc_multiplier_from_pri(const int mult)
static int sig_pri_msn_match(const char *msn_patterns, const char *exten)
static void sig_pri_party_number_convert(struct ast_party_number *ast_number, const struct pri_party_number *pri_number, struct sig_pri_span *pri)
#define ast_debug(level,...)
Log a DEBUG message.
static unsigned char ast_pri_pack_hex_char(char c)
void sig_pri_cc_agent_destructor(struct ast_cc_agent *agent)
Destroy private data on the agent.
Context IE Used by AST_EVENT_MWI Payload type: str.
static void sig_pri_open_media(struct sig_pri_chan *p)
Generic Advice of Charge encode and decode routines.
struct sig_pri_mbox mbox[SIG_PRI_MAX_MWI_MAILBOXES]
Active MWI mailboxes.
struct ast_aoc_decoded * ast_aoc_decode(struct ast_aoc_encoded *encoded, size_t size, struct ast_channel *chan)
decodes an encoded aoc payload.
struct ast_aoc_charging_association * ast_aoc_get_association_info(struct ast_aoc_decoded *decoded)
get the charging association info for AOC-E messages
void ast_channel_queue_connected_line_update(struct ast_channel *chan, const struct ast_party_connected_line *connected, const struct ast_set_party_connected_line *update)
Queue a connected line update frame on a channel.
static void sig_pri_event_party_id(struct ast_str **msg, const char *prefix, struct ast_party_id *party)
struct ast_party_id ani
Automatic Number Identification (ANI)
int ast_cc_agent_set_interfaces_chanvar(struct ast_channel *chan)
Set the first level CC_INTERFACES channel variable for a channel.
static int pri_find_fixup_principle(struct sig_pri_span *pri, int channel, q931_call *call)
void(*const set_dialing)(void *pvt, int is_dialing)
#define AST_PRES_USER_NUMBER_UNSCREENED
unsigned int inband_on_proceeding
int sig_pri_cc_monitor_unsuspend(struct ast_cc_monitor *monitor)
Unsuspend monitoring.
static int ast_pri_pack_hex_string(unsigned char *dst, char *src, int maxlen)
struct ast_party_dialed::@155 number
Dialed/Called number.
void(*const set_dnid)(void *pvt, const char *dnid)
static void sig_pri_aoc_s_from_pri(const struct pri_subcmd_aoc_s *aoc_s, struct ast_channel *owner, int passthrough)
#define ast_mutex_trylock(a)
static void sig_pri_set_digital(struct sig_pri_chan *p, int is_digital)
#define SRVST_DBKEY
Persistent Service State.
int ast_setup_cc_recall_datastore(struct ast_channel *chan, const int core_id)
Set up a CC recall datastore on a channel.
void ast_party_subaddress_free(struct ast_party_subaddress *doomed)
Destroy the party subaddress contents.
static int pri_fixup_principle(struct sig_pri_span *pri, int principle, q931_call *call)
int ast_aoc_s_add_rate_na(struct ast_aoc_decoded *decoded, enum ast_aoc_s_charged_item charged_item)
Add AOC-S entry indicating charge item is not available.
#define AST_PTHREADT_NULL
static force_inline int attribute_pure ast_strlen_zero(const char *s)
enum sig_pri_call_level call_level
struct ast_aoc_encoded * ast_aoc_encode(struct ast_aoc_decoded *decoded, size_t *out_size, struct ast_channel *chan)
encodes a decoded aoc structure so it can be passed on the wire
int sig_pri_is_chan_available(struct sig_pri_chan *pvt)
Determine if a private channel structure is available.
int(*const play_tone)(void *pvt, enum sig_pri_tone tone)
static void sig_pri_set_subaddress(struct ast_party_subaddress *ast_subaddress, const struct pri_party_subaddress *pri_subaddress)
void(*const set_alarm)(void *pvt, int in_alarm)
#define AST_MAX_EXTENSION
static void sig_pri_cc_monitor_instance_destroy(void *data)
char * ast_strip(char *s)
Strip leading/trailing whitespace from a string.
#define AST_CAUSE_NORMAL_CLEARING
void(*const lock_private)(void *pvt)
static void apply_plan_to_existing_number(char *buf, size_t size, const struct sig_pri_span *pri, const char *number, int plan)
void(*const queue_control)(void *pvt, int subclass)
Caller Party information.
#define ao2_ref(o, delta)
#define S_COR(a, b, c)
returns the equivalent of logic or for strings, with an additional boolean check: second one if not e...
static const char * sig_pri_get_orig_dialstring(struct sig_pri_chan *p)
struct sig_pri_span * pri
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 ast_cc_agent_caller_available(int core_id, const char *const debug,...)
Indicate that a previously unavailable caller has become available.
struct ast_aoc_flat_rate flat
char internationalprefix[10]
char currency_name[AOC_CURRENCY_NAME_SIZE]
void sig_pri_cc_monitor_destructor(void *monitor_pvt)
Destroy PRI private data on the monitor.
void ast_channel_set_redirecting(struct ast_channel *chan, const struct ast_party_redirecting *redirecting, const struct ast_set_party_redirecting *update)
Set the redirecting id information in the Asterisk channel.
The channel is being RESTARTed.
struct pri_subcmd_aoc_e aoc_e
struct sig_pri_span * pri
struct sig_pri_callback * calls
int sig_pri_cc_agent_start_monitoring(struct ast_cc_agent *agent)
Begin monitoring a busy device.
static int sig_pri_cmp_pri_chans(const void *left, const void *right)
static struct sig_pri_cc_monitor_instance * sig_pri_cc_monitor_instance_init(int core_id, struct sig_pri_span *pri, long cc_id, const char *device_name)
int ast_exists_extension(struct ast_channel *c, const char *context, const char *exten, int priority, const char *callerid)
Determine whether an extension exists.
void(*const handle_dchan_exception)(struct sig_pri_span *pri, int index)
void sig_pri_cli_show_channels_header(int fd)
void sig_pri_cc_agent_req_rsp(struct ast_cc_agent *agent, enum ast_cc_agent_response_reason reason)
Response to a CC request.
AST_REDIRECTING_REASON
redirecting reason codes.
unsigned int holding_aoce
static const char * sig_pri_call_level2str(enum sig_pri_call_level level)
Core PBX routines and definitions.
unsigned int ast_aoc_get_currency_amount(struct ast_aoc_decoded *decoded)
get the currency amount for AOC-D and AOC-E messages
int ast_queue_frame(struct ast_channel *chan, struct ast_frame *f)
Queue one or more frames to a channel's frame queue.
int sig_pri_is_alarm_ignored(struct sig_pri_span *pri)
Determine if layer 1 alarms are ignored.
static int pri_find_principle_by_call(struct sig_pri_span *pri, q931_call *call)
static void sig_pri_handle_cis_subcmds(struct sig_pri_span *pri, int event_id, const struct pri_subcommands *subcmds, q931_call *call_rsp)
#define AST_CC_GENERIC_MONITOR_TYPE
int pri_is_up(struct sig_pri_span *pri)
static int sig_pri_cc_monitor_instance_hash_fn(const void *obj, const int flags)
unsigned int use_callingpres
static void sig_pri_cc_link_canceled(struct sig_pri_span *pri, long cc_id, int is_agent)
struct ast_party_dialed dialed
Dialed/Called information.
The AMI - Asterisk Manager Interface - is a TCP protocol created to manage Asterisk with third-party ...
#define ast_strdupa(s)
duplicate a string in memory from the stack
void pri_event_noalarm(struct sig_pri_span *pri, int index, int before_start_pri)
struct ast_party_subaddress subaddress
Subscriber subaddress.
struct ast_channel *(*const new_ast_channel)(void *pvt, int state, enum sig_pri_law law, char *exten, const struct ast_channel *chan)
void sig_pri_stop_pri(struct sig_pri_span *pri)
Stop PRI span.
static void sig_pri_party_id_from_ast(struct pri_party_id *pri_id, const struct ast_party_id *ast_id)
int ast_aoc_set_billing_id(struct ast_aoc_decoded *decoded, const enum ast_aoc_billing_id id)
set the billing id for a AOC-D or AST_AOC_E message
int(*const new_nobch_intf)(struct sig_pri_span *pri)
int ast_tvcmp(struct timeval _a, struct timeval _b)
Compres two struct timeval instances returning -1, 0, 1 if the first arg is smaller, equal or greater to the second.
int ast_channel_transfer_masquerade(struct ast_channel *target_chan, const struct ast_party_connected_line *target_id, int target_held, struct ast_channel *transferee_chan, const struct ast_party_connected_line *transferee_id, int transferee_held)
Setup a masquerade to transfer a call.
static struct ao2_container * sig_pri_cc_monitors
void ast_party_caller_set_init(struct ast_party_caller *init, const struct ast_party_caller *guide)
Initialize the given caller structure using the given guide for a set update operation.
The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field ...
void(*const update_span_devstate)(struct sig_pri_span *pri)
struct ast_aoc_volume_rate volume
int(*const set_echocanceller)(void *pvt, int enable)
int pri_send_keypad_facility_exec(struct sig_pri_chan *p, const char *digits)
int plan
Q.931 Type-Of-Number and Numbering-Plan encoded fields.
static int pri_active_dchan_index(struct sig_pri_span *pri)
int ast_remaining_ms(struct timeval start, int max_ms)
Calculate remaining milliseconds given a starting timestamp and upper bound.
void sig_pri_unload(void)
Unload the sig_pri submodule.
static unsigned int monitor
void(*const unlock_private)(void *pvt)
static void sig_pri_make_cc_dialstring(struct sig_pri_chan *p, char *buf, size_t buf_size)
static int pri_find_empty_nobch(struct sig_pri_span *pri)
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
int ani2
Automatic Number Identification 2 (Info Digits)
#define PRI_TRANS_CAP_DIGITAL
enum ast_channel_state _state
struct ast_channel * ast_bridged_channel(struct ast_channel *chan)
Find bridged channel.
unsigned int hidecallerid
unsigned int inbanddisconnect
struct ast_cc_agent * ast_cc_agent_callback(int flags, ao2_callback_fn *function, void *arg, const char *const type)
Call a callback on all agents of a specific type.
#define SIG_PRI_NUM_DCHANS
Connected Line/Party information.
const ast_string_field name
int ast_moh_start(struct ast_channel *chan, const char *mclass, const char *interpclass)
Turn on music on hold on a given channel.
struct sig_pri_chan * pvts[SIG_PRI_MAX_CHANNELS]
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...
int ast_aoc_get_termination_request(struct ast_aoc_decoded *decoded)
get whether or not the AST_AOC_REQUEST message as a termination request.
static void pri_queue_frame(struct sig_pri_span *pri, int chanpos, struct ast_frame *frame)
static void sig_pri_send_aoce_termination_request(struct sig_pri_span *pri, int chanpos, unsigned int ms)
static void sig_pri_redirecting_convert(struct ast_party_redirecting *ast_redirecting, const struct pri_party_redirecting *pri_redirecting, const struct ast_party_redirecting *ast_guide, struct sig_pri_span *pri)
char idledial[AST_MAX_EXTENSION]
#define ao2_alloc(data_size, destructor_fn)
#define AST_PRES_NUMBER_NOT_AVAILABLE
Redirecting Line information. RDNIS (Redirecting Directory Number Information Service) Where a call d...
int ast_softhangup_nolock(struct ast_channel *chan, int reason)
Softly hangup up a channel (no channel lock)
uint32_t granularity_time
char exten[AST_MAX_EXTENSION]
static struct sig_pri_cc_monitor_instance * sig_pri_find_cc_monitor_by_cc_id(struct sig_pri_span *pri, long cc_id)
#define ast_channel_unlock(chan)
enum ast_aoc_billing_id ast_aoc_get_billing_id(struct ast_aoc_decoded *decoded)
get the billing id for AOC-D and AOC-E messages
static void sig_pri_aoc_request_from_pri(const struct pri_subcmd_aoc_request *aoc_request, struct sig_pri_chan *pvt, q931_call *call)
int ast_cc_monitor_status_request(int core_id)
Request the status of a caller or callers.
int source
Information about the source of an update.
unsigned int hidecalleridname
int sig_pri_cc_agent_stop_ringing(struct ast_cc_agent *agent)
Request for an agent's phone to stop ringing.
unsigned int append_msn_to_user_tag
static void * pri_dchannel(void *vpri)
char initial_user_tag[AST_MAX_EXTENSION]
Initial user tag for party id's sent from this device driver.
static char * dialplan2str(int dialplan)
void(*const open_media)(void *pvt)
int ast_aoc_set_total_type(struct ast_aoc_decoded *decoded, const enum ast_aoc_total_type type)
Sets the type of total for a AOC-D message.
char mwi_mailboxes[SIG_PRI_MAX_MWI_MAILBOX_STR]
Comma separated list of mailboxes to indicate MWI.
static void sig_pri_set_rdnis(struct sig_pri_chan *p, const char *rdnis)
char cid_subaddr[AST_MAX_EXTENSION]
char mohinterpret[MAX_MUSICCLASS]
void * ast_aoc_destroy_encoded(struct ast_aoc_encoded *encoded)
free an ast_aoc_encoded object
static int sig_pri_is_chan_in_use(struct sig_pri_chan *pvt)
int ast_extension_match(const char *pattern, const char *extension)
Determine if a given extension matches a given pattern (in NXX format)
static void sig_pri_redirecting_update(struct sig_pri_chan *pvt, struct ast_channel *ast)
int ast_call(struct ast_channel *chan, char *addr, int timeout)
Make a call.
char currency_name[AOC_CURRENCY_NAME_SIZE]
const char * ast_aoc_get_currency_name(struct ast_aoc_decoded *decoded)
get the currency name for AOC-D and AOC-E messages
int ast_cc_request_is_within_limits(void)
Check if the incoming CC request is within the bounds set by the cc_max_requests configuration option...
static void sig_pri_unlock_private(struct sig_pri_chan *p)
static int pri_to_ast_presentation(int pri_presentation)
char cid_num[AST_MAX_EXTENSION]
static int pri_find_empty_chan(struct sig_pri_span *pri, int backwards)
char msn_list[AST_MAX_EXTENSION]
struct ast_party_subaddress subaddress
Dialed/Called subaddress.
void ast_party_id_init(struct ast_party_id *init)
Initialize the given party id structure.
unsigned char cc_request_response_pending
char deferred_digits[AST_MAX_EXTENSION]
Structure used to handle boolean flags.
void(*const set_digital)(void *pvt, int is_digital)
static void sig_pri_set_caller_id(struct sig_pri_chan *p)
int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value)
Add a variable to the channel variable stack, removing the most recently set value for the same name...
uint32_t ast_event_get_ie_uint(const struct ast_event *event, enum ast_event_ie_type ie_type)
Get the value of an information element that has an integer payload.
unsigned int priindication_oob
struct ast_aoc_decoded * ast_aoc_create(const enum ast_aoc_type msg_type, const enum ast_aoc_charge_type charge_type, const enum ast_aoc_request requests)
creates a ast_aoc_decode object of a specific message type
static struct ast_cc_agent * sig_pri_find_cc_agent_by_cc_id(struct sig_pri_span *pri, long cc_id)
static void sig_pri_ami_channel_event(struct sig_pri_chan *p)
static void sig_pri_kill_call(struct sig_pri_span *pri, q931_call *call, int cause)
int ast_waitfordigit(struct ast_channel *c, int ms)
Waits for a digit.
#define AST_PRES_USER_NUMBER_PASSED_SCREEN
union ast_aoc_charging_association::@142 charge
enum ast_aoc_charge_type ast_aoc_get_charge_type(struct ast_aoc_decoded *decoded)
get the charging type for an AOC-D or AOC-E message
static void sig_pri_lock_owner(struct sig_pri_span *pri, int chanpos)
int sig_pri_cc_monitor_req_cc(struct ast_cc_monitor *monitor, int *available_timer_id)
Request CCSS.
char * tag
User-set "tag".
static void sig_pri_set_dialing(struct sig_pri_chan *p, int is_dialing)
int type
Q.931 subaddress type.
void(*const dial_digits)(void *pvt, const char *dial_string)
unsigned int hidecallerid
void ast_party_redirecting_free(struct ast_party_redirecting *doomed)
Destroy the redirecting information contents.
static int pri_find_principle(struct sig_pri_span *pri, int channel, q931_call *call)
void ast_event_destroy(struct ast_event *event)
Destroy an event.
unsigned int is_call_waiting
TRUE if this is a call waiting call.
static int sig_pri_cc_agent_cmp_cc_id(void *obj, void *arg, int flags)
static void * do_idle_thread(void *v_pvt)
int ast_waitfor(struct ast_channel *chan, int ms)
Wait for input on a channel.
int sig_pri_cc_agent_init(struct ast_cc_agent *agent, struct sig_pri_chan *pvt_chan)
PRI CC agent initialization.
void(*const ami_channel_event)(void *pvt, struct ast_channel *chan)
Post an AMI B channel association event.
int count
Number of times the call was redirected.
Standard Command Line Interface.
void sig_pri_chan_alarm_notify(struct sig_pri_chan *p, int noalarm)
Notify new alarm status.
int ast_db_del(const char *family, const char *key)
Delete entry in astdb.
static enum AST_REDIRECTING_REASON pri_to_ast_reason(int pri_reason)
unsigned int priexclusive
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.
struct ast_party_id to
Call is redirecting to a new party (Sent to the caller)
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Peer may not be sending the expected RESTART ACKNOWLEDGE.
#define ao2_container_alloc(arg1, arg2, arg3)
static int sig_pri_aoc_multiplier_from_ast(enum ast_aoc_currency_multiplier mult)
static int sig_pri_handle_hold(struct sig_pri_span *pri, pri_event *ev)
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one...
struct timeval ast_tv(ast_time_t sec, ast_suseconds_t usec)
Returns a timeval from sec, usec.
void ast_party_subaddress_init(struct ast_party_subaddress *init)
Initialize the given subaddress structure.
int num_call_waiting_calls
Number of outstanding call waiting calls.
union ast_aoc_s_entry::@141 rate
Charge rate being applied.
int sig_pri_available(struct sig_pri_chan **pvt, int is_specific_channel)
#define AST_CAUSE_USER_BUSY
char user_tag[AST_MAX_EXTENSION]
User tag for party id's sent from this device driver.
int ast_setstate(struct ast_channel *chan, enum ast_channel_state)
Change the state of a channel.
const char *(*const get_orig_dialstring)(void *pvt)
int sig_pri_cc_monitor_cancel_available_timer(struct ast_cc_monitor *monitor, int *sched_id)
Cancel the running available timer.
Information needed to specify a number in a call.
static void sig_pri_party_name_convert(struct ast_party_name *ast_name, const struct pri_party_name *pri_name)
int discardremoteholdretrieval
char * ast_transfercapability2str(int transfercapability) attribute_const
Gives the string form of a given transfer capability.
int sig_pri_indicate(struct sig_pri_chan *p, struct ast_channel *chan, int condition, const void *data, size_t datalen)
int ast_queue_control_data(struct ast_channel *chan, enum ast_control_frame_type control, const void *data, size_t datalen)
Queue a control frame with payload.
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
unsigned int use_callerid
enum ast_pbx_result ast_pbx_run(struct ast_channel *c)
Execute the PBX in the current thread.
static void sig_pri_lock_private(struct sig_pri_chan *p)
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.
Data structure associated with a single frame of data.
Internal Asterisk hangup causes.
#define ast_manager_event_multichan(category, event, nchans, chans, contents,...)
void ast_party_redirecting_set_init(struct ast_party_redirecting *init, const struct ast_party_redirecting *guide)
Initialize the given redirecting id structure using the given guide for a set update operation...
int pritimers[PRI_MAX_TIMERS]
struct sig_pri_span * pri
static const char * sig_pri_cc_type_name
static void apply_plan_to_number(char *buf, size_t size, const struct sig_pri_span *pri, const char *number, int plan)
Options provided by main asterisk program.
unsigned int layer1_ignored
void(*const set_callerid)(void *pvt, const struct ast_party_caller *caller)
int ast_db_put(const char *family, const char *key, const char *value)
Store value addressed by family/key.
int ast_aoc_set_association_id(struct ast_aoc_decoded *decoded, const int id)
set the charging association id for an AST_AOC_E message
struct timeval ast_tvsub(struct timeval a, struct timeval b)
Returns the difference of two timevals a - b.
static int sig_pri_cc_monitor_cmp_cc_id(void *obj, void *arg, int flags)
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
static int pri_matchdigittimeout
#define AST_APP_ARG(name)
Define an application argument.
enum ast_frame_type frametype
void * private_data
Data that is private to a monitor technology.
void ast_channel_queue_redirecting_update(struct ast_channel *chan, const struct ast_party_redirecting *redirecting, const struct ast_set_party_redirecting *update)
Queue a redirecting update frame on a channel.
void sig_pri_cli_show_spans(int fd, int span, struct sig_pri_span *pri)
#define DAHDI_CHAN_MAPPING_LOGICAL
#define AST_PRES_UNAVAILABLE
#define ast_mutex_init(pmutex)
#define SIG_PRI_AOC_GRANT_E
enum ast_aoc_currency_multiplier ast_aoc_get_currency_multiplier(struct ast_aoc_decoded *decoded)
get the currency multiplier for AOC-D and AOC-E messages
#define ast_channel_trylock(chan)
unsigned char valid
TRUE if the name information is valid/present.
Call Parking and Pickup API Includes code and algorithms from the Zapata library. ...
Information needed to specify a subaddress in a call.
static int sig_pri_set_echocanceller(struct sig_pri_chan *p, int enable)
static void build_status(char *s, size_t len, int status, int active)
static void sig_pri_cc_generic_check(struct sig_pri_span *pri, int chanpos, enum ast_cc_service_type service)
struct ast_aoc_unit_entry * ast_aoc_get_unit_info(struct ast_aoc_decoded *decoded, unsigned int entry_number)
get a specific unit entry.
static void sig_pri_aoc_d_from_pri(const struct pri_subcmd_aoc_d *aoc_d, struct ast_channel *owner, int passthrough)
const char * ast_event_get_ie_str(const struct ast_event *event, enum ast_event_ie_type ie_type)
Get the value of an information element that has a string payload.
#define AST_NONSTANDARD_APP_ARGS(args, parse, sep)
Performs the 'nonstandard' argument separation process for an application.
int reason
enum AST_REDIRECTING_REASON value for redirection
void ast_shrink_phone_number(char *n)
Shrink a phone number in place to just digits (more accurately it just removes ()'s, .'s, and -'s...
char cid_name[AST_MAX_EXTENSION]
char context[AST_MAX_CONTEXT]
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)
void ast_party_caller_init(struct ast_party_caller *init)
Initialize the given caller structure.
enum ast_cc_service_type service_offered
Say numbers and dates (maybe words one day too)
unsigned int ast_aoc_get_unit_count(struct ast_aoc_decoded *decoded)
get the number of unit entries for AOC-D and AOC-E messages
unsigned int allocated
TRUE when this channel is allocated.
void pri_event_alarm(struct sig_pri_span *pri, int index, int before_start_pri)
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.
struct pri * dchans[SIG_PRI_NUM_DCHANS]
char context[AST_MAX_CONTEXT]
unsigned int no_dialed_digits
#define SRVST_NEAREND
SRVST_NEAREND is used to indicate that the near end was put out-of-service.
static void sig_pri_aoc_d_from_ast(struct sig_pri_chan *pvt, struct ast_aoc_decoded *decoded)
#define SIG_PRI_DEBUG_DEFAULT
static int sig_pri_available_check(struct sig_pri_chan *pvt)
int sig_pri_cc_agent_stop_offer_timer(struct ast_cc_agent *agent)
Stop the offer timer.
int ast_cc_monitor_stop_ringing(int core_id)
Alert a caller to stop ringing.
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.
struct ast_event_sub * sub
MWI mailbox event subscription.
Persistant data storage (akin to *doze registry)
Information needed to specify a name in a call.
struct ast_event_sub * ast_event_unsubscribe(struct ast_event_sub *event_sub)
Un-subscribe from events.
#define SIG_PRI_AOC_GRANT_D
unsigned int waiting_for_aoce
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)
unsigned char valid
TRUE if the number information is valid/present.
#define ao2_unlink(arg1, arg2)
uint16_t granularity_time_scale
const char * ast_party_name_charset_describe(int data)
Convert ast_party_name.char_set value to explanatory string.
static int sig_pri_cc_monitor_instance_cmp_fn(void *obj, void *arg, int flags)
int pri_maintenance_bservice(struct pri *pri, struct sig_pri_chan *p, int changestatus)
char mohinterpret[MAX_MUSICCLASS]
void(*const set_outgoing)(void *pvt, int is_outgoing)
int sig_pri_hangup(struct sig_pri_chan *p, struct ast_channel *ast)
#define AST_TRANS_CAP_DIGITAL
char exten[AST_MAX_EXTENSION]
int ast_cc_monitor_callee_available(const int core_id, const char *const debug,...)
Alert the core that a device being monitored has become available.
int(*const dsp_reset_and_flush_digits)(void *pvt)
int fds[SIG_PRI_NUM_DCHANS]
int sig_pri_cc_monitor_suspend(struct ast_cc_monitor *monitor)
Suspend monitoring.
static enum ast_aoc_time_scale sig_pri_aoc_scale_to_ast(enum PRI_AOC_TIME_SCALE value)
static int sig_pri_is_cis_call(int channel)
static enum PRI_AOC_CHARGED_ITEM sig_pri_aoc_charged_item_to_pri(enum PRI_AOC_CHARGED_ITEM value)
#define AST_APP_OPTION(option, flagno)
Declares an application option that does not accept an argument.
#define ast_mutex_unlock(a)
#define SRVST_FAREND
SRVST_FAREND is used to indicate that the far end was taken out-of-service.
static char prefix[MAX_PREFIX]
char currency_name[AOC_CURRENCY_NAME_SIZE]
static void sig_pri_party_number_from_ast(struct pri_party_number *pri_number, const struct ast_party_number *ast_number)
#define ast_string_field_set(x, field, data)
Set a field to a simple string value.
int ast_aoc_set_currency_info(struct ast_aoc_decoded *decoded, const unsigned int amount, const enum ast_aoc_currency_multiplier multiplier, const char *name)
Sets the currency values for a AOC-D or AOC-E message.
struct ast_party_number number
Subscriber phone number.
static struct ast_app_option sig_pri_call_opts[128]