Internet of Things and VoIP

From Wiki for Dragino Project
Revision as of 02:12, 29 November 2012 by Edwin (Talk | contribs) (Register IP phone extensions)

Jump to: navigation, search

Introduction

This topic is talking about to set up the relationship between IoT and IP Telephony network.

We will do different tests below to show how to integrate IoT into VoIP network. We will use the open source Asterisk software here for voip connection.



Test 1: Install Asterisk in Dragino make internal calls


Purpose

Asterisk is a powerful, open source software to build telephony system. Softphone can be runed in either PC or smart phone. The purpose for this test is getting start with Asterisk and soft phone. Below is the set up of this test. Image...


Install and run Asterisk in Dragino

make sure your Dragino have network connection, Run:

root@dragino-bc8622:~# opkg update      // Update the valid package list
root@dragino-bc8622:~# opkg install asterisk18          // install asterisk v1.8
root@dragino-bc8622:~# opkg install asterisk18-app-system       // install asterisk system command applications. 

after install Asterisk, we can run:

root@dragino-bc8622:~# asterisk                        // Start Asterisk Server
root@dragino-bc8622:~# asterisk -vvvvvvgrc             // Connect to Asterisk Server console, here we can see debug info for asterisk server. 
Asterisk 1.8.7.1, Copyright (C) 1999 - 2011 Digium, Inc. and others.
Created by Mark Spencer <markster@digium.com>
Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type 'core show license' for details.
=========================================================================
  == Parsing '/etc/asterisk/asterisk.conf':   == Found
Connected to Asterisk 1.8.7.1 currently running on dragino-bc8622 (pid = 1207)
Verbosity was 0 and is now 6
   -- Remote UNIX connection
dragino-bc8622*CLI>


Register IP phone extensions

Set up phone extensions, modify the file /etc/asterisk/sip.conf and add below at the end of this file.

[dragino-test1]
type=friend                     ; Friends place calls and receive calls
context=demo                ; Context for incoming calls from this user
secret=password
host=dynamic                    ; This peer register with us
dtmfmode=rfc2833                ; Choices are inband, rfc2833, or info
allow=ulaw                      ; dtmfmode=inband only works with ulaw or alaw!
[dragino-test2]
type=friend                     ; Friends place calls and receive calls
context=demo                ; Context for incoming calls from this user
secret=password
host=dynamic                    ; This peer register with us
dtmfmode=rfc2833                ; Choices are inband, rfc2833, or info
allow=ulaw                      ; dtmfmode=inband only works with ulaw or alaw!

After modify the sip.conf file, we can run below command to active the change

dragino-bc8622*CLI> core reload

This Dragino has a IP 192.168.1.5. So now the complete resigster infomation for these two accounts are as below:

Account 1:
Server IP: 192.168.1.5
Username: dragino-test1
Password: password
Account 2:
Server IP: 192.168.1.5
Username: dragino-test2
Password: password

Now we need to register the Android Mobile to the server, to do this , you can download the free softphone 3CXPhone and install in Android. then create a profile in 3CXphone and input below info:

  • Name: Dragino-Test
  • User: dragino-test1
  • ID: dragino-test1
  • Password: password
  • Local PBX IP: 192.168.1.5

Save this profile and the Android phone can register to the Dragino. you should be able to see below info in Dragion after registered:

   -- Registered SIP 'dragino-test1' at 192.168.1.220:33696
      > Saved useragent "3CXPhone for Android 2.0.5" for peer dragino-test1

To make internal calls, we need another extensions, we can set up this in a PC. Download and install the free softphone x-lite and set up with Account 2 info.


Assign Number to extension and make calls

Now we have two extensions in this small phone system now, how to make calls? To do this, we need to modify the /etc/asterisk/extensions.conf file. open this file and find the context [demo], add:

exten => 501,1,Dial(SIP/dragino-test1,20,tr)	; number 501 is call to Account 1. 
exten => 502,1,Dial(SIP/dragino-test2,20,tr)	; number 501 is call to Account 2. 

Then save the change and reload asterisk in asterisk console.