Skip to content

Incorrect pack deccoding on EventList. #26

@soloma83

Description

@soloma83

Hello.
Unfortunately, AMIClient dispatches responses and events incorrectly.

There are a few types of responses which is marked as EventList. These responses contain a several elements divided by '\r\n\r\n'. As soon, AMIClient wait for this separator to finish pack it cannot catch these types of response.

For example, Action: Status. This action might respond with list of active channels.

Action: Status

Response: Success
EventList: start
Message: Channel status will follow

Event: Status
Privilege: Call
Channel: SIP/3030-00000002
ChannelState: 6
ChannelStateDesc: Up
CallerIDNum: 3030
CallerIDName: 3030
ConnectedLineNum:
ConnectedLineName:
Accountcode:
Context: exten-voicemail-sub
Exten: s
Priority: 5
Uniqueid: 1542489290.45
Type: SIP
DNID: 2020
EffectiveConnectedLineNum:
EffectiveConnectedLineName:
TimeToHangup: 0
BridgeID:
Linkedid: 1542489290.45
Application: VoiceMail
Data: 3030@default,b
Nativeformats: (ulaw)
Readformat: ulaw
Readtrans:
Writeformat: ulaw
Writetrans:
Callgroup: 0
Pickupgroup: 0
Seconds: 285

Event: StatusComplete
EventList: Complete
ListItems: 1
Items: 1

But AMIClient passes only first element.

def fire_recv_pack(self, pack):
print("Received pack: \n{}\n\n".format(pack))
if Response.match(pack):
response = Response.read(pack)
self.fire_recv_reponse(response)
return
if Event.match(pack):
event = Event.read(pack)
self.fire_recv_event(event)
return
self._fire_on_unknown(pack=pack)

Output is

Received pack:
Response: Success
ActionID: 1
EventList: start
Message: Channel status will follow

Received pack:
Event: StatusComplete
ActionID: 1
EventList: Complete
ListItems: 0
Items: 0

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions