domingo, 3 de noviembre de 2013

Plugin Banco del tiempo para Wordpress

En breve saldrá a la luz el plugin de Banco del tiempo para Wordpress!

Os dejo el enlace: http://www.time-bank.info/

Intercambia tiempo entre los usuarios de wordpress de forma segura y transparente, con un funcionamiento similar al sistema de transacciones bancarias.

viernes, 25 de octubre de 2013

Bash / shell linphonecsh hang pick swap commands

Hi!  I have been working on some scripts that I would like to share ;)

We have done a LAMP CRM system + asterisk + linphonecsh commands.

The Hotkeys to execute Shell / Bash commands are (works with icewm):
Pick Up call, Hang up call, Swap between a Streaming running call and a Paused call
.

These scripts are working incredible for us!
Cheers,


FILE: /home/.icewm/keys
key "Ctrl+1" linphonecsh init
key "Ctrl+2" linphonecsh register --host asterisk --username YOURUSERNAME --password YOURPASSWORD
key "Ctrl+0" linphonecsh exit

key "Ctrl+Up" /home/guillermo/pickup
key "Ctrl+Down" /home/guillermo/hangup
key "Ctrl+s" /home/guillermo/swap


FILE: home/.icewm/startup
linphonecsh init
sleep 4
linphonecsh register --host asterisk --username YOURUSERNAME --password YOURPASSWORD


FILE: home/pickup
# Pickup calls linphonecsh

linphonecsh generic calls | grep -E 'IncomingReceived' | awk '{ print $1 " " $5 " " $6 " " }' | tr -d '|' >hanguparchive

# grep search incoming calls

awk -v qt="'" '{

    # Vars definition
    estado1=$2; id1=$1; 
  
    system ("linphonecsh generic " qt "answer " id1 qt );

}' hanguparchive


FILE: home/hangup
# Hangup calls linphonecsh

linphonecsh generic calls | grep -E 'StreamsRunning' | awk '{ print $1 " " $5 " " $6 " " }' | tr -d '|' >hangdownarchive

awk -v qt="'" '{

    # Vars definition
    estado1=$2; id1=$1; 
       
    system ("linphonecsh generic " qt "terminate " id1 qt );

}' hangdownarchive


FILE: home/swap
# SWAP PAUSED and STREAMING CALLS

linphonecsh generic calls | grep -E 'Paused|StreamsRunning' | awk '{ print $1 " " $5 " " $6 " " }' | tr -d '\n' | tr -d '|' >callsarchive

awk -v qt="'" '{

    # Var definitions (estado = status)
    estado1=$2; estado2=$4; id1=$1; id2=$3;

    # Si hay 2 llamadas activas:
    if ((estado1)&&(estado2)) { 
       
        # case 1: status1 Active (or running) and 2 paused
        if ((estado1=="StreamsRunning")&&(estado2=="Paused")){
        system ("linphonecsh generic " qt "pause " id1 qt );
        #system ("sleep 0.4");
        system ("linphonecsh generic " qt "resume " id2 qt );       
        }       
       
        # case 2: status1 Paused and 2 Running
        if ((estado1=="Paused")&&(estado2=="StreamsRunning")){
        system ("linphonecsh generic " qt "pause " id2 qt );
        #system ("sleep 0.4");
        system ("linphonecsh generic " qt "resume " id1 qt );       
        }       

        # case 3: both calls in paused
        if ((estado1=="Paused")&&(estado2=="Paused")){
        system ("linphonecsh generic " qt "resume " id1 qt );       
        }

        # case 4: both calls are active
        if ((estado1=="StreamsRunning")&&(estado2=="StreamsRunning")){
        system ("linphonecsh generic " qt "pause " id2 qt );       
        }

    # Only one call running  
    }else{

        if (estado1=="Paused"){
        system ("linphonecsh generic " qt "resume " id1 qt );       
        }       
        if (estado1=="StreamsRunning"){
        system ("linphonecsh generic " qt "pause " id1 qt );       
        }       
   
    }
}' callsarchive