You are right that I MAY not need to know the codec type of a channel. But that 
was my workaround for knowing if I should place the call or if the trunk is 
busy and not show the call.

 

"group show channels" doesn't show me anything if I run it on the CLI as the 
call is initiated by A2Billing and A2Billing doesn't assign groups to trunk 
when it dials out hence I don't think GROUP_COUNT can be useful for me. "sip 
show channels" and "core show channels" do show the channel UP state and it's 
codec type.

 

I don't understand the gvbridge portion that you had in your dialplan. Can you 
please explain?

 

Thanks,

Bruce
 
> Date: Mon, 21 Jun 2010 11:07:43 -0400
> From: [email protected]
> To: [email protected]
> Subject: Re: [on-asterisk] How to check in dial-plan for a specific codec if 
> it's being used?
> 
> Bruce, 
> 
> What you asked earlier and what you are asking now seems different. If you
> just need to check if a trunk has a channel available,
> 
> For latter, you can simply use groups and function group_count in your
> dialplan. Something like
> 
> exten => _X.,n,GotoIf($[GROUP_COUNT(gvbridge) = 0]?:gvinuse);
> exten => _X.,n,Set(GROUP()=gvbridge);
> ...
> exten => _X.,n,Hangup()
> exten => _X.,n(gvinuse),Swift("All channels are busy.")
> exten => _X.,n(gvinuse),Hangup() ; Put a busy signal later
> 
> Another option is to use CHANNELS function and filter out the how many
> channels is being used in that trunk.
> 
> Can you elaborate on why you need to know the codec on a channel? It seems
> you just need to know if a channel is available or not.
> 
> On 10-06-21 1:10 AM, "Bruce N" <[email protected]> wrote:
> 
> > 
> > Remzi,
> > 
> > 
> > 
> > Thanks for pointing me to that. That's amazing but it only outputs the 
> > dialed
> > channel related info.
> > 
> > 
> > 
> > exten => s,1,Answer()
> > exten => s,n,Set(foo=${CHANNEL(audioreadformat)})
> > exten => s,n,NoOp(${foo})
> > 
> > That sets $foo = ulaw and it's perfect except for I don't need the channel
> > info for what I just dialed in but rather those of another channel that may 
> > or
> > may not be in progress is need.
> > 
> > 
> > 
> > In a nutshell, it's a DISA. Caller A calls into the system and is verfied 
> > by a
> > PIN. Afterwards, the dial-plan should check to see if a Specific dialout 
> > trunk
> > is available (as in there are no channels on that Trunk at all) and then 
> > place
> > a call out through that channel. So, the info gather by function CHANNEL 
> > won't
> > help me since it's only related to the DISA-in CHANNEL rather than those of
> > the trunk that I mentioned.
> > 
> > 
> > 
> > Or maybe there is a way to do it and I have to put some other variable in
> > CHANNEK(???)?
> > 
> > 
> > 
> > Thanks again,
> > 
> > Bruce
> > 
> > 
> >> Date: Sun, 20 Jun 2010 23:35:25 -0400
> >> From: [email protected]
> >> To: [email protected]
> >> Subject: Re: [on-asterisk] How to check in dial-plan for a specific codec 
> >> if
> >> it's being used?
> >> 
> >> Wouldn't this do the trick?
> >> 
> >> http://www.voip-info.org/wiki/view/Asterisk+func+channel
> >> 
> >> Synopsis: 
> >> CHANNEL(item) 
> >> 
> >> Description: 
> >> Gets/set various pieces of information about the channel. (New in 1.4)
> >> 
> >> item may be one of the following:
> >> Read/write Item Description
> >> R/O audioreadformat format currently being read
> >> R/O audionativeformat format used natively for audio
> >> R/O audiowriteformat format currently being written
> >> R/W callgroup call groups for call pickup
> >> R/O channeltype technology used for channel
> >> R/W language language for sounds played
> >> R/W musicclass class (from musiconhold.conf) for hold music
> >> R/O state state for channel
> >> R/W tonezone zone for indications played
> >> R/O videonativeformat format used natively for video
> >> 
> >> Items available in 1.6:
> >> Standard items (provided by all channel technologies) are:
> >> Read/write Item Description
> >> R/O audioreadformat format currently being read
> >> R/O audionativeformat format used natively for audio
> >> R/O audiowriteformat format currently being written
> >> R/W callgroup call groups for call pickup
> >> R/O channeltype technology used for channel
> >> R/W language language for sounds played
> >> R/W musicclass class (from musiconhold.conf) for hold music
> >> R/W parkinglot parkinglot for parking
> >> R/W rxgain set rxgain level on channel drivers that support it
> >> R/O state state for channel
> >> R/W tonezone zone for indications played
> >> R/W txgain set txgain level on channel drivers that support it
> >> R/O videonativeformat format used natively for video
> >> 
> >> 
> >> On 10-06-20 11:29 PM, "Remzi Turer" <[email protected]> wrote:
> >> 
> >>> Why don't you use phpagi to connect to Asterisk management directly, 
> >>> instead
> >>> of doing system calls. It is more reliable, plus I have used it many of
> >>> times, never had an issue or hanged process.
> >>> 
> >>> 
> >>> On 10-06-20 10:44 PM, "Bruce N" <[email protected]> wrote:
> >>> 
> >>>> 
> >>>> Thanks for the input.
> >>>> 
> >>>> 
> >>>> I have already used system() in phpagi to do an "asterisk -rx" and the 
> >>>> "sip
> >>>> show channels" and "grep -c" for g729 and that works kind of. But as I
> >>>> said,
> >>>> it's not very responsive and it hangs sometimes. It probably be the same
> >>>> results even if I used some php-agi parameter to harvest the info I want.
> >>>> Overall, it's not as clean of a method as a dialplan method would be if 
> >>>> it
> >>>> was
> >>>> doable.
> >>>> 
> >>>> 
> >>>> I am amazed that there is no easy dial-plan method to tell if a trunk is
> >>>> being
> >>>> used or if a codec is being used.
> >>>> 
> >>>> 
> >>>> P.S. GROUP_COUNT seems to be useless in my case as well.
> >>>> 
> >>>> 
> >>>> Thanks
> >>>> 
> >>>>> Date: Sun, 20 Jun 2010 20:44:53 -0400
> >>>>> From: [email protected]
> >>>>> To: [email protected]
> >>>>> CC: [email protected]
> >>>>> Subject: Re: [on-asterisk] How to check in dial-plan for a specific 
> >>>>> codec
> >>>>> if
> >>>>> it's being used?
> >>>>> 
> >>>>>>> I have a need to check and see if a G.729 channel is up and running
> >>>>>>> and then to set a variable as FALSE and TRUE based on the outcome.
> >>>>>>> Can this be done with the dial-plan?
> >>>>>>> 
> >>>>>>> 
> >>>>>>> I can also live with a dial-plan code that check to see if a Trunk
> >>>>>>> is being used and if it is to set a variable to FALSE or TRUE based
> >>>>>>> on the condition.
> >>>>>>> 
> >>>>>>> 
> >>>>>>> I can also work with a method that can check to see if a number
> >>>>>>> dialed on the system start with 678 and if a call is on progress and
> >>>>>>> set a variable to TRUE or FALSE.
> >>>>>>> 
> >>>>>>> 
> >>>>>>> All of the above approaches are fine by me but I prefer the Trunk
> >>>>>>> option to be checked if it's used, and then the G.729 check option.
> >>>>>>> 
> >>>>>>> 
> >>>>>>> Any input is appreciated.
> >>>>>>> 
> >>>>>>> 
> >>>>>>> Running Asterisk v1.4.x
> >>>>>>> 
> >>>>>>> 
> >>>>>>> Note: I have used phpagi to do a system call for "asterisk -rx" and
> >>>>>>> that is not a good solution as the php file itself hangs sometimes
> >>>>>>> in Asterisk dial-plan. Something dial-plan native would make my life
> >>>>>>> much easier.
> >>>>> 
> >>>>> Well "sip show channel" shows the codec in use for a given channel. I
> >>>>> would
> >>>>> have said to use an AGI script for that, but you don't want to. How 
> >>>>> about
> >>>>> scanning logs, (although that could take time?)
> >>>>> 
> >>>>> You could hack a variable into AGI command to specify the codec. There 
> >>>>> is
> >>>>> a
> >>>>> var called ${SIP_CODEC} that says it's used to set the codec, maybe it
> >>>>> shows
> >>>>> the codec too (long shot?)
> >>>>> 
> >>>>> -- 
> >>>>> John Van Ostrand
> >>>>> CTO, co-CEO 
> >>>>> Net Direct Inc.
> >>>>> 564 Weber St. N. Unit 12, Waterloo, ON N2L 5C6
> >>>>> Ph: 866-883-1172 x5102
> >>>>> Fx: 519-883-8533
> >>>>> 
> >>>>> Linux Solutions / IBM Hardware
> >>>>> 
> >>>> 
> >>>> _________________________________________________________________
> >>>> Turn down-time into play-time with Messenger games
> >>>> http://go.microsoft.com/?linkid=9734385
> >>> 
> >>> 
> >>> 
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: [email protected]
> >>> For additional commands, e-mail: [email protected]
> >>> 
> >> 
> >> 
> >> 
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [email protected]
> >> For additional commands, e-mail: [email protected]
> >> 
> > 
> > _________________________________________________________________
> > Learn more ways to connect with your buddies now
> > http://go.microsoft.com/?linkid=9734388
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 
                                          
_________________________________________________________________
Learn more ways to connect with your buddies now
http://go.microsoft.com/?linkid=9734388

Reply via email to