[asterisk-dev] add filter to verbose (CLI) for a context and src or dst match.

Germán Aracil Boned german at tecnoxarxa.com
Tue Sep 8 13:31:35 CDT 2009


Yes, I can't update channel list with new channels.

But more important question,

in function ast_log, how can see current channel, calling to 
ast_is_string_match_cli_filters from ast_log, if you don't have the 
explicit channel pointer ? Only have a list of pointers to ast_channel 
(in your version for 1.6)

With your list, I understand, you have a list of all active channels in 
asterisk, or only a channel thread ?

I need show only messages (log/verbose) for explicit channel, starting 
with context and exten filter for mark it first.

In main/channel.c I added this funcion:

int channel_find_by_context_exten(const char *context, const char *exten)
{
         struct ast_channel *c;
         const struct ast_channel *prev = NULL;
         const struct ast_channel *_prev = prev;

         AST_LIST_LOCK(&channels);
         AST_LIST_TRAVERSE(&channels, c, chan_list) {
                 prev = _prev;
                 if (prev) {
                         if (c != prev)
                                 continue;
                              if ((c = AST_LIST_NEXT(c, chan_list)) == 
NULL) break;
                         prev = NULL;
                 }
                 if (strlen(exten) <= 1)
                         if (context && strcasecmp(c->context, context) 
&& strcasecmp(c->macrocontext, context))
                                 continue;
                 if (!strcasecmp(c->context, context))
                         if (strcasecmp(c->exten, exten))
                                 continue;
                 break;
         }
         AST_LIST_UNLOCK(&channels);
         if (c) return 1;
                 else return 0;
}

I call from ast_log for see if need display channel or not. If yes, I 
plain add a flag in ast_channel for display only this channel (Now, not 
in that code)

I need mark channel with a flag and know what channel call to ast_log 
function for display only marked channel. But if I don't have a pointer 
reference and list have all active channels, I can't make this !

thank for your help Clod ;)


Clod Patry escribió:
> Which "new channels" are you having problem with?
> 
> 
> 
> On Mon, Sep 7, 2009 at 5:19 PM, Germán Aracil Boned 
> <german at tecnoxarxa.com <mailto:german at tecnoxarxa.com>> wrote:
> 
>     How I can replace ast_channel_threadassoc_add in 1.4 for update list
>     with channels ?
> 
>     I have one problem, the list is not updated with new channels.
> 
>     int ast_channel_threadassoc_add(struct ast_channel *chan){
>             struct logger_filter_list_item *filter;
>             channels = ast_threadstorage_get(&filter_channels,
>     sizeof(*channels));
> 
>             if (!channels) {
>                     return -1;
>             }
>             filter = ast_calloc(1, sizeof(*filter));
>             if (!filter) {
>                     return -1;
>             }
>             filter->chan = chan;
>             AST_LIST_INSERT_HEAD(channels, filter, next);
>             return 0;
>     }
> 
> 
> 
> 
>     Germán Aracil Boned escribió:
>      > Clod, Thank you ;)
>      >
>      > Clod Patry escribió:
>      >> hi,
>      >> that will be pretty hard to use that method with 1.4, since the
>     API TLS
>      >> was not there.
>      >> I forked that branch from trunk, so if you svn diff
>      >> http://svn.digium.com/svn/asterisk/team/junky/cli-tls
>      >> http://svn.digium.com/svn/asterisk/trunk
>      >> <http://svn.digium.com/svn/asterisk/team/junky/cli-tls> will
>     give you a
>      >> huge idea on my work.
>      >> For doc, if you read doc/cli_filters.txt, that will give you a
>     list of
>      >> functionnality. Did you have extra idea?
>      >>
>      >> Thanks
>      >>
>      >> On Sun, Sep 6, 2009 at 11:12 AM, Germán Aracil Boned
>      >> <german at tecnoxarxa.com <mailto:german at tecnoxarxa.com>
>     <mailto:german at tecnoxarxa.com <mailto:german at tecnoxarxa.com>>> wrote:
>      >>
>      >>     woo.. this is great !
>      >>     Thank you !
>      >>
>      >>     Please, what files are you modify or add to asterisk for it ?
>      >>     Exist any doc where read this ?
>      >>
>      >>     I work with 1.4 version. And need add this feature to
>     asterisk 1.4
>      >>     If you like can send any docs by email.
>      >>
>      >>     thank you !
>      >>
>      >>     Clod Patry escribió:
>      >>      > hi,
>      >>      > have you already tried the cli filtering branch?
>      >>      > That project was a google summer of code project, which I
>     added that
>      >>      > exact need.
>      >>      > You can:
>      >>      > svn co http://svn.digium.com/svn/asterisk/team/junky/cli-tls
>      >>      > And read doc/cli_filters.txt
>      >>      >
>      >>      > Feedbacks are welcome.
>      >>      >
>      >>      >
>      >>      > On Sat, Sep 5, 2009 at 11:29 PM, Germán Aracil Boned
>      >>      > <german at tecnoxarxa.com <mailto:german at tecnoxarxa.com>
>     <mailto:german at tecnoxarxa.com <mailto:german at tecnoxarxa.com>>
>      >>     <mailto:german at tecnoxarxa.com <mailto:german at tecnoxarxa.com>
>     <mailto:german at tecnoxarxa.com <mailto:german at tecnoxarxa.com>>>> wrote:
>      >>      >
>      >>      >     Hello list
>      >>      >
>      >>      >     I'm making a filter for CLI verbose output. I only
>     have one
>      >>     question.
>      >>      >     If I include asterisk/channel.h in main/logger.c file
>     I have
>      >>     compilation
>      >>      >     errors.
>      >>      >     How I can get ast_channel struct in logger.c file ? It is
>      >>     posible ?
>      >>      >
>      >>      >     Thank you
>      >>      >
>      >>      >     --
>      >>      >
>      >>      >
>      >>      >      -
>      >>      >      -------------------------------------
>      >>      >      Germán Aracil Boned
>      >>      >      Director de Sistemas
>      >>      >      Zoon Suite S.L.
>      >>      >
>      >>      >      www.zoonsuite.com <http://www.zoonsuite.com>
>     <http://www.zoonsuite.com>
>      >>     <http://www.zoonsuite.com>
>      >>      >      963146030 - General
>      >>      >      963146031 - Asistencia de incidencias
>      >>      >      963146032 - FAX
>      >>      >      -------------------------------------
>      >>      >                                          -
>      >>      >
>      >>      >
>      >>      >     _______________________________________________
>      >>      >     --Bandwidth and Colocation Provided by
>      >>     http://www.api-digital.com--
>      >>      >
>      >>      >     AstriCon 2009 - October 13 - 15 Phoenix, Arizona
>      >>      >     Register Now: http://www.astricon.net
>      >>      >
>      >>      >     asterisk-dev mailing list
>      >>      >     To UNSUBSCRIBE or update options visit:
>      >>      >       http://lists.digium.com/mailman/listinfo/asterisk-dev
>      >>      >
>      >>      >
>      >>      >
>      >>      >
>      >>      > --
>      >>      > Clod Patry
>      >>      >
>      >>      >
>      >>      >
>      >>    
>     ------------------------------------------------------------------------
>      >>      >
>      >>      > _______________________________________________
>      >>      > --Bandwidth and Colocation Provided by
>     http://www.api-digital.com--
>      >>      >
>      >>      > AstriCon 2009 - October 13 - 15 Phoenix, Arizona
>      >>      > Register Now: http://www.astricon.net
>      >>      >
>      >>      > asterisk-dev mailing list
>      >>      > To UNSUBSCRIBE or update options visit:
>      >>      >    http://lists.digium.com/mailman/listinfo/asterisk-dev
>      >>
>      >>     --
>      >>
>      >>
>      >>       -
>      >>       -------------------------------------
>      >>       Germán Aracil Boned
>      >>       Director de Sistemas
>      >>       Zoon Suite S.L.
>      >>
>      >>       www.zoonsuite.com <http://www.zoonsuite.com>
>     <http://www.zoonsuite.com>
>      >>       963146030 - General
>      >>       963146031 - Asistencia de incidencias
>      >>       963146032 - FAX
>      >>       -------------------------------------
>      >>                                           -
>      >>
>      >>     _______________________________________________
>      >>     --Bandwidth and Colocation Provided by
>     http://www.api-digital.com--
>      >>
>      >>     AstriCon 2009 - October 13 - 15 Phoenix, Arizona
>      >>     Register Now: http://www.astricon.net
>      >>
>      >>     asterisk-dev mailing list
>      >>     To UNSUBSCRIBE or update options visit:
>      >>       http://lists.digium.com/mailman/listinfo/asterisk-dev
>      >>
>      >>
>      >>
>      >>
>      >> --
>      >> Clod Patry
>      >>
>      >>
>      >>
>     ------------------------------------------------------------------------
>      >>
>      >> _______________________________________________
>      >> --Bandwidth and Colocation Provided by http://www.api-digital.com--
>      >>
>      >> AstriCon 2009 - October 13 - 15 Phoenix, Arizona
>      >> Register Now: http://www.astricon.net
>      >>
>      >> asterisk-dev mailing list
>      >> To UNSUBSCRIBE or update options visit:
>      >>    http://lists.digium.com/mailman/listinfo/asterisk-dev
>      >
> 
>     --
> 
> 
>       -
>       -------------------------------------
>       Germán Aracil Boned
>       Director de Sistemas
>       Zoon Suite S.L.
> 
>       www.zoonsuite.com <http://www.zoonsuite.com>
>       963146030 - General
>       963146031 - Asistencia de incidencias
>       963146032 - FAX
>       -------------------------------------
>                                           -
> 
>     _______________________________________________
>     --Bandwidth and Colocation Provided by http://www.api-digital.com--
> 
>     AstriCon 2009 - October 13 - 15 Phoenix, Arizona
>     Register Now: http://www.astricon.net
> 
>     asterisk-dev mailing list
>     To UNSUBSCRIBE or update options visit:
>       http://lists.digium.com/mailman/listinfo/asterisk-dev
> 
> 
> 
> 
> -- 
> Clod Patry
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> --Bandwidth and Colocation Provided by http://www.api-digital.com--
> 
> AstriCon 2009 - October 13 - 15 Phoenix, Arizona
> Register Now: http://www.astricon.net
> 
> asterisk-dev mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-dev

-- 


   -
   -------------------------------------
   Germán Aracil Boned
   Director de Sistemas
   Zoon Suite S.L.

   www.zoonsuite.com
   963146030 - General
   963146031 - Asistencia de incidencias
   963146032 - FAX
   -------------------------------------
                                       -



More information about the asterisk-dev mailing list