Video: | Ozeki NG SMS Gateway for Asterisk PBX (part 1/1, configure your system) |
Asterisk is an open source IP PBX platform. With Ozeki NG SMS Gateway you can add SMS functionality to Asterisk PBX. Once you have Ozeki NG SMS Gateway installed, you can send voice mail notifications, fax notifications, missed call alerts and SMS text messages on various events. This SMS Gateway provides a much better option for SMS messaging then the built in SMS functionality of Asterisk. Ozeki NG SMS Gateway can use GSM Modem(s) attached to your server and IP SMS connections (SMPP, UCP, CIMD2, etc) to send the SMS messages.
How does it work?
To get the system working, you have to attach a GSM phone or GSM Modem to your PC with a phone-to-PC datacable (Figure 1.). This GSM phone will send the SMS messages. After the phone is attached, you need to install the Ozeki NG SMS Gateway software and configure the GSM Modem in it. Ozeki NG - SMS Gateway will be responsible for encoding the messages and for handling your phone. The next step is to install the ngSMS extension to Asterisk PBX. The ngSMS module can be downloaded on this webpage. It makes it possible for you to use the ngsms command in your asterisk configuration files.
Figure 1 - Asterisk integration with SMS Gateway
The ngsms module and Ozeki NG - SMS Gateway can be located on two different computers. Often Ozeki NG and the GSM modem is installed on Windows XP and Asterisk PBX with ngsms is running on a Linux box. When the Asterisk PBX would like to send an SMS message, the ngsms module will perform an HTTP request to Windows XP machine running Ozeki NG - SMS Gateway and Ozeki NG will send the message through the attached GSM Modem.
How to use
In this example Asterisk runs on Ubuntu Linux and Ozeki NG SMS Gateway runs on Windows XP.
On Figure 3 you can see the IP address of the computer on which Ozeki NG SMS Gateway runs. The IP address is 192.168.91.211
On Figure 3 you can see the IP address of the computer on which Ozeki NG SMS Gateway runs. The IP address is 192.168.91.211
Figure 3 - IP address of the computer where Ozeki NG SMS Gateway runs
Start Terminal on Ubuntu Linux (Figure 4).
Figure 4 - Start Terminal on Ubuntu
If Terminal is launched install Asterisk with the following command:
sudo apt-get install asterisk |
Figure 5 - Install Asterisk
Create a directory with the name ozekisms with the following command:
mkdir ozekisms |
Figure 6 - Create ozekisms directory
Enter ozekisms directory
with the following command:cd ozekisms |
Figure 7 - Enter ozekisms directory
Download ngsms.tgz:
wget http://www.ozekisms.com/attachments/1/ngSMS.tgz |
Figure 8 - Download ngsms.tgz
Extract the downloaded ngsms.tgz file:
tar -xzvf ngSMS.tgz |
Figure 9 - Extract the file
Enter ngsms directory:
cd ngSMS |
Figure 10 - Enter ngsms directory
In ngsms directory extract the file:
tar -xzvf libwww-perl-5.805.tar.gz |
Figure 11 - Extract libwww-perl file
Enter libwww-perl directory:
cd libwww-perl-5.805 |
Figure 12 - Enter libwww-perl file
Type perl Makefile.PL (Figure 13):
perl Makefile.PL |
Figure 13 - Perl Makefile.PL
Type make (Figure 14):
make |
Figure 14 - Make
Type make test (Figure 15):
make test |
Figure 15 - Make test
Type sudo make install (Figure 16). This command will compile and install libwww-perl file:
sudo make install |
Figure 16 - Compile and install libwww-perl
Move up one directory:
cd .. |
Figure 17 - Move up one directory
Extract asterisk-perl complement:
tar -xzvf asterisk-perl-0.10.tar.gz |
Figure 18 - Extract the complement
Enter the extracted directory:
cd asterisk-perl-0.10 |
Figure 19 - Enter the extracted directory
Type perl Makefile.PL (Figure 20):
perl Makefile.PL |
Figure 20 - Perl Makefile.PL
Type make (Figure 21):
make |
Figure 21 - Make
Type make test (Figure 22):
make test |
Figure 22 - Make test
Compile and install Perl module for Asterisk (Figure 23):
sudo make install |
Figure 23 - Compile and extract file
Move up one directory (Figure 24):
cd .. |
Figure 24 - Move up one directory
Create agi-bin directory in /usr/share/asterisk directory (Figure 25):
sudo mkdir /usr/share/asterisk/agi-bin |
Figure 25 - Create agi-bin directory
Copy ngsms Perl script into the created agi-bin directory under the name of ngsms (Figure 26):
sudo cp ./ngsms /usr/share/asterisk/agi-bin/ngsms |
Figure 26 - Copy ngsms script
Open ngsms Perl script to edit (Figure 27):
sudo nano /usr/share/asterisk/agi-bin/ngsms |
Figure 27 - Edit ngsms Perl script
Specify the IP adress of the computer on which Ozeki NG SMS Gateway runs at $smsgatewayline. In our example the IP address is: 192.168.91.211 (Figure 28).
Figure 28 - Define the IP address of the computer where Ozeki NG SMS Gateway is installed
In our example there is a test_config directory on the desktop that contains an extensions.confand users.conf file (Figure 29).
Figure 29 - Test_config directory
In users.conf file there are two clients: oz850 and oz851 (Figure 30).
Figure 30 - Two clients are added
In our example there is a very basic rule defined: if client oz851 is called, ngsms module will be issued and instead of telephone calling, an SMS text message will be sent out (Figure 31):
exten => 850,1,Dial(SIP/oz850) exten => 851,1,AGI(ngsms,+4412300000,This is a test message,+4412300012,,1) |
Figure 31 - Ngsms module
AGI(ngsms,+4412300000,This is a test message,+4412300012,,1)
In this format the parameters should be read as follows:
ngsms | tells AGI to launch the ngsms script |
+4412300000 | is the recipient phone number |
This is a test message | is the message text. You can use variables in it. |
+4412300012 | is the sender phone number. This can be a number or an alphanumeric string. |
is the message type. This can be any of the messagetypes below. Since it is blank the message type will be text. | |
1 | is the extra parameter. For example in a voicemail indication this should contain the number of messages in the mailbox. |
Message types:
For text messages you do not have to specify a messagetype | |
VOICEMAILON | Sets a voicemail indication on the cellphone. The extra parameter contains the number of messages in the mailbox. |
VOICEMAILOFF | Clears a voicemail indication on the cellphone. The extra parameter should be set to 0. |
FAXON | Sets a fax indication on the cellphone. The extra parameter contains the number of messages in the mailbox. |
FAXOFF | Clears a fax indication on the cellphone. The extra parameter should be set to 0. |
EMAILON | Sets an email indication on the cellphone. The extra parameter contains the number of messages in the mailbox. |
EMAILOFF | Clears an email indication on the cellphone. The extra parameter should be set to 0. |
VIDEOON | Sets a video message indication on the cellphone. The extra parameter contains the number of messages in the mailbox. |
VIDEOOFF | Clears a video message indication on the cellphone. The extra parameter should be set to 0. |
WEBLINK | Sends a webpage URL to the phone. This webpage can be opened in the phone browser with a simple click. The extra parameter should contain the URL starting with http:// |
WEBBOOKMARK | Sends a webpage bookmark to the phone. This webpage bookmark will be stored in the phone browser. The extra parameter should contain the URL starting with http:// |
Now extensions.conf file needs to be copied from test_config directory to /etc/asteriskdirectory (Figure 32):
sudo cp /home/ozeki/Desktop/test_config/extensions.conf /etc/asterisk/extensions.conf |
Figure 32 - Copy extensions.conf file
Now users.conf file also needs to be copied from test_config directory to /etc/asterisk directory (Figure 33):
sudo cp /home/ozeki/Desktop/test_config/users.conf /etc/asterisk/users.conf |
Figure 33 - Copy users.conf file
Finally, Asterisk service needs to be restart (Figure 34):
sudo service asterisk restart |
Figure 34 - Restart Asterisk
I simulated a test call: I called oz851 client and ngsms module sends out the SMS message. You can see the sent message in Ozeki NG SMS Gateway on Figure 35.
Figure 35 - Sent message
Further utilization examples
exten=>115,55,AGI(ngsms|+4412300000|You have a voicemail from ${CALLERID}. Message was recorded at ${DATETIME}|+4412300012)
exten=>115,55,AGI(ngsms|+4412300000|You have ${VMCOUNT(100)} messages|+4412300012|VOICEMAILON|${VMCOUNT(100)})
exten=>115,55,AGI(ngsms|+4412300000|Clearing voicemail indication on phone|+4412300012|VOICEMAILOFF|0)
exten=>115,55,AGI(ngsms|+4412300000|Visit www.ozekisms.com!|+4412300012|WEBLINK|http://www.ozekisms.com)
exten=>115,55,AGI(ngsms|+4412300000|Bookmark www.ozekisms.com in your phone browser|+4412300012|WEBBOOKMARK|http://www.ozekisms.com)
exten=>115,55,AGI(ngsms|+4412300000|You have ${VMCOUNT(100)} messages|+4412300012|VOICEMAILON|${VMCOUNT(100)})
exten=>115,55,AGI(ngsms|+4412300000|Clearing voicemail indication on phone|+4412300012|VOICEMAILOFF|0)
exten=>115,55,AGI(ngsms|+4412300000|Visit www.ozekisms.com!|+4412300012|WEBLINK|http://www.ozekisms.com)
exten=>115,55,AGI(ngsms|+4412300000|Bookmark www.ozekisms.com in your phone browser|+4412300012|WEBBOOKMARK|http://www.ozekisms.com)
How to set Voicemail indication on the cellphone
exten => 115,1,VoiceMail(${EXTEN}) exten => 115,55,AGI(ngsms|+4412300000|You have ${VMCOUNT(100)} messages|+4412300012|VOICEMAILON|${VMCOUNT(100)}) exten => 115,56,AGI(ngsms|+4412300000|You have a voicemail from ${CALLERID}. Message was recorded at ${DATETIME}|+4412300012) exten => 115,57,Hangup |
How to clear Voicemail indication
exten => 120,1,VoiceMailMain(${EXTEN}) exten => 120,55,AGI(ngsms|+4412300000|Clearing voicemail indication on phone|+4412300012|VOICEMAILOFF|0) exten => 120,57,Hangup |
0 comments:
Post a Comment