keywords: ip pbx voip gateway gsm gateway

×

Notice

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

OpenVox G400E - SMS send and reciving and view with php?

10 years 3 months ago #9310 by rick
Hello,
This is Rick from OpenVox support.You have two ways to handle it.
First way:
You can read the "Text" segment via your PHP program.For example:
Time: 2013-12-27 15:43:59
Span: 1
Mode: PDU
Sender: +8613632919026
SMSC: +8613800755500
Length: 4
Text: test
PDU: 0891683108705505F0040D91683136929120F600003121725134452304F4F29C0E^M
Second ways:
You can use the AMI to achive it.
At first,please enable your elasetix AMI.
1. vi /etc/asterisk/manager.conf.
set it like below:

[general]
enabled = yes
port = 5038
bindaddr = 0.0.0.0
displayconnects=no ;only effects 1.6+
[admin]
secret = 111111
deny=0.0.0.0/0.0.0.0
permit=172.16.8.42/255.255.0.0
read = system,call,log,verbose,command,agent,user,config,command,dtmf,reporting,cdr,dialplan,originate
write = system,call,log,verbose,command,agent,user,config,command,dtmf,reporting,cdr,dialplan,originate


Other steps please refer to the manual in attachment,this manual is our GSM gateway send/receive SMS manual.
It can apply to the g400e.
If you have issues still,please contact me directly,i will write a manual for you.my contact info be shown as below:
Gtalk: This email address is being protected from spambots. You need JavaScript enabled to view it.
Skype: rick.zhu3
e-mail: This email address is being protected from spambots. You need JavaScript enabled to view it.
Attachments:
10 years 3 months ago - 8 years 9 months ago #9312 by Shamanchik
Thanks:handshake

Original posted by rick at 2013-12-27 16:04



You can read the "Text" segment via your PHP program

This method is not suitable? sms does not always in English
Example my recived sms in /var/log/asterisk/sms/receive_sms
-START-
Time: 2013-12-24 14:08:54
Span: 3
Mode: PDU
Sender: BCC62DA35A605A
SMSC: +380672020000
Length: 128
Text: Близькі та знайомі з нетерпінням чекатимуть на Ваші поздоровлення з
PDU: 0791836027200000400ED0CB6CD23AA506A50008312142418035808C050003D203010411043B04380437044C043A045600200442043000200437043D04300439043E043C0456002004370020043D0435044204350440043F0456043D043D044F043C002004470435043A043004420438043C04430442044C0020043D0430002004120430044804560020043F043E04370434043E0440043E0432043B0435043D043D044F00200437
-END-
in this sms - Text: (Russian)
how to view\encoded to normal txt???
or how to encode PDU to txt with php?

UPDATE:

Hmmmm, if in extensions.conf:
[from-gsm]
exten => sms,1,Verbose(Incoming SMS from "${SMSSRC}" : "${SMSTXT}")
;exten => sms,1,Verbose(${SMSSRC})
;exten => sms,n,Verbose(${SMSTXT})
exten => sms,n,System(echo "${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M:%S)} :: ${SMSSRC} :: ${SMSTXT}:::" >> /var/www/html/sms_in.txt)
exten => sms,n,Hangup()
exten => sms_send_ok,1,NoOp(SMS send OK!)
exten => sms_send_ok,n,Hangup()
exten => sms_send_failed,1,NoOp(SMS send failed, Please check the number and try again!)
exten => sms_send_failed,n,Hangup()
include => from-pstn
result: normal view russian txt in /var/www/html/sms_in.txt
10 years 3 months ago #9318 by Shamanchik
i'm coded send_sms.php
Result: SMS sending ok in Russian text
<?phpecho "SMS send";
$text = "привет я [email protected]";#YOUR MESSAGE
include("/var/lib/asterisk/agi-bin/phpagi-asmanager.php");
$agi=new AGI_AsteriskManager;

$vst_host="127.0.0.1"; #YOUR VOXSTACK GSM GATEWAY IP ADDRESS
$vst_user="admin"; #Corresponding to your GSM gateway API settings
$vst_pwd="pass"; #Corresponding to your GSM gateway API settings
$vst_port="5038"; #Corresponding to your GSM gateway API settings

$agi_status=$agi->connect($vst_host.":".$vst_port,$vst_user,$vst_pwd);
if(!$agi_status)
  { 
    $msg="Failed to connected Asterisk,exit.."; 
    exit(0); 
  } 
    $type="gsm"; 
    $method="send"; 
    $sync="sms";
    $span="4"; #YOUR SIMcard for sending sms
    $destination="0990000000"; #YOUR DESTINATION NUMBER
    $message=mb_convert_encoding($text, "utf-8", mb_detect_encoding($text)); #if text in russian
    $timeout="30"; 
    $id="1234"; 

$agi->Command("$type $method $sync $span $destination \"$message\" $timeout $id"); 
    exit(0);
?>
experiments continue with recive SMS in Russian txt:)

i] Last edited by Shamanchik at 2014-1-10 23:46 [/i
8 years 9 months ago - 8 years 9 months ago #10479 by Shamanchik
question: howto recive multiline sms and save to txt in one record?[/color]

variable ${SMSTXT} displayed separately if long text in recive SMS ....

Asterisk log:
Incoming SMS from +380633093055 : Ви можете надіслати голосове повідомлення абоненту, з яким не змогл
Incoming SMS from +380633093055 : и зв'язатися. Просто наберіть зірочку, номер абонента (*38063309305
Incoming SMS from +380633093055 : 5) і запишіть Ваше повідомлення.
EXAMPLE my file whith SMS
/var/www/html/sms_in.txt
2015-07-10 11:36:28 :: +380633093055 :: Ви можете надіслати голосове повідомлення абоненту, з яким не змогл:::
2015-07-10 11:36:31 :: +380633093055 :: и зв'язатися. Просто наберіть зірочку, номер абонента (*38063309305:::
2015-07-10 11:36:34 :: +380633093055 :: 5) і запишіть Ваше повідомлення.:::
8 years 9 months ago - 8 years 9 months ago #10488 by X-Files
Привет =)

Ты не одинок, я уже 7 месяцев жду эту функцию..
Time to create page: 0.039 seconds
Powered by Kunena Forum