Extensions_Custom.conf and Set(SIP_CODEC=...)

Status
Not open for further replies.

tony722

Joined
Sep 23, 2010
Messages
34
Reaction score
1
If I edit extensions_additional.conf (obviously as a test, as changes are overwritten), and in section:

[outrt-006-Toll-Free]

add the line:
exten => _1800NXXXXXX,n,Set(SIP_CODEC=g729)

then outgoing calls on this SIP Trunk go out g729 without being transcoded.

Resultant extensions_additional.conf:
Code:
[outrt-006-Toll-Free]
include => outrt-006-Toll-Free-custom
exten => _1800NXXXXXX,1,Macro(user-callerid,SKIPTTL,)
exten => _1800NXXXXXX,n,ExecIf($["${KEEPCID}"!="TRUE" & ${LEN(${DB(AMPUSER/${AMPUSER}/outboundcid)}}=0 & ${LEN(${TRUNKCIDOVERRIDE}}=0]?Set(TRUNKCIDOVERRIDE=1**********))
exten => _1800NXXXXXX,n,Set(_NODEST=)

;Added this line here--as a test:
exten => _1800NXXXXXX,n,Set(SIP_CODEC=g729)

So I undid that change, and tried it with extensions_custom.conf. I added the following:

Code:
[outrt-006-Toll-Free-custom]
exten => _1800NXXXXXX,1,Set(SIP_CODEC=g729)

and it had no effect.

What is the proper way to do this with extensions_custom.conf?

Thanks!

Tony
 
Interesting....
http://www.freepbx.org/v2/ticket/1547 points out the following:

From this I assume we must expect that the custom contexts included in all the extensions_additional.conf contexts will be called after the context in which they are included.

That in fact seems to be the case. So by adding
exten => _1800NXXXXXX,1,Set(SIP_CODEC=g729)

to the previous section [outrt-005-PSTN-Local-custom] in extensions_custom.conf (it actually works). Not how I had expected to have to set this up, curious for sure, but I suppose it's OK... it works anyway. Does this sound about right to everyone?

Seems a little hard to stay on top of, in terms of maintaining dial plans....
 
Re: Re:Extensions_Custom.conf and Set(SIP_CODEC=...)

why do u need to chaneg codecs in dialplan and no in extensions configs???
remember that asterisk is crappy at changing codecs after a cll is made ... as the reinvites and negociations are very "limited"
 
Thank you for your reply, fmvillares!

I have a system that is entirely uLaw except my SIP Trunk, which is g729 only.

My phones (Polycom) are capable of native g729, but force Asterisk to transcode calls to the SIP Trunk from uLaw to g729, rather than going g729 native on the Trunk.

I can force the extension (or the phone) to prefer g729, but then Asterisk transcodes the uLaw stuff, like the PSTN lines.

So I'm trying to find a way--hopefully there's a better way than this--to prevent transcoding.

Does that make sense?

Thanks!

Tony
 
Re: Re:Extensions_Custom.conf and Set(SIP_CODEC=...)

??????????????? dont understand a single line....
 
The phone is set up with the following codec preferences: uLaw, g729.

The Extension is configured to allow all codecs.

The SIP trunk is configured disallow=all, allow=g729.

When a call goes out over the SIP trunk, and I do "sip show channels" in asterisk CLI, it says:

Extension: 0x4 (ulaw)
Trunk: 0x100 (g729)

So the call is being transcoded, which I don't want. (I don't want to disable uLaw on my extension, as I use it for PSTN calls).

So that's why my original question about Set(SIP_CODEC=g729) in my dialplan in extensions_custom.conf.

Hopefully there's a better way to accomplish this?! :unsure:
 
im still dont understand the question...simply put phones in g729 and trunk in g729 and voila no transcoding done...btw do you have g729 licenses bought? or u use the ootb asterisk install
 
I don't want to disable uLaw on my extension, as I use it for PSTN calls, and also extension-to-extension calls.

We have licensed g729 from Digium.

Thanks!
 
its the first time i see this type of questions in my 9 years with asterisk....
what is the problem to do this?? not enough power? hundreds of comms simultaneously ? as asterisk even does not change codecs on the fly...
 
I don't want to exhaust my g729 licenses unnecessarily, and there is a clear difference in call quality between native g729 and transcoded g729.

Sorry, I didn't realize I was pushing the envelope with this question--it just felt obvious to me with my audio engineering background that unnecessary transcoding could/should be eliminated.
 
well it depends...i ve been measured with mos standards transcoded g711 to g729 and viceversa and the quality is always more than 4 with a g711 is a complete and perfect 4.5...BTW u have and absolute ear to tell the difference of compressed passthrough and transcoded in narrowband 3.1khz sound???....i think in this case the efforts for changing standard behaviours is unnecesary...
 
I want to also add--thanks again, Fernando, for sticking with me here!

Issuing the Set(SIP_CODEC=g729) in the dial plan works. I've tested it and it causes outgoing calls to be placed g729 on the extension and the trunk. The question is how to get that command to be placed properly in the extensions_custom.conf file, or if some other command/setting that would have the same effect. So far it's escaped me.
 
yeap it works (sometimes) but it should be used replacing or adding some lines ni the macro dial....or extending the dial strings in extensions_custom
 
Yes that sounds about right! Can you elaborate a bit more?
 
Re: Re:Extensions_Custom.conf and Set(SIP_CODEC=...)

yes follow the macros for example macro-dial!!!!
 
Yeah, I was looking at that, and I'm still stuck...

Unfortunately, as far as I can tell (based on the link in my second post), the Include for extensions_custom.conf (include => macro-dialout-trunk-custom) is executed *after* the macro finishes executing--too late.

Also, I wouldn't want it to execute Set(SIP_CODEC=g729) on PSTN or Extension-to-Extension calls, obviously.

Thanks! :)
 
Re: Re:Extensions_Custom.conf and Set(SIP_CODEC=...)

always a master my great friend dick...btw as our frined says before do you have also transcoding quality problems as this fella has to need this type of patch?
 
Note: This is not a working solution, yet. See post(s) below.

dicko said:
Try replacing with the "start" extension "s"

http://www.voip-info.org/wiki/view/Aste ... extensions

something like.


[outrt-006-Toll-Free-custom]
exten => s,1,Set(SIP_CODEC=g729)
exten => s,n,goto(${EXTEN},1)

Thanks so much dicko for offering this suggestion! Unfortunately the call continued to be placed in such a way as to be transcoded.

Finally, tho, I came to a very workable solution:
http://www.freepbx.org/support/documentation/howtos/how-to-execute-a-custom-dial-plan-fragment-befor

And adding the following to my extensions_custom.conf worked! :)
Code:
[macro-dialout-trunk-predial-hook]
exten => s,1,NoOp(Codec Check on ${OUT_${DIAL_TRUNK}})
exten => s,n,GotoIf($["${OUT_${DIAL_TRUNK}}" = "SIP/CallCentric"]?G729)
exten => s,n,MacroExit()

exten => s,n(G729),NoOp(Setting Codec to g729)
exten => s,n,set(SIP_CODEC=g729)
exten => s,n,MacroExit()

[macro-dialout-trunk-predial-hook] is the elusive section in extensions_custom.conf I was looking for!

Thank you Fernando and dicko for your help on this! :-) I very much appreciate it.
 
Hi ,
I have the same problem but I don't understand how you solve twice traslaction :).

PLS Could you post extension.conf?
 
Status
Not open for further replies.

Forum statistics

Threads
111,864
Messages
589,459
Members
164,703
Latest member
eokwaro