Wed Apr 6 11:29:51 2011

Asterisk developer's documentation


app_sendtext.c File Reference

App to transmit a text message. More...

#include "asterisk.h"
#include "asterisk/file.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/module.h"
#include "asterisk/app.h"

Go to the source code of this file.

Functions

static void __reg_module (void)
static void __unreg_module (void)
static int load_module (void)
static int sendtext_exec (struct ast_channel *chan, const char *data)
static int unload_module (void)

Variables

static struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Send Text Applications" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "8586c2a7d357cb591cc3a6607a8f62d1" , .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, }
static const char *const app = "SendText"
static struct ast_module_infoast_module_info = &__mod_info


Detailed Description

App to transmit a text message.

Author:
Mark Spencer <markster@digium.com>
Note:
Requires support of sending text messages from channel driver

Definition in file app_sendtext.c.


Function Documentation

static void __reg_module ( void   )  [static]

Definition at line 119 of file app_sendtext.c.

static void __unreg_module ( void   )  [static]

Definition at line 119 of file app_sendtext.c.

static int load_module ( void   )  [static]

Definition at line 114 of file app_sendtext.c.

References ast_register_application_xml, and sendtext_exec().

00115 {
00116    return ast_register_application_xml(app, sendtext_exec);
00117 }

static int sendtext_exec ( struct ast_channel chan,
const char *  data 
) [static]

Definition at line 75 of file app_sendtext.c.

References ast_channel_lock, ast_channel_unlock, ast_log(), ast_sendtext(), ast_str_alloca, ast_str_buffer(), ast_str_get_encoded_str(), LOG_WARNING, pbx_builtin_setvar_helper(), ast_channel_tech::send_text, status, str, and ast_channel::tech.

Referenced by load_module().

00076 {
00077    char *status = "UNSUPPORTED";
00078    struct ast_str *str;
00079 
00080    /* NOT ast_strlen_zero, because some protocols (e.g. SIP) MUST be able to
00081     * send a zero-length message. */
00082    if (!data) {
00083       ast_log(LOG_WARNING, "SendText requires an argument (text)\n");
00084       return -1;
00085    }
00086 
00087    if (!(str = ast_str_alloca(strlen(data) + 1))) {
00088       return -1;
00089    }
00090 
00091    ast_str_get_encoded_str(&str, -1, data);
00092 
00093    ast_channel_lock(chan);
00094    if (!chan->tech->send_text) {
00095       ast_channel_unlock(chan);
00096       /* Does not support transport */
00097       pbx_builtin_setvar_helper(chan, "SENDTEXTSTATUS", status);
00098       return 0;
00099    }
00100    status = "FAILURE";
00101    ast_channel_unlock(chan);
00102    if (!ast_sendtext(chan, ast_str_buffer(str))) {
00103       status = "SUCCESS";
00104    }
00105    pbx_builtin_setvar_helper(chan, "SENDTEXTSTATUS", status);
00106    return 0;
00107 }

static int unload_module ( void   )  [static]

Definition at line 109 of file app_sendtext.c.

References ast_unregister_application().

00110 {
00111    return ast_unregister_application(app);
00112 }


Variable Documentation

struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Send Text Applications" , .key = "This paragraph is copyright (c) 2006 by Digium, Inc. \In order for your module to load, it must return this \key via a function called \"key\". Any code which \includes this paragraph must be licensed under the GNU \General Public License version 2 or later (at your \option). In addition to Digium's general reservations \of rights, Digium expressly reserves the right to \allow other parties to license this paragraph under \different terms. Any use of Digium, Inc. trademarks or \logos (including \"Asterisk\" or \"Digium\") without \express written permission of Digium, Inc. is prohibited.\n" , .buildopt_sum = "8586c2a7d357cb591cc3a6607a8f62d1" , .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, } [static]

Definition at line 119 of file app_sendtext.c.

const char* const app = "SendText" [static]

Definition at line 73 of file app_sendtext.c.

struct ast_module_info* ast_module_info = &__mod_info [static]

Definition at line 119 of file app_sendtext.c.


Generated on Wed Apr 6 11:29:51 2011 for Asterisk - The Open Source Telephony Project by  doxygen 1.4.7