SOLVED Re: [Asterisk-Dev] ParkAndAnnounce() - trying to add var to
indicate parked exten
Andrew Kohlsmith
akohlsmith-asterisk at benshaw.com
Sat Oct 15 18:40:36 MST 2005
On Saturday 15 October 2005 11:29, Andrew Kohlsmith wrote:
> snprintf(buf, sizeof(buf), "%i", lot);
> memset(&oh, 0, sizeof(struct outgoing_helper));
> oh.vars = ast_variable_new("PARKEDAT", buf);
>
> dchan = __ast_request_and_dial(dialtech, AST_FORMAT_SLINEAR,
> dialstr,30000, &outstate, chan->cid.cid_num, chan->cid.cid_name, &oh);
I've checked it over and even metered out ast_call() -- This variable is
showing up just as any other variable does... If I place a "normal" call I
see the DIALEDPEERNUMBER variable when I use Dial in ast_call just as my
PARKEDAT variable does with ParkAndAnnounce().
I'm using the following code snippet in ast_dial() to show the variables:
struct ast_var_t *current;
AST_LIST_TRAVERSE(&chan->varshead, current, entries) {
ast_log(LOG_WARNING, "current @ %p, name %s, value %s\n",
current, current->name, current->value);
}
chan_local's call function calls ast_channel_inherit_variables, and my
variable is showing up there (the only variable, actually), so I know it's
making it to the channel driver.
The solution turned out to be naming the variable _PARKEDAT not just PARKEDAT.
ast_channel_inherit_variables() won't copy a variable into the PBX context
unless it's _-prefixed. I remember this dimly somewhere a long time ago.
Where's O'reilly, I'm gonna write the second Asterisk book. It's gonna be
titled "The Asterisk Developer's Handbook: all the info Digium isn't keeping
from you, but isn't making easy to get, either" :-)
-A.
More information about the asterisk-dev
mailing list