Sunday, December 6, 2009

Cisco 7960 Complete Phone Configuration

I love cisco phones not for its name, but for the technology and way it works. The pain for an individual users is configuration the phone. Below is one of the instance where I felt the pain.

During the cleanup of the house we just removed the power and connect it again, it happens to one of the bug with the phone saying "TFTP Timeout" and did not proceeed further and not even allowed to change the tftp serverip or name. That is a shame on Cisco's QA.

In its documentation to resolve this issue (the link in cisco is outdated) it need the following to resolve it.

Add an option 150 to the dhcp server and upload the configuration with a tftp server to be fetched by the phone.
If you say this to a normal user of the phone see how things will be. Most of use non modifiable router in this case see the pain of it. Fortunately, I owned the openwrt router. (Linksys WRTSL54GS) and I can explain how that worked.

You need to have dnsmasq installed in your router.

Add the following line to dnsmasq.conf to reflect the option,

dhcp-option=150,192.168.1.235,192.168.1.235

Option 150 says that your tftp server is running on the IP.

my complete /etc/dnsmasq.conf reflects the following,



# filter what we send upstream
domain-needed
bogus-priv
filterwin2k
localise-queries

# allow /etc/hosts and dhcp lookups via *.lan
local=/lan/
domain=kans
expand-hosts
no-negcache
resolv-file=/tmp/resolv.conf.auto

# enable dhcp (start,end,netmask,leasetime)
dhcp-authoritative
dhcp-range=eth0,192.168.1.100,192.168.1.250,255.255.0.0,12h
dhcp-range=eth2,192.168.2.100,192.168.2.250,255.255.0.0,12h
dhcp-leasefile=/tmp/dhcp.leases

# use /etc/ethers for static hosts; same format as --dhcp-host
#  
read-ethers

# other useful options:
# default route(s): dhcp-option=3,192.168.1.1,192.168.1.2
#    dns server(s): dhcp-option=6,192.168.1.1,192.168.1.2
dhcp-option=150,192.168.1.235,192.168.1.235


If you are using windows based DHCP server, you can set the option 150 and enter the IP address of your tftp server.

Place the following files with the contents as mentioned below in the tftp server,

XMLDefault.cnf.xml
SIPDefault.cnf
SIP000D28083907.cnf
SEP000D28083907.cnf.xml
P003-8-12-00.sbn
P003-8-12-00.bin
P0S3-8-12-00.sb2
P0S3-8-12-00.loads
OS79XX.TXT
CTLSEP000D28083907.tlv

XMLDefault.cnf.xml:






ity="0">


2000

2427
2428







P0S3-8-12-00
P0S3-8-12-00






 


SIPDefault.cnf:



image_version: "P0S3-8-12-00"
network_media_type : Auto
network_port2_type : Hub/Switch
dscpForAudio : 184
tftp_cfg_dir : "./"
phone_password : "cisco"
phone_prompt : ">>"
language : english
sntp_mode : DirectedBroadcast
sntp_server : 0.north-america.pool.ntp.org
time_zone : MST
dst_offset : 1
dst_start_month : Mar
dst_start_day : 2
dst_start_day_of_week : Sun
dst_start_week_of_month : 1
dst_start_time : 02
dst_stop_month : Nov
dst_stop_day : 1
dst_stop_day_of_week : Sun
dst_stop_week_of_month : 1
dst_stop_time : 2
dst_auto_adjust : 1
time_format_24hr : 1
date_format : M/D/Y
nat_enable : 0
nat_address : UNPROVISIONED
voip_control_port : 5060
start_media_port : 16384
end_media_port : 32766
sync : "1"
xml_card_dir : ""
xml_card_file : "CARD.XML"
telnet_level : 2
services_url : ""
directory_url : ""
logo_url : ""
http_proxy_addr : UNPROVISIONED
http_proxy_port : 80
garp_enable : 0
enable_vad : 0
dial_template : ""
callerid_blocking : 0
anonymous_call_block : 0
autocomplete : 1
messages_uri : "*89"
dnd_control : 0
preferred_codec : g711ulaw
dtmf_outofband : avt
dtmf_avt_payload : 101
dtmf_db_level : 4
dtmf_inband : 0
proxy1_address : "192.168.251.2"
proxy2_address : ""
proxy3_address : ""
proxy4_address : ""
proxy5_address : ""
proxy6_address : ""
proxy1_port : 5060
proxy2_port : 5060
proxy3_port : 5060
proxy4_port : 5060
proxy5_port : 5060
proxy6_port : 5060
sip_retx : 10
sip_invite_retx : 6
timer_t1 : 500
timer_t2 : 4000
timer_invite_expires : 180
timer_register_expires : 3600
proxy_register : 1
proxy_backup : ""
proxy_emergency : ""
proxy_backup_port : 5060
proxy_emergency_port : 5060
outbound_proxy : "192.168.251.2"
outbound_proxy_port : 5060
nat_received_processing : 0
mwi_status : 0
call_waiting : 1
user_info : ""
cnf_join_enable : 1
remote_party_id : 1
semi_attended_transfer : 0
transfer_onhook_enabled : 0
call_hold_ringback : 0
stutter_msg_waiting : 0
cfwd_url : ""
call_stats : 0
auto_answer : 0
local_cfwd_enable : 1
timer_register_delta : 5
sip_max_forwards : 70
rfc_2543_hold : 0
version_stamp : ""
timer_keepalive_expires : 120
connection_monitor_duration : 120 



SIP000D28083907.cnf:


phone_label="Kans Global Phone"

# SIP Configuration Generic File 

# Line 1 appearance
line1_name: "12345"
line2_name: ""
line3_name: ""
line4_name: ""
line5_name: ""
line6_name: ""

line1_authname: "12345"
line2_authname: ""
line3_authname: ""
line4_authname: ""
line5_authname: ""
line6_authname: ""

line1_password: "12345"
line2_password: ""
line3_password: ""
line4_password: ""
line5_password: ""
line6_password: ""

line1_displayname: "12345"
line2_displayname: ""
line3_displayname: ""
line4_displayname: ""
line5_displayname: ""
line6_displayname: ""
line7_displayname: ""

line1_shortname: "Kans Phone"
line2_shortname: ""
line3_shortname: ""
line4_shortname: ""
line5_shortname: ""
line6_shortname: ""

speed_label2 : ""
speed_line2 : ""
speed_label3 : ""
speed_line3 : ""
speed_label4 : ""
speed_line4 : ""
speed_label5 : ""
speed_line5 : ""
speed_label6 : ""
speed_line6 : "" 

messages_uri: "*86"

####### New Parameters added in Release 3.0 ######

# Phone Prompt (The prompt that will be displayed on console and telnet)
phone_prompt:   "Kans Phone"      ; Limited to 15 characters (Default - SIP Phone) 


# User classifcation used when Registering [ none(default), phone, ip ]
user_info: none




SEP000D28083907.cnf.xml:





P0S3-8-12-00



OS79XX.TXT:
P0S3-8-12-00

CTLSEP000D28083907.tlv:
Empty File

That is all. It took an hour for me to figure this out.

Monday, October 26, 2009

utils.c broken pipe error - Asterisk or Application error? Fix

I had debated myself whether it could be asterisk or application error. I'm trying to write something to the receiver and the receiver already closed my acceptance.

Should I need to produce an error or not?

To sort this problem if you have certain delay (like sleep or usleep to .5 secs) to receive the data from Asterisk you are fine. Any scripts or remote manager sockets calling this need to wait for the same to get this error go away.

sleep(.5); // or if it can take only integers you can have sleep(1);
Make sure you consider this time when handling call.

Alternatively if you want to get the error to ignore, you can edit utils.c and comment the line producing this error. Also keep in mind when you have errors with file or socket, it will get ignored.

Hope it helps !

Wednesday, October 14, 2009

Unique BootID in Linux

# cat /proc/sys/kernel/random/boot_id
91cbd9c4-8a68-4d14-8193-8486417410d1

Gives you the random unique boot for every boot. If you application would like to see whether you system has rebooted or not, you can check with this value.

Hope it helps.

UUID LIBUUID GUID in linux

Generating UUID in linux is much easier than having an user space app to create it.
It is patched to the latest kernel of linux.

Try,

cat /proc/sys/kernel/random/uuid
d9083201-9574-4ea2-a4fc-9b8ebf9a44e4

on your linux machine. You will get randomly generated number.

Hope it helps.

Monday, September 28, 2009

VoIP Routing - Phone to GSM

I was looking for a device which can take sim card and dial remotely through voip.

You can get those devices here.

This is plan SIP. Your ISP might block SIP traffic eventhough if it is run on other ports other than 5060. Grab one of the device and connect to a SIP Provider and dial through your softphone and Enjoy.

Please leave a comment if you face any problems.

Thursday, August 6, 2009

VoIP Routing - Phone to GSM - Part 2

It is always good to experiment any technologies free. Oof the good things with voip is you can try before you can realize whether something works with zero cost.

Let us try to experiment making few phone calls.

Try to download free softphones.

Below are the softphones i experienced good,

Xlite
Zoiper

The good thing about Zoiper is, it is simple and can communicate with native IAX protocol to asterisk.

Xlite has good features with SIP Protocol, such as recording, conferencing, etc.,

Register http://www.sipphone.com and connect to their service with the two softphones.

Configuration instructions are here,

http://support.gizmo5.com/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=440

It is very simple. Usual settings to connect to any server. You won't go wrong.

Give a try.

Wednesday, August 5, 2009

Phone to GSM Gateway VoIP Routing - Part 1




It is been request from my friends how to connect Normal phone Number to a GSM Gateway connected remotely in a different country.

This article gives a brush up how to use the SIP Protocol to make VoIP Calls and communicate freely in the internet.

Visit few of the public service providers:

1. http://www.sipphone.com
2. http://www.iptel.org/toboggan/login
3. http://www.sipgate.com/

I find these ones are reliable with their service.

If you would like to have your own server at home. You can use the following softwares as sip proxy.

1. Asterisk
2. openser
3. freeswitch

I would recommend Asterisk, since it is used by large users and enterprise and proven to be stable. It can also even run in routers and embedded devices too.

Try to get the accounts setup or install the softwares in a Linux Machine, Before we go to the next step. I would be choosing, sipphone & Asterisk in my forthcoming examples and configurations.

Wednesday, July 15, 2009

Prism - Making Web Unique

It was one of my need to have multiple users using the same website. Prism gives the comfort of browsing like an application and every time with a click it will launch as desktop application.

Also When I do important stuffs browsers crash often. Even though chrome claims to be the same, it still has the problem of closing all the tabs simultaneously.

Prism removes the hurdle.

http://prism.mozilla.com/

Monday, June 29, 2009

Automate your dialling with Bookmarklets !

It is more often these days we need to look in the number in the website and dial the same number reach the service. Instead you can create a bookmarklet in your browser to send the number by selecting it to asterisk and connect your phone with the service provider with a select and click.

So nothing to paste or no wrong number dialling. Just Select and click.

Asterisk can be communicated through http interface, send an AMI originate command with the number you want to dial in with the format. It goes from there.

Listen to your computer songs anywhere in the air

Recently explored a bit more on the shoutcast to broadcast songs from my machine. It works well with winamp. Download the softwares from shoutcast and install the plugin for winamp appropriately, you are done.

Now open the shoutcast app in your iphone and search for your station. (Make sure you select the option as public radio in yp to search for your radio). Now you are done. You can now listen to your computer songs on your iphone.

One of the features I love it. I would like to extend this for our village benefit, so that we hear village news using this public radio. The bottle neck here is the bandwidth of the broadcaster. I would best use of multicast in this scenerio.

Listen to the blog. More coming.

Wednesday, June 24, 2009

Asterisk How to Capture Events and Handle it with PHP easily, works with all 1.2, 1.4 & 1.6

PHP makes the life easily when it comes to string parsing. Just enjoy to handle the events from asterisk.

#!/usr/bin/php -q

ob_implicit_flush(false);

$socket = fsockopen("hostname or ip","port", $errornum, $errorstr);
if(!$socket) {
print "Couldn't open socket. Error #" . $errornum . ": " . $errorstr;
} else {
fputs($socket, "Action: Login\r\n");
fputs($socket, "UserName: username\r\n");
fputs($socket, "Secret: password\r\n\r\n");
fputs($socket, "Action: Events\r\n");
fputs($socket, "EventMask: on\r\n\r\n");

fgets($socket); // Ignore the welcome message

$change = false;
$agentid = NULL;
$agentchannel = NULL;
$login = NULL;

while(true)
{
while(!feof($socket) )
{

$readbuf = "";
$resp = fread($socket,8192);
$readbuf .= $resp;
$allevents = split("\r\n\r\n",$readbuf);
foreach($allevents as $event)
{
$eventdetails = split("\r\n",$event);
$event_assoc = "";
foreach($eventdetails as $value ) {
$namevalue = split(": ",$value);
$event_assoc[$namevalue[0]] = $namevalue[1];
}
switch( $event_assoc['Event'] )
{
case 'Link': // Calls getting bridged
break;

default:
if( !empty($event_assoc['Event']) )
print_r($event_assoc);
}
}
fputs($socket, "Action: Ping\r\n\r\n");
usleep(1000000);
}

}

}

?>

Friday, June 19, 2009

Internet Radio Station on the Air

It was one of my dream to listen to radio stations from the Internet while driving or in free space without needing any bulky device. With the advanced computing and lightweight chips in electronics Apple made it to happen.

The dream came true with iphone and shoutcast player. You can either listen to the stations available online or you can broadcast your own station from your home pc and listen it everywhere you keep in touch with 3G or on the air networks.

Thanks to Iphone and Shoutcast.

Tuesday, June 9, 2009

How good is your browser?

Was wondering how to find whether I'm using the right browser with my computer. Recent technologies and websites changed the way we browse and use them. It is necessary to find the right browser for our computer to get the best performance for what we have.

http://service.futuremark.com/peacekeeper/index.action

gives the good benchmark. It voted me for Safari 4. Moved from firefox 3 to Safari 4 for now.

I can feel the difference. What about for you ? !