Kannel configuration for multiple smsc
I have creat开发者_运维问答ed multiple SMSC SMPP connection.
after configuration i have send sms but sms is send with random smsc.
How can i control kannel to send sms with smpp which i want to send.
By default, Kannel will route the message in a round-robin way between all connected SMSCs.
There are three SMSC parameters which control the routing to a specific SMSC:
denied-smsc-id SMS messages with SMSC ID equal to any of the IDs in this list are never routed to this SMSC. Multiple entries are separated with semicolons (';')
allowed-smsc-id This list is opposite to previous: only SMS messages with SMSC ID in this list are ever routed to this SMSC. Multiple entries are separated with semicolons (';')
preferred-smsc-id SMS messages with SMSC ID from this list are sent to this SMSC instead than to SMSC without that ID as preferred. Multiple entries are separated with semicolons (';')
Juggling with these variables allows you to create from very simple to very complex routing scenarios.
Here is a very basic example:
Suppose we have 2 SMSC, smsc1
and smsc2
and we want to route sms messages to one of those 2 SMSC. In our kannel config file we add the following lines:
group = smsc
smsc-id = smsc1
allowed-smsc-id = smsc1
group = smsc
smsc-id = smsc2
allowed-smsc-id = smsc2
Now, we can specify what smsc to send through in the request to kannel sendsms interface:
GET /kannel/sendsms?smsc=SMSC_ID&to=TO&text=TEXT
where SMSC_ID can be one of smsc1
or smsc2
.
In this example, if we don't specify any smsc in the GET request, the sms will not match any of the rules for smsc1
or smsc2
and will not be sent. We can avoid this by setting a default SMSC to be used by all outgoing message with the following sendsms-user group variable:
- default-smsc string If no SMSC ID is given with the HTTP request, use this one as default route for all push messages.
group = sendsms-user
default-smsc = smsc1
Another option would be to use the denied-smsc-id
variable:
group = smsc
smsc-id = smsc1
denied-smsc-id = smsc2
group = smsc
smsc-id = smsc2
denied-smsc-id = smsc1
With this configuration, when we specify the smsc in the HTTP request the sms will be routed to the smsc with that id, but when we don't, Kannel will fall back to a round-robin between smsc1
and smsc2
.
For more advanced uses:
For a more in-depth understanding of Kannel's routing and more complex scenarios you can also check out this thread:
http://old.nabble.com/Routing-of-outgoing-sms-td19723248.html
You can specify what smsc to send through in the submission to the kannel server, for example:
GET /cgi-bin/sendsms?smsc=$smsc&username=$user&password=$password&to=$receipient&text=$text&dlr-mask=$dlrMask&dlr-url=$dlrUrl
where $smsc
should match a smsc-id
you have in your kannel.conf
Documentation here, under "Table 6-16. SMS Push (send-sms) CGI Variables".
精彩评论