SendText([text])
Full arguments reference
text
Sends text to the current channel.
Note
current channel could be the caller or callee depending on the context in which this application is called.
The following variables can be set:
- SENDTEXT_FROM_DISPLAYNAME - If set and this channel supports enhanced messaging, this value will be used as the
Fromdisplay name. - SENDTEXT_TO_DISPLAYNAME - If set and this channel supports enhanced messaging, this value will be used as the
Todisplay name. - SENDTEXT_CONTENT_TYPE - If set and this channel supports enhanced messaging, this value will be used as the message
Content-Type. If not specified, the default oftext/plainwill be used. - SENDTEXT_BODY - If set this value will be used as the message body and any text supplied as a function parameter will be ignored.
Result of transmission will be stored in the following variables:
- SENDTEXTTYPE
NONE- No message sent.BASIC- Message body sent without attributes because the channel driver doesn't support enhanced messaging.ENHANCED- The message was sent using enhanced messaging.
- SENDTEXTSTATUS
SUCCESS- Transmission succeeded.FAILURE- Transmission failed.UNSUPPORTED- Text transmission not supported by channel.
Note
The text encoding and transmission method is completely at the discretion of the channel driver. chan_pjsip will use in-dialog SIP MESSAGE messages always.
Examples:
same => n,SendText(Your Text Here)
If the channel driver supports enhanced messaging (currently only chan_pjsip), you can set additional variables:
same => n,Set(SENDTEXT_FROM_DISPLAYNAME=Really From Bob)
same => n,SendText(Your Text Here)
same => n,Set(SENDTEXT_CONTENT_TYPE=text/json)
same => n,SendText({"foo":a, "bar":23})
same => n,Set(SENDTEXT_CONTENT_TYPE=text/json)
same => n,Set(SENDTEXT_BODY={"foo":a, "bar":23})
same => n,SendText()
text
User Notes
Know a tip or gotcha for this topic? Share it below and help others.
Contribute a note
Share a tip, gotcha, or practical example. Keep it under 2000 characters. No questions (use the Asterisk community forums for support). Wrap code in backticks.