staskobzar / goami2

Simple Asterisk Manager Interface (AMI) library fo golang
MIT License
15 stars 3 forks source link

New parser fails to parse AMI messages with numbers in field names #8

Open halsbox opened 5 months ago

halsbox commented 5 months ago

Example message:

Event: RTCPSent
Privilege: reporting,all
Channel: PJSIP/****
ChannelState: 6
ChannelStateDesc: Up
CallerIDNum: ****
CallerIDName: CID:****
ConnectedLineNum: ****
ConnectedLineName: device
Language: **
AccountCode: 
Context: ****
Exten: 
Priority: 1
Uniqueid: 1707480456.1153253
Linkedid: 1707480456.1153252
To: aaa.bbb.ccc.ddd:port
From: aaa.bbb.ccc.ddd:port
SSRC: 0x211b953b
PT: 200(SR)
ReportCount: 1
SentNTP: 1707480563.414904
SentRTP: 328720
SentPackets: 4488
SentOctets: 718080
Report0SourceSSRC: 0x06f8b9e2
Report0FractionLost: 0
Report0CumulativeLost: 0
Report0HighestSequence: 52923
Report0SequenceNumberCycles: 0
Report0IAJitter: 4
Report0LSR: 6858342
Report0DLSR: 2.0850
staskobzar commented 3 months ago

@halsbox fixed in v1.7.3 please try and let me know if it does not work have a good day

halsbox commented 3 months ago

Sorry again. Shouldn't it be altered in parse.re so name pattern also includes digits? i.e.:

    alpha = [a-zA-Z0-9];
    name  = alpha (alpha | "-")+;
staskobzar commented 3 months ago

no problem! it actually does. Pattern alpha (alpha | "-")+ means start with alpha (a-zA-Z0-9) and the (alpha OR "-") character repeated one or more times Do you have some particular example?

halsbox commented 3 months ago

no problem! it actually does.

Yep, I fixed it this way. In your code there is just alpha = [a-zA-Z]; in master branch.

staskobzar commented 3 months ago

Ok! I see, will fix it too thanks

staskobzar commented 3 months ago

this one is fixed in new v1.7.4 thanks