-
Notifications
You must be signed in to change notification settings - Fork 14
/
libpri.h
2285 lines (2030 loc) · 72.6 KB
/
libpri.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* libpri: An implementation of Primary Rate ISDN
*
* Written by Mark Spencer <[email protected]>
*
* Copyright (C) 2001, Digium, Inc.
* All Rights Reserved.
*/
/*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2 as published by the
* Free Software Foundation. See the LICENSE file included with
* this program for more details.
*
* In addition, when this program is distributed with Asterisk in
* any form that would qualify as a 'combined work' or as a
* 'derivative work' (but not mere aggregation), you can redistribute
* and/or modify the combination under the terms of the license
* provided with that copy of Asterisk, instead of the license
* terms granted here.
*/
/*
* NOTE:
* All new global identifiers that are added to this file MUST be
* prefixed with PRI_ or pri_ to indicate that they are part of this
* library and to reduce potential naming conflicts.
*/
#ifndef _LIBPRI_H
#define _LIBPRI_H
/* Node types */
#define PRI_NETWORK 1
#define PRI_CPE 2
/* Debugging */
#define PRI_DEBUG_Q921_RAW (1 << 0) /* Show raw HDLC frames */
#define PRI_DEBUG_Q921_DUMP (1 << 1) /* Show each interpreted Q.921 frame */
#define PRI_DEBUG_Q921_STATE (1 << 2) /* Debug state machine changes */
#define PRI_DEBUG_CONFIG (1 << 3) /* Display error events on stdout */
#define PRI_DEBUG_Q931_DUMP (1 << 5) /* Show interpreted Q.931 frames */
#define PRI_DEBUG_Q931_STATE (1 << 6) /* Debug Q.931 state machine changes */
#define PRI_DEBUG_Q931_ANOMALY (1 << 7) /* Show unexpected events */
#define PRI_DEBUG_APDU (1 << 8) /* Debug of APDU components such as ROSE */
#define PRI_DEBUG_AOC (1 << 9) /* Debug of Advice of Charge ROSE Messages */
#define PRI_DEBUG_CC (1 << 10) /* Debug call-completion. */
#define PRI_DEBUG_ALL (0xffff) /* Everything */
/* Switch types */
#define PRI_SWITCH_UNKNOWN 0
#define PRI_SWITCH_NI2 1 /* National ISDN 2 */
#define PRI_SWITCH_DMS100 2 /* DMS 100 */
#define PRI_SWITCH_LUCENT5E 3 /* Lucent 5E */
#define PRI_SWITCH_ATT4ESS 4 /* AT&T 4ESS */
#define PRI_SWITCH_EUROISDN_E1 5 /* Standard EuroISDN (CTR4, ETSI 300-102) */
#define PRI_SWITCH_EUROISDN_T1 6 /* T1 EuroISDN variant (ETSI 300-102) */
#define PRI_SWITCH_NI1 7 /* National ISDN 1 */
#define PRI_SWITCH_GR303_EOC 8 /* GR-303 Embedded Operations Channel */
#define PRI_SWITCH_GR303_TMC 9 /* GR-303 Timeslot Management Channel */
#define PRI_SWITCH_QSIG 10 /* QSIG Switch */
/* Switchtypes 11 - 20 are reserved for internal use */
/* PRI D-Channel Events */
#define PRI_EVENT_DCHAN_UP 1 /* D-channel is up */
#define PRI_EVENT_DCHAN_DOWN 2 /* D-channel is down */
#define PRI_EVENT_RESTART 3 /* B-channel is restarted */
#define PRI_EVENT_CONFIG_ERR 4 /* Configuration Error Detected */
#define PRI_EVENT_RING 5 /* Incoming call (SETUP) */
#define PRI_EVENT_HANGUP 6 /* Call got hung up (RELEASE/RELEASE_COMPLETE/other) */
#define PRI_EVENT_RINGING 7 /* Call is ringing (ALERTING) */
#define PRI_EVENT_ANSWER 8 /* Call has been answered (CONNECT) */
#define PRI_EVENT_HANGUP_ACK 9 /* Call hangup has been acknowledged */
#define PRI_EVENT_RESTART_ACK 10 /* Restart complete on a given channel (RESTART_ACKNOWLEDGE) */
#define PRI_EVENT_FACNAME 11 /* Caller*ID Name received on Facility (DEPRECATED) */
#define PRI_EVENT_FACILITY 11 /* Facility received (FACILITY) */
#define PRI_EVENT_INFO_RECEIVED 12 /* Additional info (digits) received (INFORMATION) */
#define PRI_EVENT_PROCEEDING 13 /* When we get CALL_PROCEEDING */
#define PRI_EVENT_SETUP_ACK 14 /* When we get SETUP_ACKNOWLEDGE */
#define PRI_EVENT_HANGUP_REQ 15 /* Requesting the higher layer to hangup (DISCONNECT) */
#define PRI_EVENT_NOTIFY 16 /* Notification received (NOTIFY) */
#define PRI_EVENT_PROGRESS 17 /* When we get PROGRESS */
#define PRI_EVENT_KEYPAD_DIGIT 18 /* When we receive during ACTIVE state (INFORMATION) */
#define PRI_EVENT_SERVICE 19 /* SERVICE maintenance message */
#define PRI_EVENT_SERVICE_ACK 20 /* SERVICE maintenance acknowledgement message */
#define PRI_EVENT_HOLD 21 /* HOLD request received */
#define PRI_EVENT_HOLD_ACK 22 /* HOLD_ACKNOWLEDGE received */
#define PRI_EVENT_HOLD_REJ 23 /* HOLD_REJECT received */
#define PRI_EVENT_RETRIEVE 24 /* RETRIEVE request received */
#define PRI_EVENT_RETRIEVE_ACK 25 /* RETRIEVE_ACKNOWLEDGE received */
#define PRI_EVENT_RETRIEVE_REJ 26 /* RETRIEVE_REJECT received */
#define PRI_EVENT_CONNECT_ACK 27 /* CONNECT_ACKNOWLEDGE received */
/* Simple states */
#define PRI_STATE_DOWN 0
#define PRI_STATE_UP 1
#define PRI_PROGRESS_MASK
/* Progress indicator values */
#define PRI_PROG_CALL_NOT_E2E_ISDN (1 << 0)
#define PRI_PROG_CALLED_NOT_ISDN (1 << 1)
#define PRI_PROG_CALLER_NOT_ISDN (1 << 2)
#define PRI_PROG_INBAND_AVAILABLE (1 << 3)
#define PRI_PROG_DELAY_AT_INTERF (1 << 4)
#define PRI_PROG_INTERWORKING_WITH_PUBLIC (1 << 5)
#define PRI_PROG_INTERWORKING_NO_RELEASE (1 << 6)
#define PRI_PROG_INTERWORKING_NO_RELEASE_PRE_ANSWER (1 << 7)
#define PRI_PROG_INTERWORKING_NO_RELEASE_POST_ANSWER (1 << 8)
#define PRI_PROG_CALLER_RETURNED_TO_ISDN (1 << 9)
/* Numbering plan identifier */
#define PRI_NPI_UNKNOWN 0x0 /*!< Unknown numbering plan */
#define PRI_NPI_E163_E164 0x1 /*!< ISDN/telephony numbering plan (public) */
#define PRI_NPI_X121 0x3 /*!< Data numbering plan */
#define PRI_NPI_F69 0x4 /*!< Telex numbering plan */
#define PRI_NPI_NATIONAL 0x8 /*!< National standard numbering plan */
#define PRI_NPI_PRIVATE 0x9 /*!< Private numbering plan */
#define PRI_NPI_RESERVED 0xF /*!< Reserved for extension */
/* Type of number */
#define PRI_TON_UNKNOWN 0x0
#define PRI_TON_INTERNATIONAL 0x1
#define PRI_TON_NATIONAL 0x2
#define PRI_TON_NET_SPECIFIC 0x3
#define PRI_TON_SUBSCRIBER 0x4
#define PRI_TON_ABBREVIATED 0x6
#define PRI_TON_RESERVED 0x7
/* Redirection reasons */
#define PRI_REDIR_UNKNOWN 0x0
#define PRI_REDIR_FORWARD_ON_BUSY 0x1
#define PRI_REDIR_FORWARD_ON_NO_REPLY 0x2
#define PRI_REDIR_DEFLECTION 0x3
#define PRI_REDIR_DTE_OUT_OF_ORDER 0x9
#define PRI_REDIR_FORWARDED_BY_DTE 0xA
#define PRI_REDIR_UNCONDITIONAL 0xF
/* Dialing plan */
#define PRI_INTERNATIONAL_ISDN 0x11
#define PRI_NATIONAL_ISDN 0x21
#define PRI_LOCAL_ISDN 0x41
#define PRI_PRIVATE 0x49
#define PRI_UNKNOWN 0x0
/* Presentation */
#define PRI_PRES_NUMBER_TYPE 0x03
#define PRI_PRES_USER_NUMBER_UNSCREENED 0x00
#define PRI_PRES_USER_NUMBER_PASSED_SCREEN 0x01
#define PRI_PRES_USER_NUMBER_FAILED_SCREEN 0x02
#define PRI_PRES_NETWORK_NUMBER 0x03
#define PRI_PRES_RESTRICTION 0x60
#define PRI_PRES_ALLOWED 0x00
#define PRI_PRES_RESTRICTED 0x20
#define PRI_PRES_UNAVAILABLE 0x40
#define PRI_PRES_RESERVED 0x60
#define PRES_ALLOWED_USER_NUMBER_NOT_SCREENED \
(PRI_PRES_ALLOWED | PRI_PRES_USER_NUMBER_UNSCREENED)
#define PRES_ALLOWED_USER_NUMBER_PASSED_SCREEN \
(PRI_PRES_ALLOWED | PRI_PRES_USER_NUMBER_PASSED_SCREEN)
#define PRES_ALLOWED_USER_NUMBER_FAILED_SCREEN \
(PRI_PRES_ALLOWED | PRI_PRES_USER_NUMBER_FAILED_SCREEN)
#define PRES_ALLOWED_NETWORK_NUMBER \
(PRI_PRES_ALLOWED | PRI_PRES_NETWORK_NUMBER)
#define PRES_PROHIB_USER_NUMBER_NOT_SCREENED \
(PRI_PRES_RESTRICTED | PRI_PRES_USER_NUMBER_UNSCREENED)
#define PRES_PROHIB_USER_NUMBER_PASSED_SCREEN \
(PRI_PRES_RESTRICTED | PRI_PRES_USER_NUMBER_PASSED_SCREEN)
#define PRES_PROHIB_USER_NUMBER_FAILED_SCREEN \
(PRI_PRES_RESTRICTED | PRI_PRES_USER_NUMBER_FAILED_SCREEN)
#define PRES_PROHIB_NETWORK_NUMBER \
(PRI_PRES_RESTRICTED | PRI_PRES_NETWORK_NUMBER)
#define PRES_NUMBER_NOT_AVAILABLE \
(PRI_PRES_UNAVAILABLE | PRI_PRES_NETWORK_NUMBER)
/* Reverse Charging Indication */
#define PRI_REVERSECHARGE_NONE -1
#define PRI_REVERSECHARGE_REQUESTED 1
/* Causes for disconnection (See Q.850) */
#define PRI_CAUSE_UNALLOCATED 1 /*!< Called number unassigned. */
#define PRI_CAUSE_NO_ROUTE_TRANSIT_NET 2 /* !Q.SIG */
#define PRI_CAUSE_NO_ROUTE_DESTINATION 3
#define PRI_CAUSE_CHANNEL_UNACCEPTABLE 6
#define PRI_CAUSE_CALL_AWARDED_DELIVERED 7 /* !Q.SIG */
#define PRI_CAUSE_NORMAL_CLEARING 16
#define PRI_CAUSE_USER_BUSY 17
#define PRI_CAUSE_NO_USER_RESPONSE 18
#define PRI_CAUSE_NO_ANSWER 19
#define PRI_CAUSE_CALL_REJECTED 21
#define PRI_CAUSE_NUMBER_CHANGED 22
#define PRI_CAUSE_NONSELECTED_USER_CLEARING 26
#define PRI_CAUSE_DESTINATION_OUT_OF_ORDER 27
#define PRI_CAUSE_INVALID_NUMBER_FORMAT 28
#define PRI_CAUSE_FACILITY_REJECTED 29 /* !Q.SIG */
#define PRI_CAUSE_RESPONSE_TO_STATUS_ENQUIRY 30
#define PRI_CAUSE_NORMAL_UNSPECIFIED 31
#define PRI_CAUSE_NORMAL_CIRCUIT_CONGESTION 34
#define PRI_CAUSE_NETWORK_OUT_OF_ORDER 38 /* !Q.SIG */
#define PRI_CAUSE_NORMAL_TEMPORARY_FAILURE 41
#define PRI_CAUSE_SWITCH_CONGESTION 42 /* !Q.SIG */
#define PRI_CAUSE_ACCESS_INFO_DISCARDED 43 /* !Q.SIG */
#define PRI_CAUSE_REQUESTED_CHAN_UNAVAIL 44
#define PRI_CAUSE_PRE_EMPTED 45 /* !Q.SIG */
#define PRI_CAUSE_RESOURCE_UNAVAIL_UNSPECIFIED 47
#define PRI_CAUSE_FACILITY_NOT_SUBSCRIBED 50 /* !Q.SIG */
#define PRI_CAUSE_OUTGOING_CALL_BARRED 52 /* !Q.SIG */
#define PRI_CAUSE_INCOMING_CALL_BARRED 54 /* !Q.SIG */
#define PRI_CAUSE_BEARERCAPABILITY_NOTAUTH 57
#define PRI_CAUSE_BEARERCAPABILITY_NOTAVAIL 58
#define PRI_CAUSE_SERVICEOROPTION_NOTAVAIL 63 /* Q.SIG */
#define PRI_CAUSE_BEARERCAPABILITY_NOTIMPL 65
#define PRI_CAUSE_CHAN_NOT_IMPLEMENTED 66 /* !Q.SIG */
#define PRI_CAUSE_FACILITY_NOT_IMPLEMENTED 69 /* !Q.SIG */
#define PRI_CAUSE_INVALID_CALL_REFERENCE 81
#define PRI_CAUSE_IDENTIFIED_CHANNEL_NOTEXIST 82 /* Q.SIG */
#define PRI_CAUSE_INCOMPATIBLE_DESTINATION 88
#define PRI_CAUSE_INVALID_MSG_UNSPECIFIED 95 /* !Q.SIG */
#define PRI_CAUSE_MANDATORY_IE_MISSING 96
#define PRI_CAUSE_MESSAGE_TYPE_NONEXIST 97
#define PRI_CAUSE_WRONG_MESSAGE 98
#define PRI_CAUSE_IE_NONEXIST 99
#define PRI_CAUSE_INVALID_IE_CONTENTS 100
#define PRI_CAUSE_WRONG_CALL_STATE 101
#define PRI_CAUSE_RECOVERY_ON_TIMER_EXPIRE 102
#define PRI_CAUSE_MANDATORY_IE_LENGTH_ERROR 103 /* !Q.SIG */
#define PRI_CAUSE_PROTOCOL_ERROR 111
#define PRI_CAUSE_INTERWORKING 127 /* !Q.SIG */
/* Transmit capabilities */
#define PRI_TRANS_CAP_SPEECH 0x0
#define PRI_TRANS_CAP_DIGITAL 0x08
#define PRI_TRANS_CAP_RESTRICTED_DIGITAL 0x09
#define PRI_TRANS_CAP_3_1K_AUDIO 0x10
#define PRI_TRANS_CAP_7K_AUDIO 0x11 /* Depriciated ITU Q.931 (05/1998)*/
#define PRI_TRANS_CAP_DIGITAL_W_TONES 0x11
#define PRI_TRANS_CAP_VIDEO 0x18
#define PRI_LAYER_1_ITU_RATE_ADAPT 0x21
#define PRI_LAYER_1_ULAW 0x22
#define PRI_LAYER_1_ALAW 0x23
#define PRI_LAYER_1_G721 0x24
#define PRI_LAYER_1_G722_G725 0x25
#define PRI_LAYER_1_H223_H245 0x26
#define PRI_LAYER_1_NON_ITU_ADAPT 0x27
#define PRI_LAYER_1_V120_RATE_ADAPT 0x28
#define PRI_LAYER_1_X31_RATE_ADAPT 0x29
/* Intermediate rates for V.110 */
#define PRI_INT_RATE_8K 1
#define PRI_INT_RATE_16K 2
#define PRI_INT_RATE_32K 3
/* Rate adaption for bottom 5 bits of rateadaption */
#define PRI_RATE_USER_RATE_MASK 0x1F
#define PRI_RATE_ADAPT_UNSPEC 0x00
#define PRI_RATE_ADAPT_0K6 0x01
#define PRI_RATE_ADAPT_1K2 0x02
#define PRI_RATE_ADAPT_2K4 0x03
#define PRI_RATE_ADAPT_3K6 0x04
#define PRI_RATE_ADAPT_4K8 0x05
#define PRI_RATE_ADAPT_7K2 0x06
#define PRI_RATE_ADAPT_8K 0x07
#define PRI_RATE_ADAPT_9K6 0x08
#define PRI_RATE_ADAPT_14K4 0x09
#define PRI_RATE_ADAPT_16K 0x0A
#define PRI_RATE_ADAPT_19K2 0x0B
#define PRI_RATE_ADAPT_32K 0x0C
#define PRI_RATE_ADAPT_38K4 0x0D
#define PRI_RATE_ADAPT_48K 0x0E
#define PRI_RATE_ADAPT_56K 0x0F
#define PRI_RATE_ADAPT_57K6 0x12
#define PRI_RATE_ADAPT_28K8 0x13
#define PRI_RATE_ADAPT_24K 0x14
#define PRI_RATE_ADAPT_0K1345 0x15
#define PRI_RATE_ADAPT_0K1 0x16
#define PRI_RATE_ADAPT_0K075_1K2 0x17
#define PRI_RATE_ADAPT_1K2_0K075 0x18
#define PRI_RATE_ADAPT_0K05 0x19
#define PRI_RATE_ADAPT_0K075 0x1A
#define PRI_RATE_ADAPT_0K110 0x1B
#define PRI_RATE_ADAPT_0K150 0x1C
#define PRI_RATE_ADAPT_0K200 0x1D
#define PRI_RATE_ADAPT_0K300 0x1E
#define PRI_RATE_ADAPT_12K 0x1F
/* in-band negotiation flag for rateadaption bit 5 */
#define PRI_RATE_ADAPT_NEGOTIATION_POSS 0x20
/* async flag for rateadaption bit 6 */
#define PRI_RATE_ADAPT_ASYNC 0x40
/* Notifications */
#define PRI_NOTIFY_USER_SUSPENDED 0x00 /* User suspended (Q.931) (Call is placed on hold) */
#define PRI_NOTIFY_USER_RESUMED 0x01 /* User resumed (Q.931) (Call is taken off hold) */
#define PRI_NOTIFY_BEARER_CHANGE 0x02 /* Bearer service change (DSS1) */
#define PRI_NOTIFY_ASN1_COMPONENT 0x03 /* ASN.1 encoded component (DSS1) */
#define PRI_NOTIFY_COMPLETION_DELAY 0x04 /* Call completion delay */
#define PRI_NOTIFY_CONF_ESTABLISHED 0x42 /* Conference established */
#define PRI_NOTIFY_CONF_DISCONNECTED 0x43 /* Conference disconnected */
#define PRI_NOTIFY_CONF_PARTY_ADDED 0x44 /* Other party added */
#define PRI_NOTIFY_CONF_ISOLATED 0x45 /* Isolated */
#define PRI_NOTIFY_CONF_REATTACHED 0x46 /* Reattached */
#define PRI_NOTIFY_CONF_OTHER_ISOLATED 0x47 /* Other party isolated */
#define PRI_NOTIFY_CONF_OTHER_REATTACHED 0x48 /* Other party reattached */
#define PRI_NOTIFY_CONF_OTHER_SPLIT 0x49 /* Other party split */
#define PRI_NOTIFY_CONF_OTHER_DISCONNECTED 0x4a /* Other party disconnected */
#define PRI_NOTIFY_CONF_FLOATING 0x4b /* Conference floating */
#define PRI_NOTIFY_WAITING_CALL 0x60 /* Call is waiting call */
#define PRI_NOTIFY_DIVERSION_ACTIVATED 0x68 /* Diversion activated (DSS1) (cfu, cfb, cfnr) (EN 300 207-1 Section 7.2.1) */
#define PRI_NOTIFY_TRANSFER_ALERTING 0x69 /* Call transfer, alerting (EN 300 369-1 Section 7.2) */
#define PRI_NOTIFY_TRANSFER_ACTIVE 0x6a /* Call transfer, active(answered) (EN 300 369-1 Section 7.2) */
#define PRI_NOTIFY_REMOTE_HOLD 0x79 /* Remote hold */
#define PRI_NOTIFY_REMOTE_RETRIEVAL 0x7a /* Remote retrieval */
#define PRI_NOTIFY_CALL_DIVERTING 0x7b /* Call is diverting (EN 300 207-1 Section 7.2.1) */
#define PRI_COPY_DIGITS_CALLED_NUMBER
/* Network Specific Facilities (AT&T) */
#define PRI_NSF_NONE -1
#define PRI_NSF_SID_PREFERRED 0xB1
#define PRI_NSF_ANI_PREFERRED 0xB2
#define PRI_NSF_SID_ONLY 0xB3
#define PRI_NSF_ANI_ONLY 0xB4
#define PRI_NSF_CALL_ASSOC_TSC 0xB9
#define PRI_NSF_NOTIF_CATSC_CLEARING 0xBA
#define PRI_NSF_OPERATOR 0xB5
#define PRI_NSF_PCCO 0xB6
#define PRI_NSF_SDN 0xE1
#define PRI_NSF_TOLL_FREE_MEGACOM 0xE2
#define PRI_NSF_MEGACOM 0xE3
#define PRI_NSF_ACCUNET 0xE6
#define PRI_NSF_LONG_DISTANCE_SERVICE 0xE7
#define PRI_NSF_INTERNATIONAL_TOLL_FREE 0xE8
#define PRI_NSF_ATT_MULTIQUEST 0xF0
#define PRI_NSF_CALL_REDIRECTION_SERVICE 0xF7
typedef struct q931_call q931_call;
/* Name character set enumeration values */
#define PRI_CHAR_SET_UNKNOWN 0
#define PRI_CHAR_SET_ISO8859_1 1
#define PRI_CHAR_SET_WITHDRAWN 2
#define PRI_CHAR_SET_ISO8859_2 3
#define PRI_CHAR_SET_ISO8859_3 4
#define PRI_CHAR_SET_ISO8859_4 5
#define PRI_CHAR_SET_ISO8859_5 6
#define PRI_CHAR_SET_ISO8859_7 7
#define PRI_CHAR_SET_ISO10646_BMPSTRING 8
#define PRI_CHAR_SET_ISO10646_UTF_8STRING 9
/*! \brief Q.SIG name information. */
struct pri_party_name {
/*! \brief TRUE if the name information is valid/present */
int valid;
/*!
* \brief Q.931 presentation-indicator encoded field
* \note Must tollerate the Q.931 screening-indicator field values being present.
*/
int presentation;
/*!
* \brief Character set the name is using.
* \details
* unknown(0),
* iso8859-1(1),
* enum-value-withdrawn-by-ITU-T(2)
* iso8859-2(3),
* iso8859-3(4),
* iso8859-4(5),
* iso8859-5(6),
* iso8859-7(7),
* iso10646-BmpString(8),
* iso10646-utf-8String(9)
* \details
* Set to iso8859-1(1) if unsure what to use.
*/
int char_set;
/*! \brief Name data with null terminator. */
char str[64];
};
struct pri_party_number {
/*! \brief TRUE if the number information is valid/present */
int valid;
/*! \brief Q.931 presentation-indicator and screening-indicator encoded fields */
int presentation;
/*! \brief Q.931 Type-Of-Number and numbering-plan encoded fields */
int plan;
/*! \brief Number data with null terminator. */
char str[64];
};
/*!
* \note This structure is a place holder for possible future subaddress support
* to maintain ABI compatibility.
*/
struct pri_party_subaddress {
/*! \brief TRUE if the subaddress information is valid/present */
int valid;
/*!
* \brief Subaddress type.
* \details
* nsap(0),
* user_specified(2)
*/
int type;
/*!
* \brief TRUE if odd number of address signals
* \note The odd/even indicator is used when the type of subaddress is
* user_specified and the coding is BCD.
*/
int odd_even_indicator;
/*! \brief Length of the subaddress data */
int length;
/*!
* \brief Subaddress data with null terminator.
* \note The null terminator is a convenience only since the data could be
* BCD/binary and thus have a null byte as part of the contents.
*/
unsigned char data[32];
};
/*! \brief Addressing information needed to identify an endpoint in a call. */
struct pri_party_address {
/*! \brief Subscriber phone number */
struct pri_party_number number;
/*! \brief Subscriber subaddress */
struct pri_party_subaddress subaddress;
};
/*! \brief Information needed to identify an endpoint in a call. */
struct pri_party_id {
/*! \brief Subscriber name */
struct pri_party_name name;
/*! \brief Subscriber phone number */
struct pri_party_number number;
/*! \brief Subscriber subaddress */
struct pri_party_subaddress subaddress;
};
/*! \brief Connected Line/Party information */
struct pri_party_connected_line {
/*! Connected party ID */
struct pri_party_id id;
};
/*!
* \brief Redirecting Line information.
* \details
* RDNIS (Redirecting Directory Number Information Service)
* Where a call diversion or transfer was invoked.
*/
struct pri_party_redirecting {
/*! Who is redirecting the call (Sent to the party the call is redirected toward) */
struct pri_party_id from;
/*! Call is redirecting to a new party (Sent to the caller) */
struct pri_party_id to;
/*! Originally called party (in cases of multiple redirects) */
struct pri_party_id orig_called;
/*! Number of times the call was redirected */
int count;
/*! Original reason for redirect (in cases of multiple redirects) */
int orig_reason;
/*! Redirection reason */
int reason;
};
/*!
* \brief Information for rerouting/deflecting the call.
*/
struct pri_rerouting_data {
/*!
* \brief Updated caller-id information.
* \note The information may have been altered by procedure in the private network.
*/
struct pri_party_id caller;
/*!
* \note
* deflection.to is the new called number and must always be present.
*/
struct pri_party_redirecting deflection;
/*!
* \brief Diverting user subscription option to specify if caller is notified.
* \details
* noNotification(0),
* notificationWithoutDivertedToNr(1),
* notificationWithDivertedToNr(2),
* notApplicable(3) (Status only.)
*/
int subscription_option;
/*! Invocation ID to use when sending a reply to the call rerouting/deflection request. */
int invoke_id;
};
/*
* NOTE:
* The code surrounded by STATUS_REQUEST_PLACE_HOLDER is not implemented.
* The STATUS_REQUEST_PLACE_HOLDER code will be made unconditional if support
* for the messages is ever needed (and gets written).
*/
/* Subcommands derived from supplementary services. */
#define PRI_SUBCMD_REDIRECTING 1 /*!< Redirecting information update */
#define PRI_SUBCMD_CONNECTED_LINE 2 /*!< Connected line information update */
#define PRI_SUBCMD_REROUTING 3 /*!< CallRerouting/CallDeflection received. */
#if defined(STATUS_REQUEST_PLACE_HOLDER)
#define PRI_SUBCMD_STATUS_REQ 4 /*!< Determine the status of the given party. */
#define PRI_SUBCMD_STATUS_REQ_RSP 5 /*!< Status request response */
#endif /* defined(STATUS_REQUEST_PLACE_HOLDER) */
#define PRI_SUBCMD_CC_AVAILABLE 6 /*!< Indicate that CC is available */
#define PRI_SUBCMD_CC_REQ 7 /*!< CC activation request */
#define PRI_SUBCMD_CC_REQ_RSP 8 /*!< CC activation request response */
#define PRI_SUBCMD_CC_REMOTE_USER_FREE 9 /*!< Indicate that CC party B is available, party A is considered free. */
#define PRI_SUBCMD_CC_B_FREE 10 /*!< Indicate that CC party B is available, party A is considered busy. */
#define PRI_SUBCMD_CC_STATUS_REQ 11 /*!< Request/prod to receive updates of CC party A status */
#define PRI_SUBCMD_CC_STATUS_REQ_RSP 12 /*!< Requested update of CC party A status */
#define PRI_SUBCMD_CC_STATUS 13 /*!< Unsolicited update of CC party A status */
#define PRI_SUBCMD_CC_CALL 14 /*!< Indicate that this call is a CC callback */
#define PRI_SUBCMD_CC_CANCEL 15 /*!< Unsolicited indication that CC is canceled */
#define PRI_SUBCMD_CC_STOP_ALERTING 16 /*!< Indicate that someone else has responed to remote user free */
#define PRI_SUBCMD_TRANSFER_CALL 17 /*!< Request to transfer the specified calls together. */
#define PRI_SUBCMD_AOC_S 18 /*!< Advice Of Charge Start information (Rate list) */
#define PRI_SUBCMD_AOC_D 19 /*!< Advice Of Charge During information */
#define PRI_SUBCMD_AOC_E 20 /*!< Advice Of Charge End information */
#define PRI_SUBCMD_AOC_CHARGING_REQ 21 /*!< Advice Of Charge Request information */
#define PRI_SUBCMD_AOC_CHARGING_REQ_RSP 22 /*!< Advice Of Charge Request Response information */
#define PRI_SUBCMD_MCID_REQ 23 /*!< Malicious Call ID Request */
#define PRI_SUBCMD_MCID_RSP 24 /*!< Malicious Call ID Request response */
#define PRI_SUBCMD_DISPLAY_TEXT 25 /*!< Received display ie text */
#if defined(STATUS_REQUEST_PLACE_HOLDER)
struct pri_subcmd_status_request {
/*!
* \brief Invoke id in case there are multiple outstanding requests.
* \note Used to match any responses with the original invoke in case
* there are several requests active.
*/
int invoke_id;
/*! \brief Party address requesting status about. */
struct pri_party_address party;
};
#endif /* defined(STATUS_REQUEST_PLACE_HOLDER) */
#if defined(STATUS_REQUEST_PLACE_HOLDER)
struct pri_subcmd_status_request_rsp {
/*!
* \brief Request id in case there are multiple outstanding requests.
* \note Used to match any responses with the request in case there
* are several requests active.
*/
int request_id;
/*!
* \brief Response status to the status request.
* \details
* free(0),
* busy(1),
* incompatible(2)
* timeout(3),
*/
int status;
};
#endif /* defined(STATUS_REQUEST_PLACE_HOLDER) */
struct pri_subcmd_cc_id {
/*! \brief Call-Completion record id */
long cc_id;
};
struct pri_subcmd_cc_request {
/*! \brief Call-Completion record id */
long cc_id;
/*!
* \brief Mode of call-completion requested.
* \details
* ccbs(0),
* ccnr(1)
*/
int mode;
};
struct pri_subcmd_cc_request_rsp {
/*! \brief Call-Completion record id */
long cc_id;
/*!
* \brief Status of the requested call-completion activation.
* \details
* success(0),
* timeout(1),
* error(2),
* reject(3)
*/
int status;
/*!
* \brief Failure code that can be converted to a string to further
* explain the non-timeout failure.
* \note Valid when status is error or reject.
* \note Use pri_facility_error2str() to convert the error_code.
* \note Use pri_facility_reject2str() to convert the reject_code.
*/
int fail_code;
};
struct pri_subcmd_cc_status {
/*! \brief Call-Completion record id */
long cc_id;
/*!
* \brief Party A status.
* \details
* free(0),
* busy(1)
*/
int status;
};
struct pri_subcmd_cc_cancel {
/*! \brief Call-Completion record id */
long cc_id;
/*!
* \brief TRUE if the cc_id is for an agent.
* \note This is a convenience value so the upper layer can know which
* list it should search for the cc_id.
*/
int is_agent;
};
struct pri_subcmd_transfer {
/*! \brief Opaque call pointer for transfer with other call. */
q931_call *call_1;
/*! \brief Opaque call pointer for transfer with other call. */
q931_call *call_2;
/*! TRUE if call_1 is on hold. */
int is_call_1_held;
/*! TRUE if call_2 is on hold. */
int is_call_2_held;
/*! Invocation ID to use when sending a reply to the transfer request. */
int invoke_id;
};
/*! \brief What is being charged. */
enum PRI_AOC_CHARGED_ITEM {
PRI_AOC_CHARGED_ITEM_NOT_AVAILABLE,
PRI_AOC_CHARGED_ITEM_SPECIAL_ARRANGEMENT,
PRI_AOC_CHARGED_ITEM_BASIC_COMMUNICATION,
PRI_AOC_CHARGED_ITEM_CALL_ATTEMPT,
PRI_AOC_CHARGED_ITEM_CALL_SETUP,
PRI_AOC_CHARGED_ITEM_USER_USER_INFO,
PRI_AOC_CHARGED_ITEM_SUPPLEMENTARY_SERVICE,
};
/*! \brief Rate method being used. */
enum PRI_AOC_RATE_TYPE {
PRI_AOC_RATE_TYPE_NOT_AVAILABLE,
PRI_AOC_RATE_TYPE_FREE,
PRI_AOC_RATE_TYPE_FREE_FROM_BEGINNING,
PRI_AOC_RATE_TYPE_DURATION,
PRI_AOC_RATE_TYPE_FLAT,
PRI_AOC_RATE_TYPE_VOLUME,
PRI_AOC_RATE_TYPE_SPECIAL_CODE,
};
enum PRI_AOC_TIME_SCALE {
PRI_AOC_TIME_SCALE_HUNDREDTH_SECOND,
PRI_AOC_TIME_SCALE_TENTH_SECOND,
PRI_AOC_TIME_SCALE_SECOND,
PRI_AOC_TIME_SCALE_TEN_SECOND,
PRI_AOC_TIME_SCALE_MINUTE,
PRI_AOC_TIME_SCALE_HOUR,
PRI_AOC_TIME_SCALE_DAY,
};
struct pri_aoc_time {
/*! LengthOfTimeUnit (Not valid if length is zero.) */
long length;
/*! \see enum PRI_AOC_TIME_SCALE */
int scale;
};
enum PRI_AOC_MULTIPLIER {
PRI_AOC_MULTIPLIER_THOUSANDTH,
PRI_AOC_MULTIPLIER_HUNDREDTH,
PRI_AOC_MULTIPLIER_TENTH,
PRI_AOC_MULTIPLIER_ONE,
PRI_AOC_MULTIPLIER_TEN,
PRI_AOC_MULTIPLIER_HUNDRED,
PRI_AOC_MULTIPLIER_THOUSAND,
};
struct pri_aoc_amount {
long cost;
/*! \see enum PRI_AOC_MULTIPLIER */
int multiplier;
};
struct pri_aoc_duration {
struct pri_aoc_amount amount;
struct pri_aoc_time time;
/*! Not present if the granularity time is zero. */
struct pri_aoc_time granularity;
/*!
* \brief Charging interval type
* \details
* continuousCharging(0),
* stepFunction(1)
*/
int charging_type;
/*! Name of currency involved. Null terminated. */
char currency[10 + 1];
};
struct pri_aoc_flat {
struct pri_aoc_amount amount;
/*! Name of currency involved. Null terminated. */
char currency[10 + 1];
};
enum PRI_AOC_VOLUME_UNIT {
PRI_AOC_VOLUME_UNIT_OCTET,
PRI_AOC_VOLUME_UNIT_SEGMENT,
PRI_AOC_VOLUME_UNIT_MESSAGE,
};
struct pri_aoc_volume {
struct pri_aoc_amount amount;
/*! \see enum PRI_AOC_VOLUME_UNIT */
int unit;
/*! Name of currency involved. Null terminated. */
char currency[10 + 1];
};
struct pri_aoc_s_element {
/*!
* \brief What is being charged.
* \see enum PRI_AOC_CHARGED_ITEM
*/
int chargeable;
/*!
* \brief Rate method being used.
* \see enum PRI_AOC_RATE_TYPE
*/
int rate_type;
/*! \brief Charge rate being applied. */
union {
struct pri_aoc_duration duration;
struct pri_aoc_flat flat;
struct pri_aoc_volume volume;
int special;
} rate;
};
struct pri_subcmd_aoc_s {
/*!
* \brief Number of items in the rate list.
* \note If the list is empty then the charging information is not available.
*/
int num_items;
struct pri_aoc_s_element item[10];
};
enum PRI_AOC_DE_CHARGE {
PRI_AOC_DE_CHARGE_NOT_AVAILABLE,
PRI_AOC_DE_CHARGE_FREE,
PRI_AOC_DE_CHARGE_CURRENCY,
PRI_AOC_DE_CHARGE_UNITS,
};
struct pri_aoc_recorded_currency {
struct pri_aoc_amount amount;
/*! Name of currency involved. Null terminated. */
char currency[10 + 1];
};
struct pri_aoc_units_element {
/*! Number of units recorded. -1 if not available. */
long number;
/*! Type of unit recorded. -1 if not available. */
int type;
};
struct pri_aoc_recorded_units {
int num_items;
struct pri_aoc_units_element item[32];
};
enum PRI_AOC_D_BILLING_ID {
PRI_AOC_D_BILLING_ID_NOT_AVAILABLE,
PRI_AOC_D_BILLING_ID_NORMAL,
PRI_AOC_D_BILLING_ID_REVERSE,
PRI_AOC_D_BILLING_ID_CREDIT_CARD,
};
struct pri_subcmd_aoc_d {
/*!
* \brief What is being charged.
* \see enum PRI_AOC_DE_CHARGE
*/
int charge;
/*!
* \brief Billing accumulation
* \details
* subTotal(0),
* total(1)
*/
int billing_accumulation;
/*! \see enum PRI_AOC_D_BILLING_ID */
int billing_id;
union {
/*! Recorded currency */
struct pri_aoc_recorded_currency money;
/*! Recorded units list */
struct pri_aoc_recorded_units unit;
} recorded;
};
enum PRI_AOC_E_BILLING_ID {
PRI_AOC_E_BILLING_ID_NOT_AVAILABLE,
PRI_AOC_E_BILLING_ID_NORMAL,
PRI_AOC_E_BILLING_ID_REVERSE,
PRI_AOC_E_BILLING_ID_CREDIT_CARD,
PRI_AOC_E_BILLING_ID_CALL_FORWARDING_UNCONDITIONAL,
PRI_AOC_E_BILLING_ID_CALL_FORWARDING_BUSY,
PRI_AOC_E_BILLING_ID_CALL_FORWARDING_NO_REPLY,
PRI_AOC_E_BILLING_ID_CALL_DEFLECTION,
PRI_AOC_E_BILLING_ID_CALL_TRANSFER,
};
enum PRI_AOC_E_CHARGING_ASSOCIATION {
PRI_AOC_E_CHARGING_ASSOCIATION_NOT_AVAILABLE,
PRI_AOC_E_CHARGING_ASSOCIATION_NUMBER,
PRI_AOC_E_CHARGING_ASSOCIATION_ID,
};
struct pri_aoc_e_charging_association {
union {
/*! Charged number */
struct pri_party_number number;
/*! Charge identifier */
int id;
} charge;
/*! \see enum PRI_AOC_E_CHARGING_ASSOCIATION */
int charging_type;
};
struct pri_subcmd_aoc_e {
/*!
* \brief What is being charged.
* \see enum PRI_AOC_DE_CHARGE
*/
int charge;
/*! \see enum PRI_AOC_E_BILLING_ID */
int billing_id;
union {
/*! Recorded currency */
struct pri_aoc_recorded_currency money;
/*! Recorded units list */
struct pri_aoc_recorded_units unit;
} recorded;
/*! Charging association. */
struct pri_aoc_e_charging_association associated;
};
enum PRI_AOC_REQ_RSP {
/* Error Results */
PRI_AOC_REQ_RSP_ERROR_NOT_IMPLEMENTED,
PRI_AOC_REQ_RSP_ERROR_NOT_AVAILABLE,
PRI_AOC_REQ_RSP_ERROR_TIMEOUT,
PRI_AOC_REQ_RSP_ERROR_REJECT,
/* generic error result all other errors are lumped into */
PRI_AOC_REQ_RSP_ERROR,
/* AOC Results */
PRI_AOC_REQ_RSP_CHARGING_INFO_FOLLOWS,
PRI_AOC_REQ_RSP_CURRENCY_INFO_LIST,
PRI_AOC_REQ_RSP_SPECIAL_ARR,
};
enum PRI_AOC_REQUEST {
PRI_AOC_REQUEST_S = (1 << 0),
PRI_AOC_REQUEST_D = (1 << 1),
PRI_AOC_REQUEST_E = (1 << 2),
};
struct pri_subcmd_aoc_request_response {
/*!
* \brief aoc_s data from response
*/
struct pri_subcmd_aoc_s aoc_s;
/*!
* \brief if the aoc_s msg is present, this will be set
*/
int valid_aoc_s;
/*!
* \brief What type of aoc was requested.
* \see enum PRI_AOC_REQUEST
*/
int charging_request;
/*!
* \brief response to the charging_request
* \see enum PRI_AOC_REQ_RSP
*/
int charging_response;
};
struct pri_subcmd_aoc_request {
/*!
* \brief What types of aoc are being requested.
* \see enum PRI_AOC_REQUEST
*/
int charging_request;
/*!
* \brief Value given by the initiating request.
*/
int invoke_id;
};
struct pri_subcmd_mcid_req {
/*!
* \brief Information libpri knows about the malicious caller.
* \note For the convenience of the upper layer. This information
* may be incomplete if the upper layer redacted some caller
* information because it was restricted.
*/
struct pri_party_id originator;
/*! \brief Information libpri knows about the callee. */
struct pri_party_id answerer;
};
struct pri_subcmd_mcid_rsp {
/*!
* \brief MCID request response status.
* \details
* success(0),
* timeout(1),
* error(2),
* reject(3)
*/
int status;
/*!
* \brief Failure code that can be converted to a string to further
* explain the non-timeout failure.
* \note Valid when status is error or reject.
* \note Use pri_facility_error2str() to convert the error_code.
* \note Use pri_facility_reject2str() to convert the reject_code.
*/
int fail_code;
};
struct pri_subcmd_display_txt {
/*!
* \brief Character set the text is using.
* \details
* unknown(0),
* iso8859-1(1),
* enum-value-withdrawn-by-ITU-T(2)
* iso8859-2(3),
* iso8859-3(4),
* iso8859-4(5),
* iso8859-5(6),
* iso8859-7(7),
* iso10646-BmpString(8),
* iso10646-utf-8String(9)
*/
int char_set;
/*!
* \brief Number of octets in the display message.
* \note Not including any added null terminator.
*/
int length;
/*!
* \brief Display text data.
* \note Null terminated on receive.
* \note Does not need to be null terminated on send.
*/
char text[128];
};
struct pri_subcommand {