Route Binary and Text Messages to Different SMSC Connections | Search |
NowSMS Support Forums ⬆ NowSMS Support - SMS Issues ⬆ |
◄ ► |
Author | Message | |||
Pointer Telocation New member Username: Moshetal Post Number: 10 Registered: 10-2020 |
Hi Bryce, Can i set in NowSMS 2 providers - one SMPP and One Twilio and to choose to send Text messages via Twilio and Binary data with the SMPP service? | |||
Bryce Norwood - NowSMS Support Board Administrator Username: Bryce Post Number: 8414 Registered: 10-2002 |
Hi, I moved your message to a separate topic, because there may be others who have similar needs to route text and binary messages to different SMSC connections. To do this manually, when submitting via HTTP, you can include the route name in the URL by using the &SMSCRoute=xxxxx parameter. For example, your screen capture shows the SMPP route with a route name of 9, and the text-only route has a route name of 0. If you want to force a message to the SMPP route, include a parameter of &SMSCRoute=9 when submitting the message. What if you are submitting messages via SMPP? NowSMS also implements sender-based routing. If a message is submitted where the sender/source address matches the "Sender Address" or "Default Sender Address" defined for one of your SMSC connections, then that matching connection will be used to send out the message. So, the idea is to assign a particular sender address to the SMPP connection, let's say 999999. Any messages that are submitted with a sender address of 999999 will be routed to that SMPP connection. (More explanation of this routing logic can be found at https://nowsms.com/routing-sms-messages-to-a-specifc-smsc-route) It is also possible to implement rules that can perform this type of routing automatically. These additional rules are implemented a HTTP callbacks. We call this interface "Accounting Callbacks", because it was initially implemented to interface with custom billing and charging systems. Accounting callbacks provide an interface between the NowSMS SMS Gateway and external billing and charging systems. They can also be used to control message routing, providing a way for a user application to control which SMSC connections are used for sending particular messages. These accounting callbacks are HTTP-based. When accounting callbacks are enabled, NowSMS will issue HTTP requests to a customer supplied URL in order to interface with the customer billing and charging systems. To enable SMS accounting callbacks, it is necessary to manually edit the SMSGW.INI configuration file, and define the callback URL under the [SMSGW] section header, using the following configuration parameter: SMSAccountingURL=http://server/path Whenever the SMS Gateway processes an SMS message, it issues an accounting callback by issuing an HTTP transaction to the callback URL. Variables describing the SMS message transaction are appended to the SMSAccoutingURL as HTTP GET CGI-style variables, with standard URL escaping applied for encoding reserved characters. For example: http://server/path?PreAuth=Yes&Type=SMSSend&From=UserAccount&To=%2B447777777777 &MsgCount=1&SubmitIP=127.0.0.1&Text=This%20is%20a%20test. More detail about the accounting callbacks can be found here: https://nowsms.com/doc/advanced-configuration-settings/sms-accounting-callbacks These callbacks are HTTP-based, so this generally involves setting up a separate web server...and you use whatever scripting language you're most familiar with. PHP is often a good choice for implementing these scripts. And it is also possible to install PHP on the NowSMS server, where NowSMS can run PHP scripts directly if configured to do so. NowSMS Windows interfaces with PHP-FCGI, and continuation details can be found here: https://nowsms.com/now-sms-native-php-scripts. NowSMS NextGen in Linux interfaces with PHP-FPM to provide this support: https://support.nowsms.com/discus/messages/113328/113455.html That's a lot of preliminary information ... So, let's look at how to implement an accounting callback that forces binary messages to be sent to a specific route. Here's a very simple PHP accounting callback script that does just this: <?php This example processes any callbacks that include are Type=SMSSend. If the message includes a DCS attribute, then this is a good indication that the message is a binary message. In this case, the script returns the following response: SMSCRoute=USB0 This tells NowSMS that the message needs to be routed to the SMSC Connection with a route name of USB0 ... which is a GSM Modem on my usual test system. Your script might look like this: <?php This forces binary messages to route 9 and text messages to route 0. Save this file with a .php extension, such as binaryroute.php. Then configure SMSGW.INI with the following setting under the [SMSGW] header: SMSAccountingURL=http://server/path/binaryroute.php NowSMS will now issue an HTTP request to this script for all accounting callbacks. If you installed PHP on your NowSMS server, the setting would be: SMSAccountingURL=http://nowsmslocal/php/binaryroute.php Regards, Bryce Norwood NowSMS Support |