[Asterisk-cvs] asterisk/include/asterisk cdr.h, 1.14, 1.15 pbx.h, 1.29, 1.30

anthm at lists.digium.com anthm at lists.digium.com
Fri Oct 22 16:55:36 CDT 2004


Update of /usr/cvsroot/asterisk/include/asterisk
In directory mongoose.digium.com:/tmp/cvs-serv28010/include/asterisk

Modified Files:
	cdr.h pbx.h 
Log Message:
This patch adds a new api call:
int pbx_builtin_serialize_variables(struct ast_channel *chan, char *buf, size_t size);
takes a chan and a char * 'buf' assumed to be 'size' bytes.

The function fills 'buf' with a <CR>('\n') delimited list of name,value pairs in turn delimeted by '='
eg:
SIPCALLID=f30e4e72-f715193f at 1.2.3.4
SIPUSERAGENT=Sipura/SPA2000-2.0.6(c)
SIPDOMAIN=1.2.3.4

It returns the acutal number of variables encountered.
If the attempt to fill 'buf' goes beyond 'size' bytes the operation is halted and the incomplete string is returned as is.

To demonstrate a use for this, the "show channel <channame>" command has been retrofitted with the call so it also dumps all of the chan's vars 

*CLI> show channel Zap/5-1
 -- General --
           Name: Zap/5-1
           Type: Zap
       UniqueID: 1098480666.17
      Caller ID: 4999
 Caller ID Name: Tony
    DNID Digits: (N/A)
          State: Up (6)
          Rings: 0
   NativeFormat: 68
    WriteFormat: 4
     ReadFormat: 4
1st File Descriptor: 22
      Frames in: 41969
     Frames out: 83240
 Time to Hangup: 0
   Elapsed Time: 0h13m54s
 --   PBX   --
        Context: phone1
      Extension: 4994
       Priority: 2
     Call Group: 2
   Pickup Group: 2
    Application: Dial
           Data: IAX2/ulaw at cube1/00010014994 at croip
          Stack: 0
    Blocking in: ast_waitfor_nandfds
Variables:
DIALEDPEERNUMBER=ulaw at cube1/00010014994 at croip
DIALEDPEERNAME=IAX2/cube1/3
CALLTYPE=SPEECH
tempvar=tempval




Index: cdr.h
===================================================================
RCS file: /usr/cvsroot/asterisk/include/asterisk/cdr.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- cdr.h	3 Oct 2004 19:59:46 -0000	1.14
+++ cdr.h	22 Oct 2004 20:59:38 -0000	1.15
@@ -78,6 +78,7 @@
 	char uniqueid[32];
 	/* User field */
 	char userfield[AST_MAX_USER_FIELD];
+	struct ast_channel *chan;
 	struct ast_cdr *next;
 };
 

Index: pbx.h
===================================================================
RCS file: /usr/cvsroot/asterisk/include/asterisk/pbx.h,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -d -r1.29 -r1.30
--- pbx.h	16 Oct 2004 19:46:02 -0000	1.29
+++ pbx.h	22 Oct 2004 20:59:38 -0000	1.30
@@ -542,6 +542,7 @@
 	struct ast_ignorepat *ip);
 struct ast_sw *ast_walk_context_switches(struct ast_context *con, struct ast_sw *sw);
 
+int pbx_builtin_serialize_variables(struct ast_channel *chan, char *buf, size_t size);
 extern char *pbx_builtin_getvar_helper(struct ast_channel *chan, char *name);
 extern void pbx_builtin_setvar_helper(struct ast_channel *chan, char *name, char *value);
 extern void pbx_builtin_clear_globals(void);




More information about the svn-commits mailing list