It's very possible with shell scripting. Cell id can be obtained with a certain dbus call (see phone control wiki page).