Permalink
Browse files

Added conference features

  • Loading branch information...
1 parent 5b19c1c commit 653c6633e4452e90c05e1d57d768ff750755ad40 @cakebread committed Mar 19, 2012
Showing with 71 additions and 18 deletions.
  1. +13 −3 HACKING.txt
  2. +2 −0 README.rst
  3. +2 −2 setup.py
  4. +1 −1 src/twerp/__init__.py
  5. +12 −0 src/twerp/cli.py
  6. +41 −12 src/twerp/twiliolib.py
View
@@ -6,14 +6,24 @@ Vincent Driessen's branching model.
https://github.com/nvie/gitflow
+Don't care about that? Then, basically, watch the 'develop' branch on github. The 'master' branch only
+contains stable tagged versions.
+
Release HOWTO
=============
To make a release,
1) Update release date/version in NEWS.txt, setup.py and src/twerp/__init__.py
- 2) Run 'tox' to build and test using multiple Python versions
- 3) Upload to PyPI: 'python setup.py sdist register upload'
- 4) Increase version in setup.py and src/twerp/__init__.py (for next release)
+
+ 2) Configure tox.ini to use multiple python versions. The one in git is for
+ the Jenkins continuous integration running at http://cakebread.info/jenkins.
+ Only modify that in git if you're working on Jenkins.
+
+ 3) Run 'tox' to build and test using multiple Python versions
+
+ 4) Upload to PyPI: 'python setup.py sdist register upload'
+
+ 5) Increase version in setup.py and src/twerp/__init__.py (for next release)
View
@@ -1,6 +1,8 @@
README
======
+twerp version 0.0.5
+
.. contents::
View
@@ -6,7 +6,7 @@
NEWS = open(os.path.join(here, 'NEWS.txt')).read()
-version = '0.0.4'
+version = '0.0.5'
install_requires = ['twilio>=3.3.3', 'ConfigObj', 'clint']
@@ -26,7 +26,7 @@
],
keywords='twilio sms telephony',
author='Rob Cakebread',
- author_email='cakebread gmail com',
+ author_email='cakebread@gmail.com',
url='http://github.com/cakebread/twerp',
license='BSD',
packages=find_packages('src'),
View
@@ -1,4 +1,4 @@
-__version__ = '0.0.4'
+__version__ = '0.0.5'
__all__ = ["twiliolib", "cli"]
View
@@ -202,6 +202,10 @@ def run(self):
if self.options.interactive:
Interactive(self.client).cmdloop(sid)
return
+ elif self.options.participants:
+ return self.client.list_conference_participants()
+ elif self.options.conferences:
+ return self.client.list_conferences()
elif self.options.listsms:
return self.client.list_sms()
elif self.options.twerp_version:
@@ -308,6 +312,14 @@ def setup_opt_parser():
dest="notifications", default=False, help="Show notifications " +
"from Twilio API (error messages and warnings).")
+ group_reports.add_option("-C", "--conferences", action='store_true',
+ dest="conferences", default=False,
+ help="Show conferences in-progress.")
+
+ group_reports.add_option("-P", "--conference-participants", action='store_true',
+ dest="participants", default=False,
+ help="Show participants for all conferences in-progress.")
+
group_reports.add_option("-N", "--numbers", action='store_true',
dest="numbers", default=False, help="Show all my Twilio phone " +
"numbers. Use -Nv for detailed info on each number.")
View
@@ -104,6 +104,47 @@ def notifications(self, verbose=False):
print notification.more_info
print
+ def list_conference_participants(self):
+ """List all conferences"""
+ try:
+ conferences = self.client.conferences.list(status="in-progress")
+ except ServerNotFoundError, e:
+ self.logger.error(e)
+ return 1
+ except TwilioRestException, e:
+ print e
+ return 1
+ for conference in conferences:
+ print conference.status
+ print conference.date_created
+ print conference.date_updated
+ print conference.friendly_name
+ print '[' + conference.sid[0:7] + '...]'
+ print '=' * 79
+ print
+
+ def list_conferences(self):
+ """List all conferences"""
+ try:
+ conferences = self.client.conferences.list(status="in-progress")
+ except ServerNotFoundError, e:
+ self.logger.error(e)
+ return 1
+ except TwilioRestException, e:
+ print e
+ return 1
+ for conference in conferences:
+ print conference.status
+ print conference.date_created
+ print conference.date_updated
+ print conference.friendly_name
+ print '[' + conference.sid[0:7] + '...]'
+ print '=' * 79
+ print
+ for participant in conference.participants.list():
+ print participant.sid
+
+
def sid_call(self, sid):
"""Print results for given SID"""
try:
@@ -261,17 +302,6 @@ def list_numbers(self, verbose=False):
getattr(number,
NUMBER_IDS[NUMBER_IDS.index(id)])))
- else:
- pass
- #puts(" - Voice URL %s" % getattr(number,
- # NUMBER_IDS[NUMBER_IDS.index('voice_url')]))
- #puts(" - SMS URL %s" %
- #getattr(number,
- # NUMBER_IDS[NUMBER_IDS.index('sms_url')]))
- #puts("%s: %s" % (colored.green(id),
- # getattr(number,
- # NUMBER_IDS[NUMBER_IDS.index('voice-url')])))
-
except ServerNotFoundError, e:
self.logger.error(e)
return 1
@@ -283,7 +313,6 @@ def list_sms(self):
TODO: Add filtering for from, to and date
"""
- #from_ = CALLER_ID
try:
messages = self.client.sms.messages.list()
except ServerNotFoundError, e:

0 comments on commit 653c663

Please sign in to comment.