[asterisk-dev] Dialplan AGI with SIP channels blocking if AGI already running - parallellism not possible?

Johan Sandgren jsa at svep.se
Wed Apr 3 12:43:04 CDT 2013


Thanks for the suggestion Matt,
It works on behalf of the blocking is gone! Yes, celebration!! 

But, variable transfer between contexts when using Originate doesn't seem to happen.
I tried different ways of setting my variable (with and without __, lower and caps chars), still NULL when received. The debug output in asterisk doesn't show any copying taking place either, so guess it might not happen at all.

Just for comparison, I used Dial instead of Originate. The blocking is back, but the inherent variables (prefix __) are copied, and it shows in the debug output of asterisk.

Is this a limitation, or a bug perhaps?
Any suggestions for how to transfer the needed variable between contexts using Originate is appreciated.

/Johan





-----Ursprungligt meddelande-----
Från: asterisk-dev-bounces at lists.digium.com [mailto:asterisk-dev-bounces at lists.digium.com] För Matthew Jordan
Skickat: den 3 april 2013 18:15
Till: asterisk-dev at lists.digium.com
Ämne: Re: [asterisk-dev] Dialplan AGI with SIP channels blocking if AGI already running - parallellism not possible?

On 04/03/2013 09:58 AM, Johan Sandgren wrote:
> Thanks for noticing Michael L. Young.
> 
> Retested it with the right address also 2nd SIP MESSAGE.
> Still same result, I attach the new logs which show this.
> I see it stops after "Looking for 1000 in sipmessage".
> Nothing more happens. There's the stopping point. 
> Should it work?
> 

Unfortunately, no.

In the case of messages (regardless of the underlying technology - XMPP or SIP), a special "Message" channel driver in the core of Asterisk is responsible for servicing the text messages in the dialplan. When a text message is received in the SIP channel driver/XMPP stack, it is queued up for servicing by a taskprocesser, which is a construct that serializes requests and dispatches them on a single thread. In the messaging core, this entails creating an instance of the Message channel and and running the dialplan specified by the text message. When the dialplan is finished, it returns, and the next text message is serviced.

This means that each text message is serviced in the sequence that they arrive, and that two text messages are not serviced in parallel. The design here never envisioned text message handling to become long running events.

You may be able to work around this by deferring the work onto another channel. To do this, you could try Originating a channel to run your AGI
- something like this:

same => 1000,1,NoOp(Entry point for the message) ; Assuming you need the message data, you could save them ; off into inheritable channel variables 
same => n,Set(__MY_BODY=MESSAGE(body)) 
same => n,Originate(Local/message_handler at default,app,Echo)
same => n,Hangup()

same => message_handler,1,NoOp()
same => n,Answer()	; This will release the Originate in 1000
same => n,AGI(...)
same => n,Hangup()

Matt

--
Matthew Jordan
Digium, Inc. | Engineering Manager
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA Check us out at: http://digium.com & http://asterisk.org



--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-dev





More information about the asterisk-dev mailing list