[asterisk-users] IMPORT from bridged Local channels not importing.
Richard Mudgett
rmudgett at digium.com
Fri Dec 9 11:29:49 CST 2016
On Tue, Nov 15, 2016 at 8:21 AM, Ethy H. Brito <ethy.brito at inexo.com.br>
wrote:
>
> Hi All
>
> I have some users that can access outside world telephone number.
> They have external numbers to be reached as well.
>
> Due to internal policy restrictions, they are not allowed to dial
> each other internal numbers. I Can't change that.
>
> When an internal user dials the external number for another internal user,
> I Dial(Local/...) the second user.
>
> So I end up with two channels:
> SIP/origin to Local/dest_ext_num;1
> and
> Local/dest_ext_num;2 to SIP/destination
>
> When the call is hung up (h extension), I need to grab the stats of both
> legs (SIP/origin and SIP/destination) of the call, so I use:
>
> ${RTPAUDIOQOS}
>
> to grab the origin leg stats and
>
> Set(MyDESTCH=${CUT(CDR(dstchannel),\;,1)}\;2)
> Set(DESTCH=${IMPORT(${MyDESTCH},BRIDGEPEER)})
> Set(STATS=${IMPORT(${DESTCH},CHANNEL(rtpqos,audio,all))})
>
> to grab the stats for destination leg.
>
> MyDESTCH is correctly set to "Local/dest_ext_num;2"
> DESTCH receives "SIP/destination"
> But STATS is ""
>
> What am I missing here?
>
You cannot get information from a channel that no longer exists.
SIP/destination almost certainly no longer exists when the h exten
runs on SIP/origin.
> Is there a smarter way for grabbing these?
>
I would suggest using hangup handlers [1]. Add a hangup handler to
SIP/origin and SIP/destination. The handler will run on the respective
channel when it hangs up. These two channels will hang up at different
times so you can only get the current channel's information. If you have
to process both channel's information then you are going to have to do that
after both channels have hung up.
>
> Another questions: when the call is hung, in which context is "h
> extension" run?
Always originator? Always destination? Depends on what?
> What about in this scenario I describe (four contexts involved)?
>
In your case, the h exten is run by SIP/origin and Local/dest_ext_num;2.
These
channels executed dialplan when the call was originally placed. The h
exten runs
on the respective channel in the last context the channel executed
dialplan. This
is usually at the Dial application.
Richard
[1] https://wiki.asterisk.org/wiki/display/AST/Hangup+Handlers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20161209/71b5be95/attachment.html>
More information about the asterisk-users
mailing list