├── .gitignore
├── BigCouch
├── README.md
├── compact_commands.sh
├── large_shards.sh
└── shard_ratio.sh
├── CloneTools
├── Makefile
├── README.md
├── clone.sh
├── ebin
│ └── .placeholder
├── escriptize
├── lib
│ └── ejson-0.1.0
│ │ ├── AUTHORS
│ │ ├── LICENSE
│ │ ├── Makefile
│ │ ├── NOTICE
│ │ ├── README.md
│ │ ├── THANKS
│ │ ├── c_src
│ │ ├── decode.c
│ │ ├── decode.o
│ │ ├── ejson.c
│ │ ├── ejson.o
│ │ ├── encode.c
│ │ ├── encode.o
│ │ ├── erl_nif_compat.h
│ │ └── yajl
│ │ │ ├── yajl.c
│ │ │ ├── yajl.o
│ │ │ ├── yajl_alloc.c
│ │ │ ├── yajl_alloc.h
│ │ │ ├── yajl_alloc.o
│ │ │ ├── yajl_buf.c
│ │ │ ├── yajl_buf.h
│ │ │ ├── yajl_buf.o
│ │ │ ├── yajl_bytestack.h
│ │ │ ├── yajl_common.h
│ │ │ ├── yajl_encode.c
│ │ │ ├── yajl_encode.h
│ │ │ ├── yajl_encode.o
│ │ │ ├── yajl_gen.c
│ │ │ ├── yajl_gen.h
│ │ │ ├── yajl_gen.o
│ │ │ ├── yajl_lex.c
│ │ │ ├── yajl_lex.h
│ │ │ ├── yajl_lex.o
│ │ │ ├── yajl_parse.h
│ │ │ ├── yajl_parser.c
│ │ │ ├── yajl_parser.h
│ │ │ └── yajl_parser.o
│ │ ├── ebin
│ │ ├── .placeholder
│ │ ├── ejson.app
│ │ └── ejson.beam
│ │ ├── priv
│ │ └── ejson.so
│ │ ├── rebar
│ │ ├── rebar.config
│ │ ├── src
│ │ ├── ejson.app.src
│ │ └── ejson.erl
│ │ └── t
│ │ ├── 001-yajl-tests.t
│ │ ├── 002-literals.t
│ │ ├── 003-numbers.t
│ │ ├── 004-strings.t
│ │ ├── 005-arrays.t
│ │ ├── 006-maps.t
│ │ ├── 007-compound.t
│ │ ├── cases
│ │ ├── array.erl
│ │ ├── array.json
│ │ ├── array_close.erl
│ │ ├── array_close.json
│ │ ├── array_open.erl
│ │ ├── array_open.json
│ │ ├── bogus_char.erl
│ │ ├── bogus_char.json
│ │ ├── codepoints_from_unicode_org.erl
│ │ ├── codepoints_from_unicode_org.json
│ │ ├── deep_arrays.erl
│ │ ├── deep_arrays.json
│ │ ├── difficult_json_c_test_case.erl
│ │ ├── difficult_json_c_test_case.json
│ │ ├── doubles.erl
│ │ ├── doubles.json
│ │ ├── empty_array.erl
│ │ ├── empty_array.json
│ │ ├── empty_string.erl
│ │ ├── empty_string.json
│ │ ├── escaped_bulgarian.erl
│ │ ├── escaped_bulgarian.json
│ │ ├── escaped_foobar.erl
│ │ ├── escaped_foobar.json
│ │ ├── false.erl
│ │ ├── false.json
│ │ ├── false_then_garbage.erl
│ │ ├── false_then_garbage.json
│ │ ├── four_byte_utf8.erl
│ │ ├── four_byte_utf8.json
│ │ ├── integers.erl
│ │ ├── integers.json
│ │ ├── invalid_utf8.erl
│ │ ├── invalid_utf8.json
│ │ ├── isolated_surrogate_marker.erl
│ │ ├── isolated_surrogate_marker.json
│ │ ├── leading_zero_in_number.erl
│ │ ├── leading_zero_in_number.json
│ │ ├── lonely_minus_sign.erl
│ │ ├── lonely_minus_sign.json
│ │ ├── lonely_number.erl
│ │ ├── lonely_number.json
│ │ ├── map_close.erl
│ │ ├── map_close.json
│ │ ├── map_open.erl
│ │ ├── map_open.json
│ │ ├── missing_integer_after_decimal_point.erl
│ │ ├── missing_integer_after_decimal_point.json
│ │ ├── missing_integer_after_exponent.erl
│ │ ├── missing_integer_after_exponent.json
│ │ ├── non_utf8_char_in_string.erl
│ │ ├── non_utf8_char_in_string.json
│ │ ├── null.erl
│ │ ├── null.json
│ │ ├── null_then_garbage.erl
│ │ ├── null_then_garbage.json
│ │ ├── nulls_and_bools.erl
│ │ ├── nulls_and_bools.json
│ │ ├── simple.erl
│ │ ├── simple.json
│ │ ├── string_invalid_escape.erl
│ │ ├── string_invalid_escape.json
│ │ ├── string_invalid_hex_char.erl
│ │ ├── string_invalid_hex_char.json
│ │ ├── string_with_escapes.erl
│ │ ├── string_with_escapes.json
│ │ ├── string_with_invalid_newline.erl
│ │ ├── string_with_invalid_newline.json
│ │ ├── three_byte_utf8.erl
│ │ ├── three_byte_utf8.json
│ │ ├── true.erl
│ │ ├── true.json
│ │ ├── true_then_garbage.erl
│ │ ├── true_then_garbage.json
│ │ ├── unescaped_bulgarian.erl
│ │ └── unescaped_bulgarian.json
│ │ ├── etap.erl
│ │ └── util.erl
├── priv
│ └── account_ids.txt
└── src
│ ├── audit.erl
│ ├── clone_tools.app.src
│ ├── clone_tools.hrl
│ ├── db_clone.erl
│ ├── hunt_account_id.erl
│ ├── number_replicator.erl
│ ├── props.erl
│ ├── view_rebuilder.erl
│ ├── wh_account.erl
│ ├── wh_binary.erl
│ ├── wh_json.erl
│ ├── wh_json.hrl
│ ├── wh_types.erl
│ └── wh_types.hrl
├── FreeSWITCH
├── README.md
├── context_2_failures.bash
├── sipify.sh
└── user_agents.sh
├── PostgreSQL-CDR
├── README.md
├── amqp_to_pgsql_cdr.py
└── postgres_schema.txt
├── README.md
├── RadiusCDR
└── cdr_radius.rb
├── Weyoun
├── .gitignore
├── README.md
├── helperfunctions.py
├── requirements.txt
├── weyoun.py
└── weyounFunctions.py
├── bash_completion.d
├── README.md
└── sup.sh
├── blackhole-client
├── LICENSE
├── README.md
├── app.js
├── config.js.sample
└── package.json
├── buildKazoo4.sh
├── cdr-mysql-processor
├── .gitingore
├── README.md
├── config.py
├── directory_watcher.py
├── field_processors.py
├── mysql_process_cdr.py
├── mysql_schema
├── requirements.txt
└── run.py
├── dashboards
├── README.md
├── grafana-authentication-proxy
│ └── config.js
├── influxdb
│ └── shared
│ │ └── config.toml
├── nginx
│ └── conf.d
│ │ └── grafana.conf
└── system_stats.sh
├── dtmf-tones-js
├── DTMF.js
├── keypress-demo.html
├── keypress-demo.js
├── readme.md
├── ui-demo.css
├── ui-demo.html
└── ui-demo.js
├── export_auth_token.bash
├── fill_fax_db
├── README.md
├── fax_file.tiff
├── fill_faxes_db.py
├── fixture.json
├── original_file.pdf
└── pdf_file.pdf
├── fullbackup-couchdb
├── README.md
├── crontab-fullbackup-couchdb
├── fullbackup-couchdb.conf.example
├── fullbackup-couchdb.sh
└── preflight-check.sh
├── kazoo-puppet
├── README.md
└── voxter-kazoo-0.0.6.tar.gz
├── kazoo-sample-php-app
├── LICENSE
├── README.md
├── app
│ ├── commands
│ │ └── .gitkeep
│ ├── config
│ │ ├── app.php
│ │ ├── auth.php
│ │ ├── cache.php
│ │ ├── compile.php
│ │ ├── database.php
│ │ ├── mail.php
│ │ ├── packages
│ │ │ └── .gitkeep
│ │ ├── queue.php
│ │ ├── session.php
│ │ ├── testing
│ │ │ ├── cache.php
│ │ │ └── session.php
│ │ ├── view.php
│ │ └── workbench.php
│ ├── controllers
│ │ ├── .gitkeep
│ │ ├── AccountController.php
│ │ ├── BaseController.php
│ │ ├── DeviceController.php
│ │ └── HomeController.php
│ ├── database
│ │ ├── migrations
│ │ │ └── .gitkeep
│ │ ├── production.sqlite
│ │ └── seeds
│ │ │ ├── .gitkeep
│ │ │ └── DatabaseSeeder.php
│ ├── filters.php
│ ├── lang
│ │ └── en
│ │ │ ├── pagination.php
│ │ │ ├── reminders.php
│ │ │ └── validation.php
│ ├── models
│ │ └── User.php
│ ├── routes.php
│ ├── start
│ │ ├── artisan.php
│ │ ├── global.php
│ │ └── local.php
│ ├── storage
│ │ ├── .gitignore
│ │ ├── cache
│ │ │ └── .gitignore
│ │ ├── logs
│ │ │ └── .gitignore
│ │ ├── meta
│ │ │ └── .gitignore
│ │ ├── sessions
│ │ │ └── .gitignore
│ │ └── views
│ │ │ └── .gitignore
│ ├── tests
│ │ ├── ExampleTest.php
│ │ └── TestCase.php
│ └── views
│ │ ├── accounts
│ │ └── index.blade.php
│ │ ├── devices
│ │ └── index.blade.php
│ │ ├── emails
│ │ └── auth
│ │ │ └── reminder.blade.php
│ │ ├── home
│ │ ├── index.blade.php
│ │ ├── nav.blade.php
│ │ └── pagetitle.blade.php
│ │ └── layouts
│ │ └── master.blade.php
├── artisan
├── bootstrap
│ ├── autoload.php
│ ├── paths.php
│ └── start.php
├── composer.json
├── composer.lock
├── phpunit.xml
├── public
│ ├── .htaccess
│ ├── css
│ │ ├── foundation.css
│ │ ├── foundation.min.css
│ │ └── normalize.css
│ ├── favicon.ico
│ ├── img
│ │ └── .gitkeep
│ ├── index.php
│ ├── js
│ │ ├── foundation.min.js
│ │ ├── foundation
│ │ │ ├── foundation.abide.js
│ │ │ ├── foundation.accordion.js
│ │ │ ├── foundation.alert.js
│ │ │ ├── foundation.clearing.js
│ │ │ ├── foundation.dropdown.js
│ │ │ ├── foundation.interchange.js
│ │ │ ├── foundation.joyride.js
│ │ │ ├── foundation.js
│ │ │ ├── foundation.magellan.js
│ │ │ ├── foundation.offcanvas.js
│ │ │ ├── foundation.orbit.js
│ │ │ ├── foundation.reveal.js
│ │ │ ├── foundation.tab.js
│ │ │ ├── foundation.tooltip.js
│ │ │ ├── foundation.topbar.js
│ │ │ └── jquery.cookie.js
│ │ ├── jquery.js
│ │ └── modernizr.js
│ ├── packages
│ │ └── .gitkeep
│ └── robots.txt
└── server.php
├── kazoo-status.sh
├── klap
├── README.md
├── analyzers
│ ├── klap-accounts.sh
│ ├── klap-amqp-worker.sh
│ ├── klap-amqp.sh
│ ├── klap-bigcouch.sh
│ ├── klap-call-ids.sh
│ ├── klap-callflow.sh
│ ├── klap-couch-mgr.sh
│ ├── klap-hangups.sh
│ ├── klap-hotornot.sh
│ ├── klap-jonny5.sh
│ ├── klap-omnipresence.sh
│ ├── klap-phone-numbers.sh
│ ├── klap-registrar.sh
│ ├── klap-stepswitch.sh
│ ├── klap-sysconf.sh
│ ├── klap-system.sh
│ └── klap-trunkstore.sh
├── check.awk
├── klap-utils.sh
└── stats.sh
├── management-proxy
├── README.md
├── index-management.html
├── install-management-proxy.sh
├── management-proxy.conf
└── openssl-management-proxy.cnf
├── pivot-script
├── dial.xml
├── gather.php
├── reject.xml
└── say.xml
├── simple-installer
├── README.md
├── get_ip_address
├── install_kazoo
├── kazoo_motd
├── onboot_kazoo
├── setup_bigcouch
├── setup_common
├── setup_freeswitch
├── setup_haproxy
├── setup_kamailio
├── setup_kazoo
├── setup_monster-ui
├── setup_packages
├── setup_rabbitmq
└── uninstall_kazoo_all_in_one.sh
└── sipp
├── call_with_auth.sh
├── device-simulators
├── callees.csv
├── callers.csv
├── g711a_2.pcap
├── register.sh
├── register.xml
├── uac.sh
├── uac.xml
├── uas.sh
└── uas.xml
├── g711a_2.pcap
├── leave_vm.sh
├── register.sh
├── register.xml
├── test_ecallmgr.sh
├── uac-alt.xml
├── uac-hangup.xml
├── uac.xml
├── uac_auth.xml
├── uac_auth_audio.xml
├── uac_wait_for_hangup.xml
├── uas-alt.xml
├── uas.xml
└── users.csv
/.gitignore:
--------------------------------------------------------------------------------
1 | *.beam
2 | *.app
3 | CloneTools/db_clone
4 |
--------------------------------------------------------------------------------
/BigCouch/README.md:
--------------------------------------------------------------------------------
1 | # Bigcouch Utils
2 | =================
3 |
4 | ## large_shards.sh \
5 | Finds DB shards exceeding `size` and provides the SUP command to compact
6 |
7 | ```bash
8 | [root@db002-dev BigCouch]# ./large_shards.sh 10M
9 | sup couch_compactor_fsm compact_db "bigcouch@db002-dev.2600hz.com" "services"
10 | sup couch_compactor_fsm compact_db "bigcouch@db002-dev.2600hz.com" "ratedeck"
11 | sup couch_compactor_fsm compact_db "bigcouch@db002-dev.2600hz.com" "signups"
12 | sup couch_compactor_fsm compact_db "bigcouch@db002-dev.2600hz.com" "offnet"
13 | sup couch_compactor_fsm compact_db "bigcouch@db002-dev.2600hz.com" "webhooks"
14 | sup couch_compactor_fsm compact_db "bigcouch@db002-dev.2600hz.com" "accounts"
15 | sup couch_compactor_fsm compact_db "bigcouch@db002-dev.2600hz.com" "ratedeck"
16 | ```
17 |
18 | ## shard_ratio.sh \
19 | Returns the ratio of disk to data size for all shards exceeding `size`.
20 |
21 | _Note:_ Requires bc `yum install -y bc`
22 |
23 | ```bash
24 | [root@db002-dev BigCouch]# ./shard_ratio.sh 10M
25 | 13154786 signups
26 | 8253836 ratedeck
27 | 8253836 ratedeck
28 | 1538251 offnet
29 | 1453137 webhooks
30 | 265489 acdc
31 | 223425 accounts
32 | 223425 accounts
33 | 144278 services
34 | 144278 services
35 | ```
36 |
--------------------------------------------------------------------------------
/BigCouch/compact_commands.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | ## Replace the find command with whatever will print the full path of the .couch file. The output will be the curl command necessary to compact that shard.
4 |
5 | find /srv/db/shards/ -name "*201501*" | awk -F '/' 'BEGIN {OFS="%2F"} {print "curl -X POST -H \"Content-type:application/json\" localhost:5986/" $4, $5, $6, $7, $8, $9 "/_compact"}' | sed -e 's/\.couch//g' > /tmp/compact.me
6 |
--------------------------------------------------------------------------------
/BigCouch/large_shards.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | for DB in `find /srv/db/shards/ -size +$1 -exec ls -l {} \; | awk '{ print $5, $9 }' | sort -rn | cut -d' ' -f2 | sed -r 's|^.{33}||;s|\..*$||' | uniq`; do echo sup couch_compactor_fsm compact_db \"bigcouch@$(hostname -f)\" \"$DB\"; done
4 |
--------------------------------------------------------------------------------
/BigCouch/shard_ratio.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | for DB in `find /srv/db/shards/ -size +$1 -exec ls -l {} \; | awk '{ print $5, $9 }' | sort -rn | cut -d' ' -f2 | sed -r 's|^.{33}||;s|\..*$||' | uniq`
4 | do
5 | JSON=`curl -s 127.0.0.1:5984/${DB//\//%2F}`
6 | DATASIZE=`echo $JSON | grep -Eo '"data_size":([0-9]+)' | cut -d':' -f2`
7 | DISKSIZE=`echo $JSON | grep -Eo '"disk_size":([0-9]+)' | cut -d':' -f2`
8 | RATIO=`bc -l <<< "($DISKSIZE / $DATASIZE) * 100"`
9 | RATIO=${RATIO%.*}
10 | if [ "${RATIO}" -gt "150" ];
11 | then
12 | echo ${RATIO} ${DB}
13 | fi
14 | done | sort -rn
15 |
--------------------------------------------------------------------------------
/CloneTools/Makefile:
--------------------------------------------------------------------------------
1 | PROJECT = clone_tools
2 | ROOT = .
3 |
4 | EBINS = $(shell find $(ROOT)/lib -maxdepth 2 -name ebin -print)
5 | PA = $(foreach EBIN,$(EBINS),-pa $(EBIN))
6 |
7 | ERLC_OPTS = +debug_info +warn_export_all -I$(ROOT)/lib $(PA)
8 | # +bin_opt_info
9 |
10 | DIRS = . \
11 | $(ROOT)/lib/ejson-0.1.0
12 |
13 | .PHONY: all compile clean
14 |
15 | all: compile
16 |
17 | MODULES = $(shell ls src/*.erl | sed 's/src\///;s/\.erl/,/' | sed '$$s/.$$//')
18 |
19 | compile: ebin/$(PROJECT).app
20 | @cat src/$(PROJECT).app.src \
21 | | sed 's/{modules, \[\]}/{modules, \[$(MODULES)\]}/' \
22 | > ebin/$(PROJECT).app
23 | -@$(MAKE) ebin/$(PROJECT).app
24 | @./escriptize -o db_clone -d "ebin lib/ejson-0.1.0/ebin lib/ejson-0.1.0/priv"
25 | @chmod +x db_clone
26 | @echo "\n\tdb_clone successfuly created\n"
27 |
28 | ebin/$(PROJECT).app: src/*.erl
29 | @mkdir -p ebin/
30 | erlc -v $(ERLC_OPTS) -o ebin/ -pa ebin/ $?
31 |
32 | compile-test: test/$(PROJECT).app
33 | @cat src/$(PROJECT).app.src \
34 | | sed 's/{modules, \[\]}/{modules, \[$(MODULES)\]}/' \
35 | > test/$(PROJECT).app
36 | -@$(MAKE) test/$(PROJECT).app
37 |
38 | test/$(PROJECT).app: src/*.erl
39 | @mkdir -p test/
40 | erlc -v $(ERLC_OPTS) -o test/ -pa test/ $?
41 |
42 | clean:
43 | rm -f ebin/*
44 | rm -f test/*.beam test/$(PROJECT).app
45 | rm -f erl_crash.dump
46 |
47 | test: clean compile-test eunit
48 |
49 | eunit: compile-test
50 | erl -noshell -pa test -eval "eunit:test([$(MODULES)], [verbose])" -s init stop
51 |
--------------------------------------------------------------------------------
/CloneTools/clone.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | erl -pa ./lib/ejson-0.1.0/ebin -pa ebin/ -noshell -run db_clone run $@
4 |
--------------------------------------------------------------------------------
/CloneTools/ebin/.placeholder:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2600hz/community-scripts/cc0d0106eaaf066b85cc42fccbd5b774af001310/CloneTools/ebin/.placeholder
--------------------------------------------------------------------------------
/CloneTools/escriptize:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env escript
2 | %% Sponsored by CloudPBX Inc. (http://cloudpbx.ca)
3 | %%
4 | -module(escriptize).
5 |
6 | -record('opts', {dirs = ["ebin"], out}).
7 |
8 | -export([main/0, main/1]).
9 |
10 | main() ->
11 | io:format("not enough arguments"),
12 | halt(1).
13 |
14 | main(Args) ->
15 | main(Args, #opts{}).
16 |
17 | main(["-d", Dir | Args], Opts) ->
18 | Dirs = [binary_to_list(D) || D <- re:split(Dir, " ")],
19 | main(Args, Opts#opts{dirs = Dirs});
20 | main(["-o", Out | Args], Opts) ->
21 | main(Args, Opts#opts{out = Out});
22 | main([_ | Args], Opts) ->
23 | main(Args, Opts);
24 | main([], Opts) ->
25 | run(Opts).
26 |
27 | run(#opts{dirs = Dirs, out = Out}) ->
28 | Files = lists:foldl(fun(Dir, Acc) -> Acc ++ filelib:wildcard(Dir ++ "/*") end, [], Dirs),
29 | {ok, {"mem", Zip}} = zip:create("mem", Files, ['memory']),
30 | ok = escript:create(Out, [shebang, {emu_args, "-pa ebin -pa lib/ejson-0.1.0/ebin"}, {archive, Zip}]),
31 | halt(0).
32 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/AUTHORS:
--------------------------------------------------------------------------------
1 | Apache CouchDB AUTHORS
2 | ======================
3 |
4 | A number of people have contributed directly to Apache CouchDB by writing
5 | documentation or developing software. Some of these people are:
6 |
7 | * Damien Katz
8 | * Jan Lehnardt
9 | * Noah Slater
10 | * Christopher Lenz
11 | * J. Chris Anderson
12 | * Paul Joseph Davis
13 | * Adam Kocoloski
14 | * Jason Davies
15 | * Mark Hammond
16 | * Benoît Chesneau
17 | * Filipe Manana
18 | * Robert Newson
19 |
20 | For a list of other credits see the `THANKS` file.
21 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/Makefile:
--------------------------------------------------------------------------------
1 | ROOT = ../..
2 | REBAR = $(ROOT)/lib/ejson-0.1.0/rebar
3 |
4 | %.beam: %.erl
5 | erlc -o t/ $<
6 |
7 | all: app
8 |
9 | app: compile
10 |
11 | compile:
12 | @mkdir -p ebin
13 | @$(REBAR) compile
14 |
15 | deps:
16 | @rebar get-deps
17 |
18 | check: t/etap.beam t/util.beam
19 | @prove t/*.t
20 |
21 | check_verbose: t/etap.beam t/util.beam
22 | @prove -v t/*.t
23 |
24 | clean:
25 | @$(REBAR) clean
26 | @rm -f t/*.beam
27 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/NOTICE:
--------------------------------------------------------------------------------
1 | Apache CouchDB
2 | Copyright 2009 The Apache Software Foundation
3 |
4 | This product includes software developed at
5 | The Apache Software Foundation (http://www.apache.org/).
6 |
7 | Converted to an independant module by Benoît Chesneau
8 | .
9 |
10 | This product also includes the following third-party components:
11 |
12 | * MochiWeb (http://code.google.com/p/mochiweb/)
13 |
14 | Copyright 2007, Mochi Media Coporation
15 |
16 | * yajl (http://lloyd.github.com/yajl/)
17 |
18 | Copyright 2010, Lloyd Hilaiel
19 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/README.md:
--------------------------------------------------------------------------------
1 | #ejson
2 |
3 | decode and encode JSON into/from Erlang terms using Elang NIF library
4 | if available.. This the module used in CouchDB project ported a
5 | standalone module with rebar support.
6 |
7 | ##Build
8 |
9 | $ make
10 |
11 | ##Testing
12 |
13 | $ make check
14 |
15 | All tests should pass
16 |
17 | ## Usage
18 |
19 | Put this app in your Erlang path.
20 |
21 | $ erl -pa ebin/
22 | Erlang R13B04 (erts-5.7.5) [source] [64-bit] [smp:2:2] [rq:2] [async-threads:0] [hipe] [kernel-poll:false]
23 |
24 | Eshell V5.7.5 (abort with ^G)
25 | 1> ejson:decode(<<"{\"foo\": true}">>).
26 | {[{<<"foo">>,true}]}
27 | 2> ejson:encode([true, 1.2, null]).
28 | <<"[true,1.2,null]">>
29 |
30 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/c_src/decode.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2600hz/community-scripts/cc0d0106eaaf066b85cc42fccbd5b774af001310/CloneTools/lib/ejson-0.1.0/c_src/decode.o
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/c_src/ejson.c:
--------------------------------------------------------------------------------
1 | #include "erl_nif.h"
2 |
3 | ERL_NIF_TERM final_encode(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]);
4 | ERL_NIF_TERM reverse_tokens(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]);
5 |
6 | int
7 | on_load(ErlNifEnv* env, void** priv_data, ERL_NIF_TERM info)
8 | {
9 | return 0;
10 | }
11 |
12 | int
13 | on_reload(ErlNifEnv* env, void** priv_data, ERL_NIF_TERM info)
14 | {
15 | return 0;
16 | }
17 |
18 | int
19 | on_upgrade(ErlNifEnv* env, void** priv_data, void** old_data, ERL_NIF_TERM info)
20 | {
21 | return 0;
22 | }
23 |
24 | static ErlNifFunc nif_funcs[] =
25 | {
26 | {"final_encode", 1, final_encode},
27 | {"reverse_tokens", 1, reverse_tokens}
28 | };
29 |
30 | ERL_NIF_INIT(ejson, nif_funcs, &on_load, &on_reload, &on_upgrade, NULL);
31 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/c_src/ejson.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2600hz/community-scripts/cc0d0106eaaf066b85cc42fccbd5b774af001310/CloneTools/lib/ejson-0.1.0/c_src/ejson.o
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/c_src/encode.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2600hz/community-scripts/cc0d0106eaaf066b85cc42fccbd5b774af001310/CloneTools/lib/ejson-0.1.0/c_src/encode.o
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/c_src/yajl/yajl.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2600hz/community-scripts/cc0d0106eaaf066b85cc42fccbd5b774af001310/CloneTools/lib/ejson-0.1.0/c_src/yajl/yajl.o
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/c_src/yajl/yajl_alloc.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010, Lloyd Hilaiel.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are
6 | * met:
7 | *
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | *
11 | * 2. Redistributions in binary form must reproduce the above copyright
12 | * notice, this list of conditions and the following disclaimer in
13 | * the documentation and/or other materials provided with the
14 | * distribution.
15 | *
16 | * 3. Neither the name of Lloyd Hilaiel nor the names of its
17 | * contributors may be used to endorse or promote products derived
18 | * from this software without specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
28 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
29 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 | * POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | /**
34 | * \file yajl_alloc.h
35 | * default memory allocation routines for yajl which use malloc/realloc and
36 | * free
37 | */
38 |
39 | #include "yajl_alloc.h"
40 | #include
41 |
42 | static void * yajl_internal_malloc(void *ctx, unsigned int sz)
43 | {
44 | return malloc(sz);
45 | }
46 |
47 | static void * yajl_internal_realloc(void *ctx, void * previous,
48 | unsigned int sz)
49 | {
50 | return realloc(previous, sz);
51 | }
52 |
53 | static void yajl_internal_free(void *ctx, void * ptr)
54 | {
55 | free(ptr);
56 | }
57 |
58 | void yajl_set_default_alloc_funcs(yajl_alloc_funcs * yaf)
59 | {
60 | yaf->malloc = yajl_internal_malloc;
61 | yaf->free = yajl_internal_free;
62 | yaf->realloc = yajl_internal_realloc;
63 | yaf->ctx = NULL;
64 | }
65 |
66 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/c_src/yajl/yajl_alloc.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010, Lloyd Hilaiel.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are
6 | * met:
7 | *
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | *
11 | * 2. Redistributions in binary form must reproduce the above copyright
12 | * notice, this list of conditions and the following disclaimer in
13 | * the documentation and/or other materials provided with the
14 | * distribution.
15 | *
16 | * 3. Neither the name of Lloyd Hilaiel nor the names of its
17 | * contributors may be used to endorse or promote products derived
18 | * from this software without specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
28 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
29 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 | * POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | /**
34 | * \file yajl_alloc.h
35 | * default memory allocation routines for yajl which use malloc/realloc and
36 | * free
37 | */
38 |
39 | #ifndef __YAJL_ALLOC_H__
40 | #define __YAJL_ALLOC_H__
41 |
42 | #include "yajl_common.h"
43 |
44 | #define YA_MALLOC(afs, sz) (afs)->malloc((afs)->ctx, (sz))
45 | #define YA_FREE(afs, ptr) (afs)->free((afs)->ctx, (ptr))
46 | #define YA_REALLOC(afs, ptr, sz) (afs)->realloc((afs)->ctx, (ptr), (sz))
47 |
48 | void yajl_set_default_alloc_funcs(yajl_alloc_funcs * yaf);
49 |
50 | #endif
51 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/c_src/yajl/yajl_alloc.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2600hz/community-scripts/cc0d0106eaaf066b85cc42fccbd5b774af001310/CloneTools/lib/ejson-0.1.0/c_src/yajl/yajl_alloc.o
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/c_src/yajl/yajl_buf.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010, Lloyd Hilaiel.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are
6 | * met:
7 | *
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | *
11 | * 2. Redistributions in binary form must reproduce the above copyright
12 | * notice, this list of conditions and the following disclaimer in
13 | * the documentation and/or other materials provided with the
14 | * distribution.
15 | *
16 | * 3. Neither the name of Lloyd Hilaiel nor the names of its
17 | * contributors may be used to endorse or promote products derived
18 | * from this software without specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
28 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
29 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 | * POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | #ifndef __YAJL_BUF_H__
34 | #define __YAJL_BUF_H__
35 |
36 | #include "yajl_common.h"
37 | #include "yajl_alloc.h"
38 |
39 | /*
40 | * Implementation/performance notes. If this were moved to a header
41 | * only implementation using #define's where possible we might be
42 | * able to sqeeze a little performance out of the guy by killing function
43 | * call overhead. YMMV.
44 | */
45 |
46 | /**
47 | * yajl_buf is a buffer with exponential growth. the buffer ensures that
48 | * you are always null padded.
49 | */
50 | typedef struct yajl_buf_t * yajl_buf;
51 |
52 | /* allocate a new buffer */
53 | yajl_buf yajl_buf_alloc(yajl_alloc_funcs * alloc);
54 |
55 | /* free the buffer */
56 | void yajl_buf_free(yajl_buf buf);
57 |
58 | /* append a number of bytes to the buffer */
59 | void yajl_buf_append(yajl_buf buf, const void * data, unsigned int len);
60 |
61 | /* empty the buffer */
62 | void yajl_buf_clear(yajl_buf buf);
63 |
64 | /* get a pointer to the beginning of the buffer */
65 | const unsigned char * yajl_buf_data(yajl_buf buf);
66 |
67 | /* get the length of the buffer */
68 | unsigned int yajl_buf_len(yajl_buf buf);
69 |
70 | /* truncate the buffer */
71 | void yajl_buf_truncate(yajl_buf buf, unsigned int len);
72 |
73 | #endif
74 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/c_src/yajl/yajl_buf.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2600hz/community-scripts/cc0d0106eaaf066b85cc42fccbd5b774af001310/CloneTools/lib/ejson-0.1.0/c_src/yajl/yajl_buf.o
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/c_src/yajl/yajl_encode.h:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2010, Lloyd Hilaiel.
3 | *
4 | * Redistribution and use in source and binary forms, with or without
5 | * modification, are permitted provided that the following conditions are
6 | * met:
7 | *
8 | * 1. Redistributions of source code must retain the above copyright
9 | * notice, this list of conditions and the following disclaimer.
10 | *
11 | * 2. Redistributions in binary form must reproduce the above copyright
12 | * notice, this list of conditions and the following disclaimer in
13 | * the documentation and/or other materials provided with the
14 | * distribution.
15 | *
16 | * 3. Neither the name of Lloyd Hilaiel nor the names of its
17 | * contributors may be used to endorse or promote products derived
18 | * from this software without specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
24 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
28 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
29 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 | * POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | #ifndef __YAJL_ENCODE_H__
34 | #define __YAJL_ENCODE_H__
35 |
36 | #include "yajl_buf.h"
37 | #include "yajl_gen.h"
38 |
39 | void yajl_string_encode2(const yajl_print_t printer,
40 | void * ctx,
41 | const unsigned char * str,
42 | unsigned int length);
43 |
44 | void yajl_string_encode(yajl_buf buf, const unsigned char * str,
45 | unsigned int length);
46 |
47 | void yajl_string_decode(yajl_buf buf, const unsigned char * str,
48 | unsigned int length);
49 |
50 | #endif
51 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/c_src/yajl/yajl_encode.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2600hz/community-scripts/cc0d0106eaaf066b85cc42fccbd5b774af001310/CloneTools/lib/ejson-0.1.0/c_src/yajl/yajl_encode.o
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/c_src/yajl/yajl_gen.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2600hz/community-scripts/cc0d0106eaaf066b85cc42fccbd5b774af001310/CloneTools/lib/ejson-0.1.0/c_src/yajl/yajl_gen.o
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/c_src/yajl/yajl_lex.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2600hz/community-scripts/cc0d0106eaaf066b85cc42fccbd5b774af001310/CloneTools/lib/ejson-0.1.0/c_src/yajl/yajl_lex.o
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/c_src/yajl/yajl_parser.o:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2600hz/community-scripts/cc0d0106eaaf066b85cc42fccbd5b774af001310/CloneTools/lib/ejson-0.1.0/c_src/yajl/yajl_parser.o
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/ebin/.placeholder:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2600hz/community-scripts/cc0d0106eaaf066b85cc42fccbd5b774af001310/CloneTools/lib/ejson-0.1.0/ebin/.placeholder
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/ebin/ejson.app:
--------------------------------------------------------------------------------
1 | {application,ejson,
2 | [{description,"EJSON - decode and encode JSON into/from Erlang terms"},
3 | {vsn,"0.1.0"},
4 | {modules,[ejson]},
5 | {registered,[]},
6 | {applications,[kernel,stdlib]},
7 | {env,[]}]}.
8 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/ebin/ejson.beam:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2600hz/community-scripts/cc0d0106eaaf066b85cc42fccbd5b774af001310/CloneTools/lib/ejson-0.1.0/ebin/ejson.beam
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/priv/ejson.so:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2600hz/community-scripts/cc0d0106eaaf066b85cc42fccbd5b774af001310/CloneTools/lib/ejson-0.1.0/priv/ejson.so
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/rebar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2600hz/community-scripts/cc0d0106eaaf066b85cc42fccbd5b774af001310/CloneTools/lib/ejson-0.1.0/rebar
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/rebar.config:
--------------------------------------------------------------------------------
1 | {port_specs, [{"priv/ejson.so", ["c_src/*.c", "c_src/yajl/*.c"]}]}.
2 |
3 | {deps, [
4 | % {mochiweb, ".*", {git, "git://github.com/mochi/mochiweb.git", {tag,
5 | % "1.5.2"}}}
6 | ]}.
7 |
8 | {port_env, [
9 | %% Make sure to link -lstdc++ on linux or solaris
10 | {"(linux|solaris)", "LDFLAGS", "$LDFLAGS -lstdc++"}
11 |
12 | ]}.
13 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/src/ejson.app.src:
--------------------------------------------------------------------------------
1 | {application, ejson, [
2 | {description, "EJSON - decode and encode JSON into/from Erlang terms"},
3 | {vsn, "0.1.0"},
4 | {modules, [ejson]},
5 | {registered, []},
6 | {applications, [kernel, stdlib]},
7 | {env, []}
8 | ]}.
9 |
10 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/001-yajl-tests.t:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env escript
2 |
3 | main([]) ->
4 | code:add_pathz("t"),
5 | code:add_pathz("ebin"),
6 |
7 | Cases = read_cases(),
8 |
9 | etap:plan(length(Cases)),
10 | lists:foreach(fun(Case) -> test(Case) end, Cases),
11 | etap:end_tests().
12 |
13 | test({Name, Json, Erl}) ->
14 | etap:is(json_decode(Json), Erl, Name).
15 |
16 | json_decode(Json) ->
17 | case catch(ejson:decode(Json)) of
18 | {invalid_json, {{error, Error}, _}} ->
19 | {error, Error};
20 | {invalid_json, Error} ->
21 | Error;
22 | Other ->
23 | Other
24 | end.
25 |
26 | read_cases() ->
27 | CasesPath = filename:join(["t", "cases", "*.json"]),
28 | FileNames = lists:sort(filelib:wildcard(CasesPath)),
29 | lists:map(fun(F) -> make_pair(F) end, FileNames).
30 |
31 | make_pair(FileName) ->
32 | {ok, Json} = file:read_file(FileName),
33 | {BaseName, _} = lists:splitwith(fun(C) -> C /= $. end, FileName),
34 | ErlFname = BaseName ++ ".erl",
35 | {ok, [Term]} = file:consult(ErlFname),
36 | case Term of
37 | {error, _} ->
38 | {BaseName, Json, Term};
39 | {error, _, _} ->
40 | {BaseName, Json, Term};
41 | _ ->
42 | {BaseName, Json, Term}
43 | end.
44 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/002-literals.t:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env escript
2 |
3 | main([]) ->
4 | code:add_pathz("ebin"),
5 | code:add_pathz("t"),
6 |
7 | etap:plan(6),
8 | etap:is(ejson:decode(<<"true">>), true, "DEC: true -> true"),
9 | etap:is(ejson:encode(true), <<"true">>, "ENC: true -> true"),
10 |
11 | etap:is(ejson:decode(<<"false">>), false, "DEC: false -> false"),
12 | etap:is(ejson:encode(false), <<"false">>, "ENC: false -> false"),
13 |
14 | etap:is(ejson:decode(<<"null">>), null, "DEC: null -> null"),
15 | etap:is(ejson:encode(null), <<"null">>, "ENC: null -> null"),
16 |
17 | etap:end_tests().
18 |
19 |
20 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/003-numbers.t:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env escript
2 |
3 | main([]) ->
4 | code:add_pathz("ebin"),
5 | code:add_pathz("t"),
6 |
7 | etap:plan(47),
8 | util:test_good(good()),
9 | util:test_errors(errors()),
10 | etap:end_tests().
11 |
12 | good() ->
13 | [
14 | {<<"0">>, 0},
15 | {<<"-0">>, 0, <<"0">>},
16 | {<<"1">>, 1},
17 | {<<"12">>, 12},
18 | {<<"-3">>, -3},
19 | {<<"309230948234098">>, 309230948234098},
20 | {<<"1.0">>, 1.0, <<"1">>},
21 | {<<"0.3">>, 0.3},
22 | {<<"2.4234324">>, 2.4234324, <<"2.4234324">>},
23 | {<<"-3.1416">>, -3.1416},
24 | {<<"1E4">>, 10000.0, <<"10000">>},
25 | {<<"1.0E+01">>, 10.0, <<"10">>},
26 | {<<"1e1">>, 10.0, <<"10">>},
27 | {<<"3.0E2">>, 300.0, <<"300">>},
28 | {<<"0E3">>, 0.0, <<"0">>},
29 | {<<"1.5E3">>, 1500.0, <<"1500">>},
30 | {<<"1.5E-1">>, 0.15, <<"0.15">>},
31 | {<<"-0.323E+2">>, -32.3, <<"-32.3">>}
32 | ].
33 |
34 | errors() ->
35 | [
36 | <<"02">>,
37 | <<"-01">>,
38 | <<"+12">>,
39 | <<"-">>,
40 | <<"1.">>,
41 | <<".1">>,
42 | <<"1.-1">>,
43 | <<"1E">>,
44 | <<"1-E2">>,
45 | <<"2E +3">>,
46 | <<"1EA">>
47 | ].
48 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/004-strings.t:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env escript
2 |
3 | main([]) ->
4 | code:add_pathz("ebin"),
5 | code:add_pathz("t"),
6 |
7 | etap:plan(23),
8 | util:test_good(good()),
9 | util:test_errors(errors()),
10 | etap:end_tests().
11 |
12 | good() ->
13 | [
14 | {<<"\"\"">>, <<"">>},
15 | {<<"\"0\"">>, <<"0">>},
16 | {<<"\"foo\"">>, <<"foo">>},
17 | {<<"\"\\\"foobar\\\"\"">>, <<"\"foobar\"">>},
18 | {<<"\"\\n\\n\\n\"">>, <<"\n\n\n">>},
19 | {<<"\"\\\" \\b\\f\\r\\n\\t\\\"\"">>, <<"\" \b\f\r\n\t\"">>},
20 | {<<"\"foo\\u0005bar\"">>, <<"foo", 5, "bar">>},
21 | {<<"\"\\uFFFF\"">>, <<239, 191, 191>>, <<"\"", 239, 191, 191, "\"">>},
22 | {
23 | <<"\"\\uD834\\uDD1E\"">>,
24 | <<240, 157, 132, 158>>,
25 | <<34, 240, 157, 132, 158, 34>>
26 | },
27 | % Not sure if this is best but YAJL replaces invalid
28 | % combining characters with a ?
29 | {
30 | <<"\"\\uD834foo\\uDD1E\"">>,
31 | <<"?oo", 237, 180, 158>>,
32 | <<34, 63, 111, 111, 237, 180, 158, 34>>
33 | }
34 | ].
35 |
36 | errors() ->
37 | [
38 | <<"\"", 0, "\"">>,
39 | <<"\"\\g\"">>,
40 | % CouchDB-345
41 | <<"\"",78,69,73,77,69,78,32,70,216,82,82,32,70,65,69,78,33,"\"">>
42 | ].
43 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/005-arrays.t:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env escript
2 |
3 | main([]) ->
4 | code:add_pathz("ebin"),
5 | code:add_pathz("t"),
6 |
7 | etap:plan(18),
8 | util:test_good(good()),
9 | util:test_errors(errors()),
10 | etap:end_tests().
11 |
12 | good() ->
13 | [
14 | {<<"[]">>, []},
15 | {<<"[\t[\n]\r]">>, [[]], <<"[[]]">>},
16 | {<<"[\t123, \r true\n]">>, [123, true], <<"[123,true]">>},
17 | {<<"[1,\"foo\"]">>, [1, <<"foo">>]},
18 | {<<"[1199344435545.0,1]">>, [1199344435545.0,1], <<"[1199344435545,1]">>},
19 | {
20 | <<"[\"\\u00A1\",\"\\u00FC\"]">>,
21 | [<<194, 161>>, <<195, 188>>],
22 | <<"[\"", 194, 161, "\",\"", 195, 188, "\"]">>
23 | }
24 | ].
25 |
26 | errors() ->
27 | [
28 | <<"[">>,
29 | <<"]">>,
30 | <<"[,]">>,
31 | <<"[123">>,
32 | <<"[123,]">>,
33 | <<"[32 true]">>
34 | ].
35 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/006-maps.t:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env escript
2 |
3 | main([]) ->
4 | code:add_pathz("ebin"),
5 | code:add_pathz("t"),
6 |
7 | etap:plan(15),
8 | util:test_good(good()),
9 | util:test_errors(errors()),
10 | etap:end_tests().
11 |
12 | good() ->
13 | [
14 | {<<"{}">>, {[]}},
15 | {<<"{\"foo\": \"bar\"}">>,
16 | {[{<<"foo">>, <<"bar">>}]},
17 | <<"{\"foo\":\"bar\"}">>},
18 | {<<"\n\n{\"foo\":\r \"bar\",\n \"baz\"\t: 123 }">>,
19 | {[{<<"foo">>, <<"bar">>}, {<<"baz">>, 123}]},
20 | <<"{\"foo\":\"bar\",\"baz\":123}">>}
21 | ].
22 |
23 | errors() ->
24 | [
25 | <<"{">>,
26 | <<"{,}">>,
27 | <<"{123:true}">>,
28 | <<"{false:123}">>,
29 | <<"{:\"stuff\"}">>,
30 | <<"{\"key\":}">>,
31 | <<"{\"key\": 123">>,
32 | <<"{\"key\": 123 true">>,
33 | <<"{\"key\": 123,}">>
34 | ].
35 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/007-compound.t:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env escript
2 |
3 | main([]) ->
4 | code:add_pathz("ebin"),
5 | code:add_pathz("t"),
6 |
7 | etap:plan(12),
8 | util:test_good(good()),
9 | util:test_errors(errors()),
10 | etap:end_tests().
11 |
12 | good() ->
13 | [
14 | {<<"[{}]">>, [{[]}]},
15 | {<<"{\"foo\":[123]}">>, {[{<<"foo">>, [123]}]}},
16 | {<<"{\"foo\":{\"bar\":true}}">>,
17 | {[{<<"foo">>, {[{<<"bar">>, true}]} }]} },
18 | {<<"{\"foo\":[],\"bar\":{\"baz\":true},\"alice\":\"bob\"}">>,
19 | {[
20 | {<<"foo">>, []},
21 | {<<"bar">>, {[{<<"baz">>, true}]}},
22 | {<<"alice">>, <<"bob">>}
23 | ]}
24 | },
25 | {<<"[-123,\"foo\",{\"bar\":[]},null]">>,
26 | [
27 | -123,
28 | <<"foo">>,
29 | {[{<<"bar">>, []}]},
30 | null
31 | ]
32 | }
33 | ].
34 |
35 | errors() ->
36 | [
37 | <<"[{}">>,
38 | <<"}]">>
39 | ].
40 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/array.erl:
--------------------------------------------------------------------------------
1 | [
2 | <<"foo">>,
3 | <<"bar">>,
4 | <<"baz">>,
5 | true,
6 | false,
7 | null,
8 | {[{<<"key">>, <<"value">>}]},
9 | [
10 | null,
11 | null,
12 | null,
13 | []
14 | ],
15 | <<"\n\r\\">>
16 | ].
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/array.json:
--------------------------------------------------------------------------------
1 | ["foo",
2 | "bar", "baz",
3 | true,false,null,{"key":"value"},
4 | [null,null,null,[]],
5 | "\n\r\\"
6 | ]
7 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/array_close.erl:
--------------------------------------------------------------------------------
1 | {error,{1,"parse error: unallowed token at this point in JSON text\n"}}.
2 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/array_close.json:
--------------------------------------------------------------------------------
1 | ]
2 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/array_open.erl:
--------------------------------------------------------------------------------
1 | {error,insufficient_data}.
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/array_open.json:
--------------------------------------------------------------------------------
1 | [
2 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/bogus_char.erl:
--------------------------------------------------------------------------------
1 | {error,{97,"lexical error: invalid string in json text.\n"}}.
2 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/bogus_char.json:
--------------------------------------------------------------------------------
1 | ["this","is","what","should","be",
2 | "a happy bit of json",
3 | "but someone, misspelled \"true\"", ture,
4 | "who says JSON is easy for humans to generate?"]
5 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/codepoints_from_unicode_org.erl:
--------------------------------------------------------------------------------
1 | <<77, 208, 176, 228, 186, 140, 240, 144, 140, 130>>.
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/codepoints_from_unicode_org.json:
--------------------------------------------------------------------------------
1 | "\u004d\u0430\u4e8c\ud800\udf02"
2 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/deep_arrays.erl:
--------------------------------------------------------------------------------
1 | [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]].
2 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/deep_arrays.json:
--------------------------------------------------------------------------------
1 | [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/difficult_json_c_test_case.erl:
--------------------------------------------------------------------------------
1 | {[
2 | {<<"glossary">>, {[
3 | {<<"title">>, <<"example glossary">>},
4 | {<<"GlossDiv">>, {[
5 | {<<"title">>, <<"S">>},
6 | {<<"GlossList">>, [
7 | {[
8 | {<<"ID">>, <<"SGML">>},
9 | {<<"SortAs">>, <<"SGML">>},
10 | {<<"GlossTerm">>, <<"Standard Generalized Markup Language">>},
11 | {<<"Acronym">>, <<"SGML">>},
12 | {<<"Abbrev">>, <<"ISO 8879:1986">>},
13 | {<<"GlossDef">>, <<"A meta-markup language, used to create markup languages such as DocBook.">>},
14 | {<<"GlossSeeAlso">>, [<<"GML">>, <<"XML">>, <<"markup">>]}
15 | ]}
16 | ]}
17 | ]}}
18 | ]}}
19 | ]}.
20 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/difficult_json_c_test_case.json:
--------------------------------------------------------------------------------
1 | { "glossary": { "title": "example glossary", "GlossDiv": { "title": "S", "GlossList": [ { "ID": "SGML", "SortAs": "SGML", "GlossTerm": "Standard Generalized Markup Language", "Acronym": "SGML", "Abbrev": "ISO 8879:1986", "GlossDef": "A meta-markup language, used to create markup languages such as DocBook.", "GlossSeeAlso": ["GML", "XML", "markup"] } ] } } }
2 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/doubles.erl:
--------------------------------------------------------------------------------
1 | [10, 10, 3.141569, 1000].
2 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/doubles.json:
--------------------------------------------------------------------------------
1 | [ 0.1e2, 1e1, 3.141569, 10000000000000e-10]
2 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/empty_array.erl:
--------------------------------------------------------------------------------
1 | [].
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/empty_array.json:
--------------------------------------------------------------------------------
1 | []
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/empty_string.erl:
--------------------------------------------------------------------------------
1 | <<"">>.
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/empty_string.json:
--------------------------------------------------------------------------------
1 | ""
2 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/escaped_bulgarian.erl:
--------------------------------------------------------------------------------
1 | [
2 | <<208, 148, 208, 176>>,
3 | <<208, 156, 209, 131>>,
4 | <<208, 149, 208, 177, 208, 176>>,
5 | <<208, 156, 208, 176, 208, 185, 208, 186, 208, 176, 209, 130, 208, 176>>
6 | ].
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/escaped_bulgarian.json:
--------------------------------------------------------------------------------
1 | ["\u0414\u0430",
2 | "\u041c\u0443",
3 | "\u0415\u0431\u0430",
4 | "\u041c\u0430\u0439\u043a\u0430\u0442\u0430"]
5 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/escaped_foobar.erl:
--------------------------------------------------------------------------------
1 | <<"foobar">>.
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/escaped_foobar.json:
--------------------------------------------------------------------------------
1 | "\u0066\u006f\u006f\u0062\u0061\u0072"
2 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/false.erl:
--------------------------------------------------------------------------------
1 | false.
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/false.json:
--------------------------------------------------------------------------------
1 | false
2 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/false_then_garbage.erl:
--------------------------------------------------------------------------------
1 | {error,garbage_after_value}.
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/false_then_garbage.json:
--------------------------------------------------------------------------------
1 | falsex
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/four_byte_utf8.erl:
--------------------------------------------------------------------------------
1 | {[{<<"U+10ABCD">>, <<244, 138, 175, 141>>}]}.
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/four_byte_utf8.json:
--------------------------------------------------------------------------------
1 | { "U+10ABCD": "" }
2 |
3 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/integers.erl:
--------------------------------------------------------------------------------
1 | [
2 | 1,
3 | 2,
4 | 3,
5 | 4,
6 | 5,
7 | 6,
8 | 7,
9 | 123456789,
10 | -123456789,
11 | 2147483647,
12 | -2147483647
13 | ].
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/integers.json:
--------------------------------------------------------------------------------
1 | [ 1,2,3,4,5,6,7,
2 | 123456789 , -123456789,
3 | 2147483647, -2147483647 ]
4 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/invalid_utf8.erl:
--------------------------------------------------------------------------------
1 | {error,{11,"lexical error: invalid bytes in UTF8 string.\n"}}.
2 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/invalid_utf8.json:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2600hz/community-scripts/cc0d0106eaaf066b85cc42fccbd5b774af001310/CloneTools/lib/ejson-0.1.0/t/cases/invalid_utf8.json
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/isolated_surrogate_marker.erl:
--------------------------------------------------------------------------------
1 | <<"?">>.
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/isolated_surrogate_marker.json:
--------------------------------------------------------------------------------
1 | "\ud800"
2 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/leading_zero_in_number.erl:
--------------------------------------------------------------------------------
1 | {error,{16,"parse error: after key and value, inside map, I expect ',' or '}'\n"}}.
2 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/leading_zero_in_number.json:
--------------------------------------------------------------------------------
1 | { "bad thing": 01 }
2 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/lonely_minus_sign.erl:
--------------------------------------------------------------------------------
1 | {error,{82,"lexical error: malformed number, a digit is required after the minus sign.\n"}}.
2 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/lonely_minus_sign.json:
--------------------------------------------------------------------------------
1 | [
2 | "foo", true,
3 | true, "blue",
4 | "baby where are you?", "oh boo hoo!",
5 | -
6 | ]
7 |
8 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/lonely_number.erl:
--------------------------------------------------------------------------------
1 | 123456789.
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/lonely_number.json:
--------------------------------------------------------------------------------
1 | 123456789
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/map_close.erl:
--------------------------------------------------------------------------------
1 | {error,{1,"parse error: unallowed token at this point in JSON text\n"}}.
2 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/map_close.json:
--------------------------------------------------------------------------------
1 | }
2 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/map_open.erl:
--------------------------------------------------------------------------------
1 | {error,insufficient_data}.
2 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/map_open.json:
--------------------------------------------------------------------------------
1 | {
2 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/missing_integer_after_decimal_point.erl:
--------------------------------------------------------------------------------
1 | {error,{3,"lexical error: malformed number, a digit is required after the decimal point.\n"}}.
2 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/missing_integer_after_decimal_point.json:
--------------------------------------------------------------------------------
1 | 10.e2
2 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/missing_integer_after_exponent.erl:
--------------------------------------------------------------------------------
1 | {error,{3,"lexical error: malformed number, a digit is required after the exponent.\n"}}.
2 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/missing_integer_after_exponent.json:
--------------------------------------------------------------------------------
1 | 10e
2 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/non_utf8_char_in_string.erl:
--------------------------------------------------------------------------------
1 | {error,{125,"lexical error: invalid bytes in UTF8 string.\n"}}.
2 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/non_utf8_char_in_string.json:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2600hz/community-scripts/cc0d0106eaaf066b85cc42fccbd5b774af001310/CloneTools/lib/ejson-0.1.0/t/cases/non_utf8_char_in_string.json
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/null.erl:
--------------------------------------------------------------------------------
1 | null.
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/null.json:
--------------------------------------------------------------------------------
1 | null
2 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/null_then_garbage.erl:
--------------------------------------------------------------------------------
1 | {error,garbage_after_value}.
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/null_then_garbage.json:
--------------------------------------------------------------------------------
1 | nullx
2 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/nulls_and_bools.erl:
--------------------------------------------------------------------------------
1 | {[
2 | {<<"boolean, true">>, true},
3 | {<<"boolean, false">>, false},
4 | {<<"null">>, null}
5 | ]}.
6 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/nulls_and_bools.json:
--------------------------------------------------------------------------------
1 | {
2 | "boolean, true": true,
3 | "boolean, false": false,
4 | "null": null
5 | }
6 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/simple.erl:
--------------------------------------------------------------------------------
1 | {[
2 | {<<"this">>, <<"is">>},
3 | {<<"really">>, <<"simple">>},
4 | {<<"json">>, <<"right?">>}
5 | ]}.
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/simple.json:
--------------------------------------------------------------------------------
1 | {
2 | "this": "is",
3 | "really": "simple",
4 | "json": "right?"
5 | }
6 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/string_invalid_escape.erl:
--------------------------------------------------------------------------------
1 | {error,{62,"lexical error: inside a string, '\\' occurs before a character which it may not.\n"}}.
2 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/string_invalid_escape.json:
--------------------------------------------------------------------------------
1 | ["\n foo \/ bar \r\f\\\uffff\t\b\"\\ and you can't escape thi\s"]
2 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/string_invalid_hex_char.erl:
--------------------------------------------------------------------------------
1 | {error,{44,"lexical error: invalid (non-hex) character occurs after '\\u' inside string.\n"}}.
2 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/string_invalid_hex_char.json:
--------------------------------------------------------------------------------
1 | "foo foo, blah blah \u0123 \u4567 \u89ab \uc/ef \uABCD \uEFFE bar baz bing"
2 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/string_with_escapes.erl:
--------------------------------------------------------------------------------
1 | [
2 | <<"\n foo \/ bar \r\f\\", 239, 191, 191, "\t\b\"\\">>,
3 | <<"\"and this string has an escape at the beginning">>,
4 | <<"and this string has no escapes">>
5 | ].
6 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/string_with_escapes.json:
--------------------------------------------------------------------------------
1 | ["\n foo \/ bar \r\f\\\uffff\t\b\"\\",
2 | "\"and this string has an escape at the beginning",
3 | "and this string has no escapes" ]
4 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/string_with_invalid_newline.erl:
--------------------------------------------------------------------------------
1 | {error,{66,"lexical error: invalid character inside string.\n"}}.
2 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/string_with_invalid_newline.json:
--------------------------------------------------------------------------------
1 | "la di dah. this is a string, and I can do this, \n, but not this
2 | "
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/three_byte_utf8.erl:
--------------------------------------------------------------------------------
1 | {[
2 | {<<"matzue">>, <<230, 157, 190, 230, 177, 159>>},
3 | {<<"asakusa">>, <<230, 181, 133, 232, 141, 137>>}
4 | ]}.
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/three_byte_utf8.json:
--------------------------------------------------------------------------------
1 | {"matzue": "松江", "asakusa": "浅草"}
2 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/true.erl:
--------------------------------------------------------------------------------
1 | true.
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/true.json:
--------------------------------------------------------------------------------
1 | true
2 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/true_then_garbage.erl:
--------------------------------------------------------------------------------
1 | {error,garbage_after_value}.
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/true_then_garbage.json:
--------------------------------------------------------------------------------
1 | truex
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/unescaped_bulgarian.erl:
--------------------------------------------------------------------------------
1 | [
2 | <<208, 148, 208, 176, 32, 208, 156, 209, 131, 32, 208, 149, 208,
3 | 177, 208, 176, 32, 208, 156, 208, 176, 208, 185, 208, 186, 208,
4 | 176, 209, 130, 208, 176>>
5 | ].
6 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/cases/unescaped_bulgarian.json:
--------------------------------------------------------------------------------
1 | ["Да Му Еба Майката"]
2 |
--------------------------------------------------------------------------------
/CloneTools/lib/ejson-0.1.0/t/util.erl:
--------------------------------------------------------------------------------
1 | -module(util).
2 | -export([test_good/1, test_errors/1]).
3 |
4 | test_good(Cases) ->
5 | lists:foreach(fun(Case) -> check_good(Case) end, Cases).
6 |
7 | test_errors(Cases) ->
8 | lists:foreach(fun(Case) -> check_error(Case) end, Cases).
9 |
10 | ok_dec(J, E) ->
11 | lists:flatten(io_lib:format("Decoding ~p gives ~p", [J, E])).
12 |
13 | ok_enc(E, J) ->
14 | lists:flatten(io_lib:format("Encoding ~p gives ~p", [E, J])).
15 |
16 | error_mesg(J) ->
17 | lists:flatten(io_lib:format("Decoding ~p returns an error.", [J])).
18 |
19 | check_good({J, E}) ->
20 | etap:is(ejson:decode(J), E, ok_dec(J, E)),
21 | etap:is(ejson:encode(E), J, ok_enc(E, J));
22 | check_good({J, E, J2}) ->
23 | etap:is(ejson:decode(J), E, ok_dec(J, E)),
24 | etap:is(ejson:encode(E), J2, ok_enc(E, J2)).
25 |
26 | check_error(J) ->
27 | etap:fun_is(
28 | fun({invalid_json, _}) -> true; (_) -> false end,
29 | catch(ejson:decode(J)),
30 | error_mesg(J)
31 | ).
32 |
--------------------------------------------------------------------------------
/CloneTools/priv/account_ids.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2600hz/community-scripts/cc0d0106eaaf066b85cc42fccbd5b774af001310/CloneTools/priv/account_ids.txt
--------------------------------------------------------------------------------
/CloneTools/src/clone_tools.app.src:
--------------------------------------------------------------------------------
1 | {application, clone_tools,
2 | [
3 | {description, "Relicate phone numbers and audit account sanity"}
4 | ,{vsn, "0.0.1"}
5 | ,{modules, []}
6 | ,{registered, []}
7 | ,{applications, [
8 | kernel,
9 | stdlib
10 | ]}
11 | ,{mod, { clone_tools, []}}
12 | ,{env, []}
13 | ]}.
14 |
--------------------------------------------------------------------------------
/CloneTools/src/clone_tools.hrl:
--------------------------------------------------------------------------------
1 | -define(TARGET,
2 | case os:getenv("TARGET") of
3 | 'false' -> "http://127.0.0.1:15984/";
4 | _ -> os:getenv("TARGET")
5 | end).
6 | -define(TARGET_PATH(Path), wh_types:to_list(iolist_to_binary([?TARGET, wh_binary:join(Path, <<"/">>)]))).
7 |
8 | -define(SOURCE,
9 | case os:getenv("SOURCE") of
10 | 'false' -> "http://127.0.0.1:5984/";
11 | _ -> os:getenv("SOURCE")
12 | end).
13 | -define(SOURCE_PATH(Path), wh_types:to_list(iolist_to_binary([?SOURCE, wh_binary:join(Path, <<"/">>)]))).
14 |
15 | -define(MAX_CR_AGE,
16 | case os:getenv("MAX_CDR_AGE") of
17 | 'false' -> 'none';
18 | "none" -> 'none';
19 | _ -> list_to_integer(os:getenv("MAX_CDR_AGE"))
20 | end).
21 |
22 | -define(MAX_VM_AGE,
23 | case os:getenv("MAX_VM_AGE") of
24 | 'false' -> 0;
25 | "none" -> 'none';
26 | _ -> list_to_integer(os:getenv("MAX_VM_AGE"))
27 | end).
28 |
29 | -define(DEAD_ACCOUNT_IDS,
30 | case os:getenv("DEAD_ACCOUNTS") of
31 | 'false' -> [];
32 | _ -> binary:split(list_to_binary(os:getenv("DEAD_ACCOUNTS")), <<" ">>)
33 | end).
34 |
35 | %% =========================================
36 |
37 | -define(WNM_DB_PREFIX, <<"numbers/">>).
38 | -define(LOG_PATH, "/tmp/").
39 |
40 | -define(BLACK, io:format("\e[30m", [])).
41 | -define(RED, io:format("\e[31m", [])).
42 | -define(GREEN, io:format("\e[32m", [])).
43 | -define(YELLOW, io:format("\e[33m", [])).
44 | -define(BLUE, io:format("\e[34m", [])).
45 | -define(MAGENTA, io:format("\e[35m", [])).
46 | -define(CYAN, io:format("\e[36m", [])).
47 | -define(WHITE, io:format("\e[37m", [])).
48 |
49 | -define(LOG(C, F, A), fun(Control, Format, Args) ->
50 | Path = ?LOG_PATH ++ atom_to_list(?MODULE),
51 | file:write_file(Path, io_lib:format(Format, Args), ['append']),
52 | io:format(Control ++ Format, Args)
53 | end(C, F, A)).
54 | -define(LOG(F, A), ?LOG_WHITE(F, A)).
55 | -define(LOG_BLACK(F, A), ?LOG("\e[30m", F, A)).
56 | -define(LOG_RED(F, A), ?LOG("\e[31m", F, A)).
57 | -define(LOG_GREEN(F, A), ?LOG("\e[32m", F, A)).
58 | -define(LOG_YELLOW(F, A), ?LOG("\e[33m", F, A)).
59 | -define(LOG_BLUE(F, A), ?LOG("\e[34m", F, A)).
60 | -define(LOG_MAGENTA(F, A), ?LOG("\e[35m", F, A)).
61 | -define(LOG_CYAN(F, A), ?LOG("\e[36m", F, A)).
62 | -define(LOG_WHITE(F, A), ?LOG("\e[37m", F, A)).
63 |
--------------------------------------------------------------------------------
/CloneTools/src/wh_json.hrl:
--------------------------------------------------------------------------------
1 | -ifndef(WH_JSON_HRL).
2 |
3 | -include("wh_types.hrl").
4 |
5 | -define(DEFAULT_CONTENT_TYPE, <<"application/json">>).
6 |
7 | %% How do we wrap proplists to denote they're json objects?
8 | %% -define(JSON_WRAPPER(Proplist), {struct, Proplist}).
9 | %% -define(IS_JSON_GUARD(Obj), is_tuple(Obj)
10 | %% andalso element(1, Obj) =:= 'struct'
11 | %% andalso is_list(element(2, Obj))
12 | %% ).
13 |
14 | -define(JSON_WRAPPER(Proplist), {Proplist}).
15 |
16 | -define(EMPTY_JSON_OBJECT, ?JSON_WRAPPER([])).
17 |
18 | -type object() :: ?JSON_WRAPPER(json_proplist()).
19 | -type objects() :: [object(),...] | [].
20 |
21 | -type json_string() :: ne_binary() | atom() | pos_integer().
22 | -type json_strings() :: [json_string()].
23 | -type json_number() :: integer() | float().
24 | -type json_array() :: [json_term()].
25 |
26 | -type key() :: json_string() | json_strings().
27 | -type keys() :: [key(),...] | [].
28 | -type json_key() :: key().
29 |
30 | -type json_proplist_key() :: json_key().
31 | -type json_proplist_kv(K, V) :: [{K, V},...] | [].
32 | -type json_proplist_k(K) :: json_proplist_kv(K, json_term()).
33 | -type json_proplist() :: json_proplist_kv(json_proplist_key(), json_term()).
34 |
35 | -type json_iolist() :: {'json', iolist()}.
36 | -type json_term() :: json_string() | json_number() | json_array() | object() | json_iolist() | <<>>.
37 | -type json_terms() :: [json_term()].
38 |
39 | -define(WH_JSON_HRL, 'true').
40 | -endif.
41 |
42 |
--------------------------------------------------------------------------------
/FreeSWITCH/README.md:
--------------------------------------------------------------------------------
1 | # FreeSWITCH Utils
2 | =================
3 |
4 | ## user_agents.sh \
5 | Show the number of times unique user-agents occur in a FreeSWITCH debug log.
6 | ```bash
7 | [root@fs001-dev FreeSWITCH]# ./user_agents.sh /var/log/freeswitch/debug.log.1
8 | 4 User-Agent: PolycomVVX-VVX_500-UA/5.0.0.6874
9 | 16 User-Agent: 2600hz
10 | ```
11 |
12 | ## sipify.sh \
13 | The FreeSWITCH debug log does not include the call-id on the lines with the SIP headers. This script will add them so they are included in when grep'd or otherwise searched.
14 |
15 | _Note:_ This can consume large amounts of memory, and impact the running system. Use with caution.
16 |
17 | ```bash
18 | [root@fs001-dev FreeSWITCH]# ./sipify.sh /var/log/freeswitch/debug.log.1 | grep 46a1fe62-20f73e9-1c6e7dbc@10.26.0.199
19 | 46a1fe62-20f73e9-1c6e7dbc@10.26.0.199 recv 1141 bytes from udp/[10.26.0.81]:5060 at 19:34:41.657063:
20 | 46a1fe62-20f73e9-1c6e7dbc@10.26.0.199 ------------------------------------------------------------------------
21 | 46a1fe62-20f73e9-1c6e7dbc@10.26.0.199 INVITE sip:*97@kanderson.dev.2600hz.com;user=phone SIP/2.0
22 | 46a1fe62-20f73e9-1c6e7dbc@10.26.0.199 Record-Route:
23 | 46a1fe62-20f73e9-1c6e7dbc@10.26.0.199 Via: SIP/2.0/UDP 10.26.0.81;branch=z9hG4bKae67.eae1c251.0
24 | 46a1fe62-20f73e9-1c6e7dbc@10.26.0.199 Via: SIP/2.0/UDP 10.26.0.199:5060;rport=5060;branch=z9hG4bKb8aa0385D3717F7
25 | 46a1fe62-20f73e9-1c6e7dbc@10.26.0.199 From: "user_ngmdk8" ;tag=C4F24CBE-866C8875
26 | 46a1fe62-20f73e9-1c6e7dbc@10.26.0.199 To:
27 | 46a1fe62-20f73e9-1c6e7dbc@10.26.0.199 CSeq: 1 INVITE
28 | 46a1fe62-20f73e9-1c6e7dbc@10.26.0.199 Call-ID: 46a1fe62-20f73e9-1c6e7dbc@10.26.0.199
29 | 46a1fe62-20f73e9-1c6e7dbc@10.26.0.199 Contact:
30 | 46a1fe62-20f73e9-1c6e7dbc@10.26.0.199 Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, INFO, MESSAGE, SUBSCRIBE, NOTIFY, PRACK, UPDATE, REFER
31 | 46a1fe62-20f73e9-1c6e7dbc@10.26.0.199 User-Agent: PolycomVVX-VVX_500-UA/5.0.0.6874
32 | 46a1fe62-20f73e9-1c6e7dbc@10.26.0.199 Accept-Language: en
33 | 46a1fe62-20f73e9-1c6e7dbc@10.26.0.199 Supported: 100rel,replaces
34 | 46a1fe62-20f73e9-1c6e7dbc@10.26.0.199 Allow-Events: conference,talk,hold
35 | 46a1fe62-20f73e9-1c6e7dbc@10.26.0.199 Content-Type: application/sdp
36 | 46a1fe62-20f73e9-1c6e7dbc@10.26.0.199 Content-Length: 332
37 | 46a1fe62-20f73e9-1c6e7dbc@10.26.0.199 X-AUTH-IP: 10.26.0.199
38 | ```
39 |
--------------------------------------------------------------------------------
/FreeSWITCH/context_2_failures.bash:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | ## Usage: ./context_2_failures.bash /var/log/freeswitch/kazoo_debug.log
4 | ## Datetime | DID | IP | Call-ID
5 | ## 2017-05-18_15:44:34.564716 | 1234567890 | 10.10.10.10:5060 | abc123@10.10.10.10
6 | ## 2017-05-18_15:44:35.564716 | +1345678901 | 20.20.20.20:5060 | 123789128371298@20.20.20.20
7 | ## 2017-05-18_15:44:36.564716 | +1456789012 | 30.30.30.30:5060 | 291834576asdfk@30.30.30.30
8 | ##
9 | ## Works with glob patterns too
10 | ## ./context_2_failures.bash /var/log/freeswitch/kazoo_debug.log.3?.gz
11 |
12 | function print_column {
13 | printf "%28s | %15s | %20s | %s\n" $1 $2 $3 $4
14 | }
15 |
16 | function find_did {
17 | local call_id=$1
18 | local file=$2
19 |
20 | local log_line=$(zgrep "^$call_id .* New Channel sofia/sipinterface_1" $file)
21 | local did=$(echo $log_line | cut -d' ' -f 8 | cut -d'/' -f 3)
22 | local datetime=$(echo $log_line | cut -d' ' -f 2,3)
23 |
24 | print_column "${datetime/ /_}" "${did%@*}" "${did##*@}" "$call_id"
25 | }
26 |
27 | function search_log_file {
28 | md5_hash=$(md5sum $1 | cut -d ' ' -f 1)
29 | tmp_file="/tmp/$md5_hash.${1##*.}"
30 |
31 | if [ ! -f $tmp_file ]; then
32 | cp $1 $tmp_file
33 | fi
34 |
35 | for failed_call in $(zgrep "context_2 not found" $tmp_file | cut -d ' ' -f 1 | sort | uniq); do
36 | find_did $failed_call $tmp_file
37 | done
38 | }
39 |
40 | print_column "Datetime" "DID" "IP" "Call-ID"
41 | for log_file in $@; do
42 | search_log_file $log_file
43 | done
44 |
--------------------------------------------------------------------------------
/FreeSWITCH/user_agents.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | # show User-Agent breakdown
4 | # usage: ./user_agents.sh /var/log/freeswitch/kazoo-debug.log
5 |
6 | grep "User-Agent:" $1 | sort | uniq -c | sort -n
7 |
--------------------------------------------------------------------------------
/PostgreSQL-CDR/README.md:
--------------------------------------------------------------------------------
1 | # Kazoo CDR into PostgreSQL
2 |
3 | Feel free to contact me on IRC or email about this.
4 |
5 | ## This does _NOT_ remove or disable the current Kazoo CDR in any way.
6 | * This program will attach itself onto RabbitAMQP
7 | * This is the same place Kazoo Erlang listens to get the CDR for Bigcouch
8 | * All call detail for all clients is available at this level
9 |
10 | ## Why?
11 | * Nobody at my office likes BigCouch for CDR.
12 | * Easily sort records with something standard called "SQL"
13 | * You and everybody you work will, will know it already..
14 | * External Billing/Invoicing (postpay)
15 |
16 | ### Install these Python prerequisites
17 | * yum install pytz
18 | * yum install python-pika
19 | * yum install python-devel
20 | * yum install python-psycopg2
21 | * yum install postgresql-client
22 | * yum install postgresql
23 |
24 | ## Install PostgreSQL
25 | * Stop supporting MySQL and Oracle
26 | * Shoot your MySQL server in the head.
27 |
28 | ## Initial suggsted schema
29 |
30 | * This is an initial version.
31 | * There are bugs.
32 | * High load on PostgreSQL server (Who cares, it's not processing calls!)
33 | * Use pg connection pooler to help if you need
34 |
35 | ## If this becomes a useful thing it's probably best rewitten in Erlang.
36 |
37 | wlloyd@stormqloud.ca
38 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # community-scripts
2 | =================
3 |
4 | Public Scripts from the 2600hz Community
5 |
6 | ## Bigcouch
7 |
8 | A collection of scripts to help manage Bigcouch.
9 |
10 | ## FreeSWITCH
11 |
12 | A collection of scripts to extract infromation out of the FreeSWITCH logs.
13 |
14 | ## RadiusCDR
15 |
16 | Script to listen for incoming CDRs from the RabbitMQ server, store the CDR in a sqlite database, and send radius account start and stop packets for billing
17 |
18 | ## bash_completion.d
19 |
20 | Bash completion scripts for the sup utility! Tab completion for sup module names and function names, including argument count (which you should backspace when using)
21 |
22 | ## dashboards
23 | Want to set up some beautiful Kazoo dashboards? Look no further! This will set up InfluxDB, Grafana, Graphite-API, and everything around it thats necessary.
24 |
25 | ## fullbackup-couchdb
26 |
27 | Script that takes a backup of all CouchDB databases and transfers the backup to an SSH-enabled server.
28 | A detailed alert email is sent in the event of an error.
29 |
30 | ## kazoo-puppet
31 |
32 | Puppet scripts for deploying Kazoo (requires an update, only valid for single server currently)
33 |
34 | _Note:_ These have not been maintained and likely need updating to properly deploy kazoo with the recent changes to configuration.
35 |
36 | ## simple-installer
37 |
38 | Kazoo install tool that can be used to set up an all-in-one server or assist with cluster deployment.
39 |
40 | ## CloneTools
41 |
42 | Erlang tool to copy all databases from one Bigcouch cluster to another, with options for CDRs and voicemails
43 |
44 | ## sipp
45 |
46 | This is a collection of SIPp templates and scripts.
47 |
48 | ## klap
49 |
50 | Kazoo Log Analysis Program is a collection of scripts that can determine a lot of information based on a Kazoo platform log.
51 |
52 | ## management-proxy
53 |
54 | Access Kazoo's management tools from one site: CouchDB's Fauxton, RabbitMQ's management plugin and HAProxy's status
55 | page.
56 |
57 | ## pivot-script
58 | An exmample Pivot script created on Nov 7, 2013 by [frifri](https://github.com/frifri)
59 |
60 | ## blackhole-client
61 |
62 | An example client for the Kazoo websocket application "blackhole" created Mar 20, 2014 by [tickbw](https://github.com/tickbw)
63 |
64 | ## kazoo-sample-php-app
65 |
66 | A Sample PHP App for Kazoo ;) It is written using the first version of the [kazoo-php-sdk](https://github.com/2600hz/kazoo-php-sdk) on Dec 10, 2013 by [tickbw](https://github.com/tickbw)
67 |
--------------------------------------------------------------------------------
/Weyoun/README.md:
--------------------------------------------------------------------------------
1 | COMMUNITY SUPORTED SCRIPT!
2 |
3 | Weyoun, leader of the Vorta, a race that brutally imposed their masters' will across the galaxy
4 |
5 | As the name implies, this script applies order by force. Although this script's original intent was to
6 | normalize voicemail transcription settings across all descendants, it's grown to normalize other
7 | settings and also to just run generic functions across all sub-accounts like rebooting all phones in
8 | all sub-accounts.
9 |
10 | To install, just download, make a venv, install requirements.txt and run weyoun.py. It's all you need to do, everything else is interactive. Pretty typical python script...
11 |
12 | Python 3.7+ required
13 |
14 | Youtube Install Vid: https://youtu.be/ZB9lZASWNh4
15 |
--------------------------------------------------------------------------------
/Weyoun/requirements.txt:
--------------------------------------------------------------------------------
1 | kazoo-sdk
2 | requests
3 | pytz
--------------------------------------------------------------------------------
/bash_completion.d/README.md:
--------------------------------------------------------------------------------
1 | # bash completion scripts
2 | =================
3 |
4 | This script will give you tab completion in bash for sup commands
5 |
6 | ## Installation
7 |
8 | Step 1: Make sure you have the bash-completion package installed in your distribution (the package is probably called bash-completion)
9 |
10 | Step 2: Place sup.sh in /etc/bash_completion.d
11 |
12 | Step 3: chmod the script executable, "chmod +x /etc/bash_completion.d/sup.sh"
13 |
14 | Step 4: Log out and back in (or, execute "source /etc/bash_completion.d/sup.sh" to load it
15 |
16 | Step 5: Type sup and hit tab! Rejoice!
17 |
18 | ## Notes / Caveats
19 |
20 | 1) When using the ecallmgr module, you must go back and modify the command to include "-n ecallmgr".
21 |
22 | (i.e. sup ecallmgr_maintenance channel_summary should become sup -n ecallmgr ecallmgr_maintenance channel_summary)
23 |
24 | 2) This module ONLY currently looks for modules ending in _maintenance - I realize that other functions can be called, but this was just a first version. Feel free to modify the script! :)
25 |
26 | 3) When tab completing function names, it will tell you the argument count the function expects, but you MUST remove that from the command before execution or it will fail.
27 |
28 | (i.e. You will be able to tab complete to something like "sup stepswitch_maintenance process_number/1" which tells you that process_number takes one argument. On execution, it needs to be removed (and the argument added). Example: "sup stepswitch_maintenance process_number +12125551212"
29 |
30 | 4) Some modules have comments or do multiple exports so they don't auto-complete properly. If you find one fix it :) or let us know and we will correct it, thanks!
31 |
32 | Happy tab completing!
33 |
--------------------------------------------------------------------------------
/bash_completion.d/sup.sh:
--------------------------------------------------------------------------------
1 | _sup()
2 | {
3 | local cur prev opts base
4 | kazoopath="/opt/kazoo"
5 | COMPREPLY=()
6 | cur="${COMP_WORDS[COMP_CWORD]}"
7 | prev="${COMP_WORDS[COMP_CWORD-1]}"
8 |
9 | #
10 | # Find all whapps that contain maintenance commands
11 | #
12 | opts=`find $kazoopath/*/*/src/*maintenance.erl |sed 's/.*\///' |sed 's/.erl$//' | xargs`
13 |
14 | #
15 | # Complete the arguments
16 | #
17 | case "${prev}" in
18 | *_maintenance)
19 | local commands=$(grep export $kazoopath/*/*/src/${prev}.erl |sed 's/.*(\[//' | sed 's/]).//')
20 | COMPREPLY=( $(compgen -W "${commands}" -- ${cur}) )
21 | return 0
22 | ;;
23 | *)
24 | ;;
25 | esac
26 |
27 | COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
28 | return 0
29 | }
30 | complete -F _sup sup
31 |
--------------------------------------------------------------------------------
/blackhole-client/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 Ben Wann
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
--------------------------------------------------------------------------------
/blackhole-client/README.md:
--------------------------------------------------------------------------------
1 | blackhole-client
2 | ================
3 |
4 | **blackhole-client** is a node.js console application for connecting to kazoo's websockets application blackhole.
5 |
6 | **blackhole-client** utilizes a node.js kazoo crossbar library ([https://github.com/macpie/crossbar-nodejs](https://github.com/macpie/crossbar-nodejs)) for gaining authentication to Kazoo.
7 |
8 | #### Application Setup Instructions
9 | **blackhole-client** requires node.js. Follow [these instructions](https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager) to install node on your target machine.
10 |
11 | You will need git installed in order to clone the blackhole-client repo and to install the package dependencies for **blackhole-client** (crossbar lib).
12 |
13 | ###### Follow these instructions to get blackhole-client setup
14 |
15 | * mkdir /usr/local/src/blackhole-client
16 | * git clone https://github.com/tickbw/blackhole-client.git /usr/local/src/blackhole-client
17 | * cd /usr/local/src/blackhole-client
18 | * npm install
19 | * cp config.js.sample config.js
20 | * vim config.js (Make Edits to the file that reflect your kazoo server details and credentials)
21 | * node app
22 |
23 | ###### Example config.js file
24 |
25 | var config = {};
26 | config.blackhole = {};
27 | config.crossbar = {};
28 |
29 | config.blackhole.host = 'http://192.168.56.111';
30 | config.blackhole.port = 5555;
31 | config.crossbar.host = 'http://192.168.56.111';
32 | config.crossbar.port = 8000;
33 | config.crossbar.username = "bwann";
34 | config.crossbar.password = "12341234";
35 | config.crossbar.account_name = "account name";
36 | module.exports = config;
37 |
--------------------------------------------------------------------------------
/blackhole-client/app.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Module dependencies.
3 | */
4 |
5 | var express = require('express');
6 | var http = require('http');
7 | var path = require('path');
8 | var crypto = require('crypto');
9 | var clientio = require('socket.io-client');
10 | var crypto = require('crypto');
11 | var Crossbar = require('crossbar');
12 |
13 | var app = express();
14 | var config = require('./config');
15 |
16 | // all environments
17 | app.set('port', process.env.PORT || 3000);
18 |
19 | http.createServer(app).listen(app.get('port'), function(){
20 | console.log('blackhole client started ...');
21 |
22 | var socket = clientio.connect(config.blackhole.host , { port: config.blackhole.port });
23 | var cb_client = new Crossbar({
24 | 'url': config.crossbar.host,
25 | 'port': config.crossbar.port,
26 | 'validate': true
27 | });
28 |
29 | var clear_creds = config.crossbar.username + ":" + config.crossbar.password;
30 | var hash_creds = crypto.createHash('md5').update(clear_creds).digest("hex");
31 |
32 | cb_client.api.user_auth.put({
33 | 'data': {
34 | 'credentials': hash_creds,
35 | 'account_name': config.crossbar.account_name
36 | }
37 | }, function(err, data) {
38 | var account_id = data.account_id;
39 | var auth_token = cb_client.token;
40 |
41 | socket.emit("subscribe", { account_id: account_id, auth_token: auth_token, binding: "call.CHANNEL_CREATE.*"});
42 | socket.emit("subscribe", { account_id: account_id, auth_token: auth_token, binding: "call.CHANNEL_ANSWER.*"});
43 | socket.emit("subscribe", { account_id: account_id, auth_token: auth_token, binding: "call.CHANNEL_DESTROY.*"});
44 | socket.emit("subscribe", { account_id: account_id, auth_token: auth_token, binding: "conference.event.*"});
45 | socket.on("participants_event", function (data) {
46 | console.log(data);
47 | });
48 | socket.on("CHANNEL_CREATE", function (data) {
49 | console.log(data);
50 | });
51 | socket.on("CHANNEL_ANSWER", function (data) {
52 | console.log(data);
53 | });
54 | socket.on("CHANNEL_DESTROY", function (data) {
55 | console.log(data);
56 | });
57 | });
58 | });
59 |
--------------------------------------------------------------------------------
/blackhole-client/config.js.sample:
--------------------------------------------------------------------------------
1 | var config = {}
2 |
3 | config.blackhole = {};
4 | config.crossbar = {};
5 |
6 | config.blackhole.host = 'http://localhost';
7 | config.blackhole.port = 5555;
8 | config.crossbar.host = 'http://localhost';
9 | config.crossbar.port = 8000;
10 | config.crossbar.username = "username";
11 | config.crossbar.password = "12341234";
12 | config.crossbar.account_name = "account name";
13 |
14 | module.exports = config;
15 |
--------------------------------------------------------------------------------
/blackhole-client/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "blackhole-client",
3 | "version": "0.0.1",
4 | "private": true,
5 | "author": "Ben Wann ",
6 | "keywords": [
7 | "websockets",
8 | "kazoo",
9 | "api"
10 | ],
11 | "scripts": {
12 | "start": "node app.js"
13 | },
14 | "repository": {
15 | "type": "git",
16 | "url": "https://github.com/tickbw/blackhole-client.git"
17 | },
18 | "dependencies": {
19 | "crossbar": "https://github.com/macpie/crossbar-nodejs/tarball/master",
20 | "socket.io-client": "latest",
21 | "socket.io": "latest",
22 | "express": "3.4.8"
23 | },
24 | "license": "MIT",
25 | "engines": {
26 | "node": ">=0.6"
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/buildKazoo4.sh:
--------------------------------------------------------------------------------
1 | sudo apt-get install git build-essential libxslt-dev \
2 | zip unzip expat zlib1g-dev libssl-dev curl \
3 | libncurses5-dev git-core libexpat1-dev \
4 | htmldoc
5 |
6 | curl -O https://raw.githubusercontent.com/yrashk/kerl/master/kerl
7 | chmod a+x kerl
8 | mv kerl /usr/bin
9 | kerl list releases
10 | kerl build 18.2 r18.2 # this takes a while
11 | kerl install r18.2 /usr/lib/erlang
12 | . /usr/lib/erlang/activate
13 |
14 | cd /opt
15 | git clone https://github.com/2600Hz/kazoo.git
16 | cd kazoo
17 | make
18 |
--------------------------------------------------------------------------------
/cdr-mysql-processor/.gitingore:
--------------------------------------------------------------------------------
1 | *.pyc
2 |
--------------------------------------------------------------------------------
/cdr-mysql-processor/README.md:
--------------------------------------------------------------------------------
1 | # README #
2 | ### What is it? ###
3 |
4 | This script is used to monitor a directory for JSON CDRs from Kazoo.
5 | I have written a Kazoo app, cdrtofile that will automatically save CDRs to files as they come in.
6 | When a new CDR is saved to the filesystem it will be inserted into a MySQL database.
7 |
8 | ### Requirements ###
9 |
10 | * MySQL
11 | * Python2
12 | * The Python libraries in requirements.txt (install with pip install -r requirements.txt)
13 |
14 | ### Configuration ###
15 |
16 | Configuration is set in config.py, with details of what means what.
17 | FIELDS can be modified if a different schema is to be used.
18 |
19 | ### Running ###
20 |
21 | * Ensure all directories mentioned in config.py exist and have the correct permissions set.
22 | * Ensure MySQL is running, and already contains the table in mysql_schema.
23 | * Ensure the MySQL credentials in config.py are correct.
24 |
25 | Run the script with `python2 run.py`
--------------------------------------------------------------------------------
/cdr-mysql-processor/field_processors.py:
--------------------------------------------------------------------------------
1 | import datetime
2 | ##############################################################################
3 | #### Functions to process fields #############################################
4 | ##############################################################################
5 |
6 | def to_datetime(timestamp):
7 | epochSeconds_at_gregorian = 62167219200
8 | return datetime.datetime.fromtimestamp(int(timestamp)-epochSeconds_at_gregorian)
9 |
10 | def custom_channel_vars(custom):
11 | return ",".join(["%s:%s" % (key.strip(), value.strip()) for key, value in custom.items()])
12 |
--------------------------------------------------------------------------------
/cdr-mysql-processor/mysql_process_cdr.py:
--------------------------------------------------------------------------------
1 | import config
2 |
3 | import logging
4 | import pymysql
5 | import numbers
6 | import datetime
7 |
8 | class MySQLClient():
9 | def __init__(self):
10 | self.logger = logging.getLogger('MySQLClient')
11 | self.connect(config.DB_HOST, config.DB_PORT, config.DB_NAME, config.DB_USER, config.DB_PASSWORD)
12 |
13 | def connect(self, host, port, db_name, user, password):
14 | self.logger.info("Connecting to MySQL database")
15 | self.connection = pymysql.connect(host=host, port=port, db=db_name, user=user, passwd=password)
16 |
17 | def insert_sql(self, sql):
18 | cursor = self.connection.cursor()
19 | self.logger.debug("About to insert SQL: %s" % sql)
20 | cursor.execute(sql)
21 | cursor.close()
22 |
23 | def escape(self, string):
24 | return self.connection.escape(string)
25 |
26 | class SQLGenerator():
27 | def __init__(self):
28 | self.sql_client = MySQLClient()
29 | self.logger = logging.getLogger('SQLGenerator')
30 |
31 | def process_cdr(self, cdr):
32 | self.logger.debug("Processing CDR: %s" % cdr)
33 | sql = self.generate(cdr)
34 | self.logger.debug("Generated SQL: %s" % sql)
35 | self.insert(sql)
36 |
37 | def generate(self, obj):
38 | db_dict = {}
39 | FIELDS = config.FIELDS
40 |
41 | def get_json_field(key, dct, default=None):
42 | if dct is None:
43 | return default
44 | key_path = key.split(".", 1)
45 | if len(key_path) == 1:
46 | return dct.get(key, default)
47 | else:
48 | key, remaining_path = key_path
49 | return get_json_field(remaining_path, dct.get(key))
50 |
51 | #Create dictionary of database columns and their values
52 | for json_name, db_name, type_fun in FIELDS:
53 | field = get_json_field(json_name, obj)
54 | if isinstance(field, basestring):
55 | field = field.strip()
56 | if type_fun is not None:
57 | field = type_fun(field)
58 | db_dict[db_name] = field
59 |
60 | #Actually construct insert
61 | sql = "INSERT INTO calls (\n" + ", \n".join(["`%s`" % db_name for json_name, db_name, _ in FIELDS]) + ") \n"
62 | values = []
63 | for json_name, db_name, _ in FIELDS:
64 | field = db_dict.get(db_name)
65 | if field is None:
66 | values.append("NULL")
67 | elif isinstance(field, numbers.Number):
68 | values.append(str(field))
69 | elif isinstance(field, datetime.datetime):
70 | values.append(field.strftime("TIMESTAMP '%Y-%m-%d %H:%M:%S'"))
71 | else:
72 | values.append(self.sql_client.escape(field))
73 | sql += "VALUES (\n" + ", \n".join(values) + ")"
74 | return sql
75 |
76 | def insert(self, sql):
77 | self.sql_client.insert_sql(sql)
78 |
--------------------------------------------------------------------------------
/cdr-mysql-processor/mysql_schema:
--------------------------------------------------------------------------------
1 | CREATE TABLE calls (
2 | `billing_seconds` BIGINT,
3 | `call_direction` VARCHAR(80),
4 | `call_id` VARCHAR(80),
5 | `callee_id_name` VARCHAR(80),
6 | `callee_id_number` VARCHAR(80),
7 | `caller_id_name` VARCHAR(80),
8 | `caller_id_number` VARCHAR(80),
9 | `account_id` VARCHAR(80),
10 | `account_name` VARCHAR(80),
11 | `account_realm` VARCHAR(80),
12 | `application_name` VARCHAR(80),
13 | `application_node` VARCHAR(80),
14 | `authorising_id` VARCHAR(80),
15 | `authorising_type` VARCHAR(80),
16 | `bridge_id` VARCHAR(80),
17 | `channel_authorized` VARCHAR(80),
18 | `e164_destination` VARCHAR(80),
19 | `global_resource` VARCHAR(80),
20 | `inception` VARCHAR(80),
21 | `original_number` VARCHAR(80),
22 | `owner_id` VARCHAR(80),
23 | `reseller_id` VARCHAR(80),
24 | `resource_id` VARCHAR(80),
25 | `realm` VARCHAR(80),
26 | `register_overwrite_notify` VARCHAR(80),
27 | `surpress_unregister_notifications` VARCHAR(80),
28 | `username` VARCHAR(80),
29 | `custom_channel_vars` VARCHAR(1000),
30 | `x_auth_ip` VARCHAR(80),
31 | `disposition` VARCHAR(80),
32 | `duration_seconds` BIGINT,
33 | `event_category` VARCHAR(80),
34 | `event_name` VARCHAR(80),
35 | `from` VARCHAR(80),
36 | `from_tag` VARCHAR(80),
37 | `from_uri` VARCHAR(80),
38 | `hangup_cause` VARCHAR(80),
39 | `hangup_code` VARCHAR(80),
40 | `other_leg_call_id` VARCHAR(80),
41 | `other_leg_caller_id_name` VARCHAR(80),
42 | `other_leg_caller_id_number` VARCHAR(80),
43 | `other_leg_destination_number` VARCHAR(80),
44 | `other_leg_direction` VARCHAR(80),
45 | `presence_id` VARCHAR(80),
46 | `request` VARCHAR(80),
47 | `ringing_seconds` VARCHAR(80),
48 | `timestamp` VARCHAR(80),
49 | `call_time` TIMESTAMP,
50 | `to` VARCHAR(80),
51 | `to_tag` VARCHAR(80),
52 | `to_uri` VARCHAR(80),
53 | `user_agent` VARCHAR(80),
54 | PRIMARY KEY (call_id)
55 | );
56 |
--------------------------------------------------------------------------------
/cdr-mysql-processor/requirements.txt:
--------------------------------------------------------------------------------
1 | pymysql
2 | pyinotify
3 |
--------------------------------------------------------------------------------
/cdr-mysql-processor/run.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python2
2 | import mysql_process_cdr
3 | import directory_watcher
4 | import config
5 | import logging
6 |
7 | def main():
8 | logging.basicConfig(level=config.LOG_LEVEL, filename=config.LOG_FILE)
9 | sql_gen = mysql_process_cdr.SQLGenerator()
10 | watch = directory_watcher.WatchCDRs(config.MONITOR_DIR, success_dir=config.SUCCESS_DIR, failed_dir=config.FAILED_DIR, cdr_processor=sql_gen.process_cdr)
11 | if config.PROCESS_EXISTING:
12 | watch.process_existing()
13 | #Block the current thread
14 | watch.watch()
15 |
16 | if __name__ == '__main__':
17 | main()
18 |
--------------------------------------------------------------------------------
/dashboards/nginx/conf.d/grafana.conf:
--------------------------------------------------------------------------------
1 | upstream graphite-api {
2 | server 127.0.0.1:8000 fail_timeout=0;
3 | }
4 |
5 | upstream grafana-proxy {
6 | server 127.0.0.1:9202 fail_timeout=0;
7 | }
8 |
9 | server {
10 | listen 80;
11 | #server_name my_hostname;
12 | charset utf-8;
13 |
14 | location ~ ^/__gr/(?\w+|\w+/\w+/)$ {
15 | resolver 8.8.8.8;
16 | add_header 'Access-Control-Allow-Origin' '*';
17 | add_header 'Access-Control-Allow-Methods' 'GET, POST';
18 | add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type';
19 | add_header 'Access-Control-Allow-Credentials' 'false';
20 |
21 | proxy_pass http://127.0.0.1:8000/$graphiterequest?$args;
22 | }
23 |
24 | location / {
25 | add_header 'Access-Control-Allow-Origin' '*';
26 | add_header 'Access-Control-Allow-Methods' 'GET, POST';
27 | add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type';
28 | add_header 'Access-Control-Allow-Credentials' 'false';
29 |
30 | proxy_pass http://grafana-proxy;
31 | }
32 |
33 | location @graphite-api {
34 | proxy_pass http://graphite-api;
35 | }
36 |
37 | location @grafana-proxy {
38 | proxy_pass http://grafana-proxy;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/dashboards/system_stats.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # Set Graphite host
4 | GRAPHITE=your_influxdb_server_replaceme
5 | GRAPHITE_PORT=2003
6 |
7 | send_data ()
8 | {
9 | # Get epoch timestamp
10 | DATE=`date +%s`
11 |
12 | # Send data to Graphite + output on the screen
13 | echo "${DATA} ${DATE}"
14 | echo "${DATA} ${DATE}" | nc $GRAPHITE $GRAPHITE_PORT
15 | }
16 |
17 | # Get ecallmgr data
18 | CALLINFO=`sup -n ecallmgr ecallmgr_maintenance channel_summary |grep @ |awk -F\| '{print $3, $4, $5}'`
19 | SERVERS=`echo "$CALLINFO" | awk '{print $1}' | awk -F@ '{print $2}' | sort | uniq`
20 |
21 | for SERVER in $SERVERS; do
22 |
23 | # Count per-server inbound
24 | SERVER_IN=`echo "$CALLINFO" | grep $SERVER | grep inbound | wc -l`
25 |
26 | # Count per-server outbound
27 | SERVER_OUT=`echo "$CALLINFO" | grep $SERVER |grep outbound | wc -l`
28 |
29 | REVERSE_SERVER=`echo "$SERVER" | awk -F"." '{for (i=NF;i;i--) printf "%s.",$i; print ""}' | sed 's/.$//'`
30 |
31 | # Send the data out
32 |
33 | DATA="kazoo.calls.inbound.$REVERSE_SERVER.total $SERVER_IN";
34 | send_data
35 |
36 | DATA="kazoo.calls.outbound.$REVERSE_SERVER.total $SERVER_OUT";
37 | send_data
38 | done
39 |
--------------------------------------------------------------------------------
/dtmf-tones-js/keypress-demo.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | Press keys 0-9 to play DTFM tones.
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/dtmf-tones-js/readme.md:
--------------------------------------------------------------------------------
1 | # DTMF tones using Javascript
2 |
3 | ## Contents
4 | - [Demo](#demo)
5 | - [Description](#description)
6 | - [Usage](#usage)
7 | - [Author](#author)
8 | - [License](#license)
9 |
10 | ## Demos
11 |
12 | See keypress-demo.html in this repository for a simple demo for playing DTMF
13 | tones using the computer keyboard.
14 |
15 | See ui-demo.html in this repository for a simple demo for playing DTMF
16 | tones using the mouse.
17 |
18 |
19 | ## Description
20 |
21 | DTMF.js is a simple Javascript module for generating DTMF (Dual Tone – Multi Frequency)
22 | tones. This is handy for simulating the sounds that touch-tone phones produce.
23 |
24 | ## Usage
25 |
26 | ### Including the DTMF library
27 |
28 | Include the DTMF.js library in your HTML:
29 |
30 | ```html
31 |
32 |
33 | ```
34 |
35 | ### Using the DTMF library
36 |
37 | Playing tones could not be easier! Here's an example:
38 |
39 | ```js
40 | DTFM.playKey('2'); // plays the DTMF tones for the telephone button "2"
41 | ```
42 | This will play the appropriate DTMF tone. You need to stop the tone using
43 | ```js
44 | DTFM.stopKey('2');
45 | ```
46 |
47 | Supported tones are 0-9, #, and *.
48 |
49 | ## Author
50 | This library is based on code by [Ifti Khan](https://www.agiletrailblazers.com/blog/modernized-technology/quick-start-to-generate-tones-in-javascript) and humbly modified by Bret Truchan.
51 |
52 | ## License
53 | DTMF.js is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)
54 |
--------------------------------------------------------------------------------
/dtmf-tones-js/ui-demo.css:
--------------------------------------------------------------------------------
1 | /* from Stack Overflow: https://stackoverflow.com/questions/38261294/how-i-can-make-nice-looking-matrix-of-buttons-with-bootstrap-3 */
2 |
3 | .btn-matrix { flex-wrap: wrap; }
4 |
5 | .btn-matrix > .btn:nth-child(Xn+X+1) {
6 | clear: left;
7 | margin-left: 0;
8 | }
9 | .btn-matrix > .btn:nth-child(n+X+1) {
10 | margin-top: -1px;
11 | }
12 | .btn-matrix > .btn:first-child {
13 | border-bottom-left-radius: 0;
14 | }
15 | .btn-matrix > .btn:nth-child(X) {
16 | border-top-right-radius: 4px !important;
17 | }
18 | .btn-matrix > .btn:nth-last-child(X) {
19 | border-bottom-left-radius: 4px !important;
20 | }
21 | .btn-matrix > .btn:last-child {
22 | border-top-right-radius: 0;
23 | }
24 |
--------------------------------------------------------------------------------
/dtmf-tones-js/ui-demo.js:
--------------------------------------------------------------------------------
1 | $(document).ready(function() {
2 |
3 | var playing_key = null;
4 |
5 | $('button').mousedown(function() {
6 | var key = $(this).data('key');
7 | DTMF.playKey(key);
8 | playing_key = key;
9 | });
10 |
11 | $(document).mouseup(function() {
12 | if(playing_key != null)
13 | {
14 | DTMF.stopKey(playing_key);
15 | playing_key = null;
16 | }
17 | });
18 | });
19 |
--------------------------------------------------------------------------------
/export_auth_token.bash:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | ## Usage: eval $(./export_auth_token.bash -c [CREDENTIALS_HASH] -a [ACCOUNT_NAME])
4 | ## export CREDENTIALS=`echo -n "username:password" | md5sum | cut -d ' ' -f 1`
5 |
6 | usage() { echo 'Usage: eval $('"$0"' [-c {CREDENTIALS_HASH}] [-a {ACCOUNT_NAME}] [-p {PHONE_NUMBER}] [-r {ACCOUNT_REALM}])' 1>&2;}
7 |
8 | function authenticate() {
9 | local C="$1"
10 | local TYPE="$2"
11 | local ID="$3"
12 | AUTH_RESP=$(curl -s -X PUT http://localhost:8000/v2/user_auth -d "{\"data\":{\"credentials\":\"$C\", \"$TYPE\":\"$ID\"}}")
13 |
14 | STATUS=$(echo $AUTH_RESP | jq -r '.status')
15 |
16 | if [ $STATUS == "success" ]; then
17 | echo "export ACCOUNT_ID=$(echo $AUTH_RESP | jq -r '.data.account_id')"
18 | echo "export AUTH_TOKEN=$(echo $AUTH_RESP | jq -r '.auth_token')"
19 | else
20 | echo $AUTH_RESP
21 | fi
22 | }
23 |
24 | while getopts ":a:c:p:r" opt; do
25 | case $opt in
26 | c)
27 | CREDS=${OPTARG}
28 | ;;
29 | p)
30 | IDENTIFIER_VALUE=${OPTARG}
31 | ACCOUNT_IDENTIFIER="phone_number"
32 | ;;
33 | a)
34 | IDENTIFIER_VALUE=${OPTARG}
35 | ACCOUNT_IDENTIFIER="account_name"
36 | ;;
37 | r)
38 | IDENTIFIER_VALUE=${OPTARG}
39 | ACCOUNT_IDENTIFIER="account_realm"
40 | ;;
41 | *)
42 | usage
43 | ;;
44 | esac
45 | done
46 |
47 | if [[ -z "${CREDS}" ]]; then
48 | CREDS="$CREDENTIALS"
49 | fi
50 |
51 | if [[ -z "${ACCOUNT_IDENTIFIER}" ]]; then
52 | usage
53 | else
54 | authenticate $CREDS $ACCOUNT_IDENTIFIER $IDENTIFIER_VALUE
55 | fi
56 |
--------------------------------------------------------------------------------
/fill_fax_db/README.md:
--------------------------------------------------------------------------------
1 | ## fill_faxes_db.py
2 |
3 | This script is used to fill the faxes db for testing purposes like testing migrates and the task kt_fax_cleanup.
4 |
5 | It will generate randomized fields and attach the tiff, pdf files to the document.
6 |
7 | To setup python to run it:
8 |
9 | pip3 install couchdb
10 |
11 | then run with
12 |
13 | ./fill_faxes_db.py {number of docmuments to create}
14 |
15 | You can edit the account_id used if you want to test migrations to real accounts.
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/fill_fax_db/fax_file.tiff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2600hz/community-scripts/cc0d0106eaaf066b85cc42fccbd5b774af001310/fill_fax_db/fax_file.tiff
--------------------------------------------------------------------------------
/fill_fax_db/fixture.json:
--------------------------------------------------------------------------------
1 | {
2 | "from_name": "testing",
3 | "fax_identity_name": "Fax Printer",
4 | "from_number": "+15025551234",
5 | "fax_identity_number": "+1 502 555 1234",
6 | "fax_timezone": "America/New_York",
7 | "to_name": "+15025551234",
8 | "to_number": "+15025551235",
9 | "retries": 1,
10 | "notifications": {
11 | "email": {
12 | "send_to": [
13 | "testing@gmail.com",
14 | "testing@test.com"
15 | ]
16 | }
17 | },
18 | "faxbox_id": "63a3255675edd737d8478896ddd12d56",
19 | "folder": "outbox",
20 | "attempts": 1,
21 | "pvt_reseller_id": "12a3255675edd737d8478896ddd12d57",
22 | "pvt_account_db": "faxes",
23 | "pvt_account_id": "12a3255675edd737d8478896ddd12d57",
24 | "pvt_modified": 63708060942,
25 | "pvt_created": 63708060890,
26 | "pvt_job_status": "failed",
27 | "pvt_type": "fax",
28 | "pvt_size": 722016,
29 | "pvt_pages": 2,
30 | "pvt_job_node": "kazoo_apps@api001.your.test.env",
31 | "tx_result": {
32 | "success": false,
33 | "result_code": 500,
34 | "result_text": "USER_BUSY",
35 | "pages_sent": 0,
36 | "time_elapsed": 52
37 | },
38 | "retry_after": 300
39 | }
40 |
--------------------------------------------------------------------------------
/fill_fax_db/original_file.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2600hz/community-scripts/cc0d0106eaaf066b85cc42fccbd5b774af001310/fill_fax_db/original_file.pdf
--------------------------------------------------------------------------------
/fill_fax_db/pdf_file.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2600hz/community-scripts/cc0d0106eaaf066b85cc42fccbd5b774af001310/fill_fax_db/pdf_file.pdf
--------------------------------------------------------------------------------
/fullbackup-couchdb/README.md:
--------------------------------------------------------------------------------
1 | # Full Backup CouchDB
2 |
3 | This script takes a backup of all CouchDB databases, compresses the backup directory
4 |
5 | and moves it to a SSH-enabled remote server.
6 |
7 | If an error occurs with any of the steps, an alert email is sent with details about the error.
8 |
9 |
10 | ## \-\-\-\-\- Installation \-\-\-\-\-
11 |
12 | #### Get Daniele Bailo's couchdb-dump
13 | ```bash
14 | cd fullbackup-couchdb
15 | wget https://raw.githubusercontent.com/danielebailo/couchdb-dump/master/couchdb-backup.sh
16 | chmod +x *.sh
17 | ```
18 |
19 | #### Check required software
20 | ```bash
21 | ./preflight-check.sh
22 | ```
23 |
24 | #### Edit configs
25 | ```bash
26 | cp fullbackup-couchdb.conf.example fullbackup-couchdb.conf
27 | nano fullbackup-couchdb.conf
28 |
29 | ```
30 |
31 | #### Test
32 | ```bash
33 | ./fullbackup-couchdb.sh
34 | ```
35 |
36 | #### Crontab
37 | ```bash
38 | cp crontab-fullbackup-couchdb /etc/cron.d/fullbackup-couchdb
39 | systemctl restart cron.service
40 | ```
41 | The crontab file assumes you have installed the community-scripts under /opt/.
42 |
43 | If the scripts reside elsewhere, fix the path in the crontab file.
44 |
45 |
46 |
47 | ## \-\-\-\-\- Notes \-\-\-\-\-
48 |
49 | There is nothing Kazoo specific about this script. It will work on any system that uses CouchDB.
50 |
51 |
52 | Only use the SFTP option if you are unable to safely use SCP.
53 |
54 | This script is unable to detect if the SFTP client has actually transferred the backup file to the remote server.
55 |
56 | It only knows if the connection has been successfully opened and closed.
57 |
58 |
59 |
60 | ## \-\-\-\-\- Security \-\-\-\-\-
61 |
62 | Always chroot/chjail the remote server’s user.
63 |
64 | The users should only be able to run the scp-server or sftp-server programs.
65 |
66 | The user should never be able to get SSH-shell access, even if the shell and user are in a chjail.
67 |
68 |
69 | The remote server’s other backup directories should not be accessible to the user.
70 |
71 | In case of a break-in, the bad-guy will only hose these backups not all your backups.
72 |
73 | An additional protection scheme includes either periodically moving these backups to another directory
74 |
75 | or removing write permission to the existing backups.
76 |
77 |
78 |
79 |
80 | Sponsored by GBC Networks Oy (http://gbc.fi)
81 |
--------------------------------------------------------------------------------
/fullbackup-couchdb/crontab-fullbackup-couchdb:
--------------------------------------------------------------------------------
1 | # Run full backup of CouchDB databases
2 | # Default schedule = every day at 03:30
3 | 30 03 * * * root /opt/community-scripts/fullbackup-couchdb/fullbackup-couchdb.sh > /dev/null
4 |
--------------------------------------------------------------------------------
/fullbackup-couchdb/fullbackup-couchdb.conf.example:
--------------------------------------------------------------------------------
1 | ##
2 | ## Config file for fullbackup-couchdb.sh
3 | ##
4 |
5 | #### General Config ####
6 |
7 | ## Print executed commands and show couchbackup results
8 | debug=false
9 |
10 |
11 | #### CouchDB server ####
12 |
13 | ## CouchDB admin username
14 | couchdb_username=admin
15 |
16 | ## CouchDB admin password
17 | couchdb_password=YOUR_PASSWORD
18 |
19 | ## Hostname or IP of the CouchDB server
20 | couchdb_hostname=localhost
21 |
22 | ## Listening port on CouchDB server
23 | couchdb_port=5984
24 |
25 | ## Transfer protocol of CouchDB server (either http or https)
26 | couchdb_protocol=http
27 |
28 |
29 | #### Alert email ####
30 |
31 | ## Enable email alert
32 | email_enabled=true
33 |
34 | # Recipient of alert email
35 | email_address=alert.recipient@blackhole.io
36 |
37 |
38 | #### Remote storage SSH server ####
39 |
40 | ## Enable storage to SSH server
41 | remote_enabled=true
42 |
43 | ## Remote SSH server key file
44 | remote_sshkey=/home/user/.ssh/KEY_TO_REMOTE_SSH_SERVER.pem
45 |
46 | ## Username for remote backup storage
47 | remote_username=chjail_user
48 |
49 | ## Hostname or IP of remote backup storage
50 | remote_hostname=REMOTE_SSH_SERVER
51 |
52 | ## SSH port on remote server
53 | remote_port=22
54 |
55 | ## Transfer protocol of remote backup storage (either scp or sftp)
56 | remote_protocol=scp
57 |
58 | ## Directory to store backup
59 | remote_directory=/home/chjail_user/backup
60 |
--------------------------------------------------------------------------------
/fullbackup-couchdb/preflight-check.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | ##
4 | ## Check software dependencies for fullbackup-couchdb.sh
5 | ##
6 | ## This script check that the required software is found on the system.
7 | ## You only need to run this script once during setup.
8 | ##
9 |
10 | ## Sponsored by GBC Networks Oy (http://gbc.fi)
11 |
12 |
13 | declare -a gnu_programs=(basename bash cat date dirname echo hostname mkdir printf rm source)
14 | declare -a other_programs=(logger mailx scp sftp ./couchdb-backup.sh)
15 |
16 | RED='\033[0;31m'
17 | NC='\033[0m' # No Color
18 |
19 | ##START FUNCTION
20 | check_file(){
21 | program=$1
22 |
23 | if (type $program >/dev/null 2>&1); then
24 | echo -e "${NC}\t$program found"
25 | else
26 | (>&2 echo -e "${RED} Error: $program is required but it's not installed!${NC}")
27 | # exit 5;
28 | fi
29 | }
30 | ## END FUNCTION
31 |
32 |
33 | echo "Checking standard GNU software..."
34 | for program in "${gnu_programs[@]}"; do
35 | check_file $program
36 | done
37 | echo "Checking other programs..."
38 | for program in "${other_programs[@]}"; do
39 | check_file $program
40 | done
41 | echo "Check completed."
42 |
--------------------------------------------------------------------------------
/kazoo-puppet/README.md:
--------------------------------------------------------------------------------
1 | This is a collection of Puppet scripts used to deploy Whistle / Kazoo
2 |
3 | If you have any questions please contact us at info /at\ voxter.com
4 |
5 | Copyright 2012 Voxter Communications
--------------------------------------------------------------------------------
/kazoo-puppet/voxter-kazoo-0.0.6.tar.gz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2600hz/community-scripts/cc0d0106eaaf066b85cc42fccbd5b774af001310/kazoo-puppet/voxter-kazoo-0.0.6.tar.gz
--------------------------------------------------------------------------------
/kazoo-sample-php-app/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (C) 2013, 2600hz, Inc.
4 | Copyright (C) 2013, Ben Wann
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy of
7 | this software and associated documentation files (the "Software"), to deal in
8 | the Software without restriction, including without limitation the rights to
9 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
10 | of the Software, and to permit persons to whom the Software is furnished to do
11 | so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in all
14 | copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 | SOFTWARE.
--------------------------------------------------------------------------------
/kazoo-sample-php-app/README.md:
--------------------------------------------------------------------------------
1 | ## Kazoo Sample PHP Application
2 |
3 | ### License
4 |
5 | The Kazoo Sample PHP Application is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)
6 |
--------------------------------------------------------------------------------
/kazoo-sample-php-app/app/commands/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2600hz/community-scripts/cc0d0106eaaf066b85cc42fccbd5b774af001310/kazoo-sample-php-app/app/commands/.gitkeep
--------------------------------------------------------------------------------
/kazoo-sample-php-app/app/config/auth.php:
--------------------------------------------------------------------------------
1 | 'eloquent',
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | Authentication Model
23 | |--------------------------------------------------------------------------
24 | |
25 | | When using the "Eloquent" authentication driver, we need to know which
26 | | Eloquent model should be used to retrieve your users. Of course, it
27 | | is often just the "User" model but you may use whatever you like.
28 | |
29 | */
30 |
31 | 'model' => 'User',
32 |
33 | /*
34 | |--------------------------------------------------------------------------
35 | | Authentication Table
36 | |--------------------------------------------------------------------------
37 | |
38 | | When using the "Database" authentication driver, we need to know which
39 | | table should be used to retrieve your users. We have chosen a basic
40 | | default value but you may easily change it to any table you like.
41 | |
42 | */
43 |
44 | 'table' => 'users',
45 |
46 | /*
47 | |--------------------------------------------------------------------------
48 | | Password Reminder Settings
49 | |--------------------------------------------------------------------------
50 | |
51 | | Here you may set the settings for password reminders, including a view
52 | | that should be used as your password reminder e-mail. You will also
53 | | be able to set the name of the table that holds the reset tokens.
54 | |
55 | | The "expire" time is the number of minutes that the reminder should be
56 | | considered valid. This security feature keeps tokens short-lived so
57 | | they have less time to be guessed. You may change this as needed.
58 | |
59 | */
60 |
61 | 'reminder' => array(
62 |
63 | 'email' => 'emails.auth.reminder',
64 |
65 | 'table' => 'password_reminders',
66 |
67 | 'expire' => 60,
68 |
69 | ),
70 |
71 | );
--------------------------------------------------------------------------------
/kazoo-sample-php-app/app/config/cache.php:
--------------------------------------------------------------------------------
1 | 'file',
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | File Cache Location
23 | |--------------------------------------------------------------------------
24 | |
25 | | When using the "file" cache driver, we need a location where the cache
26 | | files may be stored. A sensible default has been specified, but you
27 | | are free to change it to any other place on disk that you desire.
28 | |
29 | */
30 |
31 | 'path' => storage_path().'/cache',
32 |
33 | /*
34 | |--------------------------------------------------------------------------
35 | | Database Cache Connection
36 | |--------------------------------------------------------------------------
37 | |
38 | | When using the "database" cache driver you may specify the connection
39 | | that should be used to store the cached items. When this option is
40 | | null the default database connection will be utilized for cache.
41 | |
42 | */
43 |
44 | 'connection' => null,
45 |
46 | /*
47 | |--------------------------------------------------------------------------
48 | | Database Cache Table
49 | |--------------------------------------------------------------------------
50 | |
51 | | When using the "database" cache driver we need to know the table that
52 | | should be used to store the cached items. A default table name has
53 | | been provided but you're free to change it however you deem fit.
54 | |
55 | */
56 |
57 | 'table' => 'cache',
58 |
59 | /*
60 | |--------------------------------------------------------------------------
61 | | Memcached Servers
62 | |--------------------------------------------------------------------------
63 | |
64 | | Now you may specify an array of your Memcached servers that should be
65 | | used when utilizing the Memcached cache driver. All of the servers
66 | | should contain a value for "host", "port", and "weight" options.
67 | |
68 | */
69 |
70 | 'memcached' => array(
71 |
72 | array('host' => '127.0.0.1', 'port' => 11211, 'weight' => 100),
73 |
74 | ),
75 |
76 | /*
77 | |--------------------------------------------------------------------------
78 | | Cache Key Prefix
79 | |--------------------------------------------------------------------------
80 | |
81 | | When utilizing a RAM based store such as APC or Memcached, there might
82 | | be other applications utilizing the same cache. So, we'll specify a
83 | | value to get prefixed to all our keys so we can avoid collisions.
84 | |
85 | */
86 |
87 | 'prefix' => 'laravel',
88 |
89 | );
90 |
--------------------------------------------------------------------------------
/kazoo-sample-php-app/app/config/compile.php:
--------------------------------------------------------------------------------
1 | 'sync',
19 |
20 | /*
21 | |--------------------------------------------------------------------------
22 | | Queue Connections
23 | |--------------------------------------------------------------------------
24 | |
25 | | Here you may configure the connection information for each server that
26 | | is used by your application. A default configuration has been added
27 | | for each back-end shipped with Laravel. You are free to add more.
28 | |
29 | */
30 |
31 | 'connections' => array(
32 |
33 | 'sync' => array(
34 | 'driver' => 'sync',
35 | ),
36 |
37 | 'beanstalkd' => array(
38 | 'driver' => 'beanstalkd',
39 | 'host' => 'localhost',
40 | 'queue' => 'default',
41 | ),
42 |
43 | 'sqs' => array(
44 | 'driver' => 'sqs',
45 | 'key' => 'your-public-key',
46 | 'secret' => 'your-secret-key',
47 | 'queue' => 'your-queue-url',
48 | 'region' => 'us-east-1',
49 | ),
50 |
51 | 'iron' => array(
52 | 'driver' => 'iron',
53 | 'project' => 'your-project-id',
54 | 'token' => 'your-token',
55 | 'queue' => 'your-queue-name',
56 | ),
57 |
58 | ),
59 |
60 | );
61 |
--------------------------------------------------------------------------------
/kazoo-sample-php-app/app/config/testing/cache.php:
--------------------------------------------------------------------------------
1 | 'array',
19 |
20 | );
--------------------------------------------------------------------------------
/kazoo-sample-php-app/app/config/testing/session.php:
--------------------------------------------------------------------------------
1 | 'array',
20 |
21 | );
--------------------------------------------------------------------------------
/kazoo-sample-php-app/app/config/view.php:
--------------------------------------------------------------------------------
1 | array(__DIR__.'/../views'),
17 |
18 | /*
19 | |--------------------------------------------------------------------------
20 | | Pagination View
21 | |--------------------------------------------------------------------------
22 | |
23 | | This view will be used to render the pagination link output, and can
24 | | be easily customized here to show any view you like. A clean view
25 | | compatible with Twitter's Bootstrap is given to you by default.
26 | |
27 | */
28 |
29 | 'pagination' => 'pagination::slider',
30 |
31 | );
32 |
--------------------------------------------------------------------------------
/kazoo-sample-php-app/app/config/workbench.php:
--------------------------------------------------------------------------------
1 | '',
17 |
18 | /*
19 | |--------------------------------------------------------------------------
20 | | Workbench Author E-Mail Address
21 | |--------------------------------------------------------------------------
22 | |
23 | | Like the option above, your e-mail address is used when generating new
24 | | workbench packages. The e-mail is placed in your composer.json file
25 | | automatically after the package is created by the workbench tool.
26 | |
27 | */
28 |
29 | 'email' => '',
30 |
31 | );
--------------------------------------------------------------------------------
/kazoo-sample-php-app/app/controllers/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2600hz/community-scripts/cc0d0106eaaf066b85cc42fccbd5b774af001310/kazoo-sample-php-app/app/controllers/.gitkeep
--------------------------------------------------------------------------------
/kazoo-sample-php-app/app/controllers/AccountController.php:
--------------------------------------------------------------------------------
1 | layout->content = View::make('accounts.index');
9 | }
10 |
11 | }
--------------------------------------------------------------------------------
/kazoo-sample-php-app/app/controllers/BaseController.php:
--------------------------------------------------------------------------------
1 | layout))
13 | {
14 | $this->layout = View::make($this->layout);
15 | }
16 | }
17 |
18 | }
--------------------------------------------------------------------------------
/kazoo-sample-php-app/app/controllers/DeviceController.php:
--------------------------------------------------------------------------------
1 | layout->content = View::make('devices.index');
9 | }
10 |
11 | }
--------------------------------------------------------------------------------
/kazoo-sample-php-app/app/controllers/HomeController.php:
--------------------------------------------------------------------------------
1 | layout->content = View::make('home.index');
9 | }
10 |
11 | }
--------------------------------------------------------------------------------
/kazoo-sample-php-app/app/database/migrations/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2600hz/community-scripts/cc0d0106eaaf066b85cc42fccbd5b774af001310/kazoo-sample-php-app/app/database/migrations/.gitkeep
--------------------------------------------------------------------------------
/kazoo-sample-php-app/app/database/production.sqlite:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2600hz/community-scripts/cc0d0106eaaf066b85cc42fccbd5b774af001310/kazoo-sample-php-app/app/database/production.sqlite
--------------------------------------------------------------------------------
/kazoo-sample-php-app/app/database/seeds/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2600hz/community-scripts/cc0d0106eaaf066b85cc42fccbd5b774af001310/kazoo-sample-php-app/app/database/seeds/.gitkeep
--------------------------------------------------------------------------------
/kazoo-sample-php-app/app/database/seeds/DatabaseSeeder.php:
--------------------------------------------------------------------------------
1 | call('UserTableSeeder');
15 | }
16 |
17 | }
--------------------------------------------------------------------------------
/kazoo-sample-php-app/app/filters.php:
--------------------------------------------------------------------------------
1 | '« Previous',
17 |
18 | 'next' => 'Next »',
19 |
20 | );
--------------------------------------------------------------------------------
/kazoo-sample-php-app/app/lang/en/reminders.php:
--------------------------------------------------------------------------------
1 | "Passwords must be six characters and match the confirmation.",
17 |
18 | "user" => "We can't find a user with that e-mail address.",
19 |
20 | "token" => "This password reset token is invalid.",
21 |
22 | );
--------------------------------------------------------------------------------
/kazoo-sample-php-app/app/models/User.php:
--------------------------------------------------------------------------------
1 | getKey();
30 | }
31 |
32 | /**
33 | * Get the password for the user.
34 | *
35 | * @return string
36 | */
37 | public function getAuthPassword()
38 | {
39 | return $this->password;
40 | }
41 |
42 | /**
43 | * Get the e-mail address where password reminders are sent.
44 | *
45 | * @return string
46 | */
47 | public function getReminderEmail()
48 | {
49 | return $this->email;
50 | }
51 |
52 | }
--------------------------------------------------------------------------------
/kazoo-sample-php-app/app/routes.php:
--------------------------------------------------------------------------------
1 | client->request('GET', '/');
13 |
14 | $this->assertTrue($this->client->getResponse()->isOk());
15 | }
16 |
17 | }
--------------------------------------------------------------------------------
/kazoo-sample-php-app/app/tests/TestCase.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Password Reset
8 |
9 |
10 | To reset your password, complete this form: {{ URL::to('password/reset', array($token)) }}.
11 |
12 |
13 |
--------------------------------------------------------------------------------
/kazoo-sample-php-app/app/views/home/nav.blade.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/kazoo-sample-php-app/app/views/home/pagetitle.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | @yield('page_title')
5 |
6 |
7 |
--------------------------------------------------------------------------------
/kazoo-sample-php-app/app/views/layouts/master.blade.php:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Kazoo Sample Application
7 | {{ HTML::style('css/foundation.css') }}
8 | {{ HTML::script('js/modernizr.js') }}
9 | @yield('additional_styles')
10 |
11 |
12 | @include('home.nav')
13 | @include('home.pagetitle')
14 |
15 | @yield('content')
16 |
17 | {{ HTML::script('js/jquery.js') }}
18 | {{ HTML::script('js/foundation.min.js') }}
19 | @yield('additional_scripts')
20 |
23 | @yield('page_global_javascript', '')
24 |
25 |
26 |
--------------------------------------------------------------------------------
/kazoo-sample-php-app/artisan:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env php
2 | boot();
33 |
34 | /*
35 | |--------------------------------------------------------------------------
36 | | Load The Artisan Console Application
37 | |--------------------------------------------------------------------------
38 | |
39 | | We'll need to run the script to load and return the Artisan console
40 | | application. We keep this in its own script so that we will load
41 | | the console application independent of running commands which
42 | | will allow us to fire commands from Routes when we want to.
43 | |
44 | */
45 |
46 | $artisan = Illuminate\Console\Application::start($app);
47 |
48 | /*
49 | |--------------------------------------------------------------------------
50 | | Run The Artisan Application
51 | |--------------------------------------------------------------------------
52 | |
53 | | When we run the console application, the current CLI command will be
54 | | executed in this console and the response sent back to a terminal
55 | | or another output device for the developers. Here goes nothing!
56 | |
57 | */
58 |
59 | $status = $artisan->run();
60 |
61 | /*
62 | |--------------------------------------------------------------------------
63 | | Shutdown The Application
64 | |--------------------------------------------------------------------------
65 | |
66 | | Once Artisan has finished running. We will fire off the shutdown events
67 | | so that any final work may be done by the application before we shut
68 | | down the process. This is the last thing to happen to the request.
69 | |
70 | */
71 |
72 | $app->shutdown();
73 |
74 | exit($status);
--------------------------------------------------------------------------------
/kazoo-sample-php-app/bootstrap/autoload.php:
--------------------------------------------------------------------------------
1 | __DIR__.'/../app',
17 |
18 | /*
19 | |--------------------------------------------------------------------------
20 | | Public Path
21 | |--------------------------------------------------------------------------
22 | |
23 | | The public path contains the assets for your web application, such as
24 | | your JavaScript and CSS files, and also contains the primary entry
25 | | point for web requests into these applications from the outside.
26 | |
27 | */
28 |
29 | 'public' => __DIR__.'/../public',
30 |
31 | /*
32 | |--------------------------------------------------------------------------
33 | | Base Path
34 | |--------------------------------------------------------------------------
35 | |
36 | | The base path is the root of the Laravel installation. Most likely you
37 | | will not need to change this value. But, if for some wild reason it
38 | | is necessary you will do so here, just proceed with some caution.
39 | |
40 | */
41 |
42 | 'base' => __DIR__.'/..',
43 |
44 | /*
45 | |--------------------------------------------------------------------------
46 | | Storage Path
47 | |--------------------------------------------------------------------------
48 | |
49 | | The storage path is used by Laravel to store cached Blade views, logs
50 | | and other pieces of information. You may modify the path here when
51 | | you want to change the location of this directory for your apps.
52 | |
53 | */
54 |
55 | 'storage' => __DIR__.'/../app/storage',
56 |
57 | );
58 |
--------------------------------------------------------------------------------
/kazoo-sample-php-app/bootstrap/start.php:
--------------------------------------------------------------------------------
1 | redirectIfTrailingSlash();
17 |
18 | /*
19 | |--------------------------------------------------------------------------
20 | | Detect The Application Environment
21 | |--------------------------------------------------------------------------
22 | |
23 | | Laravel takes a dead simple approach to your application environments
24 | | so you can just specify a machine name or HTTP host that matches a
25 | | given environment, then we will automatically detect it for you.
26 | |
27 | */
28 |
29 | $env = $app->detectEnvironment(array(
30 |
31 | 'local' => array('your-machine-name'),
32 |
33 | ));
34 |
35 | /*
36 | |--------------------------------------------------------------------------
37 | | Bind Paths
38 | |--------------------------------------------------------------------------
39 | |
40 | | Here we are binding the paths configured in paths.php to the app. You
41 | | should not be changing these here. If you need to change these you
42 | | may do so within the paths.php file and they will be bound here.
43 | |
44 | */
45 |
46 | $app->bindInstallPaths(require __DIR__.'/paths.php');
47 |
48 | /*
49 | |--------------------------------------------------------------------------
50 | | Load The Application
51 | |--------------------------------------------------------------------------
52 | |
53 | | Here we will load the Illuminate application. We'll keep this is in a
54 | | separate location so we can isolate the creation of an application
55 | | from the actual running of the application with a given request.
56 | |
57 | */
58 |
59 | $framework = $app['path.base'].'/vendor/laravel/framework/src';
60 |
61 | require $framework.'/Illuminate/Foundation/start.php';
62 |
63 | /*
64 | |--------------------------------------------------------------------------
65 | | Return The Application
66 | |--------------------------------------------------------------------------
67 | |
68 | | This script returns the application instance. The instance is given to
69 | | the calling script so we can separate the building of the instances
70 | | from the actual running of the application and sending responses.
71 | |
72 | */
73 |
74 | return $app;
75 |
--------------------------------------------------------------------------------
/kazoo-sample-php-app/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "2600hz/kazoo-sample-app",
3 | "type": "library",
4 | "keywords": ["kazoo", "sip", "api", "voip", "uc"],
5 | "license": "MIT",
6 | "description": "Description of project kazoo-sample-app.",
7 | "homepage": "http://github.com/2600hz/kazoo-sample-app",
8 | "authors": [
9 | {
10 | "name": "2600hz Team",
11 | "homepage": "http://2600hz.com"
12 | },
13 | {
14 | "name": "Ben Wann",
15 | "email": "ben@2600hz.com"
16 | }
17 | ],
18 | "require": {
19 | "laravel/framework": "4.0.*",
20 | "ext-curl": "*",
21 | "guzzle/guzzle": ">=3.7",
22 | "2600hz/kazoo-php-sdk": "dev-master"
23 | },
24 | "autoload": {
25 | "classmap": [
26 | "app/commands",
27 | "app/controllers",
28 | "app/models",
29 | "app/database/migrations",
30 | "app/database/seeds",
31 | "app/tests/TestCase.php"
32 | ]
33 | },
34 | "scripts": {
35 | "post-install-cmd": [
36 | "php artisan optimize"
37 | ],
38 | "post-update-cmd": [
39 | "php artisan clear-compiled",
40 | "php artisan optimize"
41 | ],
42 | "post-create-project-cmd": [
43 | "php artisan key:generate"
44 | ]
45 | },
46 | "config": {
47 | "preferred-install": "dist"
48 | },
49 | "minimum-stability": "dev"
50 | }
51 |
--------------------------------------------------------------------------------
/kazoo-sample-php-app/phpunit.xml:
--------------------------------------------------------------------------------
1 |
2 |
13 |
14 |
15 | ./app/tests/
16 |
17 |
18 |
--------------------------------------------------------------------------------
/kazoo-sample-php-app/public/.htaccess:
--------------------------------------------------------------------------------
1 |
2 | Options -MultiViews
3 | RewriteEngine On
4 |
5 | RewriteCond %{REQUEST_FILENAME} !-d
6 | RewriteCond %{REQUEST_FILENAME} !-f
7 | RewriteRule ^ index.php [L]
8 |
--------------------------------------------------------------------------------
/kazoo-sample-php-app/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2600hz/community-scripts/cc0d0106eaaf066b85cc42fccbd5b774af001310/kazoo-sample-php-app/public/favicon.ico
--------------------------------------------------------------------------------
/kazoo-sample-php-app/public/img/.gitkeep:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/kazoo-sample-php-app/public/index.php:
--------------------------------------------------------------------------------
1 |
7 | */
8 |
9 | /*
10 | |--------------------------------------------------------------------------
11 | | Register The Auto Loader
12 | |--------------------------------------------------------------------------
13 | |
14 | | Composer provides a convenient, automatically generated class loader
15 | | for our application. We just need to utilize it! We'll require it
16 | | into the script here so that we do not have to worry about the
17 | | loading of any our classes "manually". Feels great to relax.
18 | |
19 | */
20 |
21 | require __DIR__.'/../bootstrap/autoload.php';
22 |
23 | /*
24 | |--------------------------------------------------------------------------
25 | | Turn On The Lights
26 | |--------------------------------------------------------------------------
27 | |
28 | | We need to illuminate PHP development, so let's turn on the lights.
29 | | This bootstraps the framework and gets it ready for use, then it
30 | | will load up this application so that we can run it and send
31 | | the responses back to the browser and delight these users.
32 | |
33 | */
34 |
35 | $app = require_once __DIR__.'/../bootstrap/start.php';
36 |
37 | /*
38 | |--------------------------------------------------------------------------
39 | | Run The Application
40 | |--------------------------------------------------------------------------
41 | |
42 | | Once we have the application, we can simply call the run method,
43 | | which will execute the request and send the response back to
44 | | the client's browser allowing them to enjoy the creative
45 | | and wonderful applications we have created for them.
46 | |
47 | */
48 |
49 | $app->run();
50 |
51 | /*
52 | |--------------------------------------------------------------------------
53 | | Shutdown The Application
54 | |--------------------------------------------------------------------------
55 | |
56 | | Once the app has finished running, we will fire off the shutdown events
57 | | so that any final work may be done by the application before we shut
58 | | down the process. This is the last thing to happen to the request.
59 | |
60 | */
61 |
62 | $app->shutdown();
--------------------------------------------------------------------------------
/kazoo-sample-php-app/public/js/foundation/foundation.accordion.js:
--------------------------------------------------------------------------------
1 | ;(function ($, window, document, undefined) {
2 | 'use strict';
3 |
4 | Foundation.libs.accordion = {
5 | name : 'accordion',
6 |
7 | version : '5.0.1',
8 |
9 | settings : {
10 | active_class: 'active',
11 | toggleable: true
12 | },
13 |
14 | init : function (scope, method, options) {
15 | this.bindings(method, options);
16 | },
17 |
18 | events : function () {
19 | $(this.scope).off('.accordion').on('click.fndtn.accordion', '[data-accordion] > dd > a', function (e) {
20 | var accordion = $(this).parent(),
21 | target = $('#' + this.href.split('#')[1]),
22 | siblings = $('> dd > .content', target.closest('[data-accordion]')),
23 | settings = accordion.parent().data('accordion-init'),
24 | active = $('> dd > .content.' + settings.active_class, accordion.parent());
25 |
26 | e.preventDefault();
27 |
28 | if (active[0] == target[0] && settings.toggleable) {
29 | return target.toggleClass(settings.active_class);
30 | }
31 |
32 | siblings.removeClass(settings.active_class);
33 | target.addClass(settings.active_class);
34 | });
35 | },
36 |
37 | off : function () {},
38 |
39 | reflow : function () {}
40 | };
41 | }(jQuery, this, this.document));
42 |
--------------------------------------------------------------------------------
/kazoo-sample-php-app/public/js/foundation/foundation.alert.js:
--------------------------------------------------------------------------------
1 | ;(function ($, window, document, undefined) {
2 | 'use strict';
3 |
4 | Foundation.libs.alert = {
5 | name : 'alert',
6 |
7 | version : '5.0.0',
8 |
9 | settings : {
10 | animation: 'fadeOut',
11 | speed: 300, // fade out speed
12 | callback: function (){}
13 | },
14 |
15 | init : function (scope, method, options) {
16 | this.bindings(method, options);
17 | },
18 |
19 | events : function () {
20 | $(this.scope).off('.alert').on('click.fndtn.alert', '[data-alert] a.close', function (e) {
21 | var alertBox = $(this).closest("[data-alert]"),
22 | settings = alertBox.data('alert-init');
23 |
24 | e.preventDefault();
25 | alertBox[settings.animation](settings.speed, function () {
26 | $(this).trigger('closed').remove();
27 | settings.callback();
28 | });
29 | });
30 | },
31 |
32 | reflow : function () {}
33 | };
34 | }(jQuery, this, this.document));
35 |
--------------------------------------------------------------------------------
/kazoo-sample-php-app/public/js/foundation/foundation.offcanvas.js:
--------------------------------------------------------------------------------
1 | ;(function ($, window, document, undefined) {
2 | 'use strict';
3 |
4 | Foundation.libs.offcanvas = {
5 | name : 'offcanvas',
6 |
7 | version : '5.0.0',
8 |
9 | settings : {},
10 |
11 | init : function (scope, method, options) {
12 | this.events();
13 | },
14 |
15 | events : function () {
16 | $(this.scope).off('.offcanvas')
17 | .on('click.fndtn.offcanvas', '.left-off-canvas-toggle', function (e) {
18 | e.preventDefault();
19 | $(this).closest('.off-canvas-wrap').toggleClass('move-right');
20 | })
21 | .on('click.fndtn.offcanvas', '.exit-off-canvas', function (e) {
22 | e.preventDefault();
23 | $(".off-canvas-wrap").removeClass("move-right");
24 | })
25 | .on('click.fndtn.offcanvas', '.right-off-canvas-toggle', function (e) {
26 | e.preventDefault();
27 | $(this).closest(".off-canvas-wrap").toggleClass("move-left");
28 | })
29 | .on('click.fndtn.offcanvas', '.exit-off-canvas', function (e) {
30 | e.preventDefault();
31 | $(".off-canvas-wrap").removeClass("move-left");
32 | });
33 | },
34 |
35 | reflow : function () {}
36 | };
37 | }(jQuery, this, this.document));
38 |
--------------------------------------------------------------------------------
/kazoo-sample-php-app/public/js/foundation/foundation.tab.js:
--------------------------------------------------------------------------------
1 | /*jslint unparam: true, browser: true, indent: 2 */
2 | ;(function ($, window, document, undefined) {
3 | 'use strict';
4 |
5 | Foundation.libs.tab = {
6 | name : 'tab',
7 |
8 | version : '5.0.1',
9 |
10 | settings : {
11 | active_class: 'active'
12 | },
13 |
14 | init : function (scope, method, options) {
15 | this.bindings(method, options);
16 | },
17 |
18 | events : function () {
19 | $(this.scope).off('.tab').on('click.fndtn.tab', '[data-tab] > dd > a', function (e) {
20 | e.preventDefault();
21 |
22 | var tab = $(this).parent(),
23 | target = $('#' + this.href.split('#')[1]),
24 | siblings = tab.siblings(),
25 | settings = tab.closest('[data-tab]').data('tab-init');
26 |
27 | tab.addClass(settings.active_class);
28 | siblings.removeClass(settings.active_class);
29 | target.siblings().removeClass(settings.active_class).end().addClass(settings.active_class);
30 | });
31 | },
32 |
33 | off : function () {},
34 |
35 | reflow : function () {}
36 | };
37 | }(jQuery, this, this.document));
38 |
--------------------------------------------------------------------------------
/kazoo-sample-php-app/public/packages/.gitkeep:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2600hz/community-scripts/cc0d0106eaaf066b85cc42fccbd5b774af001310/kazoo-sample-php-app/public/packages/.gitkeep
--------------------------------------------------------------------------------
/kazoo-sample-php-app/public/robots.txt:
--------------------------------------------------------------------------------
1 | User-agent: *
2 | Disallow:
3 |
--------------------------------------------------------------------------------
/kazoo-sample-php-app/server.php:
--------------------------------------------------------------------------------
1 | /dev/null`
25 | if [ ! -f /var/run/$proc.pid ]
26 | then
27 | if [ -f /var/run/$proc/$proc.pid ]
28 | then
29 | proc_pid=`ps -p \`cat /var/run/$proc/$proc.pid 2> /dev/null\` 2> /dev/null`
30 | fi
31 | else
32 | proc_pid=`ps -p \`cat /var/run/$proc.pid 2> /dev/null\` 2> /dev/null`
33 | fi
34 |
35 | if [[ $proc_pid == *"$proc"* && $proc_status == *"is running"* ]]
36 | then success
37 | echo "$name is running"
38 | elif [[ $proc_pid == *"$proc"* || $proc_status == *"is running"* ]]
39 | then warning
40 | echo "$name might not be running properly"
41 | else failure
42 | echo "$name is not running"
43 | fi
44 | echo " Version: $rpm_check"
45 | fi
46 | }
47 |
48 | check_erl_proc()
49 | {
50 | proc=$1
51 | name=$2
52 | rpm_name=$3
53 | rpm_check=$(check_rpm $3)
54 | if [[ $rpm_check == "1" ]]
55 | then warning
56 | echo "$2 is not installed"
57 | else
58 | for i in `pidof $BEAM`; do
59 | if cat /proc/$i/cmdline | grep -Eq "name[^\-]+$proc"; then
60 | ERL_PIDS[$proc]=$i
61 | fi
62 | done
63 |
64 | if [[ `ps -p ${ERL_PIDS[$proc]} 2> /dev/null` == *"beam"* ]]
65 | then success
66 | echo "$name is running"
67 | else failure
68 | echo "$name is not running"
69 | fi
70 | echo " Version: $rpm_check"
71 | fi
72 | }
73 |
74 | check_rpm()
75 | {
76 | RPM=`rpm -qa | grep $1`
77 | if [[ $RPM ]]
78 | then
79 | echo "$RPM"
80 | else
81 | echo "1"
82 | fi
83 | }
84 |
85 | check_erl_proc rabbit Kazoo-RabbitMQ kazoo-R1[5-6]
86 | check_proc kamailio Kazoo-Kamailio kazoo-kamailio
87 | check_erl_proc whistle_apps Whistle-Apps kazoo-R1[5-6]
88 | check_erl_proc ecallmgr Ecallmgr kazoo-R1[5-6]
89 | check_proc httpd HTTPd httpd-[0-9]
90 | check_proc haproxy HAProxy haproxy-[0-9]
91 | check_proc freeswitch Kazoo-FreeSWITCH kazoo-freeswitch-R1[5-6]
92 | check_erl_proc bigcouch Kazoo-Bigcouch kazoo-bigcouch-R1[5-6]
93 |
--------------------------------------------------------------------------------
/klap/analyzers/klap-accounts.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | cd `dirname $0`
4 |
5 | . ../klap-utils.sh
6 |
7 | for FILE in $(listFiles $@); do
8 | createExactTmpFile "account%2F[0-9a-fA-F%]+"
9 |
10 | isTmpFileEmpty
11 | if [ $? != 0 ]; then
12 | continue
13 | fi
14 |
15 | statHeader
16 |
17 | printStat "Unique Account DBs" $(wc -l $TMP_FILE)
18 | cat $TMP_FILE | sort 2> /dev/null| uniq -c | sort -nr 2> /dev/null | head | printTable "Most Frequent Account DBs"
19 | done
20 |
--------------------------------------------------------------------------------
/klap/analyzers/klap-call-ids.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | cd `dirname $0`
4 |
5 | . ../klap-utils.sh
6 |
7 | for FILE in $(listFiles $@); do
8 | createExactTmpFile "\|.+\|"
9 |
10 | isTmpFileEmpty
11 | if [ $? != 0 ]; then
12 | continue
13 | fi
14 |
15 | statHeader
16 |
17 | printStat "Unique Call-IDs" `cat $TMP_FILE | sort | uniq | wc -l`
18 | done
19 |
--------------------------------------------------------------------------------
/klap/analyzers/klap-couch-mgr.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | cd `dirname $0`
4 |
5 | . ../klap-utils.sh
6 |
7 | for FILE in $(listFiles $@); do
8 | createTmpFile "couch_util"
9 |
10 | isTmpFileEmpty
11 | if [ $? != 0 ]; then
12 | continue
13 | fi
14 |
15 | statHeader
16 |
17 | zgrep "unformatted error" $TMP_FILE | rev | cut -d " " -f 1 | rev | sort | uniq -c | sort -nr | head | printTable "Unformatted Errors"
18 | zgrep "gateway_timeout" $FILE | wc -l | printTable "Number of gateway timeouts"
19 | done
20 |
--------------------------------------------------------------------------------
/klap/analyzers/klap-hangups.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | cd `dirname $0`
4 |
5 | . ../klap-utils.sh
6 |
7 | for FILE in $(listFiles $@); do
8 | statHeader
9 |
10 | zgrep "abnormal call termination" ${FILE} | rev | cut -d " " -f 1 | rev | sort | uniq -c | sort -nr | printTable "Abnormal Hangup Causes"
11 | done
12 |
--------------------------------------------------------------------------------
/klap/analyzers/klap-hotornot.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | cd `dirname $0`
4 |
5 | . ../klap-utils.sh
6 |
7 | for FILE in $(listFiles $@); do
8 | createTmpFile "\|hon_"
9 |
10 | isTmpFileEmpty
11 | if [ $? != 0 ]; then
12 | continue
13 | fi
14 |
15 | statHeader
16 |
17 | printStat "Rates Found" $(countMatches "using rate")
18 | printStat "Missing Rates" $(countMatches "no (results|rates)")
19 | printStat "Lookup Errors" $(countMatches "rate lookup error")
20 |
21 | zgrep -o "using rate definition .*$" $TMP_FILE | cut -c22- | sort | uniq -c | sort -nr | head | printTable "Most Frequent Rates"
22 | done
23 |
--------------------------------------------------------------------------------
/klap/analyzers/klap-jonny5.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | cd `dirname $0`
4 |
5 | . ../klap-utils.sh
6 |
7 | for FILE in $(listFiles $@); do
8 | createTmpFile "\|jonny5_|\|j5_"
9 |
10 | isTmpFileEmpty
11 | if [ $? != 0 ]; then
12 | continue
13 | fi
14 |
15 | statHeader
16 |
17 | printStat "Account Authorized Calls" $(egrep "account [A-Za-z0-9]+ authorized channel" $TMP_FILE | wc -l)
18 | printStat "Reseller Authorized Calls" $(egrep "reseller [A-Za-z0-9]+ authorized channel" $TMP_FILE | wc -l)
19 | printStat "Account Denied Calls" $(egrep "account [A-Za-z0-9]+ denied channel" $TMP_FILE | wc -l)
20 | printStat "Reseller Denied Calls" $(egrep "reseller [A-Za-z0-9]+ denied channel" $TMP_FILE | wc -l)
21 | printStat "Disabled Account Calls" $(egrep "account [A-Za-z0-9]+ is disabled" $TMP_FILE | wc -l)
22 | printStat "Disabled Limits Calls" $(countMatches "limits are disabled")
23 | printStat "Local Resources Processed" $(countMatches "authz_local_resources enabled")
24 | printStat "Accounts Found by IP" $(countMatches "found account auth'd by IP")
25 | printStat "Unknown Account IDs" $(countMatches "unable to determine account id")
26 | printStat "Emergency Exceptions" $(countMatches "allowing emergency call")
27 | printStat "Toll-free Exceptions" $(countMatches "allowing outbound tollfree call")
28 | printStat "Channel Disparities" $(countMatches "channel disparity with ecallmgr")
29 | done
30 |
--------------------------------------------------------------------------------
/klap/analyzers/klap-omnipresence.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | cd `dirname $0`
4 |
5 | . ../klap-utils.sh
6 |
7 | for FILE in $(listFiles $@); do
8 | createTmpFile "\|omnip_"
9 |
10 | isTmpFileEmpty
11 | if [ $? != 0 ]; then
12 | continue
13 | fi
14 |
15 | statHeader
16 |
17 | printStat "Updates" $(countMatches "ending update")
18 | printStat "Subscriptions" $(countMatches " subscribe ")
19 | printStat "Resubscriptions" $(countMatches " re-subscribe ")
20 | printStat "Subscription Miss" $(countMatches " no subscriptions ")
21 | printStat "Search Requests" $(countMatches "searching for subs for")
22 | done
23 |
--------------------------------------------------------------------------------
/klap/analyzers/klap-phone-numbers.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | cd `dirname $0`
4 |
5 | . ../klap-utils.sh
6 |
7 | for FILE in $(listFiles $@); do
8 | createExactTmpFile "\+1[2-9][0-9]{2}[2-9][0-9]{6}"
9 |
10 | isTmpFileEmpty
11 | if [ $? != 0 ]; then
12 | continue
13 | fi
14 |
15 | statHeader
16 |
17 | printStat "US Numbers" $(wc -l $TMP_FILE)
18 | printStat "Toll-Free Numbers" $(countMatches "\+1(800|888|877|866|855)[0-9]{7}")
19 | printStat "Toll Numbers" $(countMatches "\+1900[0-9]{7}")
20 | printStat "Caribbean" $(countMatches "\+1(684|264|268|242|246|441|284|345|767|809|829|849|473|671|876|664|670|787|939|869|758|784|721|868|649|340)[0-9]{7}")
21 | cat $TMP_FILE | sort | uniq -c | sort -nr 2> /dev/null | head | printTable "Most Frequent Numbers"
22 | done
23 |
--------------------------------------------------------------------------------
/klap/analyzers/klap-registrar.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | cd `dirname $0`
4 |
5 | . ../klap-utils.sh
6 |
7 | for FILE in $(listFiles $@); do
8 | createTmpFile "\|registrar_|\|reg_"
9 |
10 | isTmpFileEmpty
11 | if [ $? != 0 ]; then
12 | continue
13 | fi
14 |
15 | statHeader
16 |
17 | printStat "Authentication Reply" $(countMatches "SIP authentication reply")
18 | printStat "Authentication Error" $(countMatches "SIP authentication error")
19 | printStat "Disabled Credentials" $(countMatches "rejecting authn for disabled")
20 | printStat "Lookup By IP" $(countMatches "looking up IP")
21 | printStat "Ignored IP Realm" $(countMatches "realm is an IP address")
22 | printStat "Credential Lookup Errors" $(countMatches "failed to look up SIP")
23 | printStat "Route Request Replays" $(countMatches "route req was missing account information")
24 | printStat "Failed Route Request" $(countMatches "not replaying route req")
25 |
26 | zgrep "auth failure for" ${TMP_FILE} | rev | cut -d " " -f 2 | rev | sort 2> /dev/null | uniq -c | sort -rn 2> /dev/null | head | printTable "Top User Failures"
27 | zgrep "trying to authenticate" ${TMP_FILE} | rev | cut -d " " -f 1 | rev | sort 2> /dev/null | uniq -c | sort -rn 2> /dev/null | head | printTable "Top Requested Users"
28 | zgrep "trying to authenticate" ${TMP_FILE} | rev | cut -d " " -f 1 | cut -d "@" -f 1 | rev | sort 2> /dev/null | uniq -c | sort -rn 2> /dev/null | head | printTable "Top Realms"
29 | zgrep "trying to authenticate" $TMP_FILE | grep -Eo "^\w+ \w+ [0-9]+:[0-9]+" | uniq -c | sort -nr 2> /dev/null | head | printTable "Most Frequent Authentication Requests"
30 | done
31 |
--------------------------------------------------------------------------------
/klap/analyzers/klap-sysconf.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | cd `dirname $0`
4 |
5 | . ../klap-utils.sh
6 |
7 | for FILE in $(listFiles $@); do
8 | createTmpFile "\|sysconf_"
9 |
10 | isTmpFileEmpty
11 | if [ $? != 0 ]; then
12 | continue
13 | fi
14 |
15 | statHeader
16 |
17 | printStat "Gets" $(countMatches "received sysconf get ")
18 | printStat "Sets" $(countMatches "sysconf_set")
19 | done
20 |
--------------------------------------------------------------------------------
/klap/analyzers/klap-system.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | cd `dirname $0`
4 |
5 | . ../klap-utils.sh
6 |
7 | for FILE in $(listFiles $@); do
8 | createExactTmpFile "\|\w+:[0-9]+ \(<[0-9]+\.[0-9]+\.[0-9]+>\) "
9 |
10 | statHeader
11 |
12 | printStat "Unique PIDs" `cat $TMP_FILE | sort | uniq | wc -l`
13 | zgrep -Eo "<[0-9]+\.[0-9]+\.[0-9]+>" $TMP_FILE | sort 2> /dev/null | uniq -c | sort -nr 2> /dev/null | head | printTable "Most Frequent PIDs"
14 | zgrep -Eo "\|\w+:[0-9]+ " $TMP_FILE | cut -c2- | sort 2> /dev/null | uniq -c | sort -nr 2> /dev/null | head | printTable "Most Frequent Lines of Code"
15 | zgrep -Eo "^\w+ \w+ [0-9]+:[0-9]+" "${FILE}" | sort 2> /dev/null | uniq -c | sort -nr 2> /dev/null | head | printTable "Most Active Times"
16 | zgrep -Eo "2600hz\[[0-9]+\]" "${FILE}" | sort 2> /dev/null | uniq | printTable "OS Processes"
17 | done
18 |
--------------------------------------------------------------------------------
/klap/analyzers/klap-trunkstore.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | cd `dirname $0`
4 |
5 | . ../klap-utils.sh
6 |
7 | for FILE in $(listFiles $@); do
8 | createTmpFile "\|trunkstore_|\|ts_"
9 |
10 | isTmpFileEmpty
11 | if [ $? != 0 ]; then
12 | continue
13 | fi
14 |
15 | statHeader
16 |
17 | printStat "Offnet Requests" $(countMatches "call began from outside the network")
18 | printStat "Onnet Requests" $(countMatches "call began on the network")
19 | printStat "Non-trunkstore Route Requests" $(countMatches "insufficient information available to lookup routing, ignoring")
20 | done
21 |
--------------------------------------------------------------------------------
/klap/check.awk:
--------------------------------------------------------------------------------
1 | # zcat kazoo.log.gz | awk -f check.awk | sort -h
2 |
3 | BEGIN {
4 | format_str = "%-16s | %12s | %-32s | %s\n";
5 | printf(format_str, "ClientIP", "AuthType", "RequestId", "Request Payload")
6 | }
7 |
8 | # Get auth type and request id
9 | #{MONTH} {DAY} {H:M:S} {SRV} {SRV_PID}: |{REQUEST_ID}|api_resource:113({PID}) PUT: /v2/user_auth? from {IP}
10 | #$1 $2 $3 $4 $5: $6 $7 $8 $9 $10
11 | /^[^2].+PUT: .+_auth/ {
12 | split($6, request_id_arr, "|");
13 | request_id=request_id_arr[2];
14 |
15 | split($8, auth_type_arr, "/");
16 | auth_type=auth_type_arr[3];
17 |
18 | ip=$10
19 | }
20 |
21 | # when using precise timestamps
22 | # {TIMESTAMP} {HOST} {SRV_PID}: |{REQUEST_ID}|api_resource:113({PID}) PUT: /v2/user_auth? from {IP}
23 | # $1 $2 $3 $4 $5 $6 $7 $8
24 | /^2.+PUT: .+_auth/ {
25 | split($4, request_id_arr, "|");
26 | request_id=request_id_arr[2];
27 |
28 | split($6, auth_type_arr, "/");
29 | auth_type=auth_type_arr[3];
30 |
31 | ip=$8
32 | }
33 |
34 | # parse json payload line
35 | #{MONTH} {DAY} {H:M:S} {SRV} {SRV_PID}: |{REQUEST_ID}|api_util:587({PID}) request has a json payload: {"data":{"api_key":"{API_KEY}"}}
36 | #$1 $2 $3 $4 $5: $6 $7 $8 $9 $10 $11 $12
37 | /^[^2].+request has a json payload/ && request_id && match($6, request_id) > 0 && $auth_type {
38 | printf(format_str, ip, auth_type, request_id, $12);
39 | request_id=0
40 | }
41 |
42 | # {TIMESTAMP} {HOST} {SRV_PID}: |{REQUEST_ID}|api_util:587({PID}) request has a json payload: {REQUEST_JSON}}
43 | # $1 $2 $3 $4 $5 $6 $7 $8 $9 $10
44 | /^2.+request has a json payload/ && request_id && match($4, request_id) > 0 && $auth_type {
45 | printf(format_str, ip, auth_type, request_id, $10);
46 | request_id=0
47 | }
48 |
--------------------------------------------------------------------------------
/klap/klap-utils.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | # KLAP kazoo-log-analysis-program
4 |
5 | SCRIPTNAME="$(basename $0)"
6 | TMP_FILE="/tmp/stat-builder.tmp"
7 |
8 | printStat() {
9 | printf " %-25s: %s\n" "$1" "$2"
10 | }
11 |
12 | printTable() {
13 | echo " $1"
14 | while read LINE
15 | do
16 | KEY=`echo $LINE | cut -d ' ' -f 1`
17 | VALUE=`echo $LINE | cut -d ' ' -f 2-`
18 | if [ "$KEY" == "$VALUE" ]; then
19 | echo " $KEY"
20 | else
21 | printf " %-6s %s\n" "$KEY" "$VALUE"
22 | fi
23 | done
24 | }
25 |
26 | statHeader() {
27 | if [ $# -eq 0 ]; then
28 | local _FILE="$FILE"
29 | else
30 | local _FILE="$1"
31 | fi
32 |
33 | if [ -z "$AGGREGATE_STATS" ]; then
34 | echo "$_FILE"
35 | fileInfo "$_FILE"
36 | echo
37 | else
38 | local NAME="${SCRIPTNAME%.*}"
39 | local NAME="${NAME/klap-/}"
40 | echo
41 | echo " ${NAME^^}"
42 | fi
43 | }
44 |
45 | createTmpFile() {
46 | if [ $# -eq 1 ]; then
47 | local _FILE="$FILE"
48 | local _PATTERN="$1"
49 | else
50 | local _FILE="$1"
51 | local _PATTERN="$2"
52 | fi
53 |
54 | zgrep -E "$_PATTERN" "$_FILE" > "$TMP_FILE"
55 | }
56 |
57 | createExactTmpFile() {
58 | if [ $# -eq 1 ]; then
59 | local _FILE="$FILE"
60 | local _PATTERN="$1"
61 | else
62 | local _FILE="$1"
63 | local _PATTERN="$2"
64 | fi
65 |
66 | zgrep -Eo "$_PATTERN" "$_FILE" > "$TMP_FILE"
67 | }
68 |
69 | isTmpFileEmpty() {
70 | if [ -s "$TMP_FILE" ]; then
71 | return 0;
72 | else
73 | return 1
74 | fi
75 | }
76 |
77 | countMatches() {
78 | echo `zgrep -Ec "$1" "$TMP_FILE"`
79 | }
80 |
81 | fileInfo() {
82 | if [ "${1##*.}" = "gz" ]; then
83 | START_TIMEDATE=`zcat $1 | head -n 1 | grep -Po "^\w+\s+\d+\s+\d+:\d+:\d+"`
84 | END_TIMEDATE=`zcat $1 | tail -1 | grep -Po "^\w+\s+\d+\s+\d+:\d+:\d+"`
85 | else
86 | START_TIMEDATE=`cat $1 | head -n 1 | grep -Po "^\w+\s+\d+\s+\d+:\d+:\d+"`
87 | END_TIMEDATE=`cat $1 | tail -1 | grep -Po "^\w+\s+\d+\s+\d+:\d+:\d+"`
88 | fi
89 |
90 | START_EPOCH=`date -d "$START_TIMEDATE" "+%s"`
91 | END_EPOCH=`date -d "$END_TIMEDATE" "+%s"`
92 | DURATION=$(expr $END_EPOCH - $START_EPOCH)
93 |
94 | printStat 'Start' "$START_TIMEDATE"
95 | printStat 'End' "$END_TIMEDATE"
96 | printStat 'Duration' "${DURATION}s"
97 | }
98 |
99 | listFiles() {
100 | echo `printf "%s\n" $@ | sort -V`
101 | }
102 |
--------------------------------------------------------------------------------
/klap/stats.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | cd `dirname $0`
4 |
5 | export AGGREGATE_STATS=1
6 |
7 | . ./klap-utils.sh
8 |
9 | for FILE in $(listFiles $@); do
10 | echo $FILE
11 | fileInfo "$FILE"
12 | for ANALYZER in analyzers/klap-*; do
13 | ./$ANALYZER $FILE
14 | done
15 | echo
16 | done
17 |
--------------------------------------------------------------------------------
/management-proxy/README.md:
--------------------------------------------------------------------------------
1 | # Management Proxy
2 |
3 | Access Kazoo's management tools from one site:
4 |
5 | CouchDB's Fauxton, RabbitMQ's management plugin and HAProxy's status page.
6 |
7 |
8 | ## \-\-\-\-\- Installation \-\-\-\-\-
9 |
10 | #### Install
11 | ```bash
12 | cd management-proxy
13 | chmod +x install-management-proxy.sh
14 | sudo ./install-management-proxy.sh
15 | ```
16 | #### Test
17 | ```bash
18 | lynx https://localhost:443
19 | ```
20 | The installer works on Debian, RedHat/CentOS and Solaris.
21 |
22 | For other distros/OSs, you will have to manually install Nginx, then run the script.
23 |
24 |
25 | ## \-\-\-\-\- Notes \-\-\-\-\-
26 |
27 | You can also access management tools which reside on separate servers.
28 |
29 | For instance, if CouchDB is hosted on a different server, change line:
30 |
31 | `proxy_pass http://127.0.0.1:5984/$1;`
32 |
33 | to
34 |
35 | `proxy_pass http://COUCHDB-IP-ADDRESS:5984/$1;`
36 |
37 |
38 | ## \-\-\-\-\- Security \-\-\-\-\-
39 |
40 | The proxy is configured to listen to port 443 on all interfaces using IPv4 and IPv6.
41 |
42 | The golden rule of security is **"If you don't use it, disable it"**.
43 |
44 | We suggest limiting the proxy to localhost:443 and using an SSH-tunnel to access the management page.
45 |
46 | If you must expose the proxy to the public Internet, add password protection to the config file.
47 |
48 | We advise against relying solely on firewall rules.
49 |
50 |
51 |
52 |
53 | Sponsored by GBC Networks Oy (http://gbc.fi)
54 |
--------------------------------------------------------------------------------
/management-proxy/index-management.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Kazoo WEB Applications
5 |
12 |
13 |
14 | Welcome to Kazoo
Internal WEB Applications
15 |
16 |
17 | Fauxton is the new Web UI for CouchDB.
18 |
19 | CouchDB Fauxton
20 |
21 |
22 | The rabbitmq-management plugin provides an HTTP-based API for management
23 | and monitoring of your RabbitMQ server.
24 |
25 | RabbitMQ management plugin
26 |
27 |
28 | The HAProxy stats page reports some useful status information along with the statistics.
29 |
30 | HAProxy stats page
31 |
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/management-proxy/management-proxy.conf:
--------------------------------------------------------------------------------
1 | ##
2 | ## Management Proxy - server configuration
3 | ##
4 |
5 | ## Sponsored by GBC Networks Oy (http://gbc.fi)
6 |
7 |
8 | server {
9 | # SSL configuration
10 | listen 443 ssl default_server;
11 | listen [::]:443 ssl default_server;
12 |
13 | #
14 | # Self signed certs
15 | #
16 | ssl_certificate /etc/nginx/conf.d/management-proxy.crt;
17 | ssl_certificate_key /etc/nginx/conf.d/management-proxy.key;
18 |
19 | root /var/www/html;
20 | index index-management.html;
21 | server_name _;
22 |
23 | # First attempt to serve index file
24 | location ~ "^/$" {
25 | alias /var/www/html/;
26 | }
27 | location ~ "^/index.html$" {
28 | alias /var/www/html/index-management.html;
29 | }
30 | location ~ "^/index-management.html$" {
31 | alias /var/www/html/index-management.html;
32 | }
33 |
34 | # proxy internal applications
35 | location ^~ "/rabbitmq/" {
36 | proxy_pass http://127.0.0.1:15672/;
37 | }
38 | location ^~ "/haproxy-stats/" {
39 | proxy_pass http://127.0.0.1:22002/;
40 | }
41 |
42 | # Everything else goes to CouchDB Fauxton
43 | location ~ "^/(.*)$" {
44 | proxy_pass http://127.0.0.1:5984/$1;
45 | }
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/management-proxy/openssl-management-proxy.cnf:
--------------------------------------------------------------------------------
1 | #
2 | # OpenSSL configuration file for Kazoo Management Proxy
3 | #
4 |
5 | HOME = .
6 | RANDFILE = $ENV::HOME/.rnd
7 | oid_section = new_oids
8 |
9 | [ new_oids ]
10 | tsa_policy1 = 1.2.3.4.1
11 | tsa_policy2 = 1.2.3.4.5.6
12 | tsa_policy3 = 1.2.3.4.5.7
13 |
14 | [ ca ]
15 |
16 | [ CA_default ]
17 | policy = policy_match
18 |
19 | [ policy_match ]
20 | countryName = match
21 | stateOrProvinceName = match
22 | organizationName = match
23 | organizationalUnitName = optional
24 | commonName = supplied
25 | emailAddress = optional
26 |
27 | [ policy_anything ]
28 | countryName = optional
29 | stateOrProvinceName = optional
30 | localityName = optional
31 | organizationName = optional
32 | organizationalUnitName = optional
33 | commonName = supplied
34 | emailAddress = optional
35 |
36 | [ req ]
37 | default_bits = 4096
38 | default_keyfile = privkey.pem
39 | distinguished_name = req_distinguished_name
40 | attributes = req_attributes
41 | string_mask = utf8only
42 |
43 | [ req_distinguished_name ]
44 | countryName = Country Name (2 letter code)
45 | countryName_default = wo
46 | countryName_min = 2
47 | countryName_max = 2
48 | stateOrProvinceName = State or Province Name (full name)
49 | localityName = Locality Name (eg, city)
50 | 0.organizationName = Organization Name (eg, company)
51 | 0.organizationName_default = Kazoo Management Proxy
52 | organizationalUnitName = Organizational Unit Name (eg, section)
53 | organizationalUnitName_default = Kazoo Server
54 | commonName = Common Name (e.g. server FQDN or YOUR name)
55 | commonName_max = 64
56 | commonName_default = localhost
57 | emailAddress = Email Address
58 | emailAddress_max = 64
59 | emailAddress_default = root@localhost
60 |
61 | [ req_attributes ]
62 | challengePassword = A challenge password
63 | challengePassword_min = 4
64 | challengePassword_max = 20
65 | unstructuredName = An optional company name
66 |
67 | [ usr_cert ]
68 | basicConstraints=CA:FALSE
69 | nsComment = "OpenSSL Generated Certificate"
70 | subjectKeyIdentifier=hash
71 | authorityKeyIdentifier=keyid,issuer
72 |
73 | [ v3_req ]
74 | basicConstraints = CA:FALSE
75 | keyUsage = nonRepudiation, digitalSignature, keyEncipherment
76 |
77 | [ v3_ca ]
78 | subjectKeyIdentifier=hash
79 | authorityKeyIdentifier=keyid:always,issuer
80 | basicConstraints = CA:true
81 |
82 | [ crl_ext ]
83 | authorityKeyIdentifier=keyid:always
84 |
85 | [ proxy_cert_ext ]
86 | basicConstraints=CA:FALSE
87 | nsComment = "OpenSSL Generated Certificate"
88 | subjectKeyIdentifier=hash
89 | authorityKeyIdentifier=keyid,issuer
90 | proxyCertInfo=critical,language:id-ppl-anyLanguage,pathlen:3,policy:foo
91 |
--------------------------------------------------------------------------------
/pivot-script/dial.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | The redirect was successfully done
4 | I will now call the 415-676-0469
5 | Please call the 2002 if you want to test the reject
6 | 415-676-0469
7 |
8 |
--------------------------------------------------------------------------------
/pivot-script/gather.php:
--------------------------------------------------------------------------------
1 | \n";
5 | echo "";
6 | echo "You entered " . $_REQUEST['Digits'] . "";
7 | echo "I will now play a short song";
8 | echo "http://a.tumblr.com/tumblr_m0p8z5YLEb1r23p09o1.mp3";
9 | echo "/dial.xml";
10 | echo "The redirection failed";
11 | echo "";
12 | ?>
13 |
--------------------------------------------------------------------------------
/pivot-script/reject.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
--------------------------------------------------------------------------------
/pivot-script/say.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Please enter your account number,
6 | followed by the pound sign
7 |
8 |
9 | We didn't receive any input. Goodbye!
10 |
11 |
--------------------------------------------------------------------------------
/simple-installer/README.md:
--------------------------------------------------------------------------------
1 | # community-scripts
2 | =================
3 |
4 | Public Scripts from the 2600hz Community
5 |
6 | ## simple-installer
7 |
8 | * Simple-installer for installing the stable, staging or latest version of Kazoo on centos 6.5.
9 | * This is the same script packaged into the ISO.
10 |
11 |
12 | ### How To install:
13 | * get all the files from the repo and place them in /opt/kazoo_install
14 | * run
15 | ```bash
16 | chmod +x /opt/kazoo_install/setup*
17 | chmod +x /opt/kazoo_install/install*
18 | ```
19 | * to start the install run
20 | ```bash
21 | ./install_kazoo
22 | ```
23 |
24 | _NOTE_: This is a network based installer, so you should verify your internet connectivity is working prior to installing.
25 |
26 |
27 | ### Scripts:
28 | The installer breaks functionality up into seperate scripts. The installer script will install the packages selected by the user. Then setup scripts are executed based on package selection to configure each of the services that were installed. In all in one mode, the server will setup all the packages using the all in one defaults.
29 |
30 | #### Install Scripts:
31 | **install_kazoo** - Installs the RPM packages for kazoo based on user package selection and then calls setup_packages.
32 |
33 | **setup_packages** - Dispatches to setup scripts for every package specified in command line args.
34 |
35 | **setup_freeswitch** - FreeSWITCH setup script.
36 |
37 | **setup_kazoo** - Kazoo setup script.
38 |
39 | **setup_rabbitmq** - RabbitMQ setup script.
40 |
41 | **setup_monster-ui** - Monster-UI setup script.
42 |
43 | **setup_kamailio** - Kamaiio setup script.
44 |
45 | **setup_bigcouch** - BigCouch setup script.
46 |
47 | **setup_haproxy** - HaProxy setup script.
48 |
49 | **setup_common** - a bash function "library" to provide all the commonly used functions in the setup scripts.
50 |
51 | #### Other scripts:
52 | **onboot_kazoo** - Script used to check if the IP_ADDRESS value in /etc/kazoo/kazoo_boot.conf matches the systems IP address.
53 |
54 | **get_ip_address** - Script used for selecting IP address on boot if onboot_kazoo is unable to automatically determine which IP address to set if system IP was changed. This script is called on login via the root users .bashrc so the user is prompted to change the kazoo IP addresses.
55 |
56 | **kazoo_motd** - Script that generates a dynamic motd which includes some nice details about the kazoo system.
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/simple-installer/get_ip_address:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | set -e
3 | set -o nounset
4 |
5 | #logfile
6 | install_log="/var/log/kazoo_install.log"
7 |
8 | #lock_file MUST BE DEFINED!
9 | lockfile="/var/lock/subsys/ask_ip_address.lockfile"
10 |
11 | . /opt/kazoo_install/setup_common
12 |
13 | trap error_exit SIGHUP SIGTERM ERR EXIT
14 | trap int_exit SIGINT SIGQUIT
15 |
16 | ip_address=""; check_info_file
17 | system_ip_address=""; ask_ip_selection
18 |
19 | set_info_file
20 |
21 | #run setup package for this to set the right IPs/restat the right services
22 | /opt/kazoo_install/setup_packages -a -i kamailio -i monster-ui
23 |
24 | #remove this
25 | sed -i "s|get_ip_address||" /root/.bash_profile
26 | #exit and clear lock
27 | clean_exit
28 |
--------------------------------------------------------------------------------
/simple-installer/kazoo_motd:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | #print formatting
4 | green='\e[0;32m'
5 | red='\e[0;31m'
6 | yellow='\e[0;33m'
7 | NC='\e[0m'
8 | blue='\e[0;36m'
9 |
10 | [ -e /etc/kazoo/VERSION ] && kazoo_version=$(> /etc/motd
23 | }
24 |
25 |
26 | >/etc/motd
27 |
28 |
29 | write "${blue}"
30 | write ' __ '
31 | write ' / /______ _____ ____ ____ ________ ______ _____ _____'
32 | write ' / //_/ __ `/_ / / __ \/ __ \ / ___/ _ \/ ___/ | / / _ \/ ___/'
33 | write ' / ,< / /_/ / / /_/ /_/ / /_/ / (__ ) __/ / | |/ / __/ / '
34 | write '/_/|_|\__,_/ /___/\____/\____/ /____/\___/_/ |___/\___/_/ '
35 | write "${NC}"
36 | write ""
37 | write "Server Information"
38 | write ------------------------------------------------------------
39 | write "Hostname: ${green}`uname -n`${NC} "
40 | write " OS: ${green}`cat /etc/redhat-release`${NC} "
41 | write " "
42 | write "System IP addresses: "
43 | write "------------------------------------------------------------"
44 | write "${green}`ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{print " IP Address = "$1}'`${NC}"
45 | write ""
46 | write "Kazoo Information "
47 | write "------------------------------------------------------------"
48 | [[ $kazoo_version ]] && write " Version: ${green}$kazoo_version${NC} "
49 | [[ $ip_address ]] && write " WebServer: ${green}http://${ip_address}/monster-ui${NC} "
50 | [[ $admin_account ]] && write " Account: ${green}${admin_account}${NC} "
51 | [[ $admin_realm ]] && write " Sip Realm: ${green}${admin_realm}${NC} "
52 | write ${NC}
53 |
--------------------------------------------------------------------------------
/simple-installer/onboot_kazoo:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | set -e
4 | set -o nounset
5 |
6 | lockfile="/var/lock/subsys/check_interfaces.lockfile"
7 |
8 | . /opt/kazoo_install/setup_common
9 |
10 | trap clean_exit SIGHUP SIGTERM ERR EXIT
11 | trap int_exit SIGINT SIGQUIT
12 |
13 | log_file=/var/log/check_interfaces.log
14 |
15 | datestamp=$(date +"%F %T")
16 |
17 |
18 | info " : Setting up kazoo on-boot addresses : "
19 |
20 | dbg " Kazoo IP Configuration "
21 |
22 | check_root
23 | check_lock
24 |
25 | ip_address=""; check_info_file
26 |
27 | declare -a ip_addresses
28 | declare -a interfaces
29 |
30 | get_interfaces
31 | get_system_ip
32 |
33 | ip_match=""
34 | for ip_system in ${ip_addresses[@]}; do
35 | if [[ "${ip_system:-}" == "$ip_address" ]];then
36 | info "system IP address matches configured kazoo IP: $ip_address"
37 | ip_match=1
38 | fi
39 | done
40 |
41 | if ! [[ ${ip_match:-} ]];then
42 | if [[ ${#ip_addresses[@]:-} -eq 1 ]];then
43 | system_ip_address=${ip_addresses[0]}
44 | info "configuring IP address to ${system_ip_address}"
45 | set_info_file
46 | /opt/kazoo_install/setup_packages -a -i kamailio -i monster-ui
47 | sup crossbar_maintenance init_apps '/var/www/html/monster-ui/apps' "http://${system_ip_address}:8000/v2"
48 | else
49 | echo 'get_ip_address' >> /root/.bash_profile
50 | fi
51 | fi
52 |
53 |
54 |
55 | clean_exit $lockfile
56 |
57 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/simple-installer/setup_kazoo:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | set -e
4 | set -o nounset
5 |
6 | lockfile="/var/lock/subsys/setup_kazoo.lockfile"
7 |
8 | . /opt/kazoo_install/setup_common
9 |
10 | trap clean_exit SIGHUP SIGTERM ERR EXIT
11 | trap int_exit SIGINT SIGQUIT
12 |
13 |
14 | kazoo_config="/etc/kazoo/config.ini"
15 |
16 | #KAZOO COOKIE
17 | cookie=""
18 | cookie_dbg="setting $kazoo_config - setcookie = TOKEN"
19 | cookie_cmd="sed -i 's|cookie = .*|cookie = TOKEN|' $kazoo_config"
20 | cookie_question="Please enter your erlang cookie (string): "
21 | cookie_re=".*"
22 | cookie_hint="Cookie should be longish, like 32 chars at least"
23 | cookie_ref="ip_address"
24 |
25 | #KAZOO IP
26 | ip_address=""
27 | ip_address_dbg="setting $kazoo_config - ip = \"TOKEN\""
28 | ip_address_cmd="sed -i 's|ip = .*|ip = \"TOKEN\"|' $kazoo_config"
29 | ip_address_question="What IP should we use for kazoo to talk to bigcouch (normally: 127.0.0.1)?: "
30 | ip_address_re="$ip_address_regex"
31 | ip_address_hint="This is generally the haProxy ip address which is normally available via localhost"
32 | ip_address_ref="ip_address"
33 |
34 | ####KAZOO AMQP CONFIG
35 | amqp_string=""
36 | amqp_string_dbg="setting amqp config in $kazoo_config - TOKEN"
37 | amqp_string_cmd="sed -i 's|\"amqp://.*\"|\"amqp://TOKEN\"|' $kazoo_config"
38 |
39 | #AMQP IP
40 | amqp_ip=""
41 | amqp_ip_question="What is your AMQP server IP address"
42 | amqp_ip_re="$ip_address_regex"
43 | amqp_ip_hint="This is the ip address of your rabbitmq server?"
44 | amqp_ip_ref="amqp_ip"
45 |
46 |
47 | ask_amqp_config(){
48 | ask amqp_ip
49 | amqp_string="guest:guest@${amqp_ip}:5672"
50 | }
51 |
52 | interactive(){
53 | ask_amqp_config
54 | ask ip_address
55 | }
56 |
57 | info " : Configuring Kazoo : "
58 | check_root
59 | check_lock
60 | get_default_cookie
61 |
62 | if [ ${default_cookie:-} ];then
63 | cookie="$default_cookie"
64 | else
65 | ask cookie
66 | set_cookie_file $cookie
67 | fi
68 |
69 |
70 | set_value cookie $default_cookie
71 |
72 | if [[ ${1:-} =~ -a ]];then
73 | all_in_one=1
74 | fi
75 |
76 | if [ ${all_in_one:-} ];then
77 | #if allinone we default everything we can
78 | amqp_string="guest:guest@127.0.0.1:5672"
79 | ip_address="127.0.0.1"
80 | else
81 | info "NOTE: You can type '${NC}?${blue}' in response to any question for a hint"
82 | interactive
83 | fi
84 |
85 | dbg "Applying Kazoo configuration..."
86 |
87 | set_value amqp_string $amqp_string
88 | set_value cookie $cookie
89 | set_value ip_address $ip_address
90 |
91 | clean_exit $lockfile
92 |
93 |
94 |
95 |
96 |
--------------------------------------------------------------------------------
/simple-installer/setup_monster-ui:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | set -e
4 | set -o nounset
5 |
6 | lockfile="/var/lock/subsys/setup_monster-ui.lockfile"
7 | . /opt/kazoo_install/setup_common
8 |
9 | trap clean_exit SIGHUP SIGTERM ERR EXIT
10 | trap int_exit SIGINT SIGQUIT
11 |
12 | kazoo_ui_conf_js="/var/www/html/monster-ui/js/config.js"
13 |
14 | #KAZOO-UI URL
15 | url=""
16 | url_dbg="setting Monster-UI URL address for accessing API - TOKEN"
17 | url_cmd="sed -i \"s|default: .*/v2|default: 'TOKEN/v2|g\" $kazoo_ui_conf_js"
18 | url_question="Please enter your api url (EXAMPLE: http://10.0.0.1:8000): "
19 | url_re="$url_regex"
20 | url_hint="Full URL for api, this IP should be the same as your kazoo server"
21 | url_ref="url"
22 |
23 | interactive() {
24 | ask url
25 | }
26 |
27 | info " : Configuring Monster-UI : "
28 | check_root
29 | check_lock
30 |
31 | check_ip || ask_ip_selection
32 |
33 | if [[ ${1:-} =~ -a ]];then
34 | all_in_one=1
35 | fi
36 |
37 | if [ ${all_in_one:-} ];then
38 | #if allinone we default everything we can
39 | url="http://${system_ip_address}:8000"
40 | #Create blank index.html file to redirect traffic to the UI when you go to your server IP.
41 | echo "" >> /var/www/html/index.html
42 | else
43 | info "NOTE: You can type '${NC}?${blue}' as a response to any question for a hint!"
44 | interactive
45 | fi
46 |
47 | dbg "Applying Monster-UI configuration..."
48 |
49 | set_value url $url
50 |
51 | clean_exit
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/simple-installer/setup_rabbitmq:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | set -e
4 | set -o nounset
5 |
6 | #logfile
7 | #lock_file
8 | lockfile="/var/lock/subsys/setup_rabbitmq.lockfile"
9 |
10 | #Files to edit
11 | rabbitmq_env_conf="/etc/kazoo/rabbitmq/rabbitmq-env.conf"
12 |
13 | . /opt/kazoo_install/setup_common
14 | trap error_exit SIGHUP SIGTERM ERR EXIT
15 | trap int_exit SIGINT SIGQUIT
16 |
17 | #Rabbit IP ADDRESS
18 | ip_address=""
19 | ip_address_dbg="setting $rabbitmq_env_conf - = TOKEN"
20 | ip_address_cmd="sed -i 's|NODE_IP_ADDRESS=.*|NODE_IP_ADDRESS=TOKEN|' $rabbitmq_env_conf"
21 | ip_address_question="Please enter the IP address that rabbitmq-server should use for listening: "
22 | ip_address_re="$ip_address_regex"
23 | ip_address_hint="This is typically 0.0.0.0 to listen on all IP addresses"
24 | ip_address_ref="ip_address"
25 |
26 | interactive(){
27 | ask ip_address
28 | }
29 |
30 | info " : Configuring RabbitMQ : "
31 |
32 | check_root
33 | check_lock
34 |
35 | if [[ ${1:-} =~ -a ]];then
36 | all_in_one=1
37 | fi
38 |
39 | if [ ${all_in_one:-} ];then
40 | #if allinone we default everything!
41 | ip_address="0.0.0.0"
42 | else
43 | info "NOTE: You can type '${NC}?${blue}' in response to any question for a hint"
44 | interactive
45 | fi
46 |
47 | dbg "Applying rabbitmq configuration..."
48 |
49 |
50 | set_value ip_address $ip_address
51 |
52 | clean_exit
53 |
--------------------------------------------------------------------------------
/simple-installer/uninstall_kazoo_all_in_one.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | #quick and dirty unintsall script.
4 |
5 |
6 |
7 | echo "Are you sure you want to stop all serveices and remove the kazoo packages and files? [y|n]"
8 | read $question answer
9 | if ! [[ $answer =~ [yY] ]];then
10 | echo "Whew, scared me. Goodbye!"
11 | exit;
12 | fi
13 |
14 | echo "Stopping Services"
15 |
16 | service kz-whistle_apps stop
17 | service kz-ecallmgr stop
18 | service haproxy stop
19 | service freeswitch stop
20 | service bigcouch stop
21 | service rabbitmq-server stop
22 | service kamailio stop
23 | service httpd stop
24 |
25 | echo "Removing Packages"
26 |
27 | yum remove kazoo-configs kazoo-bigcouch haproxy kazoo-R15B kazoo-prompts kazoo-freeswitch-R15B kazoo-ui httpd kazoo-librabbitmq monster-ui*
28 |
29 | echo "removing old directories"
30 |
31 | rm -rf /etc/kazoo
32 | rm -rf /etc/haproxy
33 | rm -rf /srv
34 | rm -rf /var/log/kamailio
35 | rm -rf /var/log/httpd
36 | rm -rf /var/log/freeswitch
37 | rm -rf /var/log/haproxy.log
38 | rm -rf /var/log/2600hz-platform.log
39 | rm -rf /var/log/bigcouch
40 | rm /var/log/kazoo_install.log
41 | rm -rf /etc/httpd
42 | rm -rf /var/lib/rabbitmq
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/sipp/call_with_auth.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | cd `dirname $0`
3 | sipp -inf users.csv -sf uac_auth.xml -r 1 -l 1 -d 500 -s *97 -i 192.168.5.42 192.168.5.151
4 |
--------------------------------------------------------------------------------
/sipp/device-simulators/callees.csv:
--------------------------------------------------------------------------------
1 | SEQUENTIAL
2 | device_BTZMR1cGEA;zZNy.admin;[authentication username=device_BTZMR1cGEA password=e9XHZmAKwN]
3 |
--------------------------------------------------------------------------------
/sipp/device-simulators/callers.csv:
--------------------------------------------------------------------------------
1 | SEQUENTIAL
2 | device_J5hehPXTu8;zZNy.admin;[authentication username=device_J5hehPXTu8 password=leWYVN2rhr]
3 |
4 |
--------------------------------------------------------------------------------
/sipp/device-simulators/g711a_2.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2600hz/community-scripts/cc0d0106eaaf066b85cc42fccbd5b774af001310/sipp/device-simulators/g711a_2.pcap
--------------------------------------------------------------------------------
/sipp/device-simulators/register.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | cd `dirname $0`
3 |
4 | if [ -z "$1" ]; then
5 | echo "$0 [interface-ip]"
6 | exit 1
7 | fi
8 |
9 | TARGET="$1"
10 | shift
11 |
12 | if [ -z "$1" ]; then
13 | INTERFACE="${TARGET}"
14 | else
15 | INTERFACE="$1"
16 | shift
17 | fi
18 |
19 | echo "# sipp -inf callees.csv -sf register.xml -m 1 -l 1 -r 1 -d 1000 -s 5000 -i ${INTERFACE} -p 7653 ${TARGET} $@"
20 | sipp -inf callees.csv -sf register.xml -m 1 -l 1 -r 1 -d 1000 -s 5000 -i ${INTERFACE} -p 7653 ${TARGET} $@
21 |
--------------------------------------------------------------------------------
/sipp/device-simulators/register.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | ;tag=[call_number]
11 | To:
12 | Call-ID: [call_id]
13 | CSeq: 1 REGISTER
14 | Contact: sip:[field0]@[local_ip]:[local_port]
15 | Max-Forwards: 5
16 | Expires: 60
17 | User-Agent: SIPp
18 | Content-Length: 0
19 |
20 | ]]>
21 |
22 |
23 |
24 |
25 |
26 |
27 | ;tag=[call_number]
32 | To:
33 | Call-ID: [call_id]
34 | CSeq: 2 REGISTER
35 | Contact: sip:[field0]@[local_ip]:[local_port]
36 | [field2]
37 | Max-Forwards: 5
38 | Expires: 60
39 | User-Agent: SIPp
40 | Content-Length: 0
41 |
42 | ]]>
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/sipp/device-simulators/uac.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | cd `dirname $0`
3 |
4 | if [ -z "$1" -o -z "$2" ]; then
5 | echo "$0 [interface-ip]"
6 | exit 1
7 | fi
8 |
9 | TARGET="$1"
10 | shift
11 | NUMBER="$1"
12 | shift
13 |
14 | if [ -z "$1" ]; then
15 | INTERFACE="${TARGET}"
16 | else
17 | INTERFACE="$1"
18 | shift
19 | fi
20 |
21 |
22 | echo "# sipp -inf callers.csv -sf uac.xml -i ${INTERFACE} -p 7653 ${TARGET} -s ${NUMBER} -d 15000 $@"
23 | sipp -inf callers.csv -sf uac.xml -i ${INTERFACE} -p 7653 ${TARGET} -s ${NUMBER} -d 15000 $@
24 |
--------------------------------------------------------------------------------
/sipp/device-simulators/uas.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | cd `dirname $0`
3 |
4 | if [ -z "$1" ]; then
5 | echo "$0 [interface-ip]"
6 | exit 1
7 | fi
8 |
9 | TARGET="$1"
10 | shift
11 |
12 | if [ -z "$1" ]; then
13 | INTERFACE="${TARGET}"
14 | else
15 | INTERFACE="$1"
16 | shift
17 | fi
18 |
19 | echo "# sipp -inf callees.csv -sf uas.xml -i ${INTERFACE} -p 7653 ${TARGET} $@"
20 | sipp -inf callees.csv -sf uas.xml -i ${INTERFACE} -p 7653 ${TARGET} $@
21 |
--------------------------------------------------------------------------------
/sipp/device-simulators/uas.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
18 | Content-Length: 0
19 |
20 | ]]>
21 |
22 |
23 |
24 |
33 | Content-Type: application/sdp
34 | Content-Length: [len]
35 |
36 | v=0
37 | o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
38 | s=-
39 | c=IN IP[media_ip_type] [media_ip]
40 | t=0 0
41 | m=audio [media_port] RTP/AVP 0 101
42 | a=rtpmap:0 PCMU/8000
43 | a=rtpmap:101 telephone-event/8000
44 | a=fmtp:101 0-16
45 |
46 | ]]>
47 |
48 |
49 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
73 | Content-Length: 0
74 |
75 | ]]>
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
--------------------------------------------------------------------------------
/sipp/g711a_2.pcap:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/2600hz/community-scripts/cc0d0106eaaf066b85cc42fccbd5b774af001310/sipp/g711a_2.pcap
--------------------------------------------------------------------------------
/sipp/leave_vm.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | cd `dirname $0`
3 | sipp -inf users.csv -sf uac_auth_audio.xml -r 1 -d 5000 -s 5000 -i 192.168.5.42 192.168.5.151
4 |
--------------------------------------------------------------------------------
/sipp/register.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | cd `dirname $0`
3 | sipp -inf users.csv -sf register.xml -d 1000 -s 5000 -i 192.168.5.42 192.168.5.151
4 |
--------------------------------------------------------------------------------
/sipp/register.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | ;tag=[call_number]
11 | To:
12 | Call-ID: [call_id]
13 | CSeq: 1 REGISTER
14 | Contact: sip:[field0]@[local_ip]:[local_port]
15 | Max-Forwards: 5
16 | Expires: 60
17 | User-Agent: SIPp
18 | Content-Length: 0
19 |
20 | ]]>
21 |
22 |
23 |
24 |
25 |
26 |
27 | ;tag=[call_number]
32 | To:
33 | Call-ID: [call_id]
34 | CSeq: 2 REGISTER
35 | Contact: sip:[field0]@[local_ip]:[local_port]
36 | [field2]
37 | Max-Forwards: 5
38 | Expires: 60
39 | User-Agent: SIPp
40 | Content-Length: 0
41 |
42 | ]]>
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/sipp/test_ecallmgr.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | echo -n "Starting ecallmgr..."
4 |
5 | /opt/whistle/whistle/ecallmgr/start-dev.sh &
6 |
7 | echo "done"
8 |
9 | sleep 6
10 |
11 | echo -n "Stopping ecallmgr..."
12 |
13 | kill %1
14 |
15 | echo "done"
16 |
17 | ./$0 &
18 |
--------------------------------------------------------------------------------
/sipp/uac-alt.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | ;tag=[call_number]
10 | To:
11 | Call-ID: [call_id]
12 | CSeq: 1 INVITE
13 | Contact:
14 | Content-Type: application/sdp
15 | Allow: INVITE, ACK, BYE, CANCEL
16 | Max-Forwards: 70
17 | User-Agent: SIPp
18 | Content-Length: [len]
19 |
20 | v=0
21 | o=- 20102 20102 IN IP[local_ip_type] [local_ip]
22 | s=SDP data
23 | c=IN IP[media_ip_type] [media_ip]
24 | t=0 0
25 | m=audio [media_port] RTP/AVP 0 8 18 9 101
26 | a=rtpmap:0 PCMU/8000
27 | a=rtpmap:8 PCMA/8000
28 | a=rtpmap:18 G729/8000
29 | a=fmtp:18 annexb=no
30 | a=rtpmap:9 G722/8000
31 | a=fmtp:101 0-15
32 | a=rtpmap:101 telephone-event/8000
33 | a=ptime:20
34 | a=sendrecv
35 | ]]>
36 |
37 |
38 |
39 |
40 |
55 |
56 |
57 |
58 |
59 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
--------------------------------------------------------------------------------
/sipp/uac-hangup.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | ;tag=[call_number]
10 | To:
11 | Call-ID: [call_id]
12 | CSeq: 1 INVITE
13 | Contact:
14 | Content-Type: application/sdp
15 | Allow: INVITE, ACK, BYE, CANCEL
16 | Max-Forwards: 70
17 | User-Agent: SIPp
18 | Content-Length: [len]
19 |
20 | v=0
21 | o=- 20102 20102 IN IP[local_ip_type] [local_ip]
22 | s=SDP data
23 | c=IN IP[media_ip_type] [media_ip]
24 | t=0 0
25 | m=audio [media_port] RTP/AVP 0 8 18 9 101
26 | a=rtpmap:0 PCMU/8000
27 | a=rtpmap:8 PCMA/8000
28 | a=rtpmap:18 G729/8000
29 | a=fmtp:18 annexb=no
30 | a=rtpmap:9 G722/8000
31 | a=fmtp:101 0-15
32 | a=rtpmap:101 telephone-event/8000
33 | a=ptime:20
34 | a=sendrecv
35 | ]]>
36 |
37 |
38 |
39 |
40 |
55 |
56 |
57 |
58 |
59 |
60 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
--------------------------------------------------------------------------------
/sipp/uas-alt.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
20 |
21 |
22 |
23 |
33 | Allow: INVITE, ACK, BYE, CANCEL
34 | User-Agent: SIPp
35 | Content-Type: application/sdp
36 | Content-Length: [len]
37 |
38 | v=0
39 | o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
40 | s=-
41 | c=IN IP[media_ip_type] [media_ip]
42 | t=0 0
43 | m=audio [media_port] RTP/AVP 0 101 13
44 | a=rtpmap:0 PCMU/8000/3
45 | a=rtpmap:101 telephone-event/8000
46 | a=fmtp:101 0-16
47 | a=rtpmap:13 CN/8000
48 | a=ptime:20
49 |
50 | ]]>
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
--------------------------------------------------------------------------------
/sipp/users.csv:
--------------------------------------------------------------------------------
1 | SEQUENTIAL
2 | user_101;sipp.2600hz.com;[authentication username=user_101 password=pwd_101]
3 | user_102;sipp.2600hz.com;[authentication username=user_102 password=pwd_102]
4 | user_103;sipp.2600hz.com;[authentication username=user_103 password=pwd_103]
5 |
--------------------------------------------------------------------------------