Google
 
Showing posts with label ntc. Show all posts
Showing posts with label ntc. Show all posts

Tuesday, June 14, 2011

NTC PSTN Number to Name

NTC's website has a nice feature called Telephone search. This is particularly handy when you get a call from landline (PSTN) number and have no idea who's calling. Ofcourse you can go to the site and search, but the following bash script makes it faster.

#!/bin/bash

#
# Nepal Telecom PSTN Number to Name search
#

if [ "$1" == "" ] ; then
echo "Usage: " $0 "phone_number"
exit
fi

# Prefix 01, if not provided
if [[ $1 =~ ^01 ]] ; then
NUMBER=$1
else
NUMBER="01$1"
fi

wget -q http://ntc.net.np/telsearchRes.php
--post-data "searchFor=name&telno=$NUMBER&submitted=Search" -O - | html2text | grep "$NUMBER" | tr '_' ' ' | sed 's/ [\ ]*/ /g'

Save the file, chmod it as executable.

To use,
./telsearch 5544132
| 1 |015544132|Ntc |Cellular Mobile And New S|Jawalakhel|

Sunday, May 31, 2009

NTC's GPRS in Linux via Bluetooth using Nokia phone

The following guide explains how to connect to Nepal Telecom's GPRS service from Linux via Bluetooth using Nokia phone. This guide is based on Linux GPRS Guide. The steps have been tested on Nokia 6600, 6630 and 5300 but should work on all Nokia phones.

NTC's GPRS is *really* slow so I won't recommend it for everyday use. However simple mail checking and tweeting ;) should do just fine.

Requirements
1. Nokia Phone
2. Nepal Telecom GPRS Account
3. Bluetooth Dongle (if not inbuilt in your PC/laptop)
4. Linux (the following steps were tested on Ubuntu)

Steps

1. Download ntgprs.tar.gz and extract (ntgprs, ntgprs-wvdial.conf and ntgprs-disconnect)
2. Copy the files to /etc/ppp/peers/ (you need root or sudo access)
3. Turn on Bluetooth on your Nokia phone
4. Plug in Bluetooth Dongle to PC or enable it (if inbuilt)
5. Fire up terminal (the commands to be entered are in bold-face):

Make sure the bluetooth is running on PC:

$ hciconfig
hci0: Type: USB
BD Address: 11:11:11:11:11:11 ACL MTU: 672:3 SCO MTU: 48:1
UP RUNNING PSCAN ISCAN
RX bytes:149397 acl:1046 sco:0 events:764 errors:0
TX bytes:40320 acl:628 sco:0 commands:74 errors:0

The following command will find bluetooth address of your phone
$ hcitool scan
Scanning ...
00:0E:6D:C2:99:42 Nokia

Create a RFCOMM port and bind it to phone's Bluetooth address.
$ sudo rfcomm bind /dev/rfcomm0 00:0E:6D:C2:99:42 1

Please note that the bluetooth address in the above command should match the address found by 'hcitool scan' command.

Check if the port has been created
$ rfcomm -a
rfcomm0: 00:0E:6D:C2:99:42 channel 1 closed

Now dial.
$ sudo pon ntgprs

--> WvDial: Internet dialer version 1.60
--> Initializing modem.
--> Sending: ATH
ATH
OK
--> Sending: ATE1
ATE1
OK
--> Sending: AT+CGDCONT=1,"IP","internet","",0,0
AT+CGDCONT=1,"IP","internet","",0,0
OK
--> Sending: AT+CBST=0,0,1;+CHSN=6,0,0,0;+CGDCONT=,,"ntnet"
AT+CBST=0,0,1;+CHSN=6,0,0,0;+CGDCONT=,,"ntnet"
OK
--> Modem initialized.
--> Sending: ATD*99#
--> Waiting for carrier.
ATD*99#
CONNECT
~[7f]}#@!}!} } }2}#}$@#}!}$}%\}"}&} }*} } g}%~
--> Carrier detected. Waiting for prompt.
~[7f]}#@!}!} } }2}#}$@#}!}$}%\}"}&} }*} } g}%~
--> PPP negotiation detected.
Serial connection established.
using channel 9
Using interface ppp0
Connect: ppp0 <--> /dev/rfcomm0
sent [LCP ConfReq id=0x1 ]
rcvd [LCP ConfAck id=0x1 ]
rcvd [LCP ConfReq id=0x0 ]
sent [LCP ConfAck id=0x0 ]
sent [PAP AuthReq id=0x1 user="user" password="pass"]
rcvd [PAP AuthAck id=0x1 ""]
PAP authentication succeeded
sent [IPCP ConfReq id=0x1 ]
rcvd [IPCP ConfReq id=0x0 ]
sent [IPCP ConfNak id=0x0 ]
rcvd [IPCP ConfNak id=0x1 ]
sent [IPCP ConfReq id=0x2 ]
rcvd [IPCP ConfReq id=0x1 ]
sent [IPCP ConfAck id=0x1 ]
rcvd [IPCP ConfAck id=0x2 ]
Cannot determine ethernet address for proxy ARP
local IP address 10.1.4.101
remote IP address 10.0.0.1
primary DNS address 202.70.64.5
secondary DNS address 202.70.64.15
Script /etc/ppp/ip-up started (pid 9902)
Script /etc/ppp/ip-up finished (pid 9902), status = 0x0

To disconnect
$ sudo poff ntgprs