[asterisk-users] Log CODECS in CDR's

James FitzGibbon james.fitzgibbon at gmail.com
Fri May 11 07:14:55 MST 2007


On 5/11/07, Morgan Gilroy <morgan at telappliant.com> wrote:
>
> At the moment to find the codecs used I have to look though the sip
> trace or show channels/show channel (annoying when you have 50+
> channels).
> Im just trying to find an easier and quicker way to keep track of the
> codecs used to help with debug etc.
>
> The closest variable iv found is, "${SIP_CODEC} Set the SIP codec for a
> call"
> Ill see if NoOp (${SIP_CODEC}) shows the codec that was used without me
> setting it though I don't think it will.
>
> Iv looked all over and I cant find anything so it looks like I may have
> to hack a ast_set_var into app_dial or chan_sip



1.4 has the CHANNEL function:

pbxlab-01*CLI> show function CHANNEL
pbxlab-01*CLI>
  -= Info about function 'CHANNEL' =-

[Syntax]
CHANNEL(item)

[Synopsis]
Gets/sets various pieces of information about the channel.

[Description]
Gets/set various pieces of information about the channel.
Standard items (provided by all channel technologies) are:
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     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

When I put this in a dialplan with NoOps and called channel macros, I can
kind of get what you're describing:

[from-external-pbxtel]
exten   => 491,1,NoOp(${CHANNEL(audioreadformat)})
exten   => 491,n,NoOp(${CHANNEL(audiowriteformat)})
exten   => 491,n,NoOp(${CHANNEL(audionativeformat)})
exten   => 491,n,Dial(SIP/491,20,M(logcodec))
exten   => 491,n,Hangup

[macro-logcodec]
exten => s,1,NoOp(${CHANNEL(audioreadformat)})
exten => s,n,NoOp(${CHANNEL(audiowriteformat)})
exten => s,n,NoOp(${CHANNEL(audionativeformat)})

Console output is:

    -- Executing [491 at from-external-pbxtel:1] NoOp("IAX2/pbxtel-01-5",
"ulaw") in new stack
    -- Executing [491 at from-external-pbxtel:2] NoOp("IAX2/pbxtel-01-5",
"ulaw") in new stack
    -- Executing [491 at from-external-pbxtel:3] NoOp("IAX2/pbxtel-01-5",
"ulaw") in new stack
    -- Executing [491 at from-external-pbxtel:4] Dial("IAX2/pbxtel-01-5",
"SIP/491|20|M(logcodec)") in new stack
    -- Called 491
    -- SIP/491-0a16d1c0 is ringing
    -- SIP/491-0a16d1c0 answered IAX2/pbxtel-01-5
    -- Executing [s at macro-logcodec:1] NoOp("SIP/491-0a16d1c0", "slin") in
new stack
    -- Executing [s at macro-logcodec:2] NoOp("SIP/491-0a16d1c0", "slin") in
new stack
    -- Executing [s at macro-logcodec:3] NoOp("SIP/491-0a16d1c0", "gsm") in new
stack
  == Spawn extension (from-external-pbxtel, 491, 4) exited non-zero on
'IAX2/pbxtel-01-5'
    -- Hungup 'IAX2/pbxtel-01-5'

This is a call coming in as ulaw over IAX2, then going to a SIP softphone
configured for only gsm.

Hope that helps.

-- 
j.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20070511/4083b335/attachment.htm


More information about the asterisk-users mailing list