[asterisk-dev] chan_zap questions

Armin Schindler armin at melware.de
Wed Jul 12 05:43:46 MST 2006


On Wed, 12 Jul 2006, Klaus Darilion wrote:
> Armin Schindler wrote:
> > On Wed, 12 Jul 2006, Klaus Darilion wrote:
> > > Armin Schindler wrote:
> > > > On Tue, 11 Jul 2006, Kevin P. Fleming wrote:
> > > > > ----- Armin Schindler <armin at melware.de> wrote:
> > > > > > I think a defined indication via ast_indicate() (which is
> > > > > > forwarded by
> > > > > > Asterisk even in app_dial()) would be more appropriate.
> > > > > We've already added the ability to queue control frames
> > > > > (which are
> > > > > delivered by ast_indicate()) that carry a payload, which was
> > > > > done
> > > > > specifically for this purpose.
> > > > Yes, I noticed the additional Parameter to the indicate function.
> > > > That's why I mentioned this. It's a better way than doing it via
> > > > the
> > > > bridge.
> > > > 
> > > > Klaus, what is the reason for using the bridge instead of
> > > > indicate?
> > > Probably it is lack of Asterisk know-how. ast_indicate_data looks
> > > promising -
> > > but I still do not know how to get the reference to the other call
> > > leg.
> > > 
> > > 
> > > Caller          Asterisk            Callee
> > > leg 1                 leg2
> > > <-------FACILITY---
> > > 
> > > 
> > > Currently, if there is an incoming FACILITY message, the facility
> > > event is
> > > sent to chan_zap, which gets the AOC-D units from the event
> > > structure. But to
> > > forward it on call leg 1 I need to get a reference to the ast_cannel
> > > of leg 1.
> > > How do I get this?
> > 
> > I don't think you need to know the other leg.
> > Just pass a CONTROL FRAME to Asterisk.
> > It seems that currently these CONTROL frames are supported for
> > additional data:
> > AST_CONTROL_HOLD
> > AST_CONTROL_UNHOLD
> > AST_CONTROL_VIDUPDATE
> > 
> > Maybe an additional subclass
> > AST_CONTROL_AOC
> > should be introduced.
> 
> Thats what I did and it works fine. But ast_indicate_data requires a
> ast_channel as first parameter. If FACILITY is received on leg2, I have to
> find out the ast_channel of leg 1 to indicate on the proper channel. Fur this
> purpose I still use ast_bridged_call. Any other suggestion?

No, don't use ast_indicate*() directly, just use the normal *read function 
to give this CONTROL frame to asterisk. The asterisk code (bridge or 
dial-before-bridge) will forward this CONTROL frame to the other leg. 
 
> during processing of case PRI_EVENT_FACNAME:
> struct ast_channel *otherchan;
> otherchan = ast_bridged_channel(pri->pvts[chanpos]->owner);
> if (otherchan && (!strcmp(otherchan->tech->type, "Zap"))) {
> /* Only for Zap channels */
> ast_indicate_data(otherchan, AST_CONTROL_AOCD, &aocd,
>                  sizeof(struct aocd_data));

Yes, that's the direct way, but you don't need that. See above.

Armin




More information about the asterisk-dev mailing list