[Asterisk-Dev] ParkAndAnnounce() - trying to add var to indicate parked exten

Andrew Kohlsmith akohlsmith-asterisk at benshaw.com
Fri Oct 14 21:28:57 MST 2005


Subject line says it all.  I thought this would be a trivial modification to 
ParkAndAnnounce, but it's proving difficult and I can't figure out why.

Ok, in app_parkandannounce.c, chan refers to the channel that's getting 
parked, and dchan is the channel that the announcement's being played to.

I figured I could use pbx_builtin_setvar_helper() to set a dialplan variable.

So once the announce channel is allocated I figured I'd just do this:

        snprintf(buf, sizeof(buf), "%i", lot);
        pbx_builtin_setvar_helper(dchan, "PARKEDAT", buf);

where buf is just a small static buffer.

I'm using Local/555 at fxs for the announcement channel.  It gets hit alright, as 
I can verify in the CLI output.  However 

exten => 555,n,NoOp(555: PARKEDAT is ${PARKEDAT})

shows that the PARKEDAT variable is always empty.  Fine, let's try to see if 
we can't get the variable set in the channel we're parking.  We won't be able 
to use it since the channel is parked and out of commission until the 
timeout's over but it's an experiment.

Just after the channel is masqueraded, I do this:

        snprintf(buf, sizeof(buf), "%i", lot);
        pbx_builtin_setvar_helper(chan, "PARKEDAT", buf);

Interesting, but the channel variable's STILL empty after the timeout's over.  
It should have contained the parking extension we were in, but it doesn't.

Finally, I decide to write it BEFORE the channel is masqueraded.  Same lines 
as above, just before the ast_masq_park_call() function.

This time, PARKEDAT *does* show up in the extension I parked, after the 
timeout as predicted, but it's not right.  I get "1075271942" instead of 
"701".  I put a little ast_log() to show the value of 'lot' and the string 
representation in 'buf' and they're fine.

Can anyone assist?  I'm baffled.

-A.



More information about the asterisk-dev mailing list