This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#cribbed from http://vimeo.com/52569901 (Twilio carrier call origination moderation) | |
# The idea is that many fan-in queues can enqueue at any rate, but | |
# dequeue needs to happen in a rate-controlled manner without allowing | |
# any individual input queue to starve other queues. | |
# http://en.wikipedia.org/wiki/Leaky_bucket (second sense, "This version is referred to here as the leaky bucket as a queue.") | |
# | |
# requires: | |
# redis 2.6+ | |
# redis-py>=2.7.0 | |
# anyjson |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Response> | |
<Dial> | |
<Number>14157583659</Number> | |
</Dial> | |
</Response> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<Response> | |
<GetDigits action="https://gist.githubusercontent.com/bevenky/a44bb9e215c9e8c5264d290ac0bafe22/raw/64fd641d2300364905ce2bcf0277aa3a40ee237b/forward.xml" method="GET"> | |
<Speak>Thank you for calling Envioni foods. You call may be monitored and recorded for quality and training purposes.</Speak> | |
<Speak>Please press 1 to cancel or change your membership plan</Speak> | |
<Speak>Please press 2 to order new products</Speak> | |
<Speak>Please press 3 for partnership inquiries</Speak> | |
<Speak>Please press 4 for media and pr relations</Speak> | |
</GetDigits> | |
</Response> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -X POST -H "Content-Type: application/json" -d '{"src":"XXXXXXXXX","dst":"YYYYYYYYY","text":"こんにちはお元気ですか"}' -L -u <AUTHID>:<AUTHTOKEN> https://api.plivo.com/v1/Account/<AUTHID>/Message/ | |
where: | |
XXXXXXXXX = source Plivo number (it must be a Phone Number in your Plivo account) | |
YYYYYYYYY = destination mobile number | |
<AUTHID> = Plivo AUTHID | |
<AUTHTOKEN> = Plivo AUTHTOKEN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import plivo | |
auth_id = "" | |
auth_token = "" | |
p = plivo.RestAPI(auth_id, auth_token) | |
# Make Calls | |
params = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pin = argv[1]; | |
app_uri = [email protected] | |
api = freeswitch.API(); | |
-- Call conference bridge | |
call_session = freeswitch.Session("sofia/external/" .. app_uri); | |
-- Get session UUID |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def export_related_as_json(modeladmin, request, queryset): | |
opts = modeladmin.model._meta | |
for parent in queryset: | |
for inline in modeladmin.inlines: | |
related_params = inline.model.objects.filter(**{inline.fk_name: parent}) | |
from itertools import chain | |
result_list = list(chain(queryset, related_params)) | |
data = serializers.serialize("json", result_list, indent=4) | |
response = HttpResponse(data, mimetype="text/javascript") | |
response['Content-Disposition'] = 'attachment; filename=%s.json' \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import redis | |
class ResourceCache(object): | |
"""Uses a local directory as a store for cached files. | |
""" | |
def __init__(self, redis_host='localhost', redis_port=6379, redis_db=0): | |
self.cache = redis.Redis(host=redis_host, port=redis_port, db=redis_db) | |
def get_resource_params(self, resource_key): | |
if self.cache.sismember("resource_key", resource_key): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import helpers | |
#Sid and AuthToken | |
SID = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX' | |
AUTH_TOKEN = 'YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY' | |
originate_dial_string = "bridge_early_media=true,hangup_after_bridge=true" |