def getPeerStats(self, chantype):
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>info_dict = dict(<EOL>online = <NUM_LIT:0>, unreachable = <NUM_LIT:0>, lagged = <NUM_LIT:0>, <EOL>unknown = <NUM_LIT:0>, unmonitored = <NUM_LIT:0>)<EOL>for line in cmdresp.splitlines():<EOL><INDENT>if re.search('<STR_LIT>', line, re.IGNORECASE):<EOL><INDENT>info_dict['<STR_LIT>'] += <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>mobj = re.search('<STR_LIT>', <EOL>line, re.IGNORECASE)<EOL>if mobj:<EOL><INDENT>info_dict[mobj.group(<NUM_LIT:1>).lower()] += <NUM_LIT:1><EOL><DEDENT><DEDENT><DEDENT>return info_dict<EOL>
Query Asterisk Manager Interface for SIP / IAX2 Peer Stats.

        CLI Command - sip show peers
                      iax2 show peers

        @param chantype: Must be 'sip' or 'iax2'.
        @return:         Dictionary of statistics counters for VoIP Peers.