SHOW:
|
|
- or go back to the newest paste.
1 | use diagnostics; | |
2 | use strict; | |
3 | use warnings; | |
4 | use Data::Dumper; | |
5 | my $pdu ="A1 34 02 01 03 02 01 15 30 2C 55 04 01 11 00 12 A0 24 B0 22 | |
6 | 6B 11 30 0F 80 04 30 30 37 35 A1 07 30 05 80 03 31 31 31 63 | |
7 | 07 30 05 80 03 31 31 31 4E 01 01 0A 01 16"; | |
8 | $pdu =~s/\s//g; # убираем пробелы | |
9 | $pdu =pack ("H*", $pdu); # превращаем строку в бинарник | |
10 | ||
11 | # use Net::CSTA::ASN qw(CSTAapdu); | |
12 | # print Dumper($CSTAapdu->decode($pdu) or die $CSTAapdu->error); | |
13 | use Convert::ASN1; | |
14 | # parse ASN.1 desciptions | |
15 | my $asn = Convert::ASN1->new; | |
16 | $asn->prepare(<<ASN1) or die "prepare: ", $asn->error; | |
17 | ROIVapdu ::= [1] IMPLICIT SEQUENCE { | |
18 | invokeID INTEGER, -- no. de sequencia | |
19 | serviceID INTEGER, -- no. da operacao a ser realizada | |
20 | serviceArgs ANY DEFINED BY serviceID -- Uma das estruturas abaixo | |
21 | } | |
22 | ASN1 | |
23 | my $out=$asn->decode($pdu) or die $asn->error; | |
24 | my $pdu2=$out->{serviceArgs}; | |
25 | #print Dumper($out); | |
26 | $asn->prepare(<<ASN1) or die "prepare: ", $asn->error; | |
27 | - | CCSTAEventReportArgument ::= SEQUENCE |
27 | + | CSTAEventReportArgument ::= SEQUENCE |
28 | { crossRefIdentifier MonitorCrossRefID, | |
29 | eventSpecificInfo EventSpecificInfo} | |
30 | ||
31 | EventSpecificInfo ::= CHOICE | |
32 | { callControlEvents [0] CallControlEvents | |
33 | -- callAssociatedEvents [1] CallAssociatedEvents, | |
34 | -- mediaAttachmentEvents [2] MediaAttachmentEvents, | |
35 | -- physicalDeviceFeatureEvents [3] PhysicalDeviceFeatureEvents, | |
36 | -- logicalDeviceFeatureEvents [4] LogicalDeviceFeatureEvents, | |
37 | -- deviceMaintenanceEvents [5] DeviceMaintenanceEvents, | |
38 | -- voiceUnitEvents [6] VoiceUnitEvents, | |
39 | -- vendorSpecEvents [7] VendorSpecEvents | |
40 | } | |
41 | ||
42 | MonitorCrossRefID ::= [APPLICATION 21] IMPLICIT OCTET STRING | |
43 | ||
44 | CallControlEvents ::= CHOICE | |
45 | { | |
46 | -- bridged [ 0] IMPLICIT BridgedEvent, | |
47 | -- callCleared [ 1] IMPLICIT CallClearedEvent, | |
48 | -- conferenced [ 2] IMPLICIT ConferencedEvent, | |
49 | -- connectionCleared [ 3] IMPLICIT ConnectionClearedEvent, | |
50 | -- delivered [ 4] IMPLICIT DeliveredEvent, | |
51 | -- digitsDialed [ 5] IMPLICIT DigitsDialedEvent, | |
52 | -- diverted [ 6] IMPLICIT DivertedEvent, | |
53 | -- established [ 7] IMPLICIT EstablishedEvent, | |
54 | -- failed [ 8] IMPLICIT FailedEvent, | |
55 | -- held [ 9] IMPLICIT HeldEvent, | |
56 | -- networkCapabilitiesChanged [10] IMPLICIT NetworkCapabilitiesChangedEvent, | |
57 | -- networkReached [11] IMPLICIT NetworkReachedEvent, | |
58 | -- offered [12] IMPLICIT OfferedEvent, | |
59 | -- originated [13] IMPLICIT OriginatedEvent, | |
60 | -- queued [14] IMPLICIT QueuedEvent, | |
61 | -- retrieved [15] IMPLICIT RetrievedEvent, | |
62 | serviceInitiated [16] IMPLICIT ServiceInitiatedEvent | |
63 | -- transferred [17] IMPLICIT TransferredEvent | |
64 | } | |
65 | ||
66 | ServiceInitiatedEvent ::= | |
67 | SEQUENCE | |
68 | { initiatedConnection ConnectionID, | |
69 | initiatingDevice SubjectDeviceID, | |
70 | localConnectionInfo LocalConnectionState OPTIONAL, | |
71 | -- correlatorData [0] IMPLICIT CorrelatorData OPTIONAL, | |
72 | cause EventCause | |
73 | -- servicesPermitted [1] IMPLICIT ServicesPermitted OPTIONAL, | |
74 | -- mediaCallCharacteristics [2] IMPLICIT MediaCallCharacteristics OPTIONAL, | |
75 | -- callCharacteristics [3] IMPLICIT CallCharacteristics OPTIONAL, | |
76 | -- initiatedConnectionInfo [4] IMPLICIT ConnectionInformation OPTIONAL, | |
77 | -- networkCallingDevice NetworkCallingDeviceID OPTIONAL, | |
78 | -- networkCalledDevice NetworkCalledDeviceID OPTIONAL, | |
79 | -- associatedCallingDevice AssociatedCallingDeviceID OPTIONAL, | |
80 | -- callLinkageData [5] IMPLICIT CallLinkageData OPTIONAL, | |
81 | -- extensions CSTACommonArguments OPTIONAL | |
82 | } | |
83 | ||
84 | ConnectionID ::= [APPLICATION 11] CHOICE | |
85 | { callID [0] IMPLICIT CallID, | |
86 | deviceID [1] LocalDeviceID, | |
87 | both SEQUENCE | |
88 | { callID [0] IMPLICIT CallID, | |
89 | deviceID [1] LocalDeviceID | |
90 | } | |
91 | } | |
92 | ||
93 | CallID ::= OCTET STRING | |
94 | ||
95 | LocalDeviceID ::= CHOICE | |
96 | { staticID DeviceID | |
97 | -- dynamicID [3] IMPLICIT OCTET STRING | |
98 | } | |
99 | ||
100 | SubjectDeviceID ::= [APPLICATION 3] CHOICE | |
101 | {deviceIdentifier DeviceID, | |
102 | notKnown [7] IMPLICIT NULL} | |
103 | ||
104 | DeviceID ::= SEQUENCE | |
105 | { deviceIdentifier CHOICE | |
106 | { dialingNumber [0] IMPLICIT NumberDigits, | |
107 | deviceNumber [1] IMPLICIT DeviceNumber | |
108 | -- implicitPublic [2] IMPLICIT NumberDigits, | |
109 | -- explicitPublic [3] PublicTON, | |
110 | -- implicitPrivate [4] IMPLICIT NumberDigits, | |
111 | -- explicitPrivate [5] PrivateTON, | |
112 | -- other [6] IMPLICIT OtherPlan | |
113 | } | |
114 | --, | |
115 | -- mediaCallCharacteristics MediaCallCharacteristics OPTIONAL | |
116 | } | |
117 | ||
118 | NumberDigits ::= IA5String | |
119 | ||
120 | DeviceNumber ::= INTEGER | |
121 | ||
122 | LocalConnectionState ::= [APPLICATION 14] IMPLICIT ENUMERATED | |
123 | { null (0), | |
124 | initiated (1), | |
125 | alerting (2), | |
126 | connected (3), | |
127 | hold (4), | |
128 | queued (5), | |
129 | fail (6)} | |
130 | ||
131 | EventCause ::= ENUMERATED | |
132 | -- a general list of cause codes | |
133 | -- Present in Added in Added in | |
134 | -- Version 1 Version 2 Version 3 | |
135 | { aCDBusy (57), | |
136 | aCDForward (58), | |
137 | aCDSaturated (59), | |
138 | activeParticipation (1), | |
139 | alertTimeExpired (60), | |
140 | alternate (2), | |
141 | autoWork (61), | |
142 | blocked (35), | |
143 | busy (3), | |
144 | callBack (4), | |
145 | callCancelled (5), | |
146 | callForward (9), | |
147 | callForwardImmediate (6), | |
148 | callForwardBusy (7), | |
149 | callForwardNoAnswer (8), | |
150 | callNotAnswered (10), | |
151 | callPickup (11), | |
152 | campOn (12), | |
153 | campOnTrunks (62), | |
154 | characterCountReached (36), | |
155 | conference (63), | |
156 | consultation (37), | |
157 | destDetected (64), | |
158 | destNotObtainable (13), | |
159 | destOutOfOrder (65), | |
160 | distributed (38), | |
161 | distributionDelay (66), | |
162 | doNotDisturb (14), | |
163 | dTMFDigitDetected (39), | |
164 | durationExceeded (40), | |
165 | endOfMessageDetected (41), | |
166 | enteringDistribution (42), | |
167 | forcedPause (43), | |
168 | forcedTransition (67), | |
169 | incompatibleDestination (15), | |
170 | intrude (68), | |
171 | invalidAccountCode (16), | |
172 | invalidNumberFormat (69), | |
173 | joinCall (70), | |
174 | keyOperation (17), | |
175 | keyOperationInUse (71), | |
176 | lockout (18), | |
177 | maintenance (19), | |
178 | makeCall (44), | |
179 | makePredictiveCall (72), | |
180 | messageDurationExceeded (73), | |
181 | messageSizeExceeded (45), | |
182 | multipleAlerting (74), | |
183 | multipleQueuing (75), | |
184 | networkCongestion (20), | |
185 | networkDialling (76), | |
186 | networkNotObtainable (21), | |
187 | networkOutOfOrder (77), | |
188 | networkSignal (46), | |
189 | newCall (22), | |
190 | nextMessage (47), | |
191 | noAvailableAgents (23), | |
192 | normal (78), | |
193 | normalClearing (48), | |
194 | noSpeechDetected (49), | |
195 | notAvaliableBearerService (79), | |
196 | notSupportedBearerService (80), | |
197 | numberChanged (50), | |
198 | numberUnallocated (81), | |
199 | overflow (26), | |
200 | override (24), | |
201 | park (25), | |
202 | queueCleared (82), | |
203 | recall (27), | |
204 | redirected (28), | |
205 | remainsInQueue (83), | |
206 | reorderTone (29), | |
207 | reserved (84), | |
208 | resourcesNotAvailable (30), | |
209 | selectedTrunkBusy (85), | |
210 | silentParticipation (31), | |
211 | singleStepConference (51), | |
212 | singleStepTransfer (52), | |
213 | speechDetected (53), | |
214 | suspend (86), | |
215 | switchingFunctionTerminated (54), | |
216 | terminationCharacterReceived (55), | |
217 | timeout (56), | |
218 | transfer (32), | |
219 | trunksBusy (33), | |
220 | unauthorisedBearerService (87)} | |
221 | -- voiceUnitInitiator (34) } | |
222 | ||
223 | ASN1 | |
224 | ||
225 | #$pdu2 = unpack ("H*", $pdu2); | |
226 | #print $pdu2; | |
227 | - | my $obj = $asn->find('CCSTAEventReportArgument'); |
227 | + | my $obj = $asn->find('CSTAEventReportArgument'); |
228 | my $out2= $obj->decode($pdu2) or die $asn->error; | |
229 | print Dumper($out2); | |
230 | print "initiatingDevice:",$out2->{eventSpecificInfo}->{callControlEvents}->{serviceInitiated}->{initiatingDevice}->{deviceIdentifier}->{deviceIdentifier}->{dialingNumber}; |