[asterisk-users] Variable inheritance with dialplan command Originate
Naomi Rosenberg
naomi at dmcip.com
Tue Apr 12 07:04:05 CDT 2011
Hi Sherwood,
Thanks for helping me with this. The reply was indeed to you - I didn't think you could use Dial on a channel that had been hung up, so I have learnt something. However I'm still struggling with it I'm afraid. I've tried using Dial and I'm finding that when the original channel is hung up it all seems to stop working.
In the hope you might help me more, I've run your example as it is (translated into .conf cos that's what we use here - feel free to reply in ael) so I can show you the output. I'm finding it hangs just before the call to Queue. I know Queue(2) works because when I dial 400 it works as expected.
[intern]
exten => 300,1,Goto(test-in,s,1) ; experiment
exten => 400,1,Queue(2) ; control
[test-in]
exten => s,1,Set(__referencenum=foo)
exten => s,n,Hangup();
exten => h,1,NoOp(The reference number is still here! ${referencenum})
exten => h,n,Dial(Local/123 at staffcalls)
[staffcalls]
exten => 123,1,NoOp(reference number is STILL here ${referencenum})
exten => 123,n,Queue(2)
-- Executing [300 at intern:1] Goto("SIP/200-00000001", "test-in,s,1") in new stack
-- Goto (test-in,s,1)
-- Executing [s at test-in:1] Set("SIP/200-00000001", "__referencenum=foo") in new stack
-- Executing [s at test-in:2] Hangup("SIP/200-00000001", "") in new stack
== Spawn extension (test-in, s, 2) exited non-zero on 'SIP/200-00000001'
-- Executing [h at test-in:1] NoOp("SIP/200-00000001", "The reference number is still here! foo") in new stack
-- Executing [h at test-in:2] Dial("SIP/200-00000001", "Local/123 at staffcalls") in new stack
-- Called 123 at staffcalls
== Spawn extension (test-in, h, 2) exited non-zero on 'SIP/200-00000001'
-- Executing [123 at staffcalls:1] NoOp("Local/123 at staffcalls-c28c;2", "reference number is STILL here foo") in new stack
===== then it just hangs here! ==========
Naomi
----- Original Message -----
From: "Sherwood McGowan" <sherwood.mcgowan at gmail.com>
To: asterisk-users at lists.digium.com
Sent: Monday, 11 April, 2011 5:26:05 PM
Subject: Re: [asterisk-users] Variable inheritance with dialplan command Originate
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
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
More information about the asterisk-users
mailing list