[asterisk-users] Change codec when dial from SIP to DAHDI

d tbsky tbskyd at gmail.com
Wed Sep 24 22:20:13 CDT 2014


hi:
    I Have tried asterisk 1.6.2, 1.8, 11, 12, 13. all versions behave
the same => transcode in the middle even two legs use the same code.

 but I found an article which seems to solve this kind of problem:

    https://wiki.asterisk.org/wiki/display/AST/Media+Format+Rewrite

   but I tried version 13 and didn't notice the change, are there new
diaplan commands or channel variables to do this?

   thanks a lot for help!!

Regards,
tbskyd




2014-09-24 1:30 GMT+08:00 d tbsky <tbskyd at gmail.com>:
> Hi:
>      I am useing asterisk 11.12.
>      I use G722 as preferred codec for my ip-phone. and my PSTN DAHDI
> use alaw. G722 is great when ip-phone talks to each other. but when
> ip-phone dialout to PSTN DAHDI, G722 is not great, since it is need to
> transcode to alaw.
>      so I try to change the codec when dial from SIP to DAHDI. I tried
> to use IP_CODEC/SIP_CODEC_OUTBOUND at dialplan. but the SIP codec
> change after dahdi answered the channel. so everything is broken. the
> call log like below:
>
>      [2014-09-23 21:18:46] VERBOSE[11634][C-0000000d] pbx.c:     --
> Executing [s at macro-dialout-trunk-predial-hook:2]
> Set("SIP/222-00000004", "SIP_CODEC=alaw") in new stack
> [2014-09-23 21:18:46] VERBOSE[11634][C-0000000d] pbx.c:     --
> Executing [s at macro-dialout-trunk-predial-hook:3]
> Set("SIP/222-00000004", "SIP_OUT_CODEC=alaw") in new stack
> [2014-09-23 21:18:46] VERBOSE[11634][C-0000000d] pbx.c:     --
> Executing [s at macro-dialout-trunk-predial-hook:4]
> MacroExit("SIP/222-00000004", "") in new stack
> [2014-09-23 21:18:46] VERBOSE[11634][C-0000000d] pbx.c:     --
> Executing [s at macro-dialout-trunk:18] GotoIf("SIP/222-00000004",
> "0?bypass,1") in new stack
> [2014-09-23 21:18:46] VERBOSE[11634][C-0000000d] pbx.c:     --
> Executing [s at macro-dialout-trunk:19] ExecIf("SIP/222-00000004",
> "1?Set(CONNECTEDLINE(num,i)=0912345678)") in new stack
> [2014-09-23 21:18:46] VERBOSE[11634][C-0000000d] pbx.c:     --
> Executing [s at macro-dialout-trunk:20] ExecIf("SIP/222-00000004",
> "1?Set(CONNECTEDLINE(name,i)=CID:222)") in new stack
> [2014-09-23 21:18:46] VERBOSE[11634][C-0000000d] pbx.c:     --
> Executing [s at macro-dialout-trunk:21] GotoIf("SIP/222-00000004",
> "0?customtrunk") in new stack
> [2014-09-23 21:18:46] VERBOSE[11634][C-0000000d] pbx.c:     --
> Executing [s at macro-dialout-trunk:22] Dial("SIP/222-00000004",
> "DAHDI/g2/0912345678,300,Tt") in new stack
> [2014-09-23 21:18:46] VERBOSE[11634][C-0000000d] app_dial.c:     --
> Called DAHDI/g2/0912345678
> [2014-09-23 21:18:53] VERBOSE[11634][C-0000000d] app_dial.c:     --
> DAHDI/2-1 answered SIP/222-00000004
> [2014-09-23 21:18:53] NOTICE[11634][C-0000000d] chan_sip.c: Changing
> codec to 'alaw' for this call because of ${SIP_CODEC} variable
> [2014-09-23 21:18:53] NOTICE[11634][C-0000000d] chan_sip.c: Changing
> codec to 'alaw' for this call because of ${SIP_CODEC} variable
>
>    if I check channel with "core show channel xxxxx", got DAHDI/SIP
> legs final like this:
>   NativeFormats: (alaw)
>   WriteFormat: slin
>   ReadFormat: slin
>   WriteTranscode: Yes (slin)->(alaw)
>   ReadTranscode: Yes (alaw)->(slin)
>
>   although two legs finally use alaw both, but transcode use slin in
> the middle. is it possible to prevent the transcode?
>
>   if that is not possible, then maybe I should give up using G722 as
> the preffered codec of ip phone. back to G711 seems much  easier to
> make all legs with the same codec.
>
>    thanks a lot for help!!
>
> Regards,
> tbskyd



More information about the asterisk-users mailing list