Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 38 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
38
Dung lượng
1,11 MB
Nội dung
3. To adjust Brightness, Contrast, Gamma, and Saturation, click the Video Controls tab and fiddle with the sliders there. • Gamma is a curve that depicts how light or dark the gray tones of an image appear. • Saturation is a measure of the intensity of a hue. A highly saturated image has bright colors, and an image low in saturation is gray with almost no color. • Brightness defines the amount of white in an image. • Contrast defines how light the light tones are and how dark the dark tones are. 4. If you have more than one webcam or TV Tuner card connected to your computer, you can click the Tuning tab and choose the webcam or tuner that you want to view. 5. If your camera is a Philips camera, as are a variety of popular Logitech cameras, you can click the Philips Extensions tab to adjust the lighting, noise reduction, and compression of your image. Sending your webcam images to other computers CamStream generates a series of still images at speeds that you specify and saves them either on your computer’s hard drive or sends them via FTP to the hard drive of another computer that you specify. To send your files to be seen on another computer, follow these steps: 1. Click the Configuration button in the CamStream window. (Refer to Figure 8-3.) The Snapshot Settings window appears. 2. Select the radio button for the file format that you desire, such as JPEG, PNG, PPM, or BMP, and then type the name of the file into the Basename text box. 3. If you desire, you can select any of these three options: • Re-Use Filename (Overwrite): Select this radio button so that every time an image is created, it overwrites the image with the same filename. • Put Timestamp in Filename: Selecting this radio button makes the time and date part of the filename of each new image. • Number Sequentially: Select this radio button, and each image will be numbered in sequence. 148 Part III: Entertaining Your Brain with a Little Help from Linux 14_598236 ch08.qxp 6/27/06 7:43 PM Page 148 4. Type a number in the Maximum Sequence Number text box if you want to modify the default setting. If the computer generates more images than the Maximum Sequence Number, the computer erases the old file and creates a newer one, so you never exceed the limit you specified. 5. If you want CamStream to save images in the home directory on your hard drive, select the Save To Disk check box at the bottom of the Snapshot Settings dialog box; if you want CamStream to send images to another computer, select the FTP to Server check box. You can select both Save to Disk and FTP To Server if you want. If you choose the FTP route, you’ll want to do the following: a. Click the FTP Settings button in the Snapshot Settings dialog box to specify a computer where your images will be sent. The FTP Settings dialog box appears. b. Type in the hostname, username, password, and, optionally, the path of the computer that you want to send your images to, as shown in Figure 8-4. The hostname is the name of the FTP server, such as ftp.example. com, or its IP address, such as 192.0.168.55. The username and password are for the account that you want to log in to. The path specifies where on the hard drive on the server your images will be saved. The computer to which you want to send images needs to have FTP server software running so it can accept the images. c. Click OK in the FTP Settings dialog box. The FTP Settings dialog box disappears. Figure 8-4: You can specify where to transmit your images in Cam- Stream’s FTP Settings dialog box. 149 Chapter 8: Having Fun with a Webcam 14_598236 ch08.qxp 6/27/06 7:43 PM Page 149 6. Click OK in the Snapshot Settings dialog box. The Snapshot Settings dialog box disappears. CamStream starts to send a continuous series of snapshots to your computer or to your FTP server, according to whatever you have specified. 7. Click the Take Snapshot at Regular Intervals button in the CamStream window. The Timed Snapshot Settings dialog box appears. 8. Specify the number of seconds or minutes you want between images. Then click OK. The Timed Snapshot Settings dialog box disappears. CamStream sends images to your computer or FTP server at the interval you specified. You can send images from one computer on your home network to another. For example, you can set up a baby monitor in the nursery and view it in your home office. Timestamping your images To put a timestamp on your stream of images (for security reasons or infor- mational purposes or whatever), click the Configuration button in the CamStream window. Then in the Snapshot Settings window that appears, select the Put Timestamp In Image check box. You can also choose Select Color or Select Font to specify the color and font of the timestamp. Seeing your CamStream images on a browser You can load your CamStream image into your Web browser and click your browser’s Refresh or Reload button manually to view a current picture from your webcam if, for example, you want to check on a webcam image of a building site every so often. If refreshing the Web browser page is too much work, you are just too lazy — okay, there is a way to get a Web page to refresh itself for you. Kind of like a video, except slower or jerkier, at least on our computers. But it works. See the next section. Creating a reloading Web page Here’s how to create a Web page that reloads itself with a continuous stream of images updated one after another automatically. In a text editor, create a Web page by using some simple HTML. (HTML is Hypertext Markup Language, which is the simple code used to create most Web pages.) You can type this code into your text editor to create a Web page with just a title and an image on it that refreshes itself: 150 Part III: Entertaining Your Brain with a Little Help from Linux 14_598236 ch08.qxp 6/27/06 7:43 PM Page 150 <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”> <html> <head> <title>CamStream Pix</title> <meta http-equiv=”REFRESH” content=”1;url=chapter8.html”></head> <body> <img src=”snapshot.png”> </ body> </html> Feel free to substitute your own title for CamStream Pix. Save the code as a Web page by choosing File➪Save As in your text editor. Give it the name chapter8.html. The part of the HTML code, 1;url=chapter8.html, specifies that the Web browser should load the Web page named chapter8.html in 1 second. If you change this to 5;url=chapter8.html, the browser will load the page named chapter8.html in 5 seconds. Because the page is named chapter8.html, the page keeps loading itself again and again, every 1 or 5 seconds or whatever you specify in the page. An easy way to publish a Web page that constantly shows your webcam images (even if you just want to show them to a few friends or family) is to pay for an inexpensive Web-hosting service. For instance, you can get your own domain name (such as www.example.com) from a registrar like www.godaddy.com for $8 or so per year, and for a few dollars a month, godaddy.com will also host your Web site. You upload your version of chapter8.html to your site there, and you also have CamStream send its images to your site there via FTP. (Be sure to set up the Snapshot Settings dialog box, as I describe in the section “Sending your webcam images to other computers,” earlier in this chapter, so that you are reusing the filename for each new image that CamStream creates.) Then you and anyone who knows your Web address can view your continuous flow of CamStream images by, for example, surfing to www.example.com/ chapter8.html — or whatever your Web site is. Having Fun with Videoconferencing Videoconferencing is unreasonably enjoyable. It’s fun to see who you’re talk- ing to, especially if you’re talking to your family or friends. Videoconferencing is also useful. If you’re trying to explain something to someone, you can show them diagrams, gesticulate wildly, and make funny faces to keep his or her 151 Chapter 8: Having Fun with a Webcam 14_598236 ch08.qxp 6/27/06 7:43 PM Page 151 attention. You can look in on your kids if you have a webcam set up in front of the Nintendo. In business meetings, your body language can help you get your points across. And with software like Ekiga, videoconferencing is not only fun and useful, it’s free. What a great application for your webcam. Installing Ekiga Ekiga recently changed its name from GnomeMeeting and released Ekiga 2.0. The new Ekiga version of GnomeMeeting includes better audio quality and improved camera support. This package is currently available only in its source code. Compiled versions of Ekiga will be available soon for the major Linux distributions, but until that happens, you might want to use GnomeMeeting instead. Many Linux distributions (including Ubuntu, the Linux distribution we’ve been mentioning in this chapter) come with GnomeMeeting already installed. And soon, they will undoubtedly come with Ekiga installed. Check your applica- tion menus to see whether you have one or the other. If you don’t have either, you can look for Ekiga or GnomeMeeting by using a software package man- ager such as Synaptic. (In Synaptic, choose Edit➪Search to find it, and then install Ekiga or GnomeMeeting if neither one is already installed, as described earlier in this chapter, in the section “Installing software by using Synaptic.”) Configuring Ekiga The first time you run Ekiga, the Configuration Druid window appears so that you can properly set up the program. These basic steps take you through the process: 1. Go through the Druid, type your name and e-mail address, and click Get an Ekiga.net SIP Account if you’d like to get your own SIP URL so that people can call you for free by using SIP software such as Ekiga. 2. Continue to go through the Druid and type your Internet connection type, such as DSL or Local Area Network. 3. Click the Detect NAT Type button and read the report on how to con- figure your NAT router to make calls with Ekiga. If what it says makes sense to you, follow the instructions; if not, you can try Ekiga without following the instructions. If it works, great. If not, 152 Part III: Entertaining Your Brain with a Little Help from Linux 14_598236 ch08.qxp 6/27/06 7:43 PM Page 152 you might want to bring up the Configuration Druid again by choosing Edit➪Configuration Druid and hire some genius who understands what Ekiga is telling you that it requires. 4. Choose your Audio Manager — usually ALSA is the best choice when it is available. 5. Choose your Audio Input and Output devices. Ekiga suggests settings. You can accept the settings or pull down the menu to choose alternative settings. 6. On the Audio Devices page of the Druid, you can click Test Settings and record yourself saying “1, 2, 3” (or anything else you want to say). You’ll hear what you said played back to you so that you know that your audio devices are working. 7. Choose your Video Manager Software. V4L (Video4Linux) is what you usually want to choose for a webcam. 8. Choose the Video Input device. Your webcam will show up on the pop-up menu if you installed the driver, as I explain earlier in this chapter, in the section “Using Synaptic to install your driver.” The last page of the Configuration Druid summa- rizes your settings. 9. Click the Apply button. If you want to change your settings, you can always run the Configuration Druid again by choosing Edit➪Configuration Druid. Making calls You can use Ekiga to make free audio or free video calls to people with hard- ware or software that supports the H.323 standard, including Microsoft NetMeeting, or the Session Internet Protocol (SIP) which is becoming one of the leading standards for VoIP (Voice over Internet Protocol; in other words, telephony via the Internet). You can also call real phones if you purchase an account that lets you do so. With Ekiga, you usually call other people by using URLs (Web addresses). There are three kinds of URLs that Ekiga can use. One is sip:, which utilizes the increasingly popular SIP standard and is the default for Ekiga. Another is h323:, which conforms to the H.323 standard. The other is callto:, which Microsoft uses for NetMeeting. 153 Chapter 8: Having Fun with a Webcam 14_598236 ch08.qxp 6/27/06 7:43 PM Page 153 To make a call by using Ekiga, do the following: 1. Type the URL of the person you’re calling into the input box, as shown in Figure 8-5. 2. Click the Connect button. The Connect Button changes to look as if it’s connected to a socket, and the status of the call appears at the bottom of the window. 3. When your call is answered, you have your choice of views. Choose View and in the View menu choose one of the following: • Local Video • Remote Video • Both (Picture-in-Picture) • Both (Side-by-Side) • Both In New Windows 4. To end a call, click the Connect button again. Figure 8-5: To call someone, you can type a URL directly into Ekiga’s input box. 154 Part III: Entertaining Your Brain with a Little Help from Linux 14_598236 ch08.qxp 6/27/06 7:43 PM Page 154 An easier way to make a call is to use the Ekiga Address Book, which contains the URLs that you retrieve from remote directories as well as URLs that you manually enter yourself. To use the Address Book, follow these steps: 1. Choose Tools➪Address Book. The Address Book window appears. 2. In the left pane, click the Remote Contacts disclosure triangle to show or hide directories of contacts from other locations on the Web or click the Local Contacts disclosure triangle to show or hide directories of contacts you manually enter in the Address Book. Then click the directory of contacts which you want to view. The Remote Contacts directories include by default the Ekiga White Pages directory. 3. To search for someone, type a full or partial name in the Name Contains text box at the bottom of the Address Book window. The Address Book window fills with the names of people who are listed in the chosen directory and have names that match your search. 4. Click the Name button at the top of the Name column to sort by Name or click Location to sort by Location, and so on. 5. To make a call, double-click the name of the person you want to contact. 6. To end a call, click the Connect button. Ekiga sounds like a regular phone ringing when a call comes in, so be sure your speakers are hooked up and your computer is on if you’re expecting a call. Looking Around with Pan and Tilt Several models of webcams can pan and tilt via remote control. Some of these pan-and-tilters come with stratospheric price tags, but others are more affordable. The Logitech QuickCam Orbit camera is one of the more affordable models. It sells for about $130 and sits like a small head on top of a 9-inch neck. (Logitech claims that raising the camera 9 inches high gets it more to the level of the face of someone sitting at a computer. Sounds good to me.) Different webcams can pan and tilt different numbers of degrees. For instance, the Logitech QuickCam Orbit webcam can pan 128 degrees and tilt 54 degrees. It also moves silently and quickly. It takes about 1 second for it to move from one extreme side to the other. 155 Chapter 8: Having Fun with a Webcam 14_598236 ch08.qxp 6/27/06 7:43 PM Page 155 Many existing programs let you control the pan and tilt by typing parameters on the command line — but that’s a lot of work and definitely not as much fun. One Linux program called OrbitView lets you control the pan and tilt by clicking anywhere on the image, causing the pan and tilt controls to center the image at the point that you clicked. (That’s more like it, huh?) OrbitView also lets you control the pan, tilt, and zoom by using the command line, so if you have your heart set on that, you can go for it. OrbitView is a stable program and works with any camera that uses the pwc driver — which many Logitech cameras use, as well as others. To download OrbitView, go to http://hcvl.hci.iastate.edu/OrbitView. Putting Your Webcam to Work When you’ve got your webcam set up, there are many ways you can put it to work to make your home smarter. You can use your webcam for home security purposes, for example, by streaming webcam images of your home to a Web page, as described in the earlier section “Sending your webcam images to other computers.” You can set up several webcams and stream each of them to a different Web page by using this technique. Or you can plug several wireless webcams into X10 Appliance Modules and use MisterHouse to send X10 signals to turn off all but the one camera you want to see, as I describe in the section on watching your kids from the Internet in Chapter 19. Then while you’re away from home, you can keep an eye on any areas of your home, indoors or out, where you have a webcam. For example, if you’ve left your kids at home with a babysitter, you can use any Web browser to see how things are going at home. You can also use one or more webcams to keep an eye on your garden while you’re out of town. Then if the weather gets hotter than expected and your plants start to look wilted, you can use the Rain 8 X10 sprinkler control system to give your garden extra water, as I describe in the section on watering your lawn in Chapter 19. X10.com sells several webcams that are suitable for both indoor and outdoor use — to find them, visit www.x10.com and type “outdoor webcam” in the Search text box. The wireless XCam2 sells for about $80. 156 Part III: Entertaining Your Brain with a Little Help from Linux 14_598236 ch08.qxp 6/27/06 7:43 PM Page 156 Chapter 9 Setting Up a Smart Phone System In This Chapter ᮣ Introducing a smart phone system ᮣ Getting started ᮣ Installing the hardware and software ᮣ Making a smart call W elcome to Asterisk, your open source toolkit for telephony applica- tions and a full-featured, call-processing server. Or in plain English, it’s like some of the fancy telephone equipment businesses use, but it comes with more features and is easier to set up so people like you and me can use it. You can use Asterisk as a stand-alone system, which is how I show you to use it in this chapter, or as an adjunct to a previously existing PBX or Voice Over IP (VoIP) implementation (something you’ll probably begin using within the next few years). You can add telephone applications by using the AGI (Asterisk Gateway Interface). Telephone applications allow you to do all sorts of neat things, such as getting the status of or controlling MisterHouse (software I introduce in Part VI) via your phone or getting weather or other information from the Internet and listening to it over the phone. Basically, Asterisk is your smart phone system. It has lots of features and sup- ports a lot of hardware. Many of the features you probably wouldn’t need in your home unless you have a really large family. In fact, there is so much to Asterisk that I can cover only a small fraction of what it’s capable of. I’m sorry if that sounds like a cop-out, but it’s true. To do Asterisk justice, I would have to devote an entire book to it; instead, I give you the basics in this chapter. Note: In this chapter, I cover enough to get you started with a single exten- sion, voice mail, and the ability to send and receive calls from your phone company. I make most of the configuration decisions because this makes it easier to go through the material. It’s one of those unfortunate instances where you need to have experience with the material before you can properly understand and use it. Of course, to get the experience, you have to learn the material. By using my experience, you can get started using Asterisk quicker because I give you a base to expand on. 15_598236 ch09.qxp 6/27/06 7:44 PM Page 157 [...]... number pattern you want to dial I substitute X for a single digit in my dial plan description For most of North America, you need something like this: ߜ 7-digit local dialing (XXX-XXXX) ߜ 10-digit local dialing (XXX-XXX-XXXX) to handle overlay plans ߜ 11-digit long-distance dialing (1-XXX-XXX-XXXX) ߜ Call feature dialing (*XX) ߜ Emergency (911 or 311) or information dialing (411) ߜ Operator assistance... exten => s,2,Goto(s-${DIALSTATUS},1) exten => s-NOANSWER,1,Voicemail(u${ARG1}) exten => s-NOANSWER,2,Goto(default,s,1) Chapter 9: Setting up a Smart Phone System exten => s-BUSY,1,Voicemail(b${ARG1}) exten => s-BUSY,2,Goto(default,s,1) exten => _s-.,1,Goto(s-NOANSWER,1) exten => a,1,VoicemailMain(${ARG1}) ; -[ Calls from the PSTN ] -[ from-pstn] include => daytime|8:0 0-2 2:59|*|*|* include... included context are now part of the context that pulled them in This allows you to create commonly used extensions and use them in many places, as shown in Listing 9-1 161 162 Part III: Entertaining Your Brain with a Little Help from Linux Listing 9-1 : The from-pstn Context from /etc/asterisk/extensions.conf ; -[ Calls from the PSTN ] [from-pstn] ; Timing list for includes is ; | show dialplan from-sip [ Context ‘from-sip’ created by ‘pbx_config’ ] ‘2201’ => 1 Macro(stdexten|SIP/2201) [pbx_config] Include => ‘to-pstn’ [pbx_config] mozart*CLI> -= 1 extensions (1 priorities) in 1 contexts =mozart*CLI> Chapter 9: Setting up a Smart Phone System This shows your dialplan for the context from-sip 7 Type show dialplan to-pstn... patterns, it matches the 911 part and just passes on the 2 to wherever you send the call This is why you have to select your dial plan carefully 159 160 Part III: Entertaining Your Brain with a Little Help from Linux Some businesses add 4- or 5-digit dialing for calling an extension local to the building Even though you’ll have only one extension, I show you how to use 4-digit dialing for your home setup Adding... 411, 511, 61 1, 711, and 911 directly to the PSTN without delay ߜ *xx: The SPA-3000 sends numbers that start with * and two digits — for example, *69 — to the Asterisk server ߜ 0: The SPA-3000 sends 0 directly to the Asterisk server ߜ 00: The SPA-3000 sends 00 directly to the Asterisk server ߜ 2xxx: The SPA-3000 sends any 4-digit number that starts with 2 directly to the Asterisk server ߜ [ 2-9 ]xxxxxx:... SPA-3000 sends any 7-digit number, starting with any number between 2 and 9 inclusive — for example, 5551212 — directly to the Asterisk server Chapter 9: Setting up a Smart Phone System ߜ 1xxx[ 2-9 ]xxxxxxS0: The SPA-3000 sends any 11-digit number, starting with 1 and whose 5th digit is between 2 and 9 inclusive — for example, 17325551212 — immediately to the Asterisk server ߜ xxxxxxxxxxxx.: The SPA-3000... ߜ Dial Plan 8: ([ 2-7 9]11S0|*xx|0|00|2xxx|[ 2-9 ]xxxxxx|1xxxxxxxxxxS0| xxxxxxxxxxxx.) I explain the dial plans, but not until after a few more changes So scroll down to VoIP-To-PSTN Gateway Setup and make these changes: ߜ VoIP-To-PSTN Gateway Enable: Yes ߜ One Stage Dialing: Yes ߜ Line 1 VoIP Caller DP: 8 ߜ VoIP Caller Default DP: 8 Chapter 9: Setting up a Smart Phone System Figure 9 -6 : The PSTN Line Dial... macro macro-stdexten In the macro, it then dials the extension ${PHONE1}, a variable assigned to SIP/2201 (I explain macros more at the end of this list.) 4 If the dial command returns, the call was not completed; Asterisk then uses the Goto command to jump to the correct status (s-NOANSWER for no answer, s-BUSY for a busy line, or s- for everything else that doesn’t match) a The s-NOANSWER and s-BUSY both . System 15_5982 36 ch09.qxp 6/ 27/ 06 7:44 PM Page 161 Listing 9-1 : The from-pstn Context from /etc/asterisk/extensions.conf ; -[ Calls from the PSTN ] [from-pstn] ; Timing list for includes is ;. s-NOANSWER,1,Voicemail(u${ARG1}) exten => s-NOANSWER,2,Goto(default,s,1) 162 Part III: Entertaining Your Brain with a Little Help from Linux 15_5982 36 ch09.qxp 6/ 27/ 06 7:44 PM Page 162 exten => s-BUSY,1,Voicemail(b${ARG1}) exten. [pbx_config] -= 3 extensions (3 priorities) in 1 contexts. =- mozart*CLI> 164 Part III: Entertaining Your Brain with a Little Help from Linux 15_5982 36 ch09.qxp 6/ 27/ 06 7:44 PM Page 164 So what