keywords: ip pbx voip gateway gsm gateway



The forum is in read only mode.
× Questions about G400/G410 Cards.

how to send/receive sms by OpenVox G400P

13 years 5 months ago #4343 by james.zhu
OpenVox G400P can be implemented to send or receive sms. I will introduce few possible ways to get the features work.
1) To receive the sms, there is a patch to get sms and store that in text format under asterisk logs,
customers can use script to parse that and save to somewhere. please refer this link:
2) To send sms, there are few things users have to consider:
2.1) the generation of content of sms, users have to store sms in a file.
2.2) the ways to send sms, from GUI or by dialplan.
here, i use dialplan to send sms. before starting the configurations, users have to go though:
1) perl and asterisk::AGI are installed. users have to download the asteriskAGI module.
asterisk-perl-1.01.tar.gz , unzip that and follow the readme.text to install that.
2) Make sure G400P is working, edit the dialplan in this way:
CONSOLE=Console/dsp ; Console interface for demo
IAXINFO=guest ; IAXtel username/password
TRUNK=Zap/G2 ; Trunk interface
sms_test="Test OpenVox G400P by james.zhu" ; default sms, users also can read the file using asterisk cmd and pass the value to the variable.
exten =>s,1,Answer()
exten =>s,n,Dial(sip/500)
exten =>1000,1,Dial(zap/1/10000)
exten =>1000,2,Hangup()
exten =>200,1,Dial(zap/3/10000)
exten =>200,2,Hangup()
exten =>300,1,Dial(zap/5/10000)
exten =>300,2,Hangup()
exten =>400,1,Dial(zap/7/10000)
exten =>400,2,Hangup()
exten => _135.,1,AGI(gsm_sms.agi|${EXTEN}|${sms_test})
exten => _135.,n,hangup
in this dialplan, if users dial 13570XXXXXX, the agi will be executed and pass to values(${EXTEN}|${sms_test} to gsm_sms.agi. the gsm_sms.agi file must be stored into
/var/lib/asterisk/agi-bin, and make sure it is executable with asterisk permission.
this is the sample file called: gsm_sms.agi:
# Simple AGI Application to show how to send sms by using OpenVox G400P
# Written by: James.zhu <This email address is being protected from spambots. You need JavaScript enabled to view it.>
# Date:12/10/2009
# include Asteisk AGI, install it first
use Asterisk::AGI;
$AGI = new Asterisk::AGI;
# default channel, use it send sms
my $channel = 3;
# the handphone number user dialed
$number = $ARGV[0];
# the sms user wants to send
$context = $ARGV[1];
# the command line to send sms by asterisk
# asterisk -rx 'gsm send sms 3 1357080XXXX "hello, this is openvox gsm card"'
#print "asterisk -rx 'gsm send sms' $channel $number $context";
# Perl system call
system("asterisk -rx 'gsm send sms $channel $number $context'");
please take a note there, i am testing with span 3, please modify that for your needs.
========asterisk log======================================
- Executing [[email protected]:1] AGI("SIP/500-0a2af738", "gsm_sms.agi|13570807XXX|"Test OpenVox G400P by james.zhu"") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/gsm_sms.agi
AGI Tx >> agi_request: gsm_sms.agi
AGI Tx >> agi_channel: SIP/500-0a2af738
AGI Tx >> agi_language: en
AGI Tx >> agi_type: SIP
AGI Tx >> agi_uniqueid: asterisk-1260351409.30
AGI Tx >> agi_callerid: 500
AGI Tx >> agi_calleridname: 500
AGI Tx >> agi_callingpres: 0
AGI Tx >> agi_callingani2: 0
AGI Tx >> agi_callington: 0
AGI Tx >> agi_callingtns: 0
AGI Tx >> agi_dnid: 1357080XXX
AGI Tx >> agi_rdnis: unknown
AGI Tx >> agi_context: from-internal
AGI Tx >> agi_extension: 13570807XXX
AGI Tx >> agi_priority: 1
AGI Tx >> agi_enhanced: 0.0
AGI Tx >> agi_accountcode:
AGI Tx >>
AGI Rx << gsm send sms 3 135708078XXX "Test OpenVox G400P by james.zhu"
AGI Tx >> 510 Invalid or unknown command
-- Remote UNIX connection
-- Remote UNIX connection disconnected
AGI Rx << gsm send sms 3 135708078XX "Test OpenVox G400P by james.zhu"
AGI Tx >> 510 Invalid or unknown command
-- AGI Script gsm_sms.agi completed, returning 0
-- Executing [[email protected]:2] Hangup("SIP/500-0a2af738", "") in new stack
== Spawn extension (from-internal, 13570807XX, 2) exited non-zero on 'SIP/500-0a2af738'
GSM 3: SMS sent successfully on span 2.
other possible solutions to send sms using G400P:
1) use asterisk cli system command: asterisk -rx 'gsm send sms 3 1357080XXXX "hello, this is openvox gsm card"'
2) save the command above into the bash file, run the system command to launch the sms.
3) send sms from GUI(PHP, i do not test that), users can login the GUI and fill in a form, which contains message and the phone numbers users want to send to, after submitting, the php file will transfer the context to a bash file. the system will be executed and send that through asterisk -rx command.

here, i give users an example of using dialplan to send SMS with few static variables. i believe it should be very possible to send sms from GUI, system commands or other solutions.



13 years 3 weeks ago #5566 by elchavez

the procedure does not explain howto receive an SMS in the dial plan.
Is there a way to do so?


13 years 3 weeks ago #5568 by Denins.Den
1 year 2 months ago #15193 by tarajensen
Thanks for your helpful post, I appreciate what you share. I want to know which messaging app is best nowadays?
1 year 2 months ago #15194 by hua

G400 is end of life , You can try to use our GSM gateway ,it supports http interface to send SMS .
Time to create page: 0.038 seconds
Powered by Kunena Forum