OpenVox Document Center OpenVox Document Center
  • Home 
  • Products 
  • Solutions 
  • Resources 
    • Document Center 
    • Datasheets 
    • Firmwares 
    • Videos 
  • Partners 
  • Blog 
  • Company 
OpenVox Document Center OpenVox Document Center
OpenVox Document Center
  • Home 
  • Products 
  • Solutions 
  • Resources 
    • Document Center 
    • Datasheets 
    • Firmwares 
    • Videos 
  • Partners 
  • Blog 
  • Company 

Wireless Gateway

  • folder icon closed folder iconUser Manual
    • SWG-4032 User Manual V2.0
    • VS GWP Series Gateway User Manual V2.0
    • SWG-3008/3016/32 User Manual V2.0
    • SWG-M20X User Manual V2.0
    • GWM401 User Manual V2.0
    • SWG-3008/3016/32 User Manual
    • SWG-M20X User Manual
    • SWG-2016/32 User Manual
    • SWG-3016/32-4S User Manual
    • VoxStack Series Wireless Gateway
  • folder icon closed folder iconAPI
    • SMS API (Get Method)
    • SMS API (Post Method)
  • folder icon closed folder iconApplication Notes
    • GSM Gateways APP Note
      • Expand Callback Function
      • APP Note_AMI
      • How to Bind the GSM Gateway Ports with PBX Sip Extension
      • OpenVox GSM Gateway HTTP Interface
      • How to Integrate the Analog Gateway and the GSM Gateway in One OpenVox Box
      • OpenVox GSM Gateway Function User Manual
      • Openvox HTTP SMS API Demo
      • OpenVox Wireless Gateway Connect with playSMS Manual
      • Remote Server Get CDR from GSM Gateway by AMI
      • VoxStack GSM Gateway API 1.0.0
      • VoxStack GSM Gateway Connect with iCallDrid Manual
      • VoxStack GSM Module Upgrading Guide
  • folder icon closed folder iconFAQ
    • Frequently Asked Questions
  • folder icon closed folder iconFunction Guide
    • The difference between the GWP Series gateway and the old version VS-GW1600/2120 Series gateway
    • Default IP and login information of various Gateways
    • SWG30XX-4S card position switching
    • Cloud Management – How to Connect to Cloud Management
    • Balance Inquiry – How to check the balance of your card on your device
    • How to update firmware when there is a file over limit pop-up
    • how to use smpp via diafaan ?
    • Interaction docking Guide
      • Wireless Gateway connects with 3CX
      • Wireless Gateway connects with asterisk16.15.1
      • Wireless Gateway FAQ connect with UC
      • Wireless Gateway connects with Freepbx15
      • Wireless Gateway connects with FreeSwitch1.10.5
    • Modify secondary dialing voice prompts
    • Product Comparison
    • USSD API Sending – How to send USSD via API
    • Secondary Dialing – How to set up secondary dialing for outbound routing
    • Card switching strategy – how to make the sim card switch according to your expectations
    • Inbound routing, outbound routing
    • Call Forwarding – How to set up call forwarding
    • Call Waiting – How to set up call waiting
    • How to upgrade the system of the gateway
    • How to translate the language of a web page into the language you want
    • How to upload and download gateway configurations
    • How to restore factory settings via web or RST button
    • Turn on call logging and AT logging – How to turn on call logging and AT logging
    • Module Upgrade – How to Upgrade Module System
    • SMS API Delivery – How to send SMS through API
    • SMS Restrictions – How to set SMS restrictions
    • Gateway connection vpn – if connecting to vpn
    • How to Enable HTTPS Certification on Gateway Web
    • CalleeID and callerID Manipulation
    • how to adjust parameter when Volte gateway voice quality is not well
    • how to adjust parameter when gsm gateway voice quality is not well
    • SNMP Guide on Wireless gateway
    • GSM & LTE Modules Frequency and Supported Operators
loading
Popular Searches
  • Array
  • Array
  • Array
  1. Home
  2. Docs
  3. Wireless Gateway
  4. Application Notes
  5. GSM Gateways APP Note
  6. OpenVox GSM Gateway HTTP Interface
Updated on September 24, 2024

Wireless Gateway

  • folder icon closed folder iconUser Manual
    • SWG-4032 User Manual V2.0
    • VS GWP Series Gateway User Manual V2.0
    • SWG-3008/3016/32 User Manual V2.0
    • SWG-M20X User Manual V2.0
    • GWM401 User Manual V2.0
    • SWG-3008/3016/32 User Manual
    • SWG-M20X User Manual
    • SWG-2016/32 User Manual
    • SWG-3016/32-4S User Manual
    • VoxStack Series Wireless Gateway
  • folder icon closed folder iconAPI
    • SMS API (Get Method)
    • SMS API (Post Method)
  • folder icon closed folder iconApplication Notes
    • GSM Gateways APP Note
      • Expand Callback Function
      • APP Note_AMI
      • How to Bind the GSM Gateway Ports with PBX Sip Extension
      • OpenVox GSM Gateway HTTP Interface
      • How to Integrate the Analog Gateway and the GSM Gateway in One OpenVox Box
      • OpenVox GSM Gateway Function User Manual
      • Openvox HTTP SMS API Demo
      • OpenVox Wireless Gateway Connect with playSMS Manual
      • Remote Server Get CDR from GSM Gateway by AMI
      • VoxStack GSM Gateway API 1.0.0
      • VoxStack GSM Gateway Connect with iCallDrid Manual
      • VoxStack GSM Module Upgrading Guide
  • folder icon closed folder iconFAQ
    • Frequently Asked Questions
  • folder icon closed folder iconFunction Guide
    • The difference between the GWP Series gateway and the old version VS-GW1600/2120 Series gateway
    • Default IP and login information of various Gateways
    • SWG30XX-4S card position switching
    • Cloud Management – How to Connect to Cloud Management
    • Balance Inquiry – How to check the balance of your card on your device
    • How to update firmware when there is a file over limit pop-up
    • how to use smpp via diafaan ?
    • Interaction docking Guide
      • Wireless Gateway connects with 3CX
      • Wireless Gateway connects with asterisk16.15.1
      • Wireless Gateway FAQ connect with UC
      • Wireless Gateway connects with Freepbx15
      • Wireless Gateway connects with FreeSwitch1.10.5
    • Modify secondary dialing voice prompts
    • Product Comparison
    • USSD API Sending – How to send USSD via API
    • Secondary Dialing – How to set up secondary dialing for outbound routing
    • Card switching strategy – how to make the sim card switch according to your expectations
    • Inbound routing, outbound routing
    • Call Forwarding – How to set up call forwarding
    • Call Waiting – How to set up call waiting
    • How to upgrade the system of the gateway
    • How to translate the language of a web page into the language you want
    • How to upload and download gateway configurations
    • How to restore factory settings via web or RST button
    • Turn on call logging and AT logging – How to turn on call logging and AT logging
    • Module Upgrade – How to Upgrade Module System
    • SMS API Delivery – How to send SMS through API
    • SMS Restrictions – How to set SMS restrictions
    • Gateway connection vpn – if connecting to vpn
    • How to Enable HTTPS Certification on Gateway Web
    • CalleeID and callerID Manipulation
    • how to adjust parameter when Volte gateway voice quality is not well
    • how to adjust parameter when gsm gateway voice quality is not well
    • SNMP Guide on Wireless gateway
    • GSM & LTE Modules Frequency and Supported Operators

OpenVox GSM Gateway HTTP Interface

Estimated reading: 10 minutes 1214 views

OpenVox GSM Gateway HTTP Interface

OpenVox gateway supply plentiful external interfaces to meet clients’ diversified needs about SMS service. OpenVox has been committed to better meet the needs of customers and create a convenient and flexible customer experience for use.The AMI and API interface consist of the whole and plentiful SMS system and interface type of the OpenVox GSM gateway for now.

The AMI interface has been using early. The API interface is just completed.

The HTTP interface of OpenVox SMS is developed to be sample to use and meet customer’s needs for the gateway compatibility with their SMS platform. We believe that you can spend less time and price to build your own SMS platform via using our HTTP interface. Absolutely, if you already have a stable and fully functional SMS platform, we also believe that you can make the SMS function of OpenVox GSM gateway compatible with your SMS platform via making a few changes, even no need to change.

HTTP to SMS Configuration

Sending SMS:

Step 1: Configure the HTTP SMS sending Interface on the OpenVox Gateway website. Enter the menu: SMSSMS Settings.HTTP to SMS, as shown in the figure below.

 

word image 978

Step 2: Enable the HTTP to SMS function as below:

Pasted 118

Enable: Enable the HTTP to SMS function, default is closed.

URL: Sending the SMS url, the parameters’ introduction are as below:

Username: The user name for certification. You can define the username or just use the one for WEB login.

Password: The secret for certification. You can define the password or just use the one for WEB login.

Phone number: The destination to send the SMS, usually the target cellphone number.

Message: The SMS context Port: Optional parameter, need to specify which port to send, such as: gsm-1.2

Report: Optional parameter, to send the type of SMS report, such as: report=String

Timeout: Timeout, milliseconds, such as: timeout=5000

word image 980

User Name: Custom user name, if u select the “Use web server’s user and password”, then use the WEB login username and secret.

Password: Custom secret, if select the “Use web server’s user and password”, then use the WEB login username and secret.

word image 981

Report: The type of news report, supporting 2 kinds of news report format, String and JSON. If you choose “No Report”, it means you don’t need the news report.

Pasted 119

When the gateway receive a HTTP request to send SMS, it will choose one port from those you selected, for the descending order. For example, if sending SMS via gsm-1.1 port for the first time, then the second time it will choose the gsm-1.2, etc.

word image 983

Debug: The level of debug messages (warning: this function is used to debug the error by technical support staff. Suggest keeping it in default. )

Timeout: Sending the timeout, default is 0, the unit is in seconds.

Wait Timeout: Waiting for the massage to report the timeout, default is 20 seconds, the unit is seconds.

GSM Send Timeout: GSM port send the timeout, default is 10 seconds, the unit is seconds.

Warning: Suggest to keep the Advance option in default or not to enable it. (After you finish the configuration, please click the save button to save it and apply it as shown infigure below.)

word image 984

Step 3: Use the HTTP interface to send SMS Try to input a URL in the browser and click the ENTER key, the gateway will get the news report back to the current page, shown as figure below.

word image 985

HTTP to SMS Samples

Use PHP to call the gateway HTTP interface, as follows:

word image 986

The results are as follows:

word image 987

SMS to HTTP Configuration

Receiving SMS:

At present we delivered the SMS the gateway received to s specific URL link address in an active way.

Step 1: Configure the HTTP interface to receive the SMS in OpenVox gateway.

Enter the menu: SMS –> SMS Settings –> HTTP to SMS, shown as figure below:

word image 988

Step 2: Enable the SMS to HTTP, shown as figure below:

Pasted 120

Hostname: the DNS host name or IP address of the server used to store resources. Sometimes, it also includes the user name and secret needed link to the server before the host name

The integer is optional. When omit, use the default port. All kinds of protocols have default port number, such as HTTP port’ default number is 80. Sometimes, for the sake of safety or others, we could redefine the port, using the non-standard port number. In this situation, the port number can not be omitted in the URL

Pasted 121

Separated by zero or more “/” symbol strings, commonly used to represent a directory or file address on the host.

word image 992

Used to deliver parameters to the dynamic web page (Such as the pages made by CGI, ISAPI, PHP/JSP/ASP/ASP or NET technology, etc.)

Step 3: Use HTTP interface to receive SMS.

Warning: Before using this instance, please make sure you’ve installed and configured the web server correctly. This instance runs on the apache server.

The GSM gateway configuration is shown as follows:

Pasted 122

SMS to HTTP Demo Code

Pasted 123

<?php
$num = $_REQUEST['num'];
$port = $_REQUEST['port'];
$portname = $_REQUEST['portname'];
$time = $_REQUEST['time'];
$status = $_REQUEST['status'];
$type = $_REQUEST['type'];
$id = $_REQUEST['id'];
$imsi = $_REQUEST['imsi'];
$sms = $_REQUEST['message'];
$filedest = "/opt/sms/smsreport";
//if(!empty($type))
if(ture)
{
//fopen($filedest, "a+");
$content = "Type: {$type}\n";
$content .= "Time: {$time}\n";
$content .= "ID: {$id}\n";
$content .= "IMSI: {$imsi}\n";
$content .= "Status: {$status}\n";
$content .= "Number: {$num}\n";
$content .= "Port: {$port}\n";
$content .= "SMS: {$sms}\n";
//echo "$content";
file_put_contents($filedest, $content.PHP_EOL, FILE_APPEND);
}
?>

 

Demo Usage:

http://172.16.6.165:80/sendsms?username=smsuser&password=smspwd&phonenumber=10086

&timeout=60&id=edeb7540&message=ye

Pasted 124

You can get more details if you capture the http(s) requests and responses:

Pasted 125

Send:

http://172.16.6.165:80/sendsms?username=smsuser&password=smspwd&phonenumber=10086

&timeout=60&id=39fd7439&message=ye

Received:

Pasted 126

Captured:

Pasted 127

Pasted 128

Supplement 1 Using Commands or AMI Interface to Send Long SMS

For now OpenVox gateway supports long SMS, no matter using WEB GUI or AMI/HTTP interface. The follows is instruction for sending long SMS via AMI interface.

 

Step 1: Try to send long SMS using the command (For more details, please learn our company’s AMI documents), shown as figure below:

word image 996

Step 2: Sending long SMS.

Warning: To send long SMS (more than 160 bytes) via AMI interface, you need to break up your text messages (article points to send), and then to send it! That can ensure the long SMS you have sent for a whole article!

Sending command:

gsm send sync csms <span> <destination> <message> <flag> <smscount> <smsequence> <timeout>

span: the port used to send SMS, such as gsm-1.1 means to send long SMS using the first port

destination: the cellphone number to receive the SMS

message: the SMS context

flag: the identity of the letter, for example, when you need to send a letter more than 160 bytes divided into two to send, you must ensure that these two orders have the same identity, scope of identity is from 00 to ff

smscount: the number of orders to split the letter, such as you need to divide the letter into 4 parts to send, then you should fill in 4

smssequence: the queue to send, for example, you need to divide the letter into 2 parts to send, then the smssequence of the first order should be 1, the second order’s should be 2, etc.

timeout: timeout to send, milliseconds

 

instance

word image 997

Instruction: In this instance dividing the letter of 8 bytes into 2 parts to send, firstly send a “test”, secondly send other “test”. But you only receive one letter and its context is “testtest” .

 

Supplement 2 Samples for Sending Long SMS via AMI Interface

Warning: to meet clients’ diversified needs, this instance is written by C language.

Runtime environment: linux

Compile command: gcc sendsms.c –o sendsms

Runtime command: ./sendsms

 

The complete code is as follows.

#include<stdio.h>

#include<string.h>

#include<stdlib.h>

#include<sys/socket.h>

#include<netinet/in.h>

#include<unistd.h>

//Login

void login_fun(int sock_fd)

{

char username[20];

char secret[20];

int login_len=0;

int secret_len=0;

int res = 0;

char receive_buf[4096];

char login_buf[40];

memset(username,'\0',20);

memset(secret,'\0',20);

printf("please input your username\n");

scanf("%s",username); fflush(stdin);

printf("please input your secret\n");

scanf("%s",secret);

fflush(stdin);

memset(login_buf,'\0',40);

sprintf(login_buf,"action:Login\r\nusername:%s\r\nsecret:%s\r\n\r\n",username, secret);

login_len = strlen(login_buf);

if(res = write(sock_fd,login_buf,login_len) == login_len){

sleep(1);

memset(receive_buf,'\0',4096);

if(res = read(sock_fd,receive_buf,sizeof(receive_buf))<0){

perror("login failed\n"); return;

}

printf("%s\n",receive_buf);

if(NULL != strstr(receive_buf,"Authentication accepted")){

printf("login success\n");

}

}

}

void sendsms_fun(int sock_fd)

{

char send_buf[4096];

char span_num[3];

char destination[12];

char message[2048];

int res;

int send_len;

char receive_buf[4096];

int SMS_Lengh = 160;

int Message_Lengh = 0;

int Divided_Lengh =152;

char segmentation_message[153];

int temp_count = 0;

int smscount = 0;

int smssequence = 1;
int i = 0;
char flag[3] = "00";
int timeout = 10;

memset(send_buf,'\0',4096);
memset(destination,'\0',11);
memset(message,'\0',2048);
memset(span_num,'\0',3);

printf("please input the span you want used\n");
scanf("%s",span_num);
fflush(stdin);
printf("please input the destination num you want send\n");
scanf("%s",destination);
fflush(stdin);
printf("Please input the message you want send\n");
scanf("%s",message);
fflush(stdin);

Message_Lengh = strlen(message);

printf("Input Message Lengh is:%d\n",Message_Lengh);

if(Message_Lengh > SMS_Lengh){     //Send Long SMS

if(Message_Lengh%Divided_Lengh == 0){

smscount = Message_Lengh/Divided_Lengh;

}else{

smscount = Message_Lengh/Divided_Lengh+1;

}
printf("The SMS will be divided into %d part send\n",smscount);
while(temp_count!=smscount)
{

for(i = 0;i<Divided_Lengh;i++){

segmentation_message[i]=message[temp_count*Divide
d_Lengh+i];

}
printf("The %d part is:\n",temp_count+1);
printf("%s\n",segmentation_message);

sprintf(send_buf,"action:Command\r\ncommand:GSM send sync csms %s %s %s %s %d %d %d\r\n\r\n",span_num,destination,segmentation_message ,flag,smscount,smssequence+temp_count,timeout );

printf("send_buf:%s\n",send_buf);

send_len = strlen(send_buf);

memset(receive_buf,'\0',4096);

printf("%s\n",send_buf);

if(res = write(sock_fd,send_buf,send_len) == send_len){

sleep(1);

if(res = read(sock_fd,receive_buf,sizeof(receive_buf))<0){

perror("send sms error\n");

return;

}

printf("%s\n",receive_buf);

if(NULL != strstr(receive_buf,"Response: Follows")){

printf("send SMS success\n");

}

}

temp_count++;

}

}else{

sprintf(send_buf,"action:Command\r\ncommand:GSM send sms %s %s %s\r\n\r\n",span_num,destination,message);

send_len = strlen(send_buf); memset(receive_buf,'\0',4096);

printf("%s\n",send_buf);

if(res = write(sock_fd,send_buf,send_len) == send_len){

sleep(1);

if(res = read(sock_fd,receive_buf,sizeof(receive_buf))<0){

perror("send sms error\n");

return;

}

printf("%s\n",receive_buf);

if(NULL != strstr(receive_buf,"Response: Follows")){

printf("send SMS success\n");

}

}

}

}




int main(void)

{

int client_socket;

struct sockaddr_in client_addr;

char ServerIp[20];

memset(ServerIp,'\0',20);

printf("Please input your server ip address\n");

scanf("%s",ServerIp);

fflush(stdin);

client_socket = socket(AF_INET,SOCK_STREAM,0);

if(client_socket < 0) {

perror("create socket error\n"); return -1;

}

client_addr.sin_family = AF_INET;

client_addr.sin_port = htons(5038);

client_addr.sin_addr.s_addr = inet_addr(ServerIp);

if(connect(client_socket,(struct sockaddr *)&client_addr,sizeof(client_addr))<0) {

perror("connect error\n"); return -1;

} else {

printf("connect to %s success\n",ServerIp);

}

//login

login_fun(client_socket);

//send SMS

sendsms_fun(client_socket);

return 0;

}

 

 

Still stuck? How can we help?

Was this page helpful? Yes No 1

How can we help?

Leave a Comment Cancel reply

CONTENTS

Copyright © 2002-2024 OpenVox all rights reserved.