Asterisk cmd Sms

Mobile VoIP Solutions
Provider Plan Details
Rebtel VoIP Cheap International Calling
  • Free Calls to your Rebtel friends
  • Cheap international calls to any phone
  • Make calls from your PC, iPhone, Android phone, or BlackBerry


Note: Update for latest issue, see bug 2973

SMS Service in the USA

Q: Is it possible to use the sms_app over zap without the .call file?
A: in newer versions of asterisk there is smsq - a tool that sends sms from the command line.

Please note that there's also chan_mobile that omes with the application MobileSendSMS() for mobile phones that are connected to Asterisk via Bluetooth.


Communicates with both SMS service centres and SMS capable analogue phones
Can exchange SMS with Asterisk servers using IAX2 (and maybe also other protocols)

Note: Some VoIP phones (like the SNOM products) support SMS, however the term "SMS" doesn't necessarily always refer to GSM-based SMS - it can also mean "instant message as sent by MSN".



SMS(queuename|[s]|number|message) deprecated

aanswer, i.e. send initial FSK packet.
sact as service centre talking to a phone.

SMS handles exchange of SMS data with a call to/from SMS capable phone or SMS PSTN service centre. Can send and/or receive SMS messages.

Returns 0 if call handled correctly, or -1 if there were any problems.

Note: Usage of the second variant, to queue a message, is depricated in favour of the command line application smsq.


SMS() is an application to handles calls to/from text message capable phones and message centres using ETSI ES 201 912 protocol 1 FSK messaging over analogue calls.

Basically it allows sending and receiving of text messages over the PSTN. It is compatible with BT Text service in the UK and works on ISDN and PSTN lines. It is designed to connect to an ISDN or zap interface directly and uses FSK so would probably not work over any sort of compressed link.

The SMS module for asterisk was developed by Adrian Kennard, and is an implementation of the ETSI specification for landline SMS, ETSI ES 201 912, which is available from Landline SMS is starting to be available in various parts of Europe, and is available from BT in the UK. However, asterisk would allow gateways to be created in other locations such as the US, and use of SMS capable phones such as the Magic Messenger. SMS works using analogue or ISDN lines.


Short Message Service (SMS), or texting is very popular between mobile phones. A message can be sent between two phones, and normally contains 160 characters. There are ways in which various types of data can be encoded in a text message such as ring tones, and small graphic, etc. Text messaging is being used for voting and competitions, and also spam...

Sending a message involves the mobile phone contacting a message centre (SMSC) and passing the message to it. The message centre then contacts the destination mobile to deliver the message. The SMSC is responsible for storing the message and trying to send it until the destination mobile is available, or a timeout.

Landline SMS works in basically the same way. You would normally have a suitable text capable landline phone, or a separate texting box such as a Magic Messenger on your phone line. This sends a message to a message centre your telco provides by making a normal call and sending the data using 1200 Baud FSK signaling according to the ETSI spec. To receive a message the message centre calls the line with a specific calling number, and the text capable phone answers the call and receives the data using 1200 Baud FSK signaling. This works particularly well in the UK as the calling line identity is sent before the first ring, so no phones in the house would ring when a message arrives.

Typical use with asterisk

Sending messages from an asterisk box can be used for a variety of reasons, including notification from any monitoring systems, email subject lines, etc.
Receiving messages to an asterisk box is typically used just to email the messages to someone appropriate - we email and texts that are received to our direct numbers to the appropriate person. Received messages could also be used to control applications, manage competitions, votes, post items to IRC, anything.
Using a terminal such as a magic messenger, an asterisk box could ask as a message centre sending messages to the terminal, which will beep and pop up the message (and remember 100 or so messages in its memory).


SMSShort Message Service, i.e. text messages
SMSCShort Message Service Centre. The system responsible for storing and forwarding messages
MOMobile Originated. A message on its way from a mobile or landline device to the SMSC
MTMobile Terminated. A message on its way from the SMSC to the mobile or landline device
RXReceive. A message coming in to the asterisk box
TXTransmit. A message going out of the asterisk box

Sub address

When sending a message to a landline, you simply send to the landline number. In the UK, all of the mobile operators (bar one) understand sending messages to landlines and pass the messages to the BTText system for delivery to the landline.

The specification for landline SMS allows for the possibility of more than one device on a single landline. These can be configured with Sub addresses which are a single digit. To send a message to a specific device the message is sent to the landline number with an extra digit appended to the end. The telco can define a default sub address (9 in the UK) which is used when the extra digit is not appended to the end. When the call comes in, part of the calling line ID is the sub address, so that only one device on the line answers the call and receives the message.

Sub addresses also work for outgoing messages. Part of the number called by the device to send a message is its sub address. Sending from the default sub address (9 in the UK) means the message is delivered with the sender being the normal landline number. Sending from any other sub address makes the sender the landline number with an extra digit on the end.

Using asterisk, you can make use of the sub addresses for sending and receiving messages. Using DDI (DID, i.e. multiple numbers on the line on ISDN) you can also make use of many different numbers for SMS.

Build / installation

app_sms.c is included in the latest cvs. It lives in the asterisk source apps directory and is included in the object list ( in apps/Makefile.
smsq.c is a stand alone helper application which is used to send SMSs from the command line. It uses the popt library. A line for your make file is:-

smsq: smsq.c
cc -O -o smsq smsq.c -l popt

Note: Not sure if or where smsq.c would go in the CVS. Can get from bug 2973

On Ubuntu 6.06 i needed to install libopt-dev first:
sudo apt-get install libpopt-dev


The following contexts are recommended.

; Mobile Terminated, RX. This is used when an incoming call from the SMS arrives, with the queue (called number and sub address) in ${EXTEN}
; Running an app after receipt of the text allows the app to find all messages in the queue and handle them, e.g. email them.
; The app may be something like smsq --process=somecommand --queue=${EXTEN} to run a command for each received message
; See below for usage
exten = _X.,1,SMS(${EXTEN}|a)
exten = _X.,2,System(someapptohandleincomingsms ${EXTEN})
exten = _X.,3,Hangup

; Mobile originated, RX. This is receiving a message from a device, e.g. a Magic Messenger on a sip extension
; Running an app after receipt of the text allows the app to find all messages in the queue and handle then, e.g. sending them to the public SMSC
; The app may be something like smsq --process=somecommand --queue=${EXTEN} to run a command for each received message
; See below for example usage
exten = _X.,1,SMS(${EXTEN}|sa)
exten = _X.,2,System(someapptohandlelocalsms ${EXTEN})
exten = _X.,3,Hangup

smsmtrx is normally accessed by an incoming call from the SMSC. In the UK this call is from a CLI of 080058752X0 where X is the sub address. As such a typical usage in the extensions.conf at the point of handling an incoming call is:-

exten = _X./8005875290,1,Goto(smsmtrx,${EXTEN},1)
exten = _X./_80058752[0-8]0,1,Goto(smsmtrx,${EXTEN}-${CALLERIDNUM:8:1},1)

Alternatively, if you have the correct national prefix on incoming CLI, e.g. using zaphfc, you might use:-

exten = _X./08005875290,1,Goto(smsmtrx,${EXTEN},1)
exten = _X./_080058752[0-8]0,1,Goto(smsmtrx,${EXTEN}-${CALLERIDNUM:9:1},1)

smsmorx is normally accessed by a call from a local sip device connected to a Magic Messenger. It could however by that you are operating asterisk as a message centre for calls from outside. Either way, you look at the called number and goto smsmorx. In the UK, the SMSC number that would be dialed is 1709400X where X is the caller sub address. As such typical usage in extension.config at the point of handling a call from a sip phone is:-

exten = 17094009,1,Goto(smsmorx,${CALLERIDNUM},1)
exten = _1709400[0-8],1,Goto(smsmorx,${CALLERIDNUM}-{EXTEN:7:1},1)

Using smsq

smsq is a simple helper application designed to make it easy to send messages from a command line. it is intended to run on the asterisk box and have direct access to the queue directories for SMS and for asterisk.

In its simplest form you can send an SMS by a command such as

smsq 0123456789 This is a test to 0123456789

This would create a queue file for a mobile originated TX message in queue 0 to send the text "This is a test to 0123456789" to 0123456789. It would then place a file in the /var/spool/asterisk/outgoing directory to initiate a call to 17094009 (the default message centre in smsq) attached to application SMS with argument of the queue name (0).

Normally smsq will queue a message ready to send, and will then create a file in the asterisk outgoing directory causing asterisk to actually connect to the message centre or device and actually send the pending message(s).

Using --process, smsq can however be used on received queues to run a command for each file (matching the queue if specified) with various environment variables set based on the message (see below);

smsq options:-

--help Show help text
--usage Show usage
--queue-qSpecify a specific queue. In no specified, messages are queued under queue "0"
--da-dSpecify destination address
--oa-oSpecify originating address. This also implies that we are generating a mobile terminated message
--ud-mSpecify the actual message
--ud-file-fSpecify a file to be read for the context of the message. A blank filename (e.g. --ud-file= on its own) means read stdin. Very useful when using via ssh where command line parsing could mess up the message.
--mt-tMobile terminated message to be generated
--mo Mobile originated message to be generated (default)
--tx Transmit message (default)
--rx-rGenerate a message in the receive queue
--UTF-8 Treat the file as UTF-8 encoded (default)
--UCS-1 Treat the file as raw 8 bit UCS-1 data, not UTF-8 encoded
--UCS-2 Treat the file as raw 16 bit bigendian USC-2 data
--process Specific a command to process for each file in the queue. Implies --rx and --mt if not otherwise specified. Sets environment variables for every possible variable, and also ud, ud8 (USC-1 hex), and ud16 (USC-2 hex) for each call. Removes files.
--motx-channel Specify the channel for motx calls. May contain X to use sub address based on queue name or may be full number. Default is Local/1709400X
--motx-callerid Specify the caller ID for motx calls. The default is the queue name without -X suffix
--motx-wait Wait time for motx call (default 10)
--motx-delay Retry time for motx call (default 1)
--motx-retries Retries for motx call (default 10)
--mttx-channel Specify the channel for mttx calls. Default is Local/ and the queue name without -X suffix
--mtttx-callerid Specify the callerid for mttx calls. May include X to use sub address based on queue name or may be full number (default is 080058752X0)
--mttx-wait Wait time for mttx call (default 10)
--mttx-delay Retry time for mttx call (default 30)
--mttx-retries Retries for mttx call (default 100)
--default-sub-address The default sub address assumed (e.g. for X in CLI and dialled numbers as above) when none added (-X) to queue (default 9)
--no-dial-xCreate queue, but do not dial to send message
--no-wait Do not wait if a call appears to be in progress. This could have a small window where a mesdsage is queued but not sent, so regular calls to smsq should be done to pick up any missed messages
--concurrent How many concurrent calls to allow, per queue (default 1)
--mr-nMessage reference
--pid-pProtocol ID
--dcs Data coding scheme
--udh Specific hex string of user data header specified (not including the initial length byte). May be a blank string to indicate header is included in the user data already but user data header indication to be set.
--srr Status report requested
--rp Return path requested
--vp Specify validity period (seconds)
--scts Specify timestamp (YYYY-MM-DDTHH:MM:SS)
--spool-dir Spool dir (in which sms and outgoing are found). Default /var/spool/asterisk

Other arguments starting '-' or '--' are invalid and will cause an error. Any trailing arguments are processed as follows:-

  • If the message is mobile originating and no destination address has been specified, then the first argument is assumed to be a destination address
  • If the message is mobile terminating and no destination address has been specified, then the first argument is assumed to be the queue name
  • If there is no user data, or user data file specified, then any following arguments are assumed to be the message, which are concatenated.
  • If no user data is specified, then no message is sent. However, unless --no-dial is specified, smsq checks for pending messages and generates an outgoing anyway

Note that when smsq attempts to make a file in /var/spool/asterisk/outgoing, it checks if there is already a call queued for that queue. It will try several filenames, up to the --concorrent setting. If these files exists, then this means asterisk is already queued to send all messages for that queue, and so asterisk should pick up the message just queued. However, this alone could create a race condition, so if the files exist then smsq will wait up to 3 seconds to confirm it still exists or if the queued messages have been sent already. The --no-wait turns off this behaviour. Basically, this means that if you have a lot of messages to send all at once, asterisk will not make unlimited concurrent calls to the same message centre or device for the same queue. This is because it is generally more efficient to make one call and send all of the messages one after the other.

smsq can be used with no arguments, or with a queue name only, and it will check for any pending messages and cause an outgoing if there are any. It only sets up one outgoing call at a time based on the first queued message it finds. A outgoing call will normally send all queued messages for that queue. One way to use smsq would be to run with no queue name (so any queue) every minute or every few seconds to send pending message. This is not normally necessary unless --no-dial is selected. Note that smsq does only check motx or mttx depending on the options selected, so it would need to be called twice as a general check.

UTF-8 is used to parse command line arguments for user data, and is the default when reading a file. If an invalid UTF-8 sequence is found, it is treated as UCS-1 data (i.e, as is).

The --process option causes smsq to scan the specified queue (default is mtrx) for messages (matching the queue specified, or any if queue not specified) and run a command and delete the file. The command is run with a number of environment variables set as follows. Note that these are unset if not needed and not just taken from the calling environment. This allows simple processing of incoming messages

$queueSet if a queue specified
$?srrsrr is set (to blank) if srr defined and has value 1.
$?rprp is set (to blank) if rp defined and has value 1.
$udUser data, UTF-8 encoding, including any control characters, but with nulls stripped out. Useful for the content of emails, for example, as it includes any newlines, etc.
$udeUser data, escaped UTF-8, including all characters, but control characters \n, \r, \t, \f, \xxx and \ is escaped as \\. Guaranteed one line printable text, so useful in Subject lines of emails, etc
$ud8Hex UCS-1 coding of user data (2 hex digits per character). Present only if all user data is in range U+0000 to U+00FF
$ud16Hex UCS-2 coding of user data (4 hex digits per chartacter)
otherOther fields set using their field name, e.g. mr, pid, dcs, etc. udh is a hex byte string

File formats

By default all queues are held in a director /var/spool/asterisk/sms. Within this directory are sub directories mtrx, mttx, morx, motx which hold the received messages and the messages ready to send. Also, /var/log/asterisk/sms is a log file of all messages handled.

The file name in each queue directory starts with the queue parameter to SMS which is normally the CLI used for an outgoing message or the called number on an incoming message, and may have -X (X being sub address) appended. If no queue ID is known, then 0 is used by smsq by default. After this is a dot, and then any text. Files are scanned for matching queue ID and a dot at the start. This means temporary files being created can be given a different name not starting with a queue (we recommend a . on the start of the file name for temp files).

Files in these queues are in the form of a simple text file where each line starts with a keyword and an = and then data. udh and ud have options for hex encoding, see below.

UTF-8. The user data (ud) field is treated as being UTF-8 encoded unless the DCS is specified indicating 8 bit formart. If 8 bit format is specified then the user data is sent as is.

The keywords are as follows:-
oaOriginating address. The phone number from which the message came. Present on mobile terminated messages and is the CLI for morx messages
daDestination Address. The phone number to which the message is sent. Present on mobile originated messages
sctsThe service centre time stamp. Format YYYY-MM-DDTHH:MM:SS. Present on mobile terminated messages
pidOne byte decimal protocol ID. See GSM specs for more details. Normally 0 or absent
dcsOne byte decimal data coding scheme. If omitted, a sensible default is used (see below). See GSM specs for more details
mrOne byte decimal message reference. Present on mobile originated messages, added by default if absent
srr0 or 1 for status report request. Does not work in UK yet, not implemented in app_sms yet
rp0 or 1 return path. See GSM specs for details
vpValidity period in seconds. Does not work in UK yet
udhHex string of user data header prepended to the SMS contents, excluding initial length byte. Consistent with ud, this is specified as udh# rather than udh=. If blank, this means that the udhi flag will be set but any user data header must be in the ud field
udUser data, may be text, or hex, see below.

udh is specified as as udh# followed by hex (2 hex digits per byte). If present, then the user data header indicator bit is set, and the length plus the user data header is added to the start of the user data, with padding if necessary (to septet boundary in 7 bit format).

User data can hold an USC character codes U+0000 to U+FFFF. Any other characters are coded as U+FEFF
ud can be specified as ud= followed by UTF-8 encoded text if it contains no control characters, i.e. only (U+0020 to U+FFFF). Any invalid UTF-8 sequences are treated as is (U+0080-U+00FF).
ud can also be specified as ud# followed by hex (2 hex digits per byte) containing characters U+0000 to U+00FF only.
ud can also be specified as ud## followed by hex (4 hex digits per byte) containing UCS-2 characters.
When written by app_sms (e.g. incoming messages), the file is written with ud= if it can be (no control characters). If it cannot, the a comment line ;ud= is used to show the user data for human readability and ud# or ud## is used.

Delivery reports

The SMS specification allows for delivery reports. These are requested using the srr bit. However, as these do not work in the UK yet they are not fully implemented in this application. If anyone has a telco that does implement these, please let me know. BT in the UK have a non standard way to do this by starting the message with *0#, and so this application may have a UK specific bodge in the near future to handle these.

The main changes that are proposed for delivery report handling are :-

  • New queues for sent messages, one file for each destination address and message reference.
  • New field in message format, user reference, allowing applications to tie up their original message with a report.
  • Handling of the delivery confirmation/rejection and connecting to the outgoing message - the received message file would then have fields for the original outgoing message and user reference allowing applications to handle confirmations better.

Usage in various countries

FranceFrance Telecom080910100001410049X0
NetherlandsKPN Telecom0673644444067364444400
NetherlandsCreditFUN Media (1)0107447770not available
South AfricaTelkom (2)10919690881091969

  1. Accept currently only SMS for and from dutch phone
  2. Only for SMS to and from south-african phones


In the UK, British Telecom provide BTText. There is no charge for having the servic available. Sending incurs a charge per message delivered and there is no charge for messages received. The servcie works on PSTN, ISDN2 and ISDN30 services. As normal, caller display or CLIP services are needed to receive messages. You need to send a message containing register to 00000 to register to allow incoming messages as data, other wise messages will be read out as a normal phone call. Texts to 00000 are FREE

Outgoing SMS number 1709400X
Incoming SMS number 080058752X0
To unregister, Dial 08005875252 Options 1, then 5
Default sub address 9

  • BT do not support srr, pid or rp.
  • BT do not work correctly for UK numbers with international format (i.e. +44 prefix). Use national format instead
  • A few mobiles cannot yet text to landlines (Virgin and BT Mobile)
  • Until registered, incoming SMS will call you and read the message to you (text to speech)
  • You have to register each sub address separately
  • For DDI you need to register each DDI separately
  • For DDI you need to try a few times to get the registration to stick. Send reset to 00000 a few times. Using #2# does not help. DDI are not even supposed to work on BT.

There are also some prefixes that can be used on messages

Example: smsq 07956123456 *0# Message
Example for DDIs: smsq -q <YOURDDI> 00000 register - (the DDI on our ISDN Bris is the last 6 digits of our the number, using the entire number wouldn't work.)

*0# Request delivery report
*3# Force message to be delivered as speech (if to a landline number)

It is also possible to send messages to 00000 which control operation.

register To register your line (Normally automatic)
reset To reset your line (pretty much does the same as register)
test Sends something back by way of a test result.
*1# Future forced text to speech messages will not be accepted
#1# Cancel above
*2# All messages will be text to speech
#2# All messages will be sent as text

Republic of Ireland (IRL)

Outgoing SMS number 17409900
Incoming SMS number 08183651350

  • Registering a landline for SMS works by sending the first SMS.
  • SMS from landlines works national only
  • Both ISDN and PSTN have been tested
  • For DDI you need to register each DDI separately

SMS with T-Com (German Telekom)

app_sms is adequate to send and receive short messages if you are a Deutsche Telekom customer. It is the same protocol BT uses (ETSI ES 201 912).

Send outgoing messages to 0193010. Incoming messages can be identified by the callerId 01930100.
Registering a MSN for SMS works by sending a SMS to a specific number.
If registration has been successfull, messages send by fixed line or D1 phones will be transmitted as SMS.
Outgoing SMS are forwarded to any german mobile network.

Some information can be found here:
German Telekom Specification (1TR140 V3.0) (363 KB PDF Format, German Language)
SMS Configuration and registration for customers of german telekom (german language)

Sending messages is well documented at voip-info. For incoming messages I had to use something like this:


The following worked for me, using ISDN-CAPI:
exten = 0193010,1,Goto(smsmotx,${CALLERIDNUM},1)
; handle incoming SMS only (from 01930100)
exten => _X.,1,GotoIf($[X${CALLERIDNUM} = X01930100]?smsmorx,${EXTEN},1:10)
; incoming
exten => _X.,1,Verbose(Receiving SMS from ${CALLERIDNUM})
exten => _X.,2,Answer
exten => _X.,3,Wait(1)
exten => _X.,4,SMS(sms_fixedline,a)
exten => _X.,5,Hangup
; outgoing
exten => _X.,1,SMS(${smsFrom},s,${EXTEN},${smsText}) ; Create an SMS
exten => _X.,2,SMS(${smsFrom},s) ; Send queued SMS
exten => _X.,3,Hangup~/np~

For sending, I changed the following line in smsq.c:
*motxchannel = "CAPI/ISDN1/0193010",

Bezeq (Israel) land line SMS

You will need the following patch (at least until it gets into the mainline):

Note: The above example for for Germany would probably work without using the patch.

The service center numbers are:

Outgoing: 14974800
Incoming: 036809900

Belgacom (Belgium) with ISDN-2 (BRI) and chan_capi

See also this Belgacom document.

; SMS reception
; Belgacom fixed line SM-SC identifies as 0171701 when sending
; so let's apply the anti-ex-girlfriend solution to detect the SM-SC calling us
exten => 21234567/0171701,1,Verbose(Receiving SMS from ${CALLERIDNUM})
exten => 21234567/0171701,2,Answer
exten => 21234567/0171701,3,Wait(1)
exten => 21234567/0171701,4,SMS(sms_fixedline,a)
exten => 21234567/0171701,5,Hangup
; the received message can be found in /var/spool/asterisk/sms/
; as well as in /var/log/asterisk/sms

; create and send a text message, expects number+message and ...
; ... connect to the SMSC at 171700 (for receiving your message)
; this context is to be used by a .call file or thru the manager API!
exten => _X.,1,GotoIf($[${CALLERIDNUM:0:2} = 00]?2:4)
exten => _X.,2,SMS(${CALLERIDNUM},,+${EXTEN:2},${CALLERIDNAME}) ; international msg with +
exten => _X.,3,Goto(5)
exten => _X.,4,SMS(${CALLERIDNUM},,${EXTEN},${CALLERIDNAME}) ; national msg with 0
exten => _X.,5,SMS(${CALLERIDNUM})
exten => _X.,6,Hangup
exten => s,1,Verbose(Catching a SMS sending error... hangup!)
exten => s,2,Hangup

.call file:

  1. Using the CAPI channel with 021234567 as outgoing MSN and dialing the SMSC at 171700
  2. (Not sure if you have to disable echosquelch and echocancel in /etc/asterisk/capi.conf)
Channel: CAPI/021234567:171700
Context: smsdial
  1. The addressee's phone number goes into the 'Extension:'
Extension: 0299887766
Priority: 1

  1. Alternatively you can specify just an application
  2. and its arguments to be run, instead of a context
  3. extension and priority
  4. Application: SMS
  5. Data: arguments

  1. Both message text and my own caller ID go into 'Callerid:'
  2. (Not sure if you can use + followed by the international phone country code here.)
Callerid: Hello World! <021234567>


Outgoing messages are sent to 0809101000

If sending to a fixed phone in France, an 11th digit is needed, the subaddress. If not given, it will be taken as zero by default, which causes the message to be read audibly with a cute French accent ("ello wairld") instead of delivered as SMS. Note that no 11th digit is needed for SMS sent to mobiles. All mobile numbers in France begin with 06. The fixed to mobile SMS are supposed to work with all mobile providers, Orange, Bouyges and SFR. I have tested only with Orange.

Incoming SMS arrive from CID 01410049X0
(where X is the subaddress, 0 to 9)

Incoming SMS are put in /var/spool/asterisk/sms/mtrx/ by the SMS application, with names like default.2004-12-31T16:41:39-3

Since the s/callerid syntax doesn't work for me for some reason - (I think CALLERID is not known yet), I used this GoTo which is "dirty" but works:

; ZAP calls on this line come here:
exten => s,1,NoOp(whatever)
exten => s,2,GotoIf($[${CALLERIDNUM:0:8} = ${SMS_INCOMING:0:8}]?smsrecv,s,1)

;;; rest of normal calls here

exten => s,1,Answer
exten => s,2,Wait(1)
exten => s,3,NoOp(Receiving SMS from ${CALLERIDNUM})
exten => s,4,SMS(default|a)
exten => s,5,Hangup()

I edited smsq on line 413 to use the number of our French outgoing SMS server (sm-sc):

  • motxchannel = "ZAP/1/0809101000",

Now, outgoing SMS can the be sent like this:

  1. smsq 0612345678 "hello world"

It can also be overridden using the command line argument and no editing or compiling is necessary.

  1. smsq --motx-channel=ZAP/1/0809101000 0612345678 "hello world"

You can also create a .call file:

Channel: ZAP/1/0809101000
MaxRetries: 1
RetryTime: 60
WaitTime: 30
Context: smsdial
Extension: 0612345678
Priority: 1
SetVar: MSG=Bonjour monde


exten => _X.,1,SetAccount(SMS)
exten => _X.,2,Answer
exten => _X.,3,SMS(default,,${EXTEN},${MSG})
exten => _X.,4,SMS(default)
exten => _X.,5,Hangup


The SMSC number is 0622100000.

Example with smsq:
smsq --motx-channel='Zap/g1/0622100000' XXXXXXXXX 'Hello World'

Allthough, while using Asterisk 1.2, the message is sent many times at each sending.

South Africa

Disclaimer: Currently this is only theory, I haven't tested the service with Asterisk
Not even sure (yet) if the SMSC even uses ETSI ES 201 912
Outgoing SMSC : 1091969
Incoming SMSC : 0881091969


Telkom offers a fixed-line SMS service called Telkom Home SMS available with fixed-line to fixed-line SMSs costing 30c per message and fixed-line to mobile SMSs costing 45c per message.

Requirements for Telkom's SMS

  • A Telkom Analogue or ISDN Basic Rate Line.
  • Telkom IdentiCall for Calling Line Identification (CLI).


  • Phone 10219 or 10217 to activate the IdentiCall Service (R26.62 + R9.85 p/m) and SMS Service (free)
  • SMSC numbers are 1091969 for sending and 0881091969 for receiving


  • Currently you cannot send SMS to any international destination or a premium rated service.
  • Currently you cannot receive a SMS message from abroad i.e. International SMS.
  • SMS over ISDN PRI is currently not available.

Useful links


The SMSC number is:

(+34) 609090909 -> Movistar (Telefónica Móviles)

(+34) 656000311 -> Orange (Amena/Retevisión)


Unsuccessful send attempt
If you see Asterisk CLI output as shown below then you most probably got your SMSC number wrong. You might need to add a 1 or 0 to the published SMS Center number, or else do some reading on what exactly your provider expects. If you still find your message in the "me-sc..." directory, if there is no new entry in the log file, and/or if your Asterisk CLI output looks like below then your attempt wasn't sucessful

— SMS TX 93 00 6D 00 00 00...
— SMS TX 92 01 FF 6E 00 00...
— SMS TX 92 01 FF 6E 00 00...
— SMS TX 92 01 FF 6E 00 00...
— SMS TX 92 01 FF 6E 00 00...
— SMS TX 92 01 FF 6E 00 00...
... many more of these lines follow and you'll need to restart Asterisk ...

Successful send attempt
There is no file left in the "me-sc..." directory, we have a new log entry in /var/log/asterisk/sms where the second column carries a Y to indicate that the remote SM-SC liked what you have sent, and the Asterisk CLI displays this:

 -- Executing SMS("CAPI[contr1/021234567]/7", "021234567") in new stack
 -- SMS RX 93 00 6D 00 00 00...
 -- SMS TX 91 2C 01 00 0D 91...
 -- SMS RX 92 01 01 6C 00 00...
 -- SMS TX 91 2C 01 00 0D 91...
 -- SMS RX 96 0A 01 C4 00 40...
 -- SMS TX 94 00 6C 00 0D 91...
Sep 27 21:42:55 NOTICE[25614]: pbx_spool.c:242 attempt_thread: Call completed to CAPI/021234567:171700

See also

Go back to Asterisk - documentation of application commands

Created by: JustRumours, Last modification: Sun 06 of Apr, 2014 (23:19 UTC) by admin

Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+

Page Changes | Comments


Featured -