Skip to content

Commit

Permalink
[feat] add peer(peername) function (unified peers search)
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Bour committed May 6, 2013
1 parent f40cab5 commit 07e0620
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pyajam/pyajam.py
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,21 @@ def iaxpeer(self, peername):
return params


def peer(self, peername):
"""Query IAX or SIP peers, to return matching peer parameters
peername: tech/name (i.e SIP/101, IAX/demo)
"""
(tech, name) = peername.split('/', 1)
# SIP/101 -> return self.sippeer('101')
# IAX/demo -> return self.iaxpeer('demo')
try:
return getattr(self, tech.lower()+'peer')(name)
except AttributeError:
logging.error("peer(%s): unknown '%s' channel type" % (peername, tech))
raise Exception("unknown '%s' channel type" % tech)


def command(self, command, regex=None, normalizer=None, unifyin=None):
"""Execute an Asterisk command.
command is always returned in raw mode from asterisk.
Expand Down

0 comments on commit 07e0620

Please sign in to comment.