gsm: Implement the size checking of the hello packet
[lcr.git] / chan_lcr.c
index ef48739..4e93db1 100644 (file)
@@ -136,6 +136,13 @@ it is called from ast_channel process which has already locked ast_channel.
 #ifdef LCR_FOR_ASTERISK
 #include <asterisk/buildopts.h>
 #endif
+
+/*
+ * Fwd declare struct ast_channel to get rid of gcc warning about
+ * incompatible pointer type passed to ast_register_application2.
+ */
+struct ast_channel;
+
 #include <asterisk/module.h>
 #include <asterisk/channel.h>
 #include <asterisk/config.h>
@@ -161,8 +168,9 @@ it is called from ast_channel process which has already locked ast_channel.
 #include <asterisk/app.h>
 #include <asterisk/features.h>
 #include <asterisk/sched.h>
+#if ASTERISK_VERSION_NUM < 110000
 #include <asterisk/version.h>
-
+#endif
 #include "extension.h"
 #include "message.h"
 #include "callerid.h"
@@ -959,11 +967,12 @@ static void lcr_in_setup(struct chan_call *call, int message_type, union paramet
 #if ASTERISK_VERSION_NUM < 110000
        ast->tech_pvt = call;
        ast->tech = &lcr_tech;
+       ast->fds[0] = call->pipe[0];
 #else
        ast_channel_tech_pvt_set(ast, call);
        ast_channel_tech_set(ast, &lcr_tech);
+       ast_channel_set_fd(ast, 0, call->pipe[0]);
 #endif
-       ast->fds[0] = call->pipe[0];
 
        /* fill setup information */
        if (param->setup.dialinginfo.id)
@@ -2079,7 +2088,7 @@ static
 #if ASTERISK_VERSION_NUM < 100000
 struct ast_channel *lcr_request(const char *type, format_t format, const struct ast_channel *requestor, void *data, int *cause)
 #else
-struct ast_channel *lcr_request(const char *type, struct ast_format_cap *format, struct ast_channel *requestor, void *data, int *cause)
+struct ast_channel *lcr_request(const char *type, struct ast_format_cap *format, const struct ast_channel *requestor, void *data, int *cause)
 #endif
 #else
 struct ast_channel *lcr_request(const char *type, int format, void *data, int *cause)
@@ -2088,8 +2097,8 @@ struct ast_channel *lcr_request(const char *type, int format, void *data, int *c
        char exten[256], *dial, *interface, *opt;
        struct ast_channel *ast;
        struct chan_call *call;
-       struct ast_party_redirecting *req_redir;
-       struct ast_party_caller *req_caller;
+       const struct ast_party_redirecting *req_redir;
+       const struct ast_party_caller *req_caller;
 
        ast_mutex_lock(&chan_lock);
        CDEBUG(NULL, NULL, "Received request from Asterisk. (data=%s)\n", (char *)data);
@@ -2179,10 +2188,11 @@ struct ast_channel *lcr_request(const char *type, int format, void *data, int *c
        call->ast = ast;
 #if ASTERISK_VERSION_NUM < 110000
        ast->tech_pvt = call;
+       ast->fds[0] = call->pipe[0];
 #else
        ast_channel_tech_pvt_set(ast, call);
+       ast_channel_set_fd(ast, 0, call->pipe[0]);
 #endif
-       ast->fds[0] = call->pipe[0];
        call->pbx_started = 0;
        /* set state */
        call->state = CHAN_LCR_STATE_OUT_PREPARE;
@@ -2731,10 +2741,11 @@ static int lcr_hangup(struct ast_channel *ast)
        /* disconnect asterisk, maybe not required */
 #if ASTERISK_VERSION_NUM < 110000
        ast->tech_pvt = NULL;
+       ast->fds[0] = -1;
 #else
        ast_channel_tech_pvt_set(ast, NULL);
+       ast_channel_set_fd(ast, 0, -1);
 #endif
-       ast->fds[0] = -1;
        if (call->ref) {
                /* release */
                CDEBUG(call, ast, "Releasing ref and freeing call instance.\n");
@@ -2944,7 +2955,7 @@ static int lcr_indicate(struct ast_channel *ast, int cond, const void *data, siz
        union parameter newparam;
        int res = 0;
        struct chan_call *call;
-       const struct tone_zone_sound *ts = NULL;
+       const struct ast_tone_zone_sound *ts = NULL;
 
        ast_mutex_lock(&chan_lock);
 #if ASTERISK_VERSION_NUM < 110000