Gammu how to load balance between two modems
Question: I have two GSM USB modems connected to my server, and we use gammu send SMS.
We would like to load balance between both the modems, so that if 100 messages
are send in day 50 goes from first and 50 goes from second.

We are using standard Python code as copied from Gammu web site as given below

    
    
    import gammu
    
    sm = gammu.StateMachine()
    sm.ReadConfig()
    sm.Init()
    
    message = {
        'Text': 'python-gammu testing message', 
        'SMSC': {'Location': 1},
        'Number': '+420800123465',
    }
    
    sm.SendSMS(message)
    

How do we do that. Currently it is very haphazard. We need this balancing to
get the best out of telco provider's offer of free texts per day.

Help appreciated


Answer: I have solved this. I created two configuration files for each modem. And then
wrote a random file picker function something as trivial as below

    
    
    def randfile():
      return random.sample([gammurc1_path, gammurc2_path], 1) [0]
    

Then in the sm.ReadConfig(FileName=randfile())

And it's working comfortably

