Skip to content

Instantly share code, notes, and snippets.

View bevenky's full-sized avatar

Venky B bevenky

View GitHub Profile
<Response>
<Stream bidirectional="true" keepCallAlive="true" contentType="audio/x-mulaw;rate=8000">
wss://renewal-ellis-context-groups.trycloudflare.com
</Stream>
</Response>
@bevenky
bevenky / plivo_dial_sip
Last active March 23, 2026 01:16
Dial SIP Endpoint
<Response>
<Dial>
<User>sip:lkpcagent1311237372354671685277@phone.plivo.com</User>
</Dial>
</Response>
import pygame
import math
import random
def main():
pygame.init()
width, height = 800, 600
screen = pygame.display.set_mode((width, height))
pygame.display.set_caption("True ASCII Rotating Torus")
@bevenky
bevenky / redis_leaky_bucket.py
Created December 29, 2017 20:54 — forked from jdunck/redis_leaky_bucket.py
leaky bucket queue - redis 2.6 + lua + python
#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
<Response>
<Dial>
<Number>14157583659</Number>
</Dial>
</Response>
<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>
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
import plivo
auth_id = ""
auth_token = ""
p = plivo.RestAPI(auth_id, auth_token)
# Make Calls
params = {
@bevenky
bevenky / trial_lua
Created August 18, 2012 11:46
Trial lua
pin = argv[1];
app_uri = 1111111@app.domain.com
api = freeswitch.API();
-- Call conference bridge
call_session = freeswitch.Session("sofia/external/" .. app_uri);
-- Get session UUID
@bevenky
bevenky / gist:1213838
Created September 13, 2011 13:44
Export json admin action with inlines
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' \