Ethy H. Brito
2016-Nov-15 14:21 UTC
[asterisk-users] IMPORT from bridged Local channels not importing.
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? Is there a smarter way for grabbing these? 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)? Environment is: asterisk -V Asterisk 11.7.0~dfsg-1ubuntu1 running on Ubuntu 14.04.5 LTS Thanx for your time. Cheers Ethy
Ethy H. Brito
2016-Dec-09 00:56 UTC
[asterisk-users] IMPORT from bridged Local channels not importing.
On Tue, 15 Nov 2016 12:21:31 -0200 "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? > Is there a smarter way for grabbing these? > > 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)? > > Environment is: asterisk -V > > Asterisk 11.7.0~dfsg-1ubuntu1 running on Ubuntu 14.04.5 LTS > > > Thanx for your time. > Cheers > > EthyHi All No suggestions at all?? Cheers Ethy
Richard Mudgett
2016-Dec-09 17:29 UTC
[asterisk-users] IMPORT from bridged Local channels not importing.
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>