def getVoIPchanStats(self, chantype, <EOL>codec_list=('<STR_LIT>', '<STR_LIT>', '<STR_LIT>', '<STR_LIT>')):
chan = chantype.lower()<EOL>if not self.hasChannelType(chan):<EOL><INDENT>return None<EOL><DEDENT>if chan == '<STR_LIT>':<EOL><INDENT>cmd = "<STR_LIT>"<EOL><DEDENT>elif chan == '<STR_LIT>':<EOL><INDENT>cmd = "<STR_LIT>"<EOL><DEDENT>else:<EOL><INDENT>raise AttributeError("<STR_LIT>")<EOL><DEDENT>cmdresp = self.executeCommand(cmd)<EOL>lines = cmdresp.splitlines()<EOL>headers = re.split('<STR_LIT>', lines[<NUM_LIT:0>])<EOL>try:<EOL><INDENT>idx = headers.index('<STR_LIT>')<EOL><DEDENT>except ValueError:<EOL><INDENT>try:<EOL><INDENT>idx = headers.index('<STR_LIT>')<EOL><DEDENT>except:<EOL><INDENT>raise Exception("<STR_LIT>" <EOL>% chan)<EOL><DEDENT><DEDENT>codec_list = tuple(codec_list) + ('<STR_LIT>', '<STR_LIT:none>')<EOL>info_dict = dict([(k,<NUM_LIT:0>) for k in codec_list])<EOL>for line in lines[<NUM_LIT:1>:-<NUM_LIT:1>]:<EOL><INDENT>codec = None<EOL>cols = re.split('<STR_LIT>', line)<EOL>colcodec = cols[idx]<EOL>mobj = re.match('<STR_LIT>', colcodec)<EOL>if mobj:<EOL><INDENT>codec = mobj.group(<NUM_LIT:1>).lower()<EOL><DEDENT>elif re.match('<STR_LIT>', colcodec):<EOL><INDENT>codec = colcodec.lower()<EOL><DEDENT>if codec:<EOL><INDENT>if codec in info_dict:<EOL><INDENT>info_dict[codec] += <NUM_LIT:1><EOL><DEDENT>elif codec == '<STR_LIT>' or codec[<NUM_LIT:0>:<NUM_LIT:4>] == '<STR_LIT>':<EOL><INDENT>info_dict['<STR_LIT:none>'] += <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>info_dict['<STR_LIT>'] += <NUM_LIT:1><EOL><DEDENT><DEDENT><DEDENT>return info_dict<EOL>
Query Asterisk Manager Interface for SIP / IAX2 Channel / Codec Stats.

        CLI Commands - sip show channels
                       iax2 show channnels

        @param chantype:   Must be 'sip' or 'iax2'.
        @param codec_list: List of codec names to parse.
                           (Codecs not in the list are summed up to the other 
                           count.)
        @return:           Dictionary of statistics counters for Active VoIP 
                           Channels.