Merge "astobj2: Create function to copy weak proxied objects from container."
[asterisk/asterisk.git] / apps / app_privacy.c
index 4b8f61c..86aec01 100644 (file)
  * \ingroup applications
  */
 
-#include "asterisk.h"
+/*** MODULEINFO
+       <support_level>core</support_level>
+ ***/
 
-ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+#include "asterisk.h"
 
 #include "asterisk/lock.h"
 #include "asterisk/file.h"
@@ -36,7 +38,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #include "asterisk/pbx.h"
 #include "asterisk/module.h"
 #include "asterisk/translate.h"
-#include "asterisk/image.h"
 #include "asterisk/callerid.h"
 #include "asterisk/app.h"
 #include "asterisk/config.h"
@@ -53,6 +54,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
                        <parameter name="minlength">
                                <para>Minimum allowable digits in the input callerid number. Defaults to <literal>10</literal>.</para>
                        </parameter>
+                       <parameter name="options">
+                               <para>Position reserved for options.</para>
+                       </parameter>
                        <parameter name="context">
                                <para>Context to check the given callerid against patterns.</para>
                        </parameter>
@@ -96,18 +100,18 @@ static int privacy_exec(struct ast_channel *chan, const char *data)
                AST_APP_ARG(checkcontext);
        );
 
-       if (chan->caller.id.number.valid
-               && !ast_strlen_zero(chan->caller.id.number.str)) {
+       if (ast_channel_caller(chan)->id.number.valid
+               && !ast_strlen_zero(ast_channel_caller(chan)->id.number.str)) {
                ast_verb(3, "CallerID number present: Skipping\n");
        } else {
                /*Answer the channel if it is not already*/
-               if (chan->_state != AST_STATE_UP) {
+               if (ast_channel_state(chan) != AST_STATE_UP) {
                        if ((res = ast_answer(chan))) {
                                return -1;
                        }
                }
 
-               parse = ast_strdupa(S_OR(data, ""));
+               parse = ast_strdupa(data);
 
                AST_STANDARD_APP_ARGS(args, parse);
 
@@ -129,7 +133,7 @@ static int privacy_exec(struct ast_channel *chan, const char *data)
                /* Play unidentified call */
                res = ast_safe_sleep(chan, 1000);
                if (!res) {
-                       res = ast_streamfile(chan, "privacy-unident", chan->language);
+                       res = ast_streamfile(chan, "privacy-unident", ast_channel_language(chan));
                }
                if (!res) {
                        res = ast_waitstream(chan, "");
@@ -138,7 +142,7 @@ static int privacy_exec(struct ast_channel *chan, const char *data)
                /* Ask for 10 digit number, give 3 attempts */
                for (retries = 0; retries < maxretries; retries++) {
                        if (!res) {
-                               res = ast_streamfile(chan, "privacy-prompt", chan->language);
+                               res = ast_streamfile(chan, "privacy-prompt", ast_channel_language(chan));
                        }
                        if (!res) {
                                res = ast_waitstream(chan, "");
@@ -157,7 +161,7 @@ static int privacy_exec(struct ast_channel *chan, const char *data)
                                /* if we have a checkcontext argument, do pattern matching */
                                if (!ast_strlen_zero(args.checkcontext)) {
                                        if (!ast_exists_extension(NULL, args.checkcontext, phone, 1, NULL)) {
-                                               res = ast_streamfile(chan, "privacy-incorrect", chan->language);
+                                               res = ast_streamfile(chan, "privacy-incorrect", ast_channel_language(chan));
                                                if (!res) {
                                                        res = ast_waitstream(chan, "");
                                                }
@@ -168,7 +172,7 @@ static int privacy_exec(struct ast_channel *chan, const char *data)
                                        break;
                                }
                        } else {
-                               res = ast_streamfile(chan, "privacy-incorrect", chan->language);
+                               res = ast_streamfile(chan, "privacy-incorrect", ast_channel_language(chan));
                                if (!res) {
                                        res = ast_waitstream(chan, "");
                                }
@@ -177,7 +181,7 @@ static int privacy_exec(struct ast_channel *chan, const char *data)
 
                /* Got a number, play sounds and send them on their way */
                if ((retries < maxretries) && res >= 0) {
-                       res = ast_streamfile(chan, "privacy-thankyou", chan->language);
+                       res = ast_streamfile(chan, "privacy-thankyou", ast_channel_language(chan));
                        if (!res) {
                                res = ast_waitstream(chan, "");
                        }
@@ -188,9 +192,9 @@ static int privacy_exec(struct ast_channel *chan, const char *data)
                         * be passed out to other channels.  This is the point of the
                         * privacy application.
                         */
-                       chan->caller.id.name.presentation = AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED;
-                       chan->caller.id.number.presentation = AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED;
-                       chan->caller.id.number.plan = 0;/* Unknown */
+                       ast_channel_caller(chan)->id.name.presentation = AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED;
+                       ast_channel_caller(chan)->id.number.presentation = AST_PRES_ALLOWED_USER_NUMBER_NOT_SCREENED;
+                       ast_channel_caller(chan)->id.number.plan = 0;/* Unknown */
 
                        ast_set_callerid(chan, phone, "Privacy Manager", NULL);