Set up multiple accounts for one connection in Kannel - sms

I am stuck with a problem with Kannel. I have one SMSC (with one IP and port) but I have 2 user accounts for it. The problem is that I can't set up both user accounts for one SMSC in Kannel (only one connection.) Currently I'm setting each user account in a separate connection (2 connections.) I want to run both accounts on one smsc group in case one of them dies. How can I use two accounts with one connection?

You can do it by creating two smsc groups with the same smsc-id but with different smsc-admin-id, e.g.:
group = "smsc"
smsc-id = "my-smsc"
smsc-admin-id = "my-smsc-1"
smsc-username = "login-1"
smsc-password = "pass-1"
... other params...
group = "smsc"
smsc-id = "my-smsc"
smsc-admin-id = "my-smsc-2"
smsc-username = "login-2"
smsc-password = "pass-2"
... other params...
When sending to smsbox use the my-smsc as SMSC ID. However, if you want to do something like stop-smsc, start-smsc, etc. from the web interface, you have to use the my-smsc-1 or my-smsc-2.
Kannel will treat both connections as the same and will automatically load balance your messages over both connections. If one of them will die, Kannel will automatically move all traffic to the live connection.

Related

Mqtt connection & data publisher misinterpreted in JMeter

I have jmeter , where a single thread contains two mqtt gateway connection sampler & each sampler have three publishers connected to iothub.
Jmeter reference:
When I run the thread in loop 6frames / second for 10 seconds, I could see all 60 frames published successful in JMeter.
But when I check data count at iothub, first gate way point have received only 6 frames ( some data get missed it seems, problem with jmeter I assume ) & second gateway have received 42 frames. Second part led to major confusion, when it have to receive maximum of 30 frames, but received 42.
Diagram reference:
Each gateway (A &B) include the Connection panel with :
Iothub URL
Mqtt v 3.1.1
Username: iothuburl/device ID
Pwd: SAS token ( generated SAS from connection string available at iothubowner page from azure portal).
Each Gateway (A&B) include
three publishers & Each includes 200 JSON objects and size doesn't exceed 55kb.
Publisher QoS: 0
Operation:
For every one second, each gateway publish 3 frames ( total 600 JSON objects).
As I have mentioned 2 gateway, so total 6 frames with 1200 JSON object get published successful in JMeter.
But the data is missing at iothub.
note: while running two gateway in single thread, i could both gateway connection sharing the common connection string ID.
Any clue, where did I miss the major configuration, any help would be greatly appreciated. Thanks.
Change the QoS=1 in publisher panel. Though we have few latency time to wait for acknowledgement, but the simulation works fine without any loss of connection/data.

Kannel - Getting shortcode from POST_URL

currently we uses Kannel to connect to SMSC and receive any incoming SMS.
The setup successfully direct the message to our CGI Perl script. However, the destination address (in this case it's the shortcode) is empty. We have several shortcode configured at the SMSC therefore we need to be able to know the message is sent via which shortcode.
The current configuration is as follow:
group = sms-service
keyword =default
accept-x-kannel-headers=true
post-url= "http://127.0.0.1:8990/cgi-bin/test_shortcode.cgi?MSISDN=%p&MSG=%a&SC=%P"
max-messages =1
catch-all=yes
concatenation = 1
omit-empty = true
send-sender=true
The param SC receive empty string.
A check in the SMSC log files and the shortcode is actually found as the destination_addr:
2016-04-20 14:48:56 [20307] [6] DEBUG: dest_addr_ton: 0 = 0x00000000
2016-04-20 14:48:56 [20307] [6] DEBUG: dest_addr_npi: 1 = 0x00000001
2016-04-20 14:48:56 [20307] [6] DEBUG: destination_addr: "27626"
Any idea on why this is happening and how can we get the shortcode as the param?
Thank you
Found the issue after checking the Kannel source. Turns out Kannel will read a sequence of configuration for sending out SMS, and these setting will replace the destination number when MO is coming in. The settings i found are:
my-number
global-sender
faked-sender
Each level of setting will override the previous one, i.e. if all 3 are set, faked-sender will be in effect. By commenting off the above 3, we are able to get the correct shortcode value from the parameter %P in the post-url request.
Just posting this in case it will help somebody.

freeswitch - group dialing, registration issue

I am trying to setup a group dial for a given extension.
The bridge command I pass data specifying two call groups.
group/support|group/sales
Inside the directory I have users assigned to these call groups, some of which which are configured using only cellphone numbers by overriding the dial string parameter (no sip device).
However, when I try to call, the given user is not dialed as they are not registered (Originate Failed. Cause USER_NOT_REGISTERED. ) How can I configure a given user xml so that freeswitch will not skip over it for not being registered?
Thanks,
Matt
you can define dial-string in the user entry in the directory so that it dials the user's external number. In this example, I used loopback endpoint, and you can also define a string with the sofia gateway:
<param name="dial-string" value="[group_confirm_key=1,leg_delay_start=15]loopback/0794070224/${context}"/>
group_confirm_key defines that the user has to press 1 to accept the call -- this way you can be sure that the call does not land in voicemail.
leg_delay_start=15 is done because I have a SIP desktop phone, and I let it ring for the first 15 seconds.

How to join multiple multicast groups on one interface

The Ruby version I have available is 1.8.7 and can't be upgraded as it is part of standard image that is used on all the companies Linux servers at this time and anything I do needs to be able to run on all of these servers without issue (I'm hoping though this won't be an issue)
The project I am doing is to recreate an application that currently runs on Windows on a Linux server. The application takes a list of multicast groups and interfaces and attempts to join the groups and then listens for any data (doesn't matter what) reporting whether it could join and the data was there. It helps us in our environment prove out network connectivity prior to deployment of actual software on to the server. The data that it will be receiving will be binary encoded financial information from an exchange so I don't need to output (hence the commented out line and the output) I just need to check it is available to the server.
I have read up online and found bits and pieces of code that I have cobbled together into a small version of this where it joins 1 multicast group bound to 1 interface and listens for data for a period of time reporting whether any data was received.
I then wanted to add a second multicast group and this is where my understanding is lacking in how to achieve this. My code is as follows:
#!/usr/bin/ruby
require 'socket'
require 'ipaddr'
require 'timeout'
MCAST_GROUP_A =
{
:addr => '233.54.12.111',
:port => 26477,
:bindaddr => '172.31.230.156'
}
MCAST_GROUP_B =
{
:addr => '233.54.12.111',
:port => 18170,
:bindaddr => '172.31.230.156'
}
ipA = IPAddr.new(MCAST_GROUP_A[:addr]).hton + IPAddr.new(MCAST_GROUP_A[:bindaddr]).hton
ipB = IPAddr.new(MCAST_GROUP_B[:addr]).hton + IPAddr.new(MCAST_GROUP_B[:bindaddr]).hton
begin
sockA = UDPSocket.open
sockA.setsockopt Socket::IPPROTO_IP, Socket::IP_ADD_MEMBERSHIP, ipA
sockA.setsockopt Socket::IPPROTO_IP, Socket::IP_ADD_MEMBERSHIP, ipB
sockA.bind Socket::INADDR_ANY, MCAST_GROUP_A[:port]
sockA.bind Socket::INADDR_ANY, MCAST_GROUP_B[:port]
timeoutSeconds = 10
Timeout.timeout(timeoutSeconds) do
msg, info = sockA.recvfrom(1024)
#puts "MSG: #{msg} from #{info[2]} (#{info[3]})/#{info[1]} len #{msg.size}"
puts "MSG: <garbled> from #{info[2]} (#{info[3]})/#{info[1]} len #{msg.size}"
end
rescue Timeout::Error
puts "Nothing received connection timedout\n"
ensure
sockA.close
end
The error I get when I run this is:
[root#dt1d-ddncche21a ~]# ./UDPServer.rb
./UDPServer.rb:35:in `setsockopt': Address already in use (Errno::EADDRINUSE)
from ./UDPServer.rb:35
So that's where I am at and could really do with firstly pointers as to what is wrong (hopefully with an update to the code) and then once I this example working the next step will to be add a second interface into the mix to listen to again multiple multicast groups,
Ok so I followed the advice given to bind to the interface first for each port and then add members for each of the multicast groups I want to listen to and this has resolved this particular issue and moved me on to the next issue I have. The next issue I will raise as a new topic.

Multiple postfix output IP

I have a server with multiple public IP addresses.
I want to send campaign emails on this server.
Sometimes i would like to send mail from a particular IP (it is a filter on the sender email address that gives which IP to use).
The only thing i find is to install multiple postfix instances (one per output IP). Is there a best way to do this ?
I have a second question: Postfix gives a unique queue id to each message. If i have several instances of postfix, do you think thoses uniques id can be the same in 2 postfix instances ?
Thanks
sender_dependent_default_transport_maps is your friend. First, add this to main.cf:
sender_dependent_default_transport_maps = hash:/etc/postfix/sender-transport
Next, create the file /etc/postfix/sender-transport with
#my-sender-domain.com smtp-192-168-0-1:
Any message received with sender #my-sender-domain.com will use the service smtp-192-168-0-1 (can be any name) for sending. Don't forget to postmap /etc/postfix/sender-transport the file.
And then, add the service to master.cf
smtp-192-168-0-1 unix - - n - - smtp
-o smtp_bind_address=192.168.0.1
Again, the service name can be anything, but it must match the one on the hash file. This smtp service will send the message from the IP 192.168.0.1. Change as needed.
Add as many services and lines in the hash file as you want. Don't forget to service postfix restart after that.
There are many other options you can add to the smtp service, like -o smtp_helo_name=my.public.hostname.com, etc.
I just finished to set up a postfix like this :-)

Resources