コード例 #1
0
ファイル: app.py プロジェクト: stuartlogan82/geolocator
def dequeue():
    print(request.is_json)
    content = request.get_json()
    print(content)
    # identity = content.get("identity")
    client = Client(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN)
    call_sid = ''
    members = client.queues(
        'QU0273e99cff8753d81cc9912099ad0c01').members.list()

    calls = client.calls.list(status='in-progress')

    for record in calls:
        if record.from_ == '+{}'.format(content["identity"]):
            print(record.sid, record.from_)
            call_sid = record.sid

    for record in members:
        if record.call_sid == call_sid:
            print("found call!!", record.call_sid)
            member = client.queues('QU0273e99cff8753d81cc9912099ad0c01') \
                .members(call_sid) \
                .update(url=SERVICE_BASE_URL + '/enqueue_to_flex', method='GET',)
            print(member.call_sid)
            return jsonify({'message': 'Dequeued succesfully!'}), 200

    return jsonify({'message': 'Dequeue failed'}), 200
コード例 #2
0
class CallQueue:
    def __init__(self, name):
        self.name = name
        self.client = Client()
        self.sid = self._create()

    def __repr__(self):
        return f"{self.name} ({self.sid})"

    def _create(self):
        current_queues = self.client.queues.list()
        for queue in current_queues:
            if self.name == queue.friendly_name:
                return queue.sid
        else:
            new_queue = self.client.queues.create(friendly_name=self.name)
            return new_queue.sid

    def size(self):
        queue = self.client.queues(self.sid).fetch()
        return queue.current_size
コード例 #3
0
# Download the helper library from https://www.twilio.com/docs/python/install
from twilio.rest import Client


# Your Account Sid and Auth Token from twilio.com/console
# DANGER! This is insecure. See http://twil.io/secure
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
client = Client(account_sid, auth_token)

queue = client.queues('QU5ef8732a3c49700934481addd5ce1659').fetch()

print(queue.friendly_name)
コード例 #4
0
# Download the helper library from https://www.twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/console
account_sid = '"ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"'
auth_token = 'your_auth_token'
client = Client(account_sid, auth_token)

queue = client.queues("QU32a3c49700934481addd5ce1659f04d2") \
              .update(max_size=123)

print(queue.friendly_name)
コード例 #5
0
# Download the helper library from https://www.twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/console
# DANGER! This is insecure. See http://twil.io/secure
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
client = Client(account_sid, auth_token)

members = client.queues('QU5ef8732a3c49700934481addd5ce1659') \
                .members \
                .list(limit=20)

for record in members:
    print(record.call_sid)
コード例 #6
0
# Download the helper library from https://www.twilio.com/docs/python/install
from twilio.rest import Client


# Your Account Sid and Auth Token from twilio.com/console
# DANGER! This is insecure. See http://twil.io/secure
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
client = Client(account_sid, auth_token)

member = client.queues('QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
               .members('CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
               .update(url='https://example.com', method='GET')

print(member.call_sid)
コード例 #7
0
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

member = client.queues("QU5ef8732a3c49700934481addd5ce1659") \
               .members("CA386025c9bf5d6052a1d1ea42b4d16662") \
               .fetch();

print(member.wait_time)
コード例 #8
0
# Download the helper library from https://www.twilio.com/docs/python/install
from twilio.rest import Client


# Your Account Sid and Auth Token from twilio.com/console
# DANGER! This is insecure. See http://twil.io/secure
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
client = Client(account_sid, auth_token)

queue = client.queues('QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch()

print(queue.friendly_name)
コード例 #9
0
# Download the helper library from https://www.twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/console
# DANGER! This is insecure. See http://twil.io/secure
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
client = Client(account_sid, auth_token)

members = client.queues('QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').members.list()

for record in members:
    print(record.call_sid)
コード例 #10
0
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

queue = client.queues("QU32a3c49700934481addd5ce1659f04d2").update(max_size="123")

print(queue.average_wait_time)
コード例 #11
0
# Download the helper library from https://www.twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/console
account_sid = '"ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"'
auth_token = 'your_auth_token'
client = Client(account_sid, auth_token)

member = client.queues("QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \
               .members("CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \
               .update(url="https://example.com", method="GET")

print(member.call_sid)
コード例 #12
0
ファイル: fetch-default.6.x.py プロジェクト: sekharfly/twilio
# Download the helper library from https://www.twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/console
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
client = Client(account_sid, auth_token)

member = client.queues('QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
               .members('CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
               .fetch()

print(member.call_sid)
コード例 #13
0
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

# A list of member objects with the properties described above
members = client.queues("QU5ef8732a3c49700934481addd5ce1659") \
                .members \
                .list()

for member in members:
    print(member.position)
コード例 #14
0
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

# A list of member objects with the properties described above
members = client.queues("QU5ef8732a3c49700934481addd5ce1659").members.list()

for member in members:
    print(member.position)
コード例 #15
0
# Download the helper library from https://www.twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/console
# DANGER! This is insecure. See http://twil.io/secure
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
client = Client(account_sid, auth_token)

members = client.queues('QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
                .members \
                .list(limit=20)

for record in members:
    print(record.call_sid)
コード例 #16
0
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

queue = client.queues("QU5ef8732a3c49700934481addd5ce1659") \
              .fetch()

print(queue.average_wait_time)
コード例 #17
0
# Download the helper library from https://www.twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/console
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
client = Client(account_sid, auth_token)

members = client.queues('QU5ef8732a3c49700934481addd5ce1659').members.list()

for record in members:
    print(record.call_sid)
コード例 #18
0
# Download the helper library from https://www.twilio.com/docs/python/install
from twilio.rest import Client


# Your Account Sid and Auth Token from twilio.com/console
account_sid = '"ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"'
auth_token = 'your_auth_token'
client = Client(account_sid, auth_token)

member = client.queues("QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \
               .members("CAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX") \
               .fetch()

print(member.call_sid)
コード例 #19
0
# Download the helper library from https://www.twilio.com/docs/python/install
from twilio.rest import Client


# Your Account Sid and Auth Token from twilio.com/console
account_sid = '"ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"'
auth_token = 'your_auth_token'
client = Client(account_sid, auth_token)

client.queues("QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").delete()
コード例 #20
0
# Download the helper library from https://www.twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/console
# DANGER! This is insecure. See http://twil.io/secure
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
client = Client(account_sid, auth_token)

member = client.queues('QU5ef8732a3c49700934481addd5ce1659') \
               .members('CA386025c9bf5d6052a1d1ea42b4d16662') \
               .fetch()

print(member.call_sid)
コード例 #21
0
# Download the helper library from https://www.twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/console
account_sid = '"ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"'
auth_token = 'your_auth_token'
client = Client(account_sid, auth_token)

queue = client.queues("QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").fetch()

print(queue.friendly_name)
コード例 #22
0
# Download the helper library from https://www.twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/console
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
client = Client(account_sid, auth_token)

member = client.queues('QU5ef8732a3c49700934481addd5ce1659') \
               .members('Front') \
               .update(
                    url='http://demo.twilio.com/docs/voice.xml',
                    method='POST'
                )

print(member.call_sid)
コード例 #23
0
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

member = client.queues("QU5ef8732a3c49700934481addd5ce1659") \
               .members("CA5ef8732a3c49700934481addd5ce1659") \
               .update(url="http://demo.twilio.com/docs/voice.xml",
                       method="POST")

print(member.position)
コード例 #24
0
# Download the helper library from https://www.twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/console
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
client = Client(account_sid, auth_token)

queue = client.queues('QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
              .update(friendly_name='friendly_name')

print(queue.friendly_name)
コード例 #25
0
# Download the helper library from https://www.twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/console
# DANGER! This is insecure. See http://twil.io/secure
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
client = Client(account_sid, auth_token)

client.queues('QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete()