OpenWrt Forum Archive

Topic: [How To] Asterisk 11+GSM/SMS channel+Google Voice+OpenWRT SIP Client

The content of this topic has been archived between 25 Apr 2018 and 5 May 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

pilovis wrote:

...very unstable usb "overlay"...

Sad to hear this from you!
You did a great job.

May I ask your opinion on my issue with the pivot-overlay to miniSDHC in an USB-modem slot? Is it doable at all?
My goal is to run asterisk on Asus WL-330N3G with Huawei E3131 modem.

Thank you in advance.

(Last edited by booBot on 14 Apr 2016, 09:38)

usavich wrote:

Also I have compiled
asterisk18-dongle module, up and running with E1550 and E173 voice enabled modems for
asterisk dialouts.

Nice! smile

Could you please let me know were I can get the compiled asterisk18-dongle module ?
Thanks a lot for your help.

Maurizio

booBot wrote:
pilovis wrote:

...very unstable usb "overlay"...

Sad to hear this from you!
You did a great job.

May I ask your opinion on my issue with the pivot-overlay to miniSDHC in an USB-modem slot? Is it doable at all?
My goal is to run asterisk on Asus WL-330N3G with Huawei E3131 modem.

Thank you in advance.

I tried many times to use the micro-sd slot of the dongle as a USB "overlay" but never found a way to do it, the sd slot is not recognized by OpenWRT.
Use a USB flash memory instead.

(Last edited by pilovis on 14 Apr 2016, 10:49)

Sorry for the off-topic.

pilovis wrote:

I tried many times to use the micro-sd slot of the dongle as a USB "overlay" but never found a way to do it, the sd slot is not recognized by OpenWRT.
Use a USB flash memory instead.

Will using an USD-hub help me? I need both the USB-modem and - apparently - the USB-flash connected.
Will extroot work this way?

Tried to use embeeded SDcard reader with my USB modem E173, mounted successfully.

/dev/sdd1               929.7M      1.2M    880.5M   0% /mnt/sdd1

Have not tried to move overlay to it tho - because I'm using separate USB flash disk for overlay.

usavich wrote:

Tried to use embeeded SDcard reader with my USB modem E173, mounted successfully.
/dev/sdd1               929.7M      1.2M    880.5M   0% /mnt/sdd1
Have not tried to move overlay to it tho - because I'm using separate USB flash disk for overlay.

If I do it manually - no problems either - to /mnt/sda1 or /overlay, but this is not an extroot yet...

pilovis,
I tried to reach you via e-mail.
Could you please help me to compile a ramips/rt305x version of the chan_dongle for asterisk v1.8?
(I'm on Asus WL-330N3G)

Thank you in advance.

i am looking for some help. i have been stuck from few weeks. i am trying to install asterisk any version with codec_g729 support.

TL-WR1043ND v1 
OpenWrt Chaos Calmer 15.05.1 / LuCI 15.05-149-g0d8bbd2 Release (git-15.363.78009-956be55)

root@OpenWrt:~# opkg install asterisk18

root@OpenWrt:~# asterisk -r
Asterisk 1.8.32.3, Copyright (C) 1999 - 2013 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.
=========================================================================
Connected to Asterisk 1.8.32.3 currently running on OpenWrt (pid = 5185)
OpenWrt*CLI>


Now i am gona install g729.

root@OpenWrt:~# opkg install asterisk18-codec-g729
Installing asterisk18-codec-g729 (1.3-1) to root...
Downloading http://downloads.openwrt.org/chaos_calm … r71xx.ipk.
Installing bcg729 (1.0.0-1) to root...
Downloading http://downloads.openwrt.org/chaos_calm … r71xx.ipk.
Configuring bcg729.
Configuring asterisk18-codec-g729.

root@OpenWrt:~# /etc/init.d/asterisk restart
Privilege escalation protection disabled!
See https://wiki.asterisk.org/wiki/x/1gKfAQ for more details.
root@OpenWrt:~# asterisk -r
Unable to connect to remote asterisk (does /var/run/asterisk/asterisk.ctl exist?)
root@OpenWrt:~# asterisk -&
root@OpenWrt:~# Privilege escalation protection disabled!
See https://wiki.asterisk.org/wiki/x/1gKfAQ for more details.

[1]+  Done                       asterisk -
root@OpenWrt:~# asterisk -r
Unable to connect to remote asterisk (does /var/run/asterisk/asterisk.ctl exist?)
root@OpenWrt:~#

opkg list_installed | grep asterisk
asterisk18 - 1.8.32.3-4
asterisk18-codec-g729 - 1.3-1

root@OpenWrt:~# /etc/init.d/asterisk enable
root@OpenWrt:~# /etc/init.d/asterisk restart
Privilege escalation protection disabled!
See https://wiki.asterisk.org/wiki/x/1gKfAQ for more details.
root@OpenWrt:~# asterisk -cccv
Privilege escalation protection disabled!
See https://wiki.asterisk.org/wiki/x/1gKfAQ for more details.
Asterisk 1.8.32.3, Copyright (C) 1999 - 2013 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.
=========================================================================
Asterisk Dynamic Loader Starting:
Asterisk PBX Core Initializing
Registering builtin applications:
[Answer]
[BackGround]
[Busy]
[Congestion]
[ExecIfTime]
[Goto]
[GotoIf]
[GotoIfTime]
[ImportVar]
[Hangup]
[Incomplete]
[NoOp]
[Proceeding]
[Progress]
[RaiseException]
[ResetCDR]
[Ringing]
[SayAlpha]
[SayDigits]
[SayNumber]
[SayPhonetic]
[Set]
[MSet]
[SetAMAFlags]
[Wait]
[WaitExten]
Asterisk Dynamic Loader Starting:
[May  6 01:08:31] NOTICE[5449]: loader.c:1194 load_modules: 20 modules will be loaded.
[May  6 01:08:31] WARNING[5449]: loader.c:434 load_dynamic_module: Error loading module 'res_musiconhold.so': File not found
[May  6 01:08:31] WARNING[5449]: loader.c:434 load_dynamic_module: Error loading module 'res_musiconhold.so': File not found
[May  6 01:08:31] WARNING[5449]: loader.c:910 load_resource: Module 'res_musiconhold.so' could not be loaded.
[May  6 01:08:31] WARNING[5449]: loader.c:434 load_dynamic_module: Error loading module 'res_crypto': File not found
[May  6 01:08:31] WARNING[5449]: loader.c:910 load_resource: Module 'res_crypto' could not be loaded.
[May  6 01:08:31] WARNING[5449]: loader.c:434 load_dynamic_module: Error loading module 'chan_local': File not found
[May  6 01:08:31] WARNING[5449]: loader.c:910 load_resource: Module 'chan_local' could not be loaded.
res_rtp_asterisk.so => (Asterisk RTP Stack)
res_rtp_multicast.so => (Multicast RTP Engine)
SIP channel loading...
chan_sip.so => (Session Initiation Protocol (SIP))
format_wav.so => (Microsoft WAV/WAV16 format (8kHz/16kHz Signed Linear))
format_pcm.so => (Raw/Sun uLaw/ALaw 8KHz (PCM,PCMA,AU), G.722 16Khz)
format_wav_gsm.so => (Microsoft WAV format (Proprietary GSM))
format_gsm.so => (Raw GSM data)
func_callerid.so => (Party ID related dialplan functions (Caller-ID, Connected-line, Redirecting))
pbx_config.so => (Text Extension Configuration)
Segmentation fault
root@OpenWrt:~#

usavich wrote:

router2*CLI> dongle show devices
ID           Group State      RSSI Mode Submode Provider Name  Model      Firmware          IMEI             IMSI             Number
dongle0      0     Free       3    0    0                      E1550      11.608.14.15.311  3XXXXXXXXXXXX37  2XXXXXXXXXX77  Unknown
dongle1      0     Free       8    0    0                     E173       11.126.85.00.209  8XXXXXXXXXX05  2XXXXXXXXXXXX2  Unknown

Do You used it with an external powered USB hub, or with the built in ports?

It is possible then to use an android smart-phone as a sip client, for GSM voice calls?
It is possible to setup a phone number to be routed to the sip client?
(to accept and make calls from/to provider network...)

Thanks in advance.

csandor wrote:

Do You used it with an external powered USB hub, or with the built in ports?

it is better to use an external powered USB since each dongle needs more than 500 mA

It is possible then to use an android smart-phone as a sip client, for GSM voice calls?

yes, I would suggest you to use Zoiper or Csip (android sip clients)

It is possible to setup a phone number to be routed to the sip client?
(to accept and make calls from/to provider network...)

Sure wink

(Last edited by pilovis on 13 Jul 2016, 10:54)

pilovis wrote:

Sure wink

Thanks for answers...

I decided for an Asus RT-AC56, but I am not sure for the modems...
Can I succeed with Huawei E352s-2?  has voice enabled too, seems better for data. It will be recognized ?
Or E353-S2?

Or  better the E173s-2 ? As we already know that works...

csandor wrote:
pilovis wrote:

Sure wink

Thanks for answers...

I decided for an Asus RT-AC56, but I am not sure for the modems...
Can I succeed with Huawei E352s-2?  has voice enabled too, seems better for data. It will be recognized ?
Or E353-S2?

Or  better the E173s-2 ? As we already know that works...

The only dongle GSM I have tested with success is Huawey E169, I also tested E173 but with no success.
TP-Link TL-WDR3600 is a great router to use with OpenWRT, it has 2 USB ports, a lot of ram (128 Mbytes) and a fast 560 Mhz CPU.

(Last edited by pilovis on 14 Jul 2016, 13:28)

Hi Pilovis!

I've installed the Asterisk 11 packages based on your tutorial on my asus router (AC56U), the Huawei dongle E169  is connected to the USB port  3.0.

Sms sending is working.
Voip calls are working between SIP clients.

From external calling the dongle I got a busy tone and on the logs I don't see anything

From sip client to external call (603/Declined - on the client), on the asterisk cli :
RT-AC56U-8B58*CLI>
  == Using SIP RTP CoS mark 5
    -- Executing [XXXXXXXXXX@from-sip:1] Log("SIP/sanyi-00000002", "NOTICE, Dialing out from "" <sanyi> to XXXXXXXXXX through Dongle0 Provider") in new stack
[Aug  3 13:31:40] NOTICE[4436][C-00000002]: Ext. 0770208650:1 @ from-sip:  Dialing out from "" <sanyi> to 0770208650 through Dongle0 Provider
    -- Executing [XXXXXXXXXX@from-sip:2] Dial("SIP/sanyi-00000002", "dongle/dongle0/XXXXXXXXXX,60") in new stack
[Aug  3 13:31:40] WARNING[4436][C-00000002]: channel.c:180 channel_request: [dongle0] Request to call on device which can not make call at this moment
[Aug  3 13:31:40] WARNING[4436][C-00000002]: app_dial.c:2455 dial_exec_full: Unable to create channel of type 'dongle' (cause 44 - Requested channel not available)
  == Everyone is busy/congested at this time (1:0/0/1)
[Aug  3 13:31:40] WARNING[4436][C-00000002]: pbx.c:4926 pbx_extension_helper: No application 'Playtones' for extension (from-sip, XXXXXXXXXX, 3)
  == Spawn extension (from-sip,XXXXXXXXXX, 3) exited non-zero on 'SIP/sanyi-00000002'

dongle show device state dongle0
-------------- Status -------------
  Device                  : dongle0
  State                   : Dialing
  Audio                   : /dev/ttyUSB0
  Data                    : /dev/ttyUSB1
  Voice                   : Yes
  SMS                     : Yes
  Manufacturer            : huawei
  Model                   : E169
  Firmware                : 11.315.05.00.00
  IMEI                    : 359638015545142
  IMSI                    : 226050080737498
  GSM Registration Status : Registered, home network
  RSSI                    : 6, -101 dBm
  Mode                    : No Service
  Submode                 : No service
  Provider Name           : Digi.Mobil
  Location area code      : 2C1
  Cell ID                 : 3DC3
  Subscriber Number       : +4YYYYYYYYYY
  SMS Service Center      : +40770000050
  Use UCS-2 encoding      : Yes
  USSD use 7 bit encoding : No
  USSD use UCS-2 decoding : Yes
  Tasks in queue          : 0
  Commands in queue       : 0
  Call Waiting            : Disabled
  Current device state    : start
  Desired device state    : start
  When change state       : now
  Calls/Channels          : 1
    Active                : 0
    Held                  : 0
    Dialing               : 0
    Alerting              : 0
    Incoming              : 0
    Waiting               : 0
    Releasing             : 0
    Initializing          : 1

RT-AC56U-8B58*CLI> sip show peers
Name/username             Host                                    Dyn Forcerport Comedia    ACL Port     Status      Description                     
bobby/bobby               (Unspecified)                            D  Auto (No)  No             0        UNKNOWN                                     
sanyi/sanyi               192.168.32.175                           D  Auto (No)  No             58554    OK (238 ms)                                 
2 sip peers [Monitored: 1 online, 1 offline Unmonitored: 0 online, 0 offline]


extensions.conf:
[from-sip]
exten => 100,1,Dial(SIP/sanyi,30)
exten => 100,2,Hangup()

exten => 101,1,Dial(SIP/bobby,30)
exten => 100,2,Hangup()

exten => _X.,1,Log(NOTICE, Dialing out from ${CALLERID(all)} to ${EXTEN} through Dongle0 Provider)
exten => _X.,n,Dial(dongle/dongle0/${EXTEN},60)
exten => _X.,n,Playtones(congestion)
exten => _X.,n,Hangup()

[from-dongle]
exten => +4YYYYYYYYYY,1,Log(NOTICE, Incoming call from ${CALLERID(all)})
exten => +4YYYYYYYYYY,n,Dial(SIP/sanyi)
exten => +4YYYYYYYYYY,n,Hangup()

dongle.conf:
.......
[defaults]
; now you can set here any not required device settings as template
;   sure you can overwrite in any [device] section this default values

context=from-dongle                     ; context for incoming calls
group=1                         ; calling group
rxgain=0                        ; increase the incoming volume; may be negative
txgain=0                        ; increase the outgoint volume; may be negative
autodeletesms=yes               ; auto delete incoming sms
resetdongle=yes                 ; reset dongle during initialization with ATZ command
u2diag=-1                       ; set ^U2DIAG parameter on device (0 = disable everything except modem function) ; -1 not use ^U2DIAG command
usecallingpres=yes              ; use the caller ID presentation or not
callingpres=allowed_passed_screen ; set caller ID presentation          by default use default network settings
disablesms=no                   ; disable of SMS reading from device when received
                                ;  chan_dongle has currently a bug with SMS reception. When a SMS gets in during a
                                ;  call chan_dongle might crash. Enable this option to disable sms reception.
                                ;  default = no

language=en                     ; set channel default language
smsaspdu=yes                    ; if 'yes' send SMS in PDU mode, feature implementation incomplete and we strongly recommend say 'yes'
mindtmfgap=45                   ; minimal interval from end of previews DTMF from begining of next in ms
mindtmfduration=80              ; minimal DTMF tone duration in ms
mindtmfinterval=200             ; minimal interval between ends of DTMF of same digits in ms

callwaiting=auto                ; if 'yes' allow incoming calls waiting; by default use network settings

disable=no                      ; OBSOLETED by initstate: if 'yes' no load this device and just ignore this section

initstate=start                 ; specified initial state of device, must be one of 'stop' 'start' 'remote'


exten=+4YYYYYYYYYY              ; exten for start incoming calls, only in case of Subscriber Number not available!, also set to CALLERID(ndid)

dtmf=relax                      ; control of incoming DTMF detection, possible values:

[dongle0]
audio=/dev/ttyUSB0              ; tty port for audio connection;        no default value
data=/dev/ttyUSB1               ; tty port for AT commands;             no default value

; or you can omit both audio and data together and use imei=123456789012345 and/or imsi=123456789012345
;  imei and imsi must contain exactly 15 digits !
;  imei/imsi discovery is available on Linux only
imei=359638015545142
imsi=226050080737498


sip.conf:
......
[sanyi]
type=friend
username=sanyi
secret=******
host=dynamic
context=from-sip

[bobby]
type=friend
username=bobby
secret=******
host=dynamic
context=from-sip

Any ideas with the busy issue?
Could be locked/disabled the Voice feature, even if the we see "Voice: Yes" on the dongle status?
The AT^CVOICE=?  -> responds:  AT^CVOICE:(0)  - OK
A DC-UNCLOCKER from windows says VOICE disabled.
I am confused a little smile.

I think your problem is here:

csandor wrote:

  RSSI                    : 6, -101 dBm
  Mode                    : No Service
  Submode                 : No service

  Provider Name           : Digi.Mobil

does "No Service" mean no connection?
Maybe.

My dongle shows this:

RSSI                    : 10, -119 dBm
Mode                    : WCDMA
Submode                 : WCDMA
Provider Name           : 3 Italy

Also, your  RSSI (Radio Signal) is lower than mine, maybe it's a insufficient signal problem, try to move your dongle around to improve the signal.

eventually check the following guide, under "AT commands" section, the AT command instructions how to switch beetwen 3G and 2G network (use minicom serial console to give the commands to the dongle):

http://www.lovisolo.com/asterisk/softwa … mmands.pdf

(Last edited by pilovis on 4 Aug 2016, 13:44)

try this command under Asterisk cli:

dongle show devices

you should see something like this:

ID           Group State      RSSI Mode Submode Provider Name  Model      Firmware          IMEI             IMSI             Number       
dongle0      1     Free       7    5    4       3 Italy        E169       11.314.11.00.00   358xxxxxxxxxxx  222992xxxxxxxxx  +3939xxxxxxxx

the State should be "Free"

(Last edited by pilovis on 4 Aug 2016, 13:38)

pilovis wrote:

try this command under Asterisk cli:

dongle show devices

you should see something like this:

ID           Group State      RSSI Mode Submode Provider Name  Model      Firmware          IMEI             IMSI             Number       
dongle0      1     Free       7    5    4       3 Italy        E169       11.314.11.00.00   358xxxxxxxxxxx  222992xxxxxxxxx  +3939xxxxxxxx

the State should be "Free"

I've corrected with AT commands, now :

  GSM Registration Status : Registered, home network
  RSSI                    : 9, -95 dBm
  Mode                    : WCDMA
  Submode                 : WCDMA
  Provider Name           : Digi.Mobil
  Location area code      : 2C1
  Cell ID                 : 2C13DC8

The incoming still give me busy tone.

If I do an outgoing cal the dongle stuck in dialing.
I need to reboot again then the sate it is free:
ID           Group State      RSSI Mode Submode Provider Name  Model      Firmware          IMEI             IMSI             Number       
dongle0      1     Free       9    5    4       Digi.Mobil     E169       11.315.05.00.00   359638015545142  226050080737498  +40XXXXXXXXX 

The outgoing log now:

== Using SIP RTP CoS mark 5
    -- Executing [0770208650@from-sip:1] Log("SIP/sanyi-00000005", "NOTICE, Dialing out from "" <sanyi> to 0NNNNNNNNN through Dongle0 Provider") in new stack
[Aug  5 08:10:56] NOTICE[6054][C-00000005]: Ext. 0NNNNNNNNN:1 @ from-sip:  Dialing out from "" <sanyi> to 0NNNNNNNNN through Dongle0 Provider
    -- Executing [0NNNNNNNNN@from-sip:2] Dial("SIP/sanyi-00000005", "dongle/dongle0/0NNNNNNNNN,60") in new stack
    -- Called dongle/dongle0/0NNNNNNNNN
[Aug  5 08:10:56] ERROR[6040]: at_response.c:467 at_response_error: [dongle0] Dial failed
    -- Dongle/dongle0-0100000002 is circuit-busy
  == Everyone is busy/congested at this time (1:0/1/0)
[Aug  5 08:10:56] WARNING[6054][C-00000005]: pbx.c:4926 pbx_extension_helper: No application 'Playtones' for extension (from-sip, 0NNNNNNNNN, 3)
  == Spawn extension (from-sip, 0NNNNNNNNN, 3) exited non-zero on 'SIP/sanyi-00000005'
[Aug  5 08:10:56] ERROR[6040]: at_response.c:472 at_response_error: [dongle0] AT^DDSETEX failed

If i google to at_response_error: [dongle0] AT^DDSETEX  failed some forum says that voice is not enabled.

Thanks for reply.

(Last edited by csandor on 5 Aug 2016, 09:23)

at this point I really think that VOICE is disabled on your dongle sad

In my country all the E169 dongles from Wind IT and TIM IT I used, have Voice Enabled feature by default, check on Google about your dongle.

I suppose there is no alternative than follow DC-UNCLOCKER guide to enable Voice on your dongle or buy another one that has the "Voice enable" feature guaranteed.

(Last edited by pilovis on 7 Aug 2016, 05:39)

pilovis wrote:

at this point I really think that VOICE is disabled on your dongle sad

In my country all the E169 dongles from Wind IT and TIM IT I used, have Voice Enabled feature by default, check on Google about your dongle.

I suppose there is no alternative than follow DC-UNCLOCKER guide to enable Voice on your dongle or buy another one that has the "Voice enable" feature guaranteed.

Thanks for help! I have succeded after i`ve unlocked with dc-unlocker smile .
Calls in both directions are working.
The remote side hear my voice not 100% clean... but is acceptable, I will study the issue.
I've included Your modules optimizations.

Best Regards.

To improve audio quality on chan_dogle you may set up your modem to use only 3G (WCDMA) network

Commands to block modem to 3G mode:
asterisk -r (to get to asterisk console)

dongle cmd dongle0 AT^SYSCFG=14,2,3FFFFFFF,2,4

instead to block modem to 2G:
dongle cmd dongle0 AT^SYSCFG=13,1,3FFFFFFF,2,4

to disable call-waiting:
dongle cmd dongle0 AT+CCWA=0,0,1

In case of dongle memory full of SMS, to clear all SMS from dongle memory:
dongle cmd name_dongle AT+CPMS=\"SM\",\"SM\",\"SM\"
dongle cmd name_dongle AT+CMGD=1,4

to clear all SMS from SIM memory:
dongle cmd name_dongle AT+CPMS=\"ME\",\"ME\",\"ME\"
dongle cmd name_dongle AT+CMGD=1,4

(Last edited by pilovis on 29 Aug 2016, 14:20)

[HOW-TO] Send an email and restart Asterisk when a SIP trunk gets disconnected.

0) prerequisites: asterisk and mini-sendmail (no_auth SMTP server required)


1) create and edit the script:

touch /root/check-sip.sh

vi /root/check-sip.sh

#!/bin/bash
# check SIP trunk for Asterisk/OpenWRT, send an email and restart Asterisk when a SIP trunk gets disconnected
# don't forget to create a crontab to lauch this script every xx minutes
# by pilovis - parknat12@yahoo.com
#
## check for sip trunk status
checkifok=`/usr/sbin/asterisk -rx "sip show peer
xxxxxxxx" | grep Status | grep -wc OK`
## if trunk is not connected
if [[ $checkifok == 0 ]]; then
## send an email
/bin/echo "SIP Trunk
xxxxxx not registered" | /usr/sbin/mini_sendmail -fsender@mail.com -smailer-smtp.com -p25 receiver@mail.com
## then wait for 3 seconds
/bin/sleep 3
## and restarts Asterisk
/usr/sbin/asterisk -rx "sip reload"
## if trunk is OK do nothing
else
/bin/echo "Trunk OK" > /dev/null 2>&1
fi
#eof

Notes:
"/bin/echo "SIP Trunk xxxxxx not registered" | /usr/sbin/mini_sendmail -fsender@mail.com -smailer-smtp.com -p25 receiver@mail.com" is a single line!
change peer name 'xxxxxxxx' with your outbound trunk peer name as specified in /etc/asterisk/sip.conf


2) give the right permissions to the script:

chmod 755 check-sip.sh


3) create a contab to run the script every 5 minutes:

vi /etc/crontabs/root

*/5 * * * * /bin/sh /root/check-sip.sh


4) reboot to apply.

----------------------------------------------------

If you want to use "msmtp" to be able to use your Google account and SMTP Google server,
this is the line to be used to send an email:

/bin/echo "SIP Trunk xxxxxx not registered" | /usr/bin/msmtp receiver@mail.com


you also need to edit "/etc/msmtprc" with your gmail credentials,
delete everything inside the file and put the following;

account default
host smtp.gmail.com
port 587
auth on
user youraccount@gmail.com
password yourpassword
auto_from off
from youraccount@gmail.com
tls on
tls_starttls on
tls_certcheck off
logfile
syslog LOG_MAIL

Note: change "youraccount@gmail.com" and "yourpassword" with your Gmail credentials.


To install msmtp:

opkg update
opkg install msmtp

(Last edited by pilovis on 6 Sep 2016, 23:19)

this is my last (mad) creation:

OpenWRT Home Automation BOX

Features:

- 2 digital input channels (to get feedback from remote devices)
- 7 power output channels 1500 W max each (to switch ON and OFF remote devices)
- PBX Voip/GSM server (Asterisk 11 + GSM_dongle)
- remote control by phone by using DTMF tones (I created an IVR that says: "press 1 to switch on relay 1, etc")
- HD video streaming to monitor remote location (MJPG-streamer)
- 2 ways (listen/talk) remote audio streaming by phone (Baresip)
- 2 ways SMS server (receive commands and/or send back alerts/notifications) (Gnokii)
- remote/local control by web page (PHP + uhttpd)
- local control by USB keypad (Triggerhappy)
- restore the channels status after a power failure/reboot (restore the last status ON/OFF just before the power loss)

Maximum power consumption = 15W, one single power supply 12v/2.5A (I keept the original netgear PS)
This BOX can be powered by solar cells and/or by a 12V rechargeable lead battery
To save some electrical power and heating, I removed the (useless) WiFi PCI internal card because it is not supported by Barrier Breaker sad , maybe Chaos Calmer supports it, but C.C. sucks, it is almost useless since there are to many packages missing, included most of the packages I used for this BOX mad

Notes: by having a GSM dongle (GSM calls and SMS), this box can work anywere, even in a place without any internet connection.


I used (cost):

my brain (free) smile
many sleepless nights (almost free)
Openwrt Barrier Breaker (free)
Netgear DGND3700V1 router (Ebay @ 50 Euro)
USB HD webcam (local store @ 30 Euro)
8 channels Relay Board (Ebay @ 10 Euro)
USB GSM dongle Huawei E169 (Ebay @ 15 Euro)
USB audio card (local store @ 5 Euro)
Small speaker (recovered for free from my electronic trash)
USB Keypad (local store @ 5 Euro)
USB Hub (local store @ 5 Euro)

http://www.lovisolo.com/asterisk/software/openwrt/netgear-DGND2700-home-automation/20160911_183045.jpg
http://www.lovisolo.com/asterisk/software/openwrt/netgear-DGND2700-home-automation/20160911_183100.jpg
http://www.lovisolo.com/asterisk/software/openwrt/netgear-DGND2700-home-automation/20160911_183320.jpg
http://www.lovisolo.com/asterisk/software/openwrt/netgear-DGND2700-home-automation/20160911_180049.jpg

Netgear DGND3700V1 has 11 LEDs of wich 9 of them can be used to control 9 relays, fortunately these 9 LEDs do not turn on or do not start blinking during startup process smile

The downside of this router is that the internal PCI WiFi module is bad supported on OpenWRT, as a workaround you can use a different WiFI PCI board or connect an external USB WiFi dongle to the router (or use an ethernet cable).

This router is very powerful: it has 2x400 Mhz CPUs, 2xUSB2 ports, 2 integrated Switch buttons (plus reset) both usable directly by triggerhappy, 1 WAN and 4 LAN Gigabit ethernet connectors, 128 Mbytes of RAM and 32 Mbytes of Flash.

Here are the commands to switch ON the 9 LEDs (to switch them off use "echo 0 > ..."):

/bin/echo 1 > /sys/devices/platform/leds-gpio.0/leds/DGND3700v1_3800B:blue:wifi5g/brightness
/bin/echo 1 > /sys/devices/platform/leds-gpio.0/leds/DGND3700v1_3800B:green:dsl/brightness
/bin/echo 1 > /sys/devices/platform/leds-gpio.0/leds/DGND3700v1_3800B:green:inet/brightness
/bin/echo 1 > /sys/devices/platform/leds-gpio.0/leds/DGND3700v1_3800B:green:usb-back/brightness
/bin/echo 1 > /sys/devices/platform/leds-gpio.0/leds/DGND3700v1_3800B:green:usb-front/brightness
/bin/echo 1 > /sys/devices/platform/leds-gpio.0/leds/DGND3700v1_3800B:green:wifi2g/brightness
/bin/echo 1 > /sys/devices/platform/leds-gpio.0/leds/DGND3700v1_3800B:green:wps/brightness
/bin/echo 1 > /sys/devices/platform/leds-gpio.0/leds/DGND3700v1_3800B:red:inet/brightness
/bin/echo 1 > /sys/devices/platform/leds-gpio.0/leds/DGND3700v1_3800B:green:lan/brightness

LED name, Color, GPIO, #note
power, red, 22, # it turns on at bootup
power, green, 24, # it turns on and starts blinking at bootup
lan, green, 23, # usable
usb-back, green, 14, # usable
wifi2g, green, 26, # usable
wifi5g, blue, 27, # usable
dsl, green, 2, # usable
inet, red, 4, # usable
inet, green, 5, # usable
usb-front, green, 13, # usable
wps, green, 11, # usable


Board switches as seen by triggerhappy:

root@OpenWrt:~# thd --dump /dev/input/event*
EV_KEY    KEY_WPS_BUTTON    1    /dev/input/event0
# KEY_WPS_BUTTON    1    command
EV_KEY    KEY_WPS_BUTTON    0    /dev/input/event0
# KEY_WPS_BUTTON    0    command
EV_KEY    KEY_WLAN    1    /dev/input/event0
# KEY_WLAN    1    command
EV_KEY    KEY_WLAN    0    /dev/input/event0
# KEY_WLAN    0    command

KEY_WLAN = gpio-10
KEY_WPS_BUTTON =  gpio-35


Usable GPIOs:

root@OpenWrt:~# cat /sys/kernel/debug/gpio
GPIOs 0-37, bcm63xx-gpio:
gpio-2   (DGND3700v1_3800B:gre) out hi
gpio-4   (DGND3700v1_3800B:red) out hi
gpio-5   (DGND3700v1_3800B:gre) out hi
gpio-10  (wlan                ) in  hi
gpio-11  (DGND3700v1_3800B:gre) out hi
gpio-12  (reset               ) in  hi
gpio-13  (DGND3700v1_3800B:gre) out hi
gpio-14  (DGND3700v1_3800B:gre) out hi
gpio-22  (DGND3700v1_3800B:red) out hi
gpio-23  (DGND3700v1_3800B:gre) out hi
gpio-24  (DGND3700v1_3800B:gre) out lo
gpio-26  (DGND3700v1_3800B:gre) out lo
gpio-27  (DGND3700v1_3800B:blu) out lo
gpio-35  (wps                 ) in  hi

(Last edited by pilovis on 11 Sep 2016, 22:42)

Important note on Netgear DGND3700V1 and Barrier Breaker.

This router with its custom OpenWRT Barrier Breaker firmware has a very bad problem: during a reboot, invoked by a program or by the reboot command,  the router may hangs forever, unfortunately it happens quite often and the only way to recover it, it is to do a power cycle.
The problem occurs during the shutdown process, just before the reboot, it seems that some process cannot be stopped correctly.

To avoid this problem during reboot cycle, you might use the following command to do an hard_reboot of the router:

/bin/echo b > /proc/sysrq-trigger

this  is pretty much the same as pressing the reset button on a PC, no daemons will be shut down gracefully, no filesystem sync will occur (but we don't need it).

So, don't use anymore the "reboot" command (busybox) on this router, also disable watchcat and zram: 
/etc/init.d/watchcat disable
/etc/init.d/zram disable

(Last edited by pilovis on 13 Sep 2016, 19:34)