[asterisk-users] CEL custom variable in outbound channel

Hristo Trendev dist.lists at gmail.com
Fri Jul 19 03:20:09 CDT 2013


Unfortunately I am stuck with 1.8 for the moment. The only workaround that
comes to my mind is to use userfield in the master channel as a "shared
storage" to also pack all the information (CSV or similar) that applies to
the outbound channel(s) and then to correlate the CEL events in a
post-processing step in order to pull out the info that applies to the
outbound channel from a linked master channel event.


On Thu, Jul 18, 2013 at 5:37 PM, Matthew Jordan <mjordan at digium.com> wrote:

>
> On Thu, Jul 18, 2013 at 10:16 AM, Hristo Trendev <dist.lists at gmail.com>wrote:
>
>> Hi,
>>
>> I am using Asterisk 1.8 and trying to pack some custom data in a CEL
>> HANGUP event.
>>
>> In a master (inbound) channel I can set the CHANENL(userfield) to pass
>> custom information to a CEL event. In the outbound channel created by
>> Dial() I can also possibly use a macro/gosub on answer and set the
>> CHANENL(userfield) from there.
>>
>> The problem is how to set it in an outbound channel created by Queue()
>> for example or even one created by Dial(), but which was cancelled or
>> rejected?
>>
>> If I read the docs correctly CEL uses a predefined set of values, which
>> mostly come from the CHANNEL function, but it cannot just pull the value of
>> any channel variable/function and put it in the event. Also I don't think
>> that there is any such thing as function value inheritance (setting
>> __CHANNEL(userfiled) so it is inherited so to say).
>>
>> I didn't test it myself, but there is a configuration option in
>> manager.conf that allows a list of variables to be defined and they will
>> then be automatically included in AMI events.
>>
>> Is there something similar for CEL events (with sqlite backend if that
>> matters)? Can I just get any channel variable value in a CEL event? I tried
>> changing the default cel_sqlite3 template to include a channel variable,
>> but it is always empty.
>>
>>
> So, this is only so helpful, as this solution only applies to Asterisk 11.
> There may be another way to accomplish this in Asterisk 1.8, but this is
> the first one that came to my mind - maybe someone else will have another
> suggestion. If migrating to Asterisk 11 is an option for you, than maybe
> this will help.
>
> In Asterisk 11, you could use a pre-dial handler [1] to apply the
> userfield directly to the outbound channel on the initial Dial. Because
> pre-dial handlers are run immediately after channel creation but before
> dialing or any other action is taken, they work in situations where the
> dial operation fails or is cancelled. You would have something that looks
> something like this:
>
> exten => s,1,Dial(SIP/foo,,b(default^callee_handler^1))
> ...
>
> exten => callee_handler,1,NoOp()
> same => n,Set(CHANNEL(userfield)=my_custom_data)
> same => n,Return()
>
> Note that pre-dial handlers are not directly available in the Queue
> application. However, if you use Local channel agents, then you could use
> pre-dial to put the userfield information on the callee SIP channel when
> the Local channel performs a Dial to the actual SIP device.
>
> [1] https://wiki.asterisk.org/wiki/display/AST/Pre-Dial+Handlers
>
> 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 --
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20130719/bd62e39c/attachment.htm>


More information about the asterisk-users mailing list