Skip to content

Instantly share code, notes, and snippets.

View areski's full-sized avatar
🤗
Working at DialerAI

Areski Belaid areski

🤗
Working at DialerAI
  • Star2Billing // DialerAI
  • Barcelona
  • X @areskib
View GitHub Profile
@areski
areski / test_outbound
Created February 8, 2011 18:19
Telephonie failed with AttributeError
python outbound_sync_server_test.py
2011-02-08 19:17:56,286 outbound_sync_server_test[14999]: INFO: Start server ('127.0.0.1', 8084) ...
2011-02-08 19:18:03,592 outbound_sync_server_test[14999]: INFO: New request from ('127.0.0.1', 40567)
2011-02-08 19:18:03,593 outbound_sync_server_test[14999]: INFO: [connect] args=''
Traceback (most recent call last):
File "/home/areski/.virtualenvs/telephonie/lib/python2.6/site-packages/gevent/greenlet.py", line 405, in run
result = self._run(*self.args, **self.kwargs)
File "outbound_sync_server_test.py", line 62, in do_handle
self._handle_class(socket, address, self.log, filter=self._filter)
File "outbound_sync_server_test.py", line 15, in __init__
@areski
areski / outbound_async_server_test
Created February 8, 2011 19:10
more on outbound_async_server_test
python outbound_async_server_test.py
2011-02-08 20:08:44,895 outbound_async_server_test[15489]: INFO: Start server ('127.0.0.1', 8084) ...
2011-02-08 20:08:51,646 outbound_async_server_test[15489]: INFO: New request from ('127.0.0.1', 41712)
2011-02-08 20:08:51,646 outbound_async_server_test[15489]: INFO: [connect] args=''
2011-02-08 20:08:51,656 outbound_async_server_test[15489]: INFO: <CommandResponse headers=Event-Name: CHANNEL_DATA\nCore-UUID: 27f31c16-339d-11e0-bf48-834f981de622\nFreeSWITCH-Hostname: openplanet-desktop\nFreeSWITCH-IPv4: 192.168.0.5\nFreeSWITCH-IPv6: ::1\nEvent-Date-Local: 2011-02-08 20:08:51\nEvent-Date-GMT: Tue, 08 Feb 2011 19:08:51 GMT\nEvent-Date-Timestamp: 1297192131647364\nEvent-Calling-File: mod_event_socket.c\nEvent-Calling-Function: parse_command\nEvent-Calling-Line-Number: 1786\nChannel-Username: 1000\nChannel-Dialplan: XML\nChannel-Caller-ID-Name: Areski\nChannel-Caller-ID-Number: 1000\nChannel-Network-Addr: 192.168.0.5\nChannel-ANI: 1000\nChannel-Destination-Number: 55555\nCh
@areski
areski / gist:908000
Created April 7, 2011 15:27
telephonie - hangup event
# -*- coding: utf-8 -*-
from telephonie.core.inboundsocket import InboundEventSocket
from telephonie.core.errors import ConnectError
from telephonie.utils.logger import StdoutLogger
import gevent.event
class MyEventSocket(InboundEventSocket):
def __init__(self, host, port, password, filter, log=None):
InboundEventSocket.__init__(self, host, port, password, filter)
self.log = log
@areski
areski / gist:908274
Created April 7, 2011 17:39
new sample - telefonie
# -*- coding: utf-8 -*-
from telephonie.core.inboundsocket import InboundEventSocket
from telephonie.core.errors import ConnectError
from telephonie.utils.logger import StdoutLogger
import gevent.event
import random
random.seed()
@areski
areski / Makfile.android.template
Created October 16, 2011 21:55 — forked from pmuellr/Makfile.android.template
skeletal makefile for phonegap android
#
# PhoneGap is available under *either* the terms of the modified BSD license *or* the
# MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
#
# Copyright (c) 2011, IBM Corporation
#
#-------------------------------------------------------------------------------
help:
@echo make targets available:
@areski
areski / gist:2509756
Created April 27, 2012 14:36
Attempt to add accountcode to core.db in table channels
diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c
index d436c60..b9a920a 100644
--- a/src/switch_core_sqldb.c
+++ b/src/switch_core_sqldb.c
@@ -1254,14 +1254,15 @@ static void core_event_handler(switch_event_t *event)
break;
}
case SWITCH_EVENT_CHANNEL_CREATE:
- new_sql() = switch_mprintf("insert into channels (uuid,direction,created,created_epoch, name,state,callstate,dialplan,context,hostname) "
@areski
areski / gist:2510165
Created April 27, 2012 15:28
Add accountcode to core.db in table channels
diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c
index d436c60..6ec8792 100644
--- a/src/switch_core_sqldb.c
+++ b/src/switch_core_sqldb.c
@@ -1254,14 +1254,15 @@ static void core_event_handler(switch_event_t *event)
break;
}
case SWITCH_EVENT_CHANNEL_CREATE:
- new_sql() = switch_mprintf("insert into channels (uuid,direction,created,created_epoch, name,state,callstate,dialplan,context,hostname) "
- "values('%q','%q','%q','%ld','%q','%q','%q','%q','%q','%q')",
prefixlist = range(0, 100)
rate_list = VoIPRetailRate.objects.values('prefix', 'retail_rate', 'prefix__destination').filter(prefix__in=[int(s) for s in prefixlist])
print rate_list
@areski
areski / gist:4722239
Last active December 12, 2015 05:28
make_pi
#
# Display PI Number
#
def make_pi():
q, r, t, k, m, x = 1, 0, 1, 1, 3, 3
for j in range(10000):
if 4 * q + r - t < m * t:
yield m
q, r, t, k, m, x = 10*q, 10*(r-m*t), t, k, (10*(3*q+r))//t - 10*m, x
#!/usr/bin/env python
"""
Install a package from your local pip download cache without having to touch
the 'net at all.
You'll need to be using a pip download cache; that is, you'll need the
following in your ~/.pip/pip.cfg:
[install]