Skip to content

Instantly share code, notes, and snippets.

View debojitkakoti's full-sized avatar

DEBOJIT KAKOTI debojitkakoti

View GitHub Profile
@debojitkakoti
debojitkakoti / gps_track_server.py
Created June 20, 2016 13:10 — forked from gruzovator/gps_track_server.py
Async TCP server example (using standard python lib asyncore)
#!/usr/bin/env python
''' Async TCP server to make first tests of newly received GPS trackers '''
import asyncore
import socket
import logging
class Server(asyncore.dispatcher):
def __init__(self, address):
asyncore.dispatcher.__init__(self)
@debojitkakoti
debojitkakoti / default
Last active October 14, 2016 05:06
Reverse Proxy with Nginx, HHVM and PHP FPM
upstream BACKEND {
server 127.0.0.1:9000; #HHVM
server unix:/var/run/php5-fpm.sock backup; #PHP-FPM in backup mode
}
server {
listen 80;
server_name YOUR_SERVER_IP;
root /var/www/sampleapp/app/webroot/;
@debojitkakoti
debojitkakoti / conference
Created June 30, 2015 07:01
conferece dialplan
[conf_miss_conference]
exten => _X.,1,Ringing()
exten => _X.,n,Wait(2)
exten => _X.,n,AGI(example.php);your agi script here use pin based authentication here
exten => _X.,n,Set(MEETME_RECORDINGFILE=/var/spool/asterisk/meetme/${UNIQUEID});your conference recording location
exten => _X.,n,MeetMe(${conference_id},rM,${conference_pin});get the conference id and pin dynamically from example.php
exten => h,1,AGI(billing.php);handle billing and other stuff here
@debojitkakoti
debojitkakoti / extconfig.conf
Created June 30, 2015 06:51
extconfig.conf for asterisk real time
; Static and realtime external configuration
; engine configuration
;
; See https://wiki.asterisk.org/wiki/display/AST/Realtime+Database+Configuration
; for basic table formatting information.
;
[settings]
;
; Static configuration files:
;
@debojitkakoti
debojitkakoti / meetme
Created June 30, 2015 06:45
asterisk meetme table for real time conference setup
CREATE TABLE `meetmes` (
`bookid` INT(11) NOT NULL AUTO_INCREMENT,
`created` DATETIME NOT NULL,
`confno` INT(10) NULL DEFAULT NULL,
`pin` INT(10) NULL DEFAULT NULL,
`adminpin` CHAR(20) NULL DEFAULT NULL,
`opts` CHAR(20) NULL DEFAULT NULL,
`adminopts` CHAR(20) NULL DEFAULT NULL,
`maxusers` INT(11) NOT NULL DEFAULT '10',
`members` INT(11) NULL DEFAULT NULL,
@debojitkakoti
debojitkakoti / asterisk_zombie_kill.sh
Last active August 29, 2015 14:15
Asterisk zombie killing
#!/bin/sh
###########################################################################
#
# clean-up Asterisk zombies
# file asterisk_zombie_kill.sh
# Description: clean_up all parent dead Asterisk AGI processes, v 1.0 2006/05/10 bb Exp $
#
# cron task */30 * * * * root /usr/local/sbin/clean_up.sh
#
###########################################################################
@debojitkakoti
debojitkakoti / hangup_cause.php
Created February 15, 2015 05:22
Hangup cause in asterisk using phpagi
<?php
require_once('phpagi.php');
$agi = new AGI();
$clid = $agi->request['agi_callerid']; // -Caller ID
$dest = $agi->request['agi_dnid']; // -Destination id
$uid = $agi->request['agi_uniqueid'];
$rdnis =$agi->request['agi_rdnis']; //Redirected Dialed Number Information Service
@debojitkakoti
debojitkakoti / seq_mongo_auto.php
Last active October 27, 2020 06:31
Auto Incrementing Sequence in mongodb using php mongo
<?php
$m = new MongoClient();
// select a database
$db = $m->seq;
// select a collection (analogous to a relational database's table)
$collection = $db->counters;
$user_collection = $db->user;
@debojitkakoti
debojitkakoti / download_wav_header.php
Last active August 29, 2015 13:56
PHP Header code to download wav files
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($destination_name_ulaw));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($destination_name_ulaw));
ob_clean();
flush();
@debojitkakoti
debojitkakoti / google_tts.php
Created February 15, 2014 11:46
GOOGLE undocumented TTS engine in HINDI
<?php
$words ="dilli%20bharat%20ki%20rajdhani%20hey";
$file = "sample.wav";
if (!file_exists($file)) {
$mp3 = file_get_contents('http://translate.google.com/translate_tts?tl=hi&q='.$words);
file_put_contents($file, $mp3);
}
?>