SMS Server Tools 3
This site is hosted by Kekekasvi.com
 Menu
Basic information:
Additional information:
Support:
Get SMS Server Tools 3:
Additional Options

 Sponsored links

 Search
Custom Search

 Visitor locations
 
 SMS Server Tools 3 Community
Welcome, Guest. Please login or register. Thu Mar 28, 2024 20:07
SMSTools3 Community » Help and support Bottom

[answered] sending SMS to many numbers

  This topic is locked

Page:  1

Author Post
Member
Registered:
Dec 2010
Location: Poland
Hello,
I was looking for this feature, but I didn't find it. I'm using SMSTools in our NMS to send sms alerts. Everything works great, but I can't send the same alert to many persons - at this moment I'm making new sms for every one..The question is:what should the message form look like to be send to many numbers?Below there are some examples which I tried, but without success:

1)
To: 48600700800; 48600700801

SMSmessage

2)
To: 48600700800
To: 48600700801

SMSmessage

3)
To: 48600700800 48600700801

SMSmessage

Thanks in advance for any help in this topic.

Peter

Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
For smsd every SMS is a single file. This is because sending to some numbers may fail, delivery timestamps are stored to files, etc...

You can use checkhandler to check "To:" field(s) and create multiple files if necessary. Here is an example: Multiple recipients in single SMS file.

Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
I just edited the sample. It now allows multiple numbers in single To: field, and also multiple To: fields. Semicolon also works, but do not use it.

Member
Registered:
Dec 2010
Location: Poland
Topic owner
Sorry for bothering You about something that was already solved before Keke :]

But I'm having some problems with using this script:
My smsd.conf:


Your sample script /etc/multisms.conf:
#!/bin/bash

# Sample script to allow multiple recipients in one message file.
# Define this script as a checkhandler.

outgoing="/var/spool/sms/outgoing"

recipients=`formail -zx "To:" < "$1"`

#count=`echo "$recipients" | wc -l`
count=`echo "$recipients" | wc -w`
if [ $count -gt 1 ]; then

  # Will need echo which accepts -n argument:
  ECHO=echo
  case `uname` in
    SunOS)
      ECHO=/usr/ucb/echo
      ;;
  esac

  messagebody=`sed -e '1,/^$/ d' < "$1"`
  headers=`formail -X "" -I "To:" -f < "$1"`

  for recipient in $recipients
  do
    file=`mktemp $outgoing/send_XXXXXX`
    $ECHO "To: $recipient" > $file
    if [ "x$headers" != "x" ]; then
      $ECHO "$headers" >> $file
    fi
    $ECHO "" >> $file
    $ECHO -n "$messagebody" >> $file
  done

  # Remove processed file:
  rm $1

  # Tell to smsd that checkhandler has spooled this message:
  exit 2
fi

exit 0
 
'bash' Syntax Highlight powered by GeSHi


Result when I'm trying to restart smsd:


My smsd version:


Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
moss2k10 wrote



chmod 755 /etc/multisms.conf

Member
Registered:
Dec 2010
Location: Poland
Topic owner
Of course Keke - I've noticed this after I post my reply ;)
One more thing: your script generates random temp file names:


Is there a chance to stay with original names with only tiny changes for example: originalnameofsms_1,2,3?
In our case the name of the sms is the name of event and it's quite needed for troubleshooting..

Thanks,
Peter

Administrator
Registered:
May 2009
Location: Jyväskylä, Finland
The script can do anything what is required... ;)

Comment out the line containing mktemp and add those three lines. This will keep the original name and add _1, _2 and so on:

  do
    #file=`mktemp $outgoing/send_XXXXXX`
    [ -z $nr ] && nr=1
    file="$1_$nr"
    nr=$(($nr + 1))
 
'bash' Syntax Highlight powered by GeSHi


Perhaps a phone number also can be used. /var/spool/sms/outgoing/eventname_phonenumber:

  do
    #file=`mktemp $outgoing/send_XXXXXX`
    file="$1_$recipient"
 
'bash' Syntax Highlight powered by GeSHi


Also note that you can use your own headers in the SMS file, if they do not override existing headers in smsd (fileformat). This will add a  "Event:"  header to the file and later all details can be read from file:

  tmp=$(readlink -f $1)
  event=${tmp##*/}

  for recipient in $recipients
  do
    #file=`mktemp $outgoing/send_XXXXXX`
    [ -z $nr ] && nr=1
    file="$1_$nr"
    nr=$(($nr + 1))

    $ECHO "To: $recipient" > $file
    if [ "x$headers" != "x" ]; then
      $ECHO "$headers" >> $file
    fi
    $ECHO "Event: $event" >> $file
    $ECHO "" >> $file
    $ECHO -n "$messagebody" >> $file
  done
 
'bash' Syntax Highlight powered by GeSHi


Member
Registered:
Dec 2010
Location: Poland
Topic owner
This is exactly what I've been looking for - now our NMS alerts work epicly :mrgreen:

Big thanks for Your help Keke!
Peter

  This topic is locked

Page:  1

SMSTools3 Community » Help and support Top

 
Time in this board is UTC.  

Privacy Policy   SMS Server Tools 3 Copyright © Keijo Kasvi.