Wednesday, 22 February 2012

One-liners

One liner for random password generation
dd if=/dev/random count=1 bs=8 2>/dev/null | base64 | sed -e 's/=*$//'

Setting up test users(sip) in Asterisk


Setting up test users(sip) in Asterisk
Two files to modify
-sip.conf
-extensions.conf
Software needed:
Twinkle for Ubuntu 11.04
Ekiga for Windows (7)
Of course the softphone can be anything you choose but this is what im using

This is a demonstration of a call between a Ubuntu sip user and windows user who both can connect to the Asterisk server as set up in previous steps. The GUI can be used for this,but as recommended getting to know the files personally is a lot better in the long run.


Ok so here goes:
Adding sip users

open ter
sudo su root
navigate your way to /etc/asterisk
vi sip.conf
Only add the text in bold
[test]
--user register
type=friend
--user can make or recieve calls peer =inbound only, user = outbound only
username=test
--username
secret=password
--password
host =dynamic
sets dynamic ip for the host
context=tutorial
sets the group test will belong to.
Our second user
[test1]
type=friend
username=test1
secret=password1
host =dynamic
context=tutorial

Adding the users to the extensions

navigate your way to /etc/asterisk
vi extensions.conf
[tutorial]
exten => 1234,1,Dial(SIP/test)
exten => 4321,1,Dial(SIP/test1)
exten => number,prioirty,Dial(protocol/user)

Now asterisk -r
reload
sip show peers
The users should now be there!

Adding the softphones

Twinkle for Ubuntu
Install twinkle
wizard
enter name for profile
user name test
domain 192.168.0.23 –this is what the domain was for me,so whatever your ip address is that the asterisk server resides on

authentication name test
password password

Ekiga for windows 7

Once installed
Accounts->Add a sip account
name test1
Registrar 192.168.0.23
user test1
authentication user test1
password password
enable account (ticked)


To test the call functionality
From either machine
(ubuntu in this case and twinkle)
make sure user is registered(logged in)
Call 4321
Hopefully it will come up as an incoming call on the ekiga machine :-)

From windows machine using Ekiga
sip:1234@192.168.0.23
hit call icon

To see the communication between both login into the asterisk server
asterisk -r

This was done on my home network so modifications for accessing the asterisk server from outside the home network will be done soon

Update: 
The ip for the registrar is the outside ip address of the server which you are using. provided that port forwarding is enabled and working properly then connecting to the asterisk server should not be a problem. From a clean install on a VM outside my network I was able to connect and register the SIP user without having to change any network configuration files for asterisk.

Wednesday, 15 February 2012

Random Game Reviews


Tow Truck Simulator 2010 PC
Abschleppenwagen-Simulator 2010


Ah yes a Tow Truck simulator,now my life is complete!
Before any judgement a quick analysis of the game-
You play a lonely tow truck driver,hated by motorists and even his boss.
With one mission in life,you stalk the streets looking for "illegally" parked cars which you can pick up and receive some cash in return.It's a ruthless life but someone has to do it.
Right so starting with €60000 and a tow truck the first mission is drive around guided by the illegal car park arrow which guides you to the cars which can make you cash. With the elevator music to drive you mad,its an all round fun time for tow truck enthusiasts.

Not a soul to be seen on the streets,scared of the tow truck of doom


Taking the car for a flying lesson



Fines.


No police,just fines.



Stalking the streets for prey



In fairness its an alright game but has one small catch-- the tow truck has NO REVERSE gear.
How do you reverse??
You dont ,hit the recover button and magically appear metres down the road possibly in the wrong direction,miss a car and drive around again for a second attempt.

Tuesday, 14 February 2012

Saorview using a Dongle (usb)

Saorview using a Dongle (usb)
This tutorial is for a DVB-T205 dongle on windows seven
http://www.dealextreme.com/p/wandtv-usb-dvb-t-tv-tuner-with-remote-8325
This works for me in Dublin,Ireland so the signal here is quite strong as the location is city based. 
The software used (win7)--
http://www.augustint.com/download/Software/DVB-T205/T205_Driver.zip
http://www.augustint.com/download/Software/DVB-T205/TotalMedia1207.zip
The screens--
http://imgur.com/a/Xz2Z2

 


 


 

Install the driver
Install TotalMedia
To setup just auto-scan(take a few mins)
BOOM!shitty tv!
Linux drivers
http://git.linuxtv.org/anttip/media_tree.git?a=shortlog%3Bh%3Drefs%2Fheads%2Frealtek
 
 


Monday, 13 February 2012

Get info about system (Windows)

Get info about system (Windows)
Quick script to generate some useful info about your system!
The extra option is for Oracle database which i designed this script for.
https://docs.google.com/open?id=0B5lcmPAbggVLNTZkNDFjM2EtM2I1ZC00NjA0LTg2MTQtZWZkZGNjMDg5NjE1










Asterisk install on Ubuntu 11.04

Asterisk install on Ubuntu 11.04
Login as root - sudo su root

Get the packages needed
wget http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-10.1.2.tar.gz (this might change over time from http://www.asterisk.org/downloads)
tar xvfz asterisk-10.1.2..tar.gz
sudo apt-get install gcc-snapshot
sudo apt-get install libncurses5-dev
sudo apt-get install libxml2-dev

Install asterisk
./configure
make
make install
make samples

asterisk -vcfg
core restart now
reload
BOOM! done ,now install the GUI if ya want

Installing Asterisk GUI on Ubuntu 11.04





Installing Asterisk GUI on Ubuntu 11.04
Ok so this is a basic install of asterisk GUI for Ubuntu 11.04
What you'll need already is asterisk installed, as was covered in a different post
Right here goes:

Download the asterisk-gui source code from SVN:

Login as root:
sudo su root
mkdir -p ~/downloads/asterisk-gui
cd ~/downloads/asterisk-gui
svn checkout http://svn.digium.com/svn/asterisk-gui/trunk


Compile the source code:
cd trunk
./configure
make
make install

Backup your asterisk config:
cp -r /etc/asterisk /etc/asterisk.backup
Just in case we fuck it up!!

Sample settings install (quick setup for testing)
make samples

Edit /etc/asterisk/manager.conf to enable the web management interface and to add a user:
enabled = yes 
webenabled = yes 
[administrator] secret = what-ever-password-you-want 
read = system,call,log,verbose,command,agent,user,config 
write = system,call,log,verbose,command,agent,user,config 

Edit /etc/asterisk/http.conf to enable asterisk’s mini webserver.
If you are accessing from your local machine use 127.0.0.1 otherwise you might want to bind to a public ip, but be aware this is less secure.
enabled=yes 
enablestatic=yes 
bindaddr=127.0.0.1

Run make checkconfig to verify your configuration settings:
cd ~/downloads/asterisk-gui/trunk
make checkconfig


Create a folder in this place(if it doesnt exist) as asterisk looks for this as default and link it 
cd /usr/share/
mkdir asterisk sudo ln -s /var/lib/asterisk/static-http/ /usr/share/asterisk/
Fire up that sucker in a web-browser(persuming it's already running)
a Reload is also required 
asterisk -vvvvvr this gives the debugging output aswell
asterisk -r no debugging output
Most tutorials point to http://127.0.0.1:8088/asterisk/static/config/cfgbasic.html 
But for me it was: http://127.0.0.1:8088/cfgbasic.html
User name is what we defined in the asterisk-setup tutorial First time startup, it will ask for restart and update files automatically so a login is required again.
Once that is done then you should be looking at the GUI !







Asterisk CLI commands

Asterisk CLI commands:
These are executed from the cli command line interface for asterisk

General commands

!<command>: Executes a given shell command
abort halt: Cancel a running halt
add extension: Add new extension into context
add ignorepat: Add new ignore pattern
add indication: Add the given indication to the country
agent show: Show status of agents
debug channel: Enable debugging on a channel
dont include: Remove a specified include from context
help: Display help list, or specific help on a command
include context: Include context in other context
load: Load a dynamic module by name
logger reload: Reopen log files. Use after rotating the log files.
no debug channel: Disable debugging on a channel
originate: originate a call.
remove extension: Remove a specified extension
remove ignorepat: Remove ignore pattern from context
remove indication: Remove the given indication from the country
save dialplan: Overwrites your current extensions.conf file with an exported version based on the current state of the dialplan. A backup copy of your old extensions.conf is not saved. The initial values of global variables defined in the [globals] category retain their previous initial values; the current values of global variables are not written into the new extensions.conf. (:exclaim:) Using "save dialplan" will result in losing any comments in your current extensions.conf.
dialplan save (1.4): BROKEN, doesn't parse correctly. Overwrites your current extensions.conf file with an exported version based on the current state of the dialplan. A backup copy of your old extensions.conf is not saved. The initial values of global variables defined in the [globals] category retain their previous initial values; the current values of global variables are not written into the new extensions.conf. (:exclaim:) Using "save dialplan" will result in losing any comments in your current extensions.conf.
set verbose: Set level of verboseness
show applications: Shows registered applications
show application: Describe a specific application
show channel: Display information on a specific channel
show channels: Display information on channels
show codecs: Display information on codecs
show conferences: Show status of conferences
show dialplan: Show dialplan
show hints: Show registered hints
show image formats: Displays image formats
show indications: Show a list of all country/indications
show locals: Show status of local channels
show manager command: Show manager commands
show manager connect: Show connected manager users
show parkedcalls: Lists parked calls
show queues: Show status of queues, see details here
show switches: Show alternative switches
show translation: Display translation matrix
soft hangup: Request a hangup on a given channel - in Asterisk 1.6.2: "channel request hangup <name>"
show voicemail users: List defined voicemail boxes
show voicemail zones: List zone message formats
devstate change: Change state of a custom device (new in Asterisk 1.6.0)


Server management (for newer versions of asterisk use core at start of command e.g. core reload)

restart gracefully: Restart Asterisk gracefully, i.e. stop receiving new calls and restart at empty call volume
restart now: Restart Asterisk immediately
restart when convenient: Restart Asterisk at empty call volume

Note for Asterisk 1.2: Restart now is like a reload, not a real restart it just run the reload routines (thus open ports are not closed). Often you don't need really need to restart asterisk, instead just need to issue e.g. 'unload chan_sip.so' and 'load chan_sip.so'.

reload: Reload configuration
stop gracefully: Gracefully shut down Asterisk, i.e. stop receiving new calls and shut down at empty call volume
stop now: Shut down Asterisk imediately
stop when convenient: Shut down Asterisk at empty call volume
dialplan reload: Reload extensions and only extensions (formerly extensions reload)
unload: Unload a dynamic module by name
show modules: List modules and info about them
show uptime: Show uptime information
show version: Display Asterisk version info


AGI commands

show agi: Show AGI commands or specific help
dump agihtml: Dumps a list of agi command in html format

Database handling commands

database del: Removes database key/value
database deltree: Removes database keytree/values
database get: Gets database value
database put: Adds/updates database value
database show: Shows database contents
database showkey: Shows database contents: An alternative to showing keys by family with database show, this command shows all the families with a particular key

IAX Channel commands

iax2 debug: Enable IAX debugging
iax2 no debug: Disable IAX debugging
iax2 set jitter: Sets IAX jitter buffer
iax2 show cache: Display IAX cached dialplan
iax2 show channels: Show active IAX channels
iax2 show netstats: Show network and jitter buffer statistics for active IAX calls
iax2 show peers: Show defined IAX peers
iax2 show registry: Show IAX registration status
iax2 show stats: Display IAX statistics
iax2 show users: Show defined IAX users
iax2 trunk debug: Request IAX trunk debug

iax debug: Enable IAX debugging
iax no debug: Disable IAX debugging
iax set jitter: Sets IAX jitter buffer
iax show cache: Display IAX cached dialplan
iax show channels: Show active IAX channels
iax show peers: Show defined IAX peers
iax show registry: Show IAX registration status
iax show stats: Display IAX statistics
iax show users: Show defined IAX users
init keys: Initialize RSA key passcodes
show keys: Displays RSA key information

H323 channel commands

h.323 debug: Enable chan_h323 debug
h.323 gk cycle: Manually re-register with the Gatekeper
h.323 hangup: Manually try to hang up a call
h.323 no debug: Disable chan_h323 debug
h.323 no trace: Disable H.323 Stack Tracing
h.323 show codecs: Show enabled codecs
h.323 show tokens: Manually try to hang up a call
h.323 trace: Enable H.323 Stack Tracing

SIP channel commands

Debugging
Enable
sip debug
sip set debug on (valid on 1.6.2.7)
Disable
sip no debug
sip set debug off (valid on 1.6.2.7)
sip reload: Reload sip.conf (added after 0.7.1 on 2004-01-23)
sip show channels: Show active SIP channels
sip show channel: Show detailed SIP channel info
sip show inuse: List all inuse/limit
sip show peers: Show defined SIP peers (clients that register to your Asterisk server), see details here
sip show registry: Show SIP registration status (when Asterisk registers as a client to a SIP Proxy)
sip show subscriptions: Lists all sip presence (busy lamp indication) subscriptions
sip show users: Show defined SIP users


Zap channel commands


zap destroy channel: Destroy a channel
zap show channels: Show active zapata channels
zap show channel: Show information on a channel
zap show status: lists all the Zaptel spans. A span will apear here whether or not its channels are configured with chan_zap.
zap show cadences: Show the configured ring cadences (available e.g with Zap/1r2).
zap set swgain(<= 1.6): set the (software) gain for a hannel. Temporary equivalents of rxgain and txgain in zapata.conf.
zap set hwgain(<=1.6): set the hardware gain for channels that support it.
zap set dnd(<=1.6) set a channel's do-not-disturb mode on or off.

The following commands are available if the channel is built with support for libpri:

pri debug span: Enables PRI debugging on a span
pri intense debug span: Enables REALLY INTENSE PRI debugging
pri no debug span: Disables PRI debugging on a span
pri show spans: List spans and their status.
pri show span: Information about a span.
pri show debug: show where debug is enabled.

See section 3 of AT&T tr41459_99 to better understand what the output generated by the pri debug command means.

Bristuff adds bri debug which is an alias for pri debug.


TODO: SS7 support in 1.6.

Console channel commands

dial : Dials the given extension, if specified, from the console. Can be used to initiate a call, or to dial digits during an existing call.
answer: Answer a call if one is currently ringing on the console.
hangup: Hangup the call if there is currently one on the console.



Asterisk channel MGCP commands

mgcp audit endpoint: Audit specified MGCP endpoint
mgcp debug: Enable MGCP debugging
mgcp no debug: Disable MGCP debugging
mgcp show endpoints: Show defined MGCP endpoints


skinny channel commands

skinny debug: Enable Skinny debugging
skinny no debug: Disable Skinny debugging
skinny show lines: Show defined Skinny lines per device

Asterisk channel CAPI commands

capi debug: Enable CAPI debugging
capi no debug: Disable CAPI debugging
capi info: Show CAPI info

Sirrix ISDN channel commands


srx reload: Reload channel driver configuration; active calls are not being terminated!
srx show ccmsgs: Disable / enable output of incoming callcontrol messages.
srx show chans: Show info about B-Channels
srx show globals: Show info about global settings
srx show groups: Show info about configured groups
srx show layers: Show info about ISDN stack (Layer 1, 2, 3)
srx show sxpvts: Show private info about active channels
srx show timers: Show info about running timers