[asterisk-users] Variable inheritance with dialplan command Originate
Sherwood McGowan
sherwood.mcgowan at gmail.com
Mon Apr 11 11:26:05 CDT 2011
On 4/11/2011 5:15 AM, Naomi Rosenberg wrote:
>
> Hi,
>
> The reason I think Dial isn't appropriate is not to do with the database call. Here's the wider context of the application I'm putting together:
>
> Punter calls in, leaves a message, gets a reference number, hangs up. System then initiates call to a queue of on-call staff and when one answers it plays them the ref and the punter's message.
>
> The Originate bit is when, after the punter's hung up, the system initiates an outgoing call.
>
> I've worked around the inheritance problem by using the reference number as the extension, which being the primary key then allows me to retrieve the rest of the data from the DB again once over the Originate hump.
>
> Passing it all in the extension is an idea, but would not suit this case since there is a lot of data and as the application develops the nature of the data may change.
>
> Naomi
>
I'm still not following why you think Dial is a bad idea. You're already
using a Local channel, which causes dialplan code to be executed upon
the start of the Local channel. Maybe you were replying to someone
else's post but hit reply on mine?
Your stated example in your email is pretty much EXACTLY what I'm
already accomplishing using Dial, Local Channels, and Variable
inheritance. Were it not for a Non-Disclosure Agreement that does not
allow me to share the specific code, I could show it to you and then
maybe you'd see what I'm trying to say.
Let's try a quickie example of what you're saying (I'm going to use AEL
this time, because typing same= > over and over drives me nuts)
context inbound {
// punter calls in
_X. => {
// code for recording the message and database junk
// code returns a reference number to the caller
Set(__referencenum=foo); // this is the inherited variable
Hangup();
}
h => {
Noop(The reference number is still here! ${referencenum})
// Here is where we trigger the queue call to the staff
Dial(Local/123 at staffcalls) ;
}
}
context staffcalls {
123 => {
Noop(reference number is STILL here ${referencenum});
// do your database lookup based on ${referencenum} here
Queue(staff) ; //obviously not a representation of your actual
queue request
}
}
the above example accomplishes what you're talking about, without
inheritance problems, and is working in a callcenter without issues.
--
Sherwood McGowan <sherwood.mcgowan at gmail.com>
Carrier, ITSP, Call Center, and PBX Solutions Consultant
More information about the asterisk-users
mailing list