Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #include "asterisk.h"
00035
00036 ASTERISK_FILE_VERSION(__FILE__, "$Revision: 357542 $")
00037
00038 #include "asterisk/lock.h"
00039 #include "asterisk/file.h"
00040 #include "asterisk/channel.h"
00041 #include "asterisk/pbx.h"
00042 #include "asterisk/module.h"
00043 #include "asterisk/translate.h"
00044 #include "asterisk/image.h"
00045 #include "asterisk/callerid.h"
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091 static char *app2 = "SetCallerPres";
00092
00093 static int setcallerid_pres_exec(struct ast_channel *chan, const char *data)
00094 {
00095 int pres = -1;
00096 static int deprecated = 0;
00097
00098 if (!deprecated) {
00099 deprecated = 1;
00100 ast_log(LOG_WARNING, "SetCallerPres is deprecated. Please use Set(CALLERPRES()=%s) instead.\n", (char *)data);
00101 }
00102
00103
00104 if (sscanf(data, "%30d", &pres) != 1 || pres < 0 || pres > 255 || (pres & 0x9c)) {
00105 pres = ast_parse_caller_presentation(data);
00106 }
00107
00108 if (pres < 0) {
00109 ast_log(LOG_WARNING, "'%s' is not a valid presentation (see 'show application SetCallerPres')\n",
00110 (char *) data);
00111 return 0;
00112 }
00113
00114
00115 ast_channel_caller(chan)->id.name.presentation = pres;
00116 ast_channel_caller(chan)->id.number.presentation = pres;
00117 return 0;
00118 }
00119
00120 static int unload_module(void)
00121 {
00122 return ast_unregister_application(app2);
00123 }
00124
00125 static int load_module(void)
00126 {
00127 return ast_register_application_xml(app2, setcallerid_pres_exec);
00128 }
00129
00130 AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Set CallerID Presentation Application");