[PATCH] Make sure we return an iterable of chan.get is we use it that way

Bug #1174722 reported by Marcel van der Boom (HS-Development BV) on 2013-04-30
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
OpenERP-Asterisk connector
Undecided
Unassigned

Bug Description

Make sure chan.get('BridgedChannel') returns an iterable if used in a construct which expects one.

The situation where the current code generates an exception is that when 'BridgedChannel' is not key in the status. A 'None' would be returned, which is not iterable. By returning an empty string, we prevent the exception.

Patch:
=== modified file 'asterisk_click2dial/asterisk_click2dial.py'
--- asterisk_click2dial/asterisk_click2dial.py 2013-04-15 06:46:08 +0000
+++ asterisk_click2dial/asterisk_click2dial.py 2013-04-30 11:48:57 +0000
@@ -299,7 +299,7 @@
                     _logger.debug("Found a matching Event in 'Ring' state")
                     calling_party_number = chan.get('CallerIDNum')
                     break
- if chan.get('ChannelState') == '6' and sip_account in chan.get('BridgedChannel'): # 6 = Up
+ if chan.get('ChannelState') == '6' and sip_account in chan.get('BridgedChannel',''): # 6 = Up
                     _logger.debug("Found a matching Event in 'Up' state")
                     calling_party_number = chan.get('CallerIDNum')
                     break

Alexis de Lattre (alexis-via) wrote :

Fixed in revno 83 of the trunk branch. Thank you very much for your patch Marcel.

Changed in openerp-asterisk-connector:
status: New → Fix Committed
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers