Skip to content

Instantly share code, notes, and snippets.

View seven1240's full-sized avatar

Seven Du seven1240

View GitHub Profile
@seven1240
seven1240 / dialplan.xml
Created July 1, 2013 15:03
FreeSWITCH dialplan xml_curl
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="freeswitch/xml">
<section name="dialplan" description="RE Dial Plan For FreeSwitch">
<context name="default">
<extension name="9196">
<condition field="destination_number" expression="^9196$">
<action application="log" data="ERR I'm from xml curl dialplan"/>
<action application="answer"/>
<action application="echo"/>
</condition>
@seven1240
seven1240 / fs_loadtest.c
Created July 1, 2013 08:39
load test example based on testclient.c
#include <stdio.h>
#include <stdlib.h>
#include <esl.h>
int main(void)
{
esl_handle_t handle = {{0}};
int i;
int rate = 20;
/*
<extension name="socket">
<condition field="destination_number" expression="^socket$">
<action application="socket" data="127.0.0.1 8084 async full"/>
</condition>
</extension>
*/
#include <stdio.h>
cid = session:getVariable("caller_id_number");
dest= session:getVariable("destination_number");
session:execute("log", "ERR cid is:" .. cid);
session:execute("log", "ERR dest is:" .. dest .. " or " .. argv[1]);
session:hangup();
freeswitch.msleep(2000);
%%%-------------------------------------------------------------------
%%% @author egobrain <egobrain@linux-ympb>
%%% @copyright (C) 2012, egobrain
%%% @doc
%%% Function for uploading files and properties,which were sent as a
%%% multipart. Files are stored in tmp_folder with random name,
%%% generated by tmp_filename function.
%%% @end
%%% Created : 25 Mar 2012 by egobrain <egobrain@linux-ympb>
%%%-------------------------------------------------------------------
-module(fsm_ivr).
-behaviour(gen_fsfsm).
-export([start/1, init/1, handle_info/3, handle_event/3, terminate/3]).
-export([welcome/2, wait_lang/2, wait_number/2, wait_hangup/2]).
-define(FS_NODE, 'freeswitch@localhost').
-define(WELCOME_SOUND, "tone_stream://%(100,1000,800);loops=1").
-define(INPUT_NUMBER_SOUND, "tone_stream://%(100,1000,800);loops=2").
-define(SELECT_LANG_SOUND, "tone_stream://%(100,1000,800);loops=3").
@seven1240
seven1240 / sup
Last active December 14, 2015 03:49
-module(xcds_user_sup).
-behaviour(supervisor).
%% API
-export([start_link/0, start_users/0]).
%% Supervisor callbacks
-export([init/1]).
@seven1240
seven1240 / file_upload_example.html
Created May 21, 2012 07:08 — forked from egobrain/file_upload_example.html
File upload example that uses new Browser HTML5 Upload API.
<style>
#dropZone {
color: #555;
font-size: 18px;
text-align: center;
width: 400px;
padding: 50px 0;
margin: 50px auto;
@seven1240
seven1240 / gen_fsfsm.erl
Created November 10, 2011 13:38
gen_fsfsm.erl
%% This is copied from gen_fsm from Erlang release R13B01
%% Modified by Seven Du <dujinfang at gmail.com> for easy handle FS messages
%% From FreeSWITCH through mod_erlang_event.
%%
%% %CopyrightBegin%
%%
%% Copyright Ericsson AB 1996-2010. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@seven1240
seven1240 / ivr.erl
Created August 21, 2011 01:38
erlang sample ivr
-module(ivr).
-author("Seven Du").
-export([start/0, start/1]).
-define(FS_NODE, 'freeswitch@localhost').
-define(WELCOME_SOUND, "tone_stream://%(100,1000,800);loops=1").
-define(INPUT_NUMBER_SOUND, "tone_stream://%(100,1000,800);loops=2").
-define(LOG(Fmt, Args), io:format("~b " ++ Fmt, [?LINE | Args])).