Wed Jan 8 2020 09:49:55

Asterisk developer's documentation


app_setcallerid.c File Reference

App to set callerid presentation. More...

#include "asterisk.h"
#include "asterisk/lock.h"
#include "asterisk/file.h"
#include "asterisk/channel.h"
#include "asterisk/pbx.h"
#include "asterisk/module.h"
#include "asterisk/translate.h"
#include "asterisk/image.h"
#include "asterisk/callerid.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 setcallerid_pres_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 = "Set CallerID Presentation Application" , .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 = "ac1f6a56484a8820659555499174e588" , .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, }
 
static char * app2 = "SetCallerPres"
 
static struct ast_module_infoast_module_info = &__mod_info
 

Detailed Description

App to set callerid presentation.

Author
Mark Spencer marks.nosp@m.ter@.nosp@m.digiu.nosp@m.m.co.nosp@m.m

Definition in file app_setcallerid.c.

Function Documentation

static void __reg_module ( void  )
static

Definition at line 129 of file app_setcallerid.c.

static void __unreg_module ( void  )
static

Definition at line 129 of file app_setcallerid.c.

static int load_module ( void  )
static

Definition at line 124 of file app_setcallerid.c.

References ast_register_application_xml, and setcallerid_pres_exec().

125 {
127 }
static char * app2
static int setcallerid_pres_exec(struct ast_channel *chan, const char *data)
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
Definition: module.h:437
static int setcallerid_pres_exec ( struct ast_channel chan,
const char *  data 
)
static

Definition at line 92 of file app_setcallerid.c.

References ast_log(), ast_parse_caller_presentation(), ast_channel::caller, ast_party_caller::id, LOG_WARNING, ast_party_id::name, ast_party_id::number, ast_party_name::presentation, and ast_party_number::presentation.

Referenced by load_module().

93 {
94  int pres = -1;
95  static int deprecated = 0;
96 
97  if (!deprecated) {
98  deprecated = 1;
99  ast_log(LOG_WARNING, "SetCallerPres is deprecated. Please use Set(CALLERPRES()=%s) instead.\n", (char *)data);
100  }
101 
102  /* For interface consistency, permit the argument to be specified as a number */
103  if (sscanf(data, "%30d", &pres) != 1 || pres < 0 || pres > 255 || (pres & 0x9c)) {
104  pres = ast_parse_caller_presentation(data);
105  }
106 
107  if (pres < 0) {
108  ast_log(LOG_WARNING, "'%s' is not a valid presentation (see 'show application SetCallerPres')\n",
109  (char *) data);
110  return 0;
111  }
112 
113  /* Set the combined caller id presentation. */
114  chan->caller.id.name.presentation = pres;
115  chan->caller.id.number.presentation = pres;
116  return 0;
117 }
int presentation
Q.931 encoded presentation-indicator encoded field.
Definition: channel.h:227
struct ast_party_caller caller
Channel Caller ID information.
Definition: channel.h:804
int presentation
Q.931 presentation-indicator and screening-indicator encoded fields.
Definition: channel.h:245
struct ast_party_name name
Subscriber name.
Definition: channel.h:290
#define LOG_WARNING
Definition: logger.h:144
struct ast_party_id id
Caller party ID.
Definition: channel.h:370
int ast_parse_caller_presentation(const char *data)
Convert caller ID text code to value (used in config file parsing)
Definition: callerid.c:1144
void ast_log(int level, const char *file, int line, const char *function, const char *fmt,...)
Used for sending a log message This is the standard logger function. Probably the only way you will i...
Definition: logger.c:1207
struct ast_party_number number
Subscriber phone number.
Definition: channel.h:292
static int unload_module ( void  )
static

Definition at line 119 of file app_setcallerid.c.

References ast_unregister_application().

120 {
122 }
static char * app2
int ast_unregister_application(const char *app)
Unregister an application.
Definition: pbx.c:7705

Variable Documentation

struct ast_module_info __mod_info = { .name = AST_MODULE, .flags = AST_MODFLAG_LOAD_ORDER , .description = "Set CallerID Presentation Application" , .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 = "ac1f6a56484a8820659555499174e588" , .load = load_module, .unload = unload_module, .load_pri = AST_MODPRI_DEFAULT, }
static

Definition at line 129 of file app_setcallerid.c.

char* app2 = "SetCallerPres"
static

Definition at line 90 of file app_setcallerid.c.

Definition at line 129 of file app_setcallerid.c.