Thanks for pointing me there, Marcel. That would indeed fix the exception.
But in my scenario it would also lead to no calling number being retrieved at all - which is an independent (probably ISDN/DAHDI instead SIP related) issue i guess.
As a workaround I just replaced:
if chan.get('ChannelState') == '6' and sip_account in chan.get('BridgedChannel'): # 6 = Up
with:
if chan.get('ChannelState') == '6' and (chan.get('ConnectedLineNum') == user.internal_number or sip_account in chan.get('BridgedChannel')): # 6 = Up
So the if statement is true before evaluating 'sip_account in chan.get('BridgedChannel')', leading to the correct phone number being returned. As I see now, your fix should also be integrated, as the exception can nevertheless still occur with other responses from asterisk.
Thanks for pointing me there, Marcel. That would indeed fix the exception.
But in my scenario it would also lead to no calling number being retrieved at all - which is an independent (probably ISDN/DAHDI instead SIP related) issue i guess.
As a workaround I just replaced: 'ChannelState' ) == '6' and sip_account in chan.get( 'BridgedChannel '): # 6 = Up
if chan.get(
with: 'ChannelState' ) == '6' and (chan.get( 'ConnectedLineN um') == user.internal_ number or sip_account in chan.get( 'BridgedChannel ')): # 6 = Up
if chan.get(
So the if statement is true before evaluating 'sip_account in chan.get( 'BridgedChannel ')', leading to the correct phone number being returned. As I see now, your fix should also be integrated, as the exception can nevertheless still occur with other responses from asterisk.