EvoluxBR / greenswitch

Battle proven FreeSWITCH Event Socket Protocol client implementation with Gevent
Other
126 stars 50 forks source link

Crash on FreeSWITCH 'bad' EVENT (double Content-Length) #54

Open nttranbao opened 4 years ago

nttranbao commented 4 years ago

Hi,

For some reason, FreeSWITCH returns an event with double "Content-Length" as below, which causes esl.py to crash.

While I can report this to FreeSWITCH team, is there anything that we can do on greenswitch to get around this issue? (i.e. removing duplicate lines)?

Thanks, Bao

Traceback (most recent call last): File "src/gevent/greenlet.py", line 766, in gevent._greenlet.Greenlet.run File "../libs/greenswitch/esl.py", line 97, in receive_events self.handle_event(event) File "../libs/greenswitch/esl.py", line 147, in handle_event length = int(event.headers['Content-Length']) KeyError: 'Content-Length' 2020-03-13T15:23:27Z <Greenlet at 0x7f057214cae8: <bound method ESLProtocol.receive_events of <libs.greenswitch.esl.InboundESL object at 0x7f0572149e10>>> failed with K eyError

Event fired by Freeswitch v.1.10.2 `RECV EVENT Event-Subclass: sofia::notify_refer Event-Name: CUSTOM Core-UUID: c6327c82-be80-4c4d-8966-2a11bb4004f4 FreeSWITCH-Hostname: PBX-SIPT-IPSM-2 FreeSWITCH-Switchname: PBX-SIPT-IPSM-2 FreeSWITCH-IPv4: 192.168.194.31 FreeSWITCH-IPv6: ::1 Event-Date-Local: 2020-03-13 10:52:49 Event-Date-GMT: Fri, 13 Mar 2020 14:52:49 GMT Event-Date-Timestamp: 1584111169386681 Event-Calling-File: sofia.c Event-Calling-Function: sofia_handle_sip_i_notify Event-Calling-Line-Number: 657 Event-Sequence: 895854 content-type: message/sipfrag event-package: refer event-id: 17501791 contact: +14167601210@10.1.109.13 from: +14167601210@hipv.itech.ca from-tag: 1400489415-1584111124103 to: 6137700001@hipv.itech.ca to-tag: Njryg7ra0U9vN call-id: 225c8744-dfdd-1238-6da5-005056a17d9b subscription-substate: terminated subscription-reason: noresource UniqueID: 63509455-96e6-4e43-b52f-8239e7088331 Content-Length: 20 Content-Length: 20

SIP/2.0 100 Trying`