Pages: [1]   Go Down
Author Topic: VoIP support (terminal for Asterisk)  (Read 6638 times)
0 Members and 1 Guest are viewing this topic.
Chernogolovka, Moscow dst., Russia
Offline Offline
Newbie
*
Karma: 0
Posts: 43
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Is there an Arduino to support VoIP protocols and codecs?

I want to make a network VoIP gateway with additional options. Can I use for this purpose Arduino with ethernet board?

Ogogon.
Logged

Chernogolovka, Moscow dst., Russia
Offline Offline
Newbie
*
Karma: 0
Posts: 43
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Dear Richard!

If you go on the URL http://www.nerdybynature.com/index.php/2010/09/br-r-r-r-r-ing-its-your-arduino/, then we can read the description of the project.
He does not pass through a network of sound. It transmits only the signal of an event.

Ogogon (Richard, RU3DSH)

P.S. You might be interested. I'm trying to find easily upgradeable VoIP gateway or to make it. I want to pass through the signaling protocol SIP (exact SDP) commands to control a simplex radio.

73! RU3DSH (Richard de Chernogolovka, Moscow district)
« Last Edit: April 04, 2011, 04:20:33 am by ogogon » Logged

Chernogolovka, Moscow dst., Russia
Offline Offline
Newbie
*
Karma: 0
Posts: 43
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Can you suggest some inexpensive and well-documented platform for such development?
It is desirable that are running Linux ...

Ogogon.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 48
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Dear Richard!

If you go on the URL http://www.nerdybynature.com/index.php/2010/09/br-r-r-r-r-ing-its-your-arduino/, then we can read the description of the project.
He does not pass through a network of sound. It transmits only the signal of an event.

Ogogon (Richard, RU3DSH)

P.S. You might be interested. I'm trying to find easily upgradeable VoIP gateway or to make it. I want to pass through the signaling protocol SIP (exact SDP) commands to control a simplex radio.

73! RU3DSH (Richard de Chernogolovka, Moscow district)
Has anyone else gotten this to work? It doesnt compile for me
Code:
/*
 * Asterisk Controlling Arduino Example
 *
 * A basic example displaying the ability of Asterisk
 * open-source PBX to control an LED on an Arduino with
 * an ethernet shield.
 *
 * Dan Wagoner
 * http://www.nerdybynature.com
 */

#include <Ethernet.h>

int LEDpin = 4;       //LED set to pin 4
int x;
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //must give WIZnet a MAC
byte ip[] = { 192, 168, 15, 15 };       //must configure WIZnet IP
Sserver = Server(23);       //TCP port the server is listening on
            //I'm using telnet, but you could use any
void setup()
{
  Ethernet.begin(mac, ip);
  server.begin();
  Serial.begin(9600);       //for troubleshooting purposes (not needed)
  pinMode(LEDpin, OUTPUT);
}

void loop () {
Client client = server.available();      //client connects to server

I get "cannot allocate an object of abstract type ‘Server’" right here

Code:
/*
if (client){      //if connection present
  x = client.read();      //read information coming from server
  Serial.println(x);}      //print to serial (troublshooting only)
 
if (x == 0){      //if information sent is a zero
  digitalWrite(LEDpin, LOW);}      //turn of LED
else if (x == 1){            //if information sent is a one
  digitalWrite(LEDpin, HIGH);}      //turn on LED
else if (x == 2){            //if information sent is a two
  digitalWrite(LEDpin, HIGH);      //blink the LED
  delay(500);
  digitalWrite(LEDpin, LOW);
  delay(500);}
}
Logged

Earth
Offline Offline
Edison Member
*
Karma: 41
Posts: 1387
My browser no longer is binding static IP, Floating is the way to go.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You might use Raspberry Pi as Ethernet shield, and load Asterisk at Raspberry Pi, and connect between Raspberry Pi and Arduino via usb cable.

Asterisk support;-

AGI (Asterisk Gateway Interface)
IVR (Interactive Voice Response)
TTS (Text-to-Speech, a lot of languages supported)
...

say Arduino has relay and temperature sensor, the person could call the Asterisk phone number,  go through IVR, get temperature via TTS, and switch on/off relay.
or  Arduino  push temperature reading to Asterisk AGI, and once AGI preset temperature reached, it will generate call.file and trigger asterisk make outbound call to play back prerecord sound or TTS voice.

Arduino+Asterisk could do much more, a little list here.









« Last Edit: February 24, 2013, 12:23:58 am by sonnyyu » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 48
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

ya I have both a pi and arduino with ethernet shield, I would actually rather use the pi since its cost is less than a arduino+ethernet shield. Im trying to make it so than when an extension is dialed it would trigger a relay which would than unlock an electronic lock. So maybe I need to just get it working with a standalone pi, there are plenty of sip applications that can be installed on the pi but I would need to figure out how to make them run a script when a call is received
Logged

Earth
Offline Offline
Edison Member
*
Karma: 41
Posts: 1387
My browser no longer is binding static IP, Floating is the way to go.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Arduino code:

Code:
/*
  Physical Pixel
 
 An example of using the Arduino board to receive data from the
 computer.  In this case, the Arduino boards turns on an LED when
 it receives the character 'H', and turns off the LED when it
 receives the character 'L'.
 
 The data can be sent from the Arduino serial monitor, or another
 program like Processing (see code below), Flash (via a serial-net
 proxy), PD, or Max/MSP.
 
 The circuit:
 * LED connected from digital pin 13 to ground
 
 created 2006
 by David A. Mellis
 modified 30 Aug 2011
 by Tom Igoe and Scott Fitzgerald
 
 This example code is in the public domain.

 http://www.arduino.cc/en/Tutorial/PhysicalPixel
 */

const int ledPin = 13; // the pin that the LED is attached to
int incomingByte;      // a variable to read incoming serial data into

void setup() {
  // initialize serial communication:
  Serial.begin(9600);
  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);
}

void loop() {
  // see if there's incoming serial data:
  if (Serial.available() > 0) {
    // read the oldest byte in the serial buffer:
    incomingByte = Serial.read();
    // if it's a capital H (ASCII 72), turn on the LED:
    if (incomingByte == 'H') {
      digitalWrite(ledPin, HIGH);
    }
    // if it's an L (ASCII 76) turn off the LED:
    if (incomingByte == 'L') {
      digitalWrite(ledPin, LOW);
    }
  }
}



Asterisk  code:

/etc/asterisk/extensions.conf


Code:
[general]
static=yes
writeprotect=no

[default]
exten => 1001,1,Answer()
exten => 1001,n,Dial(SIP/1001,20,tr)
exten => 1001,n,Hangup
exten => 1688,1,NoOp()
exten => 1688,n,AGI(ledon.php)
exten => 1688,n,Hangup
exten => 1689,1,NoOp()
exten => 1689,n,AGI(ledoff.php)
exten => 1689,n,Hangup


/etc/asterisk/sip.conf

Code:
[general]
context = default
bindport = 5060
bindaddr = 0.0.0.0
tcpbindaddr = 0.0.0.0
tcpenable = yes

[1001]
type = friend
callerid = User One <1001>
secret = 1001
host = dynamic
canreinvite = no
dtmfmode = rfc2833
mailbox = 1001
disallow = all
allow = ulaw
transport = udp


Asterisk AGI code

ledon.php

Code:
#!/usr/bin/php -q
<?php $c stream_context_create(array('dio' =>
array('data_rate' => 9600,
  'data_bits' => 8,
  'stop_bits' => 1,
  'parity' => 0,
  'flow_control' => 0,
  'is_blocking' => 0,
  'canonical' => 1))); // Open the port $handle = 
$handle fopen("dio.serial:///dev/ttyACM0""r+"false$c);
if (
$handle) {
//echo "Initiate port";
fwrite($handle'H');
fclose($handle);
}
exit(
0); 
?>


ledoff.php

Code:
#!/usr/bin/php -q
<?php $c stream_context_create(array('dio' =>
array('data_rate' => 9600,
  'data_bits' => 8,
  'stop_bits' => 1,
  'parity' => 0,
  'flow_control' => 0,
  'is_blocking' => 0,
  'canonical' => 1))); // Open the port $handle = 
$handle fopen("dio.serial:///dev/ttyACM0""r+"false$c);
if (
$handle) {
//echo "Initiate port";
fwrite($handle'L');
fclose($handle);
}
exit(
0); 
?>


put all AGI file into "/var/lib/asterisk/agi-bin/",  Asterisk  is need  compile at target machine and it does not support well with parallel build on multi CPU or cross compile for ARM processor. the long coffee break is needed for waiting compile finished.

dio.serial is php dio extension

install as:

apt-get install -y php5-dev php-pear
pecl install channel://pecl.php.net/dio-0.0.7

« Last Edit: February 26, 2013, 01:52:39 am by sonnyyu » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 48
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

thanks sonny
only problem is Im not sure if a serial connection to the arduino from the box running asterisk is possible due to distance requirements. Any ideas for ethernet?
Logged

Earth
Offline Offline
Edison Member
*
Karma: 41
Posts: 1387
My browser no longer is binding static IP, Floating is the way to go.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

arduino+ ethernet  shield  is ok.


ledon.php

Code:
#!/usr/bin/php -q
<?php
file_get_contents
(arduinoledonurl);
exit(
0); 
?>

Logged

Earth
Offline Offline
Edison Member
*
Karma: 41
Posts: 1387
My browser no longer is binding static IP, Floating is the way to go.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Add:
allow_url_fopen=1
in your php.ini file.

there are 2 php.ini  file at debian.

/etc/php5/apache2/php.ini
/etc/php5/cli/php.ini

since AGI is cli, add it into /etc/php5/cli/php.ini.
Logged

Pages: [1]   Go Up
Jump to: