[Asterisk-Users] Re: app_changrab.c released on pbxfreeware.org

Nenad Radosavljevic nenadr at deltaplan.co.yu
Wed Jun 22 04:03:46 MST 2005


Hi !

Managed to fix app_changrab.c to compile and start working under 1.0.X.

it is working on my installation, but is tested well enough.

Regards,
                Nenad

Here is diff -u :

----------

--- app_changrab.c.orig 2005-06-20 22:10:50.000000000 +0200
+++ app_changrab.c      2005-06-22 11:43:54.000000000 +0200
@@ -8,11 +8,12 @@
  */

 /*uncomment below or build with -DAST_10_COMPAT for 1.0 */
-//#define AST_10_COMPAT
+#define AST_10_COMPAT

 #include <asterisk/file.h>
 #include <asterisk/logger.h>
 #include <asterisk/channel.h>
+#include <asterisk/channel_pvt.h>
 #include <asterisk/pbx.h>
 #include <asterisk/utils.h>
 #include <asterisk/musiconhold.h>
@@ -24,9 +25,11 @@
 #include <string.h>
 #include <pthread.h>

-#include "asterisk.h"
+#include "../asterisk.h"

+#ifndef AST_10_COMPAT
 ASTERISK_FILE_VERSION(__FILE__, "$Revision: 1.39 $")
+#endif

 static char *tdesc = "Take over an existing channel and bridge to it.";
 static char *app = "ChanGrab";
@@ -85,10 +88,13 @@
                ast_log(LOG_WARNING, "No Such Channel: %s\n",(char *) data);
                return -1;
        }
-
+#ifndef AST_10_COMPAT
        if(flags && oldchan->_bridge && strchr(flags,'b'))
                oldchan = oldchan->_bridge;
-
+#else
+       if(flags && oldchan->bridge && strchr(flags,'b'))
+               oldchan = oldchan->bridge;
+#endif
        if(flags && strchr(flags,'r') && oldchan->_state == AST_STATE_UP) {
                return -1;
        }
@@ -102,9 +108,10 @@
        if((f = ast_read(newchan))) {
                ast_frfree(f);
                memset(&config,0,sizeof(struct ast_bridge_config));
+#ifndef AST_10_COMPAT
                ast_set_flag(&(config.features_callee), 
AST_FEATURE_REDIRECT);
                ast_set_flag(&(config.features_caller), 
AST_FEATURE_REDIRECT);
-
+#endif
                if(oldchan && !oldchan->pbx)
                        ast_hangup(oldchan);

--------

> Unfortunatly it won't compile under 1.0.7 :(
>
> I have uncommented #define AST_10_COMPAT but I don't see any usage of it 
> in
> app_changrab.c.
>
> Complains about missing asterisk.h ( I think it should be #include
> "../asterisk.h" )
>
> It also complains about ASTERISK_FILE_VERSION() function, and about 
> _bridge
> member of ast_channel structure and some othet things:
>
> Here is compile log:
>
>  ......... 






More information about the asterisk-users mailing list