Re: [asterisk-users] Variable inheritance with dialplan command Originate

2011-04-13 Thread Naomi Rosenberg
Hi

 I believe I made one mistake in my example, I don't use a call to Queue
 in my local channel without a partner channel (the customer). I'll
 revisit this later today when I have some time, I'll be glad to help you
 if I can recall the right solution :)

That would explain it. I wonder if we can get it working. Originate turned out 
to have its own issues (mysteriously hanging itself up after 30 seconds) and 
preesently my workaround involves an AGI script that writes and copies a call 
file. Ouch!

Naomi



--
_
-- 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


Re: [asterisk-users] Variable inheritance with dialplan command Originate

2011-04-12 Thread Naomi Rosenberg
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@staffcalls)

[staffcalls]
exten = 123,1,NoOp(reference number is STILL here ${referencenum})
exten = 123,n,Queue(2)


-- Executing [300@intern:1] Goto(SIP/200-0001, test-in,s,1) in new 
stack
-- Goto (test-in,s,1)
-- Executing [s@test-in:1] Set(SIP/200-0001, __referencenum=foo) in 
new stack
-- Executing [s@test-in:2] Hangup(SIP/200-0001, ) in new stack
  == Spawn extension (test-in, s, 2) exited non-zero on 'SIP/200-0001'
-- Executing [h@test-in:1] NoOp(SIP/200-0001, The reference number 
is still here! foo) in new stack
-- Executing [h@test-in:2] Dial(SIP/200-0001, Local/123@staffcalls) 
in new stack
-- Called 123@staffcalls 
  == Spawn extension (test-in, h, 2) exited non-zero on 'SIP/200-0001'
-- Executing [123@staffcalls:1] NoOp(Local/123@staffcalls-c28c;2, 
reference number is STILL here foo) in new stack

= then it just hangs here! ==

Naomi 

- Original Message -
From: Sherwood McGowan sherwood.mcgo...@gmail.com
To: asterisk-users@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@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.mcgo...@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

--
_
-- Bandwidth and Colocation Provided by http://www.api

Re: [asterisk-users] Variable inheritance with dialplan command Originate

2011-04-12 Thread Sherwood McGowan
On 4/12/2011 7:04 AM, Naomi Rosenberg wrote:
 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@staffcalls)

 [staffcalls]
 exten = 123,1,NoOp(reference number is STILL here ${referencenum})
 exten = 123,n,Queue(2)


 -- Executing [300@intern:1] Goto(SIP/200-0001, test-in,s,1) in 
 new stack
 -- Goto (test-in,s,1)
 -- Executing [s@test-in:1] Set(SIP/200-0001, __referencenum=foo) 
 in new stack
 -- Executing [s@test-in:2] Hangup(SIP/200-0001, ) in new stack
   == Spawn extension (test-in, s, 2) exited non-zero on 'SIP/200-0001'
 -- Executing [h@test-in:1] NoOp(SIP/200-0001, The reference number 
 is still here! foo) in new stack
 -- Executing [h@test-in:2] Dial(SIP/200-0001, 
 Local/123@staffcalls) in new stack
 -- Called 123@staffcalls 
   == Spawn extension (test-in, h, 2) exited non-zero on 'SIP/200-0001'
 -- Executing [123@staffcalls:1] NoOp(Local/123@staffcalls-c28c;2, 
 reference number is STILL here foo) in new stack

 = then it just hangs here! ==

 Naomi 

I believe I made one mistake in my example, I don't use a call to Queue
in my local channel without a partner channel (the customer). I'll
revisit this later today when I have some time, I'll be glad to help you
if I can recall the right solution :)


-- 
Sherwood McGowan sherwood.mcgo...@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


Re: [asterisk-users] Variable inheritance with dialplan command Originate

2011-04-11 Thread Naomi Rosenberg
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 

- Original Message -
From: Sherwood McGowan sherwood.mcgo...@gmail.com
To: asterisk-users@lists.digium.com
Sent: Friday, 8 April, 2011 5:10:55 PM
Subject: Re: [asterisk-users] Variable inheritance with dialplan command 
Originate

On 4/8/2011 11:05 AM, Jim Dickenson wrote:
 Another option is to pass the information in the extension. At times I
 have an extension like

 _[s][o][m][e]-[e][x][a][m][p][l][e].

 And call it like some-example:info1:info2 and use cut to extract the
 info1 and info2 values. Not real pretty but as this is computer
 generated calls it gets the job done.

Still not sure why you guys need this...Here's my example

[firstleg]
exten = 200,1,Set(__myvar=foo) ; Don't forget you don't want quotes!)
exten = 200,n,Dial(Local/123@test_orig)
[test_orig] exten = 123,1,Noop(${myvar})
same = n,Set(dbtest=${ODBC_TESTQUERY(myvar)})

-- Sherwood McGowan sherwood.mcgo...@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

--
_
-- 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


Re: [asterisk-users] Variable inheritance with dialplan command Originate

2011-04-11 Thread Sherwood McGowan
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@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.mcgo...@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


Re: [asterisk-users] Variable inheritance with dialplan command Originate

2011-04-08 Thread Sherwood McGowan
On 4/8/2011 4:57 AM, Naomi Rosenberg wrote:
 Hi,

 I would have thought that when spawning a channel using the Originate() 
 dialplan command, variables prefixed with two underscores would be preserved.

 However this does not work in the following case.

 Dialplan code:

 [intern]
 exten = 200,1,Set(__myvar=foo)
 exten = 200,n,Originate(Local/123@test_orig,exten,dummy)

 [test_orig]
 exten = 123,1,NoOp(${myvar})
 exten = 123,n,Hangup()

 [dummy]

 /end dialplan code.

 Console output:

 -- Executing [200@intern:1] Set(SIP/200-0018, __myvar=foo) in 
 new stack
 -- Executing [200@intern:2] Originate(SIP/200-0018, 
 Local/123@test_orig,exten,dummy) in new stack
 -- Executing [123@test_orig:1] NoOp(Local/123@test_orig-cbab;2, ) in 
 new stack
 -- Executing [123@test_orig:2] Hangup(Local/123@test_orig-cbab;2, ) 
 in new stack


 /end console output.

 This is in Asterisk 1.8.3.

 Is this expected behaviour or a bug, or am I just confused? I would 
 appreciate your thoughts on the matter.

 Thank you,

 Naomi 

I believe that it's expected behavior because you're not creating a
child channel, you're originating a different set. Try using Dial
instead of Originate, and you'll get the inheritance behavior you expected.

-- 
Sherwood McGowan sherwood.mcgo...@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


Re: [asterisk-users] Variable inheritance with dialplan command Originate

2011-04-08 Thread Naomi Rosenberg
Thanks. That's as I thought (feared). Dial is not an option in this case but I 
have come up with a workaround involving using a reference number as the 
extension and then doing a database call. Not pretty but it works!

Naomi 
- Original Message -
From: Sherwood McGowan sherwood.mcgo...@gmail.com
To: asterisk-users@lists.digium.com
Sent: Friday, 8 April, 2011 4:35:43 PM
Subject: Re: [asterisk-users] Variable inheritance with dialplan command 
Originate

On 4/8/2011 4:57 AM, Naomi Rosenberg wrote:
 Hi,

 I would have thought that when spawning a channel using the
 Originate() dialplan command, variables prefixed with two underscores
 would be preserved.

 However this does not work in the following case.

 Dialplan code:

 [intern]
 exten = 200,1,Set(__myvar=foo)
 exten = 200,n,Originate(Local/123@test_orig,exten,dummy)

 [test_orig]
 exten = 123,1,NoOp(${myvar})
 exten = 123,n,Hangup()

 [dummy]

 /end dialplan code.

 Console output:

 -- Executing [200@intern:1] Set(SIP/200-0018,
 __myvar=foo) in new stack
 -- Executing [200@intern:2] Originate(SIP/200-0018,
 Local/123@test_orig,exten,dummy) in new stack
 -- Executing [123@test_orig:1] NoOp(Local/123@test_orig-cbab;2,
 ) in new stack
 -- Executing [123@test_orig:2]
 Hangup(Local/123@test_orig-cbab;2, ) in new stack


 /end console output.

 This is in Asterisk 1.8.3.

 Is this expected behaviour or a bug, or am I just confused? I would
 appreciate your thoughts on the matter.

 Thank you,

 Naomi

I believe that it's expected behavior because you're not creating a
child channel, you're originating a different set. Try using Dial
instead of Originate, and you'll get the inheritance behavior you
expected.

-- Sherwood McGowan sherwood.mcgo...@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

--
_
-- 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


Re: [asterisk-users] Variable inheritance with dialplan command Originate

2011-04-08 Thread Jim Dickenson
Another option is to pass the information in the extension. At times I have an 
extension like

_[s][o][m][e]-[e][x][a][m][p][l][e].

And call it like some-example:info1:info2 and use cut to extract the info1 and 
info2 values. Not real pretty but as this is computer generated calls it gets 
the job done.
-- 
Jim Dickenson
mailto:dicken...@cfmc.com

CfMC
http://www.cfmc.com/



On Apr 8, 2011, at 8:57 AM, Naomi Rosenberg wrote:

 Thanks. That's as I thought (feared). Dial is not an option in this case but 
 I have come up with a workaround involving using a reference number as the 
 extension and then doing a database call. Not pretty but it works!
 
 Naomi 
 - Original Message -
 From: Sherwood McGowan sherwood.mcgo...@gmail.com
 To: asterisk-users@lists.digium.com
 Sent: Friday, 8 April, 2011 4:35:43 PM
 Subject: Re: [asterisk-users] Variable inheritance with dialplan command 
 Originate
 
 On 4/8/2011 4:57 AM, Naomi Rosenberg wrote:
 Hi,
 
 I would have thought that when spawning a channel using the
 Originate() dialplan command, variables prefixed with two underscores
 would be preserved.
 
 However this does not work in the following case.
 
 Dialplan code:
 
 [intern]
 exten = 200,1,Set(__myvar=foo)
 exten = 200,n,Originate(Local/123@test_orig,exten,dummy)
 
 [test_orig]
 exten = 123,1,NoOp(${myvar})
 exten = 123,n,Hangup()
 
 [dummy]
 
 /end dialplan code.
 
 Console output:
 
-- Executing [200@intern:1] Set(SIP/200-0018,
__myvar=foo) in new stack
-- Executing [200@intern:2] Originate(SIP/200-0018,
Local/123@test_orig,exten,dummy) in new stack
-- Executing [123@test_orig:1] NoOp(Local/123@test_orig-cbab;2,
) in new stack
-- Executing [123@test_orig:2]
Hangup(Local/123@test_orig-cbab;2, ) in new stack
 
 
 /end console output.
 
 This is in Asterisk 1.8.3.
 
 Is this expected behaviour or a bug, or am I just confused? I would
 appreciate your thoughts on the matter.
 
 Thank you,
 
 Naomi
 
 I believe that it's expected behavior because you're not creating a
 child channel, you're originating a different set. Try using Dial
 instead of Originate, and you'll get the inheritance behavior you
 expected.
 
 -- Sherwood McGowan sherwood.mcgo...@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
 
 --
 _
 -- 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


--
_
-- 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


Re: [asterisk-users] Variable inheritance with dialplan command Originate

2011-04-08 Thread Sherwood McGowan
On 4/8/2011 10:57 AM, Naomi Rosenberg wrote:
 Thanks. That's as I thought (feared). Dial is not an option in this case but 
 I have come up with a workaround involving using a reference number as the 
 extension and then doing a database call. Not pretty but it works!

 Naomi 

I'm not sure why Dial wouldn't work...I use Dial all the time for
triggering Local channels that perform database calls all the time

-- 
Sherwood McGowan sherwood.mcgo...@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


Re: [asterisk-users] Variable inheritance with dialplan command Originate

2011-04-08 Thread Sherwood McGowan
On 4/8/2011 11:05 AM, Jim Dickenson wrote:
 Another option is to pass the information in the extension. At times I have 
 an extension like

 _[s][o][m][e]-[e][x][a][m][p][l][e].

 And call it like some-example:info1:info2 and use cut to extract the info1 
 and info2 values. Not real pretty but as this is computer generated calls it 
 gets the job done.

Still not sure why you guys need this...Here's my example

[firstleg]
exten = 200,1,Set(__myvar=foo) ; Don't forget you don't want quotes!)
exten = 200,n,Dial(Local/123@test_orig)
[test_orig]
exten = 123,1,Noop(${myvar})
same = n,Set(dbtest=${ODBC_TESTQUERY(myvar)})

-- 
Sherwood McGowan sherwood.mcgo...@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