This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# An awesome tool to dump a couch database - mysqldump style! | |
# 2600hz - The Future of Cloud Telecom | |
COUCH_URL=$1 | |
DB=$2 | |
DOC_IDS=`curl -s -X "GET" "$COUCH_URL/$DB/_all_docs" | sed -n -e 's/^.*"id":"\([^"]\+\)".*$/\1/p'` | |
DOC_COUNT=`echo "$DOC_IDS" | wc -l` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# A tool to copy couch documents between databases/clusters | |
# 2600hz - The Future of Cloud Telecom | |
DB1=$1 | |
DB2=$2 | |
shift 2 | |
DOC_IDS=$@ | |
TEMP_FILE=/tmp/copy_doc.tmp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# A useful tool for viewing FreeSWITCH SIP logs | |
# 2600hz - The Future of Cloud Telecom | |
awk 'BEGIN{I=0};/^(send|recv).*$/{SIPPACKET=1}; SIPPACKET==1{PACKET[I++]=$0;}; SIPPACKET==1&&/^\ +(Call-ID:).*$/{CALLID=$2}; SIPPACKET==0{print $0}; /^\ +-+$/{PRINT=(SIPPACKET==1?(PRINT==1?0:1):0);SIPPACKET=(PRINT==1?1:0);if(SIPPACKET==0){for(i=0;i<I;i++){print CALLID, PACKET[i]; delete PACKET[i];}I=0;CALLID="";}};' "$@" <&0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var jcouch = { | |
new: function(db_name, options) { | |
return { | |
config: $.extend(true, { | |
async: false | |
}, | |
typeof options === 'object' ? options : {} | |
), | |
db: $.couch.db(decodeURIComponent(db_name)), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var c2c = { | |
realm: 'somerealm.sip.2600hz.com', | |
ext_regex: /^79\d\d$/, | |
init: function() { | |
winkstart.registerResources('voip', { | |
'c2c.create': { | |
url: '{api_url}/accounts/{account_id}/clicktocall', | |
dataType: 'application/json', | |
verb: 'PUT' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var make_parent = { | |
accounts_db: $.couch.db('accounts'), | |
parent_id: '9a07ed4820fd17b54efbf53dcaece757', | |
get_accounts: function(callback) { | |
var THIS = this; | |
THIS.accounts_db.view('accounts/listing_by_realm', { | |
success: function(data) { | |
callback(data.rows); |