[asterisk-dev] a few newbie questions about asterisk and voicemail code
Russell Bryant
russell at digium.com
Sat Sep 8 08:59:55 CDT 2007
Caio Begotti wrote:
> 1. I see ast_set2_flag in app_voicemail.c (handling VM_ATTACH for
> example) and ast_test_flag in many other modules but I didn't
> understand if should I use some ast_get/read_flag or something to
> capture the flag value back. Actually I simply don't know if there's
> something such as ast_get/read_flag. Is there it?
ast_test_flag() will give you the current value of the flag for an object. If
set, it will return the flag, if not, it will return 0.
> 2. I have a CLI command that expects for a mailbox name using
> completion. It's ok, and working but with all the possible matches I
> got a mailbox not number also. Is there some internal way to remove a
> given match from the completion list in CLI? Should I do that
> "manually", maybe?
I don't quite understand this question. Could you provide the output that is
not correct, and the completion function that is generating the incorrect results?
> 3. Is there a way to use "ast_cli(fd, myformattype, 'Foo',
> mynumericvar);" where myformattype accepts both numeric and strings
> so I don't need to write two formats for ast_cli or optionally don't
> need to write the mynumericvar type instead of myformattype? I have a
> bunch of both strings and numeric stuff that is printed altogether,
> for instance.
The format string here is the exact same as printf(). You can print integers
and strings in the same instance. ast_cli(fd, "%s has %d toes\n", "Russell",
16);, for example.
If your question is if you can print a string *or* an integer in the same format
string, then no, you can't do that unless you convert one to the type of the other.
--
Russell Bryant
Software Engineer
Digium, Inc.
More information about the asterisk-dev
mailing list