Asterisk cmd SendText

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
Details

Synopsis

Send a Text Message

Description

SendText(text)

Send text to the client on the connected channel.

This application accepts a text string as argument and attempts to send it to the calling client via the sendtext function of the channel driver.

See the channel driver documentation for support of text. In Asterisk SIP, for example, sendtext is implemented via the SIP MESSAGE method, sending payload data in the signalling messages with content type text/plain. This means any SIP phone that implements the SIP MESSAGE method should be supported.

The application does not encode characters in any special way, it simply passes the given text buffer to the channel driver service routine.

  WARNING[16710] pbx.c: No application 'SendText' for extension (XXXX, YYYY, 1): 
  load app_sendtext.so in modules.conf


Note: You could consider to use Dial() with the 'M' option to call SendText() upon a successful connect. This way SendText() might be used also on outbound calls, not only on inbound ones.

News

New in Asterisk 10: Asterisk cmd MessageSend with support for receiving and sending SIP MESSAGE
Asterisk now has protocol independent support for processing text messages outside of a call. Messages are routed through the Asterisk dialplan. SIP MESSAGE and XMPP are currently supported. There are options in jabber.conf and sip.conf to allow enabling these features.
  • jabber.conf: see the "sendtodialplan" and "context" options.
  • sip.conf: see the "accept_outofcall_message", "auth_message_requests" and "outofcall_message_context" options.
The MESSAGE() dialplan function and MessageSend() application have been added to go along with this functionality. More detailed usage information can be found on the Asterisk wiki (http://wiki.asterisk.org/).

New in Asterisk 1.8: SendText is now implemented in chan_gtalk and chan_jingle. It will simply send XMPP text messages to the remote JID.

Example


exten => 123, 1, Answer
exten => 123, 2, SendText(hello world)
exten => 123, 3, HangUp

NOTE: The Answer step at priority 1 is needed, since the channel need to be established before anything can be sent on it. Look at auto-answer mode on your phone, possibly together with an Asterisk .call file (or SIPSAK) to send text messages from a remote device or process.

Receiving text with Asterisk

Asterisk does not have a ReceiveText() dialplan application, however here is how you can send and receive text using an AGI script:

print STDERR "1. Testing 'sendtext'...";
print "SEND TEXT \"hello world\"\n";
my $result = <STDIN>;
&checkresult($result);

print STDERR "2. Receiving Text 'receivetext'...";
print "RECEIVE TEXT 3000\n";
my $result = <STDIN>;
&checkresult($result);

SNOM phones

When 123 (see example above) is called on a SNOM phone, you should hangup and the Message Waiting Indicator lamp will start blinking. The screen will indicate "SMS". Press the SMS softkey (snom190) or the Message button (snom 320/360) and the screen will display the message, shown to originate from 123. On the snom 320 you have 2x24 characters minus the Caller ID/ Called extension to display the message; scrolling is not possible. Apparently the snom 190 show the sms only if it is less than 9 char long.

See the SNOM FAQ entry for more on this topic.

Firmware 7 The XML Minibrowser is now also implemented for SNOM 320 and 300 (next to 370 and 360).
Firmware 4.0 & 4.1 Now it works even the SIPSAK option "-O desktop", just set the phone settings "Support broken registrar" to "on" and "Long SIP-Contact (RFC3840)" to "off" and "Refer-To Brackets" to "off". but off course it will only work after the call is answered. If you don't want this use SIPSAK via System() or TrySytem() in Asterisk to send a message.
Firmware 3.60r: Partial success together with Asterisk 1.0.2bristuffed and a SNOM line set to auto-answer mode: Depending on the line's SIP setting "Support broken registrar" the SNOM 360 will either reply with "404 Not Found" (broken registrar OFF) or "200 Ok" (broken registrar ON) in combination with Asterisk's SendText() application. SIPSAK also works, but only when the option "-O desktop" is not used.
Firmware 3.60i: Although above example gives the desired result of displaying the message, the recent revisions (3.60i) of SNOM phone firmware have a protocol bug, they sent a misformulated 200 OK response back to the server.
Firmware 3.56y: The snom200 phone does not implement receiving a MESSAGE request within a dialog. It returns a "501 Not Implemented" message, although you can send out-of-dialog MESSAGE requests successfully.

Cisco Phones

With chan_sccp2 version 20051019 SendText is supported.

Alternative approaches

  • Create a custom SIP header with SIPAddHeader and carry your text within, read it it with SIP_HEADER
  • Use the IAX2 patch 7619 that can carry variables from Asterisk to Asterisk
  • In case of two Asterisk boxes connected through an analog line: Use SendDTMF and Read and encode your text as DTMF - for a related (non-Asterisk) solution check out MF TeleType
  • Use Asterisk's SMS application to send and receive short messages

See also



Asterisk | Applications | Functions | Variables | Expressions | Asterisk FAQ

Created by: oej, Last modification: Mon 04 of Jun, 2012 (07:53 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 -

Search: