[Asterisk-Users] How to force G729
We want some of our users to use G729, and some others to use ULAW. Our PSTN gateway provider supports both, so that's not a problem, and if I force him (the PSTN gateway) to allow G729 only, the outgoing call will take place with G729. The problem is that I want to have my PSTN provider configured to allow ULAW as a first priority, then G729. I did it like that: [mypstngate] type=friend host=192.168.0.100 port=5060 context=pstn-in canreinvite=no disallow=all allow=ulaw allow=g729 Then, in the outgoing context for our G729 SIP customers, I've put something like that: exten = _0N,1,setvar(SIP_CODEC=g729) exten = _0N,2,Dial(SIP/0041${EXTEN:[EMAIL PROTECTED],90) What happens now when placing a call is very interesting. As you can see, Asterisk wants to change the codec to g729, but on the outgoing call to the PSTN gateway it remains ULAW. Like this, I'm using up one of my G729 licenses, and Asterisk is doing the transcoding between G729 and ULAW. That's definitely not what I want. Any ideas about how to force both channels to G729? By the way, if I use a client which doesn't support G729, this call doesn't even take place, it hangs up, because Asterisk tries to force G729 on the client's channel (but not on the PSTN gateway's channel). In other words, the setvar(SIP_CODEC=g729) only forces the codec on the calling channel, not on the called channel. How can I change that? Another interesting thing, the show g729 after the call hangs up: I have -1/-2 encoders/decoders in use. Maybe a bug? Thanks -Manuel *CLI -- Executing SetVar(SIP/2016-b119, SIP_CODEC=g729) in new stack -- Executing Dial(SIP/2016-b119, SIP/[EMAIL PROTECTED]|90) in new stack -- Called [EMAIL PROTECTED] -- SIP/mypstngate-caed is making progress passing it to SIP/2016-b119 -- SIP/mypstngate-caed is ringing -- SIP/mypstngate-caed answered SIP/2016-b119 Jun 24 09:49:23 NOTICE[1094450096]: chan_sip.c:1314 sip_answer: Changing codec to 'g729' for this call because of ${SIP_CODEC) variable -- Attempting native bridge of SIP/2016-b119 and SIP/mypstngate-caed *CLI sip show channels Peer User/ANRCall ID Seq (Tx/Rx) Lag Jitter Format 192.168.0.1000041911234 1f7d34e3642 00102/0 0ms ms ULAW 192.168.0.2 20164977-4F41-7 00101/3 0ms ms G729A 2 active SIP channel(s) [... after hangup ...] == Spawn extension (auth-out, 0911234567, 2) exited non-zero on 'SIP/2016-b119' -- Executing Hangup(SIP/2016-b119, ) in new stack == Spawn extension (auth-out, h, 1) exited non-zero on 'SIP/2016-b119' cdr_odbc: Query Successful! *CLI show g729 -1/-2 encoders/decoders of 30 licensed channels are currently in use *CLI ___ Ticinocom SA - Via Stazione 5 - 6600 Muralto Tel 0844 007070 - Fax 0844 007071 http://www.ticinocom.com ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [Asterisk-Users] How to force G729
allow=ulaw Why don't you remove this? Isamar ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
R: [Asterisk-Users] How to force G729
Try to configure in sip.conf your extensions context like this: [XXX] disallow=all allow=g729 Done that already: but then, the incoming channel (from the user to Asterisk) is G729, and the outgoing channel (from Asterisk to the PSTN gateway) still remains ULAW, so Asterisk has to do transcoding (ULAW to G729), which I don't want, obviously. For some reason, the outgoing channel doesn't follow the setvar(SIP_CODEC=g729) rule. -Manuel ___ Ticinocom SA - Via Stazione 5 - 6600 Muralto Tel 0844 007070 - Fax 0844 007071 http://www.ticinocom.com ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
R: R: [Asterisk-Users] How to force G729
Define that per user. Of course... The user part is not the problem. If I force a user in its extensions to use G729 only, he actually talks G729 to Asterisk, but asterisk still talks ULAW to the PSTN gateway, doing the transcoding. This is driving me crazy... -Manuel ___ Ticinocom SA - Via Stazione 5 - 6600 Muralto Tel 0844 007070 - Fax 0844 007071 http://www.ticinocom.com ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: R: [Asterisk-Users] How to force G729
When I set the SIP_CODEC variable to force g729: Jun 24 12:30:01 NOTICE[1226062640]: chan_sip.c:1313 sip_answer: Changing codec to 'g729' for this call because of ${SIP_CODEC) variable -- Attempting native bridge of SIP/8011-86fe and SIP/8008-c2b9 Jun 24 12:30:02 NOTICE[1234455344]: channel.c:1508 ast_set_read_format: Unable to find a path from G729A to ULAW Jun 24 12:30:02 NOTICE[1234455344]: channel.c:1478 ast_set_write_format: Unable to find a path from ULAW to G729A Jun 24 12:30:02 WARNING[1226062640]: chan_sip.c:1332 sip_write: Asked to transmit frame type 256, while native formats is 4 (read/write = 4/4) == Spawn extension (sip, 8041, 2) exited non-zero on 'SIP/8011-86fe' -- Got SIP response 481 Call Leg/Transaction Does Not Exist back from 217.117.xxx.xxx Though I get a short 'hello' (voice) from the otherside, but after that line dies. Stefan On Thu, 24 Jun 2004, Manuel Wenger wrote: Try to configure in sip.conf your extensions context like this: [XXX] disallow=all allow=g729 Done that already: but then, the incoming channel (from the user to Asterisk) is G729, and the outgoing channel (from Asterisk to the PSTN gateway) still remains ULAW, so Asterisk has to do transcoding (ULAW to G729), which I don't want, obviously. For some reason, the outgoing channel doesn't follow the setvar(SIP_CODEC=g729) rule. -Manuel ___ Ticinocom SA - Via Stazione 5 - 6600 Muralto Tel 0844 007070 - Fax 0844 007071 http://www.ticinocom.com ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: R: R: [Asterisk-Users] How to force G729
Define that per user. Of course... The user part is not the problem. If I force a user in its extensions to use G729 only, he actually talks G729 to Asterisk, but asterisk still talks ULAW to the PSTN gateway, doing the transcoding. This is driving me crazy... If I understood your initial objective correctly (and I may not have), the user's phones are negotiating the codec to be used for each rtp session. Asterisk parameters can be used to dictate rtp sessions between the sip phone and asterisk, but that won't influence the next step in which the sip phone negotiates a new rtp session directly with the gateway. The gateway and the phone will negotiate a common codec based on whatever logic those two devices have been programmed with by their respective manufacturers; asterisk isn't involved. So, it sounds like the issue is understanding the codec selection logic that has been programmed into the gateway and the phone. ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
R: R: R: [Asterisk-Users] How to force G729
If I understood your initial objective correctly (and I may not have), the user's phones are negotiating the codec to be used for each rtp session. Asterisk parameters can be used to dictate rtp sessions between the sip phone and asterisk, but that won't influence the next step in which the sip phone negotiates a new rtp session directly with the gateway. The gateway and the phone will negotiate a common codec based on whatever logic those two devices have been programmed with by their respective manufacturers; asterisk isn't involved. So, it sounds like the issue is understanding the codec selection logic that has been programmed into the gateway and the phone. I think you're getting my point, at least I think so (I'm getting more and more confused myself about this...) The problem is that the phone negotiates a codec with asterisk when placing the call (remember I have all reinvite's set to no, so the gateway and the phone won't talk directly to each other!). This negotiation actually works correctly, because I force the phone's codec using disallow=all; allow=g729 in the SIP phone's peer configuration. The negotiation which doesn't work the way I want is the asterisk-to-gateway part. The gateway can talk either ULAW or G729, whatever I tell it, if I force it using the disallow/allow method in sip.conf. The problem is that I need asterisk to talk to the gateway sometimes with ULAW, sometimes with G729, depending on the SIP phone who placed the call in the first place. What I need is some sort of command which says OK, now Dial(... @gateway), but force G729 (which works *if* I tell asterisk that the gateway supports G729 *only* in sip.conf, but we want it to support both codecs, right?). Apparently I can only force the codec on incoming channels, not on outgoing channels. Is this really an asterisk limitation? -Manuel ___ Ticinocom SA - Via Stazione 5 - 6600 Muralto Tel 0844 007070 - Fax 0844 007071 http://www.ticinocom.com ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: R: R: R: [Asterisk-Users] How to force G729
If I understood your initial objective correctly (and I may not have), the user's phones are negotiating the codec to be used for each rtp session. Asterisk parameters can be used to dictate rtp sessions between the sip phone and asterisk, but that won't influence the next step in which the sip phone negotiates a new rtp session directly with the gateway. The gateway and the phone will negotiate a common codec based on whatever logic those two devices have been programmed with by their respective manufacturers; asterisk isn't involved. So, it sounds like the issue is understanding the codec selection logic that has been programmed into the gateway and the phone. I think you're getting my point, at least I think so (I'm getting more and more confused myself about this...) The problem is that the phone negotiates a codec with asterisk when placing the call (remember I have all reinvite's set to no, so the gateway and the phone won't talk directly to each other!). This negotiation actually works correctly, because I force the phone's codec using disallow=all; allow=g729 in the SIP phone's peer configuration. The negotiation which doesn't work the way I want is the asterisk-to-gateway part. The gateway can talk either ULAW or G729, whatever I tell it, if I force it using the disallow/allow method in sip.conf. The problem is that I need asterisk to talk to the gateway sometimes with ULAW, sometimes with G729, depending on the SIP phone who placed the call in the first place. What I need is some sort of command which says OK, now Dial(... @gateway), but force G729 (which works *if* I tell asterisk that the gateway supports G729 *only* in sip.conf, but we want it to support both codecs, right?). Apparently I can only force the codec on incoming channels, not on outgoing channels. Is this really an asterisk limitation? Now I better understand what you're trying to do. I'm not a programmer, but I'm fairly certain that you can't dynamically change codec preference within asterisk on a per call basis. However, just as soon as this gets posted, someone will likely jump all over that statement and post a way to do it. I don't think its and incoming vs outgoing issue. For each outgoing call, an rtp session is established between * and the gateway. That rtp session goes through a codec negotiation process that automatically selects a compatible codec based on what's common, and, when multiple choices are available, some other decision making process (transcode time, quality or something) that you probably don't have control over on a per call basis. So, my guess is you're not going to be able to do what you want. ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: R: R: R: [Asterisk-Users] How to force G729
Did you try having two sip.conf entries for your gateway? Forcing one with G729 and the other with ulaw? You would obviously need to change your dialplan accordingly and have each phone configured so that it would take the proper extension. I have not tried this, it is just really an idea... Manuel Wenger wrote: If I understood your initial objective correctly (and I may not have), the user's phones are negotiating the codec to be used for each rtp session. Asterisk parameters can be used to dictate rtp sessions between the sip phone and asterisk, but that won't influence the next step in which the sip phone negotiates a new rtp session directly with the gateway. The gateway and the phone will negotiate a common codec based on whatever logic those two devices have been programmed with by their respective manufacturers; asterisk isn't involved. So, it sounds like the issue is understanding the codec selection logic that has been programmed into the gateway and the phone. I think you're getting my point, at least I think so (I'm getting more and more confused myself about this...) The problem is that the phone negotiates a codec with asterisk when placing the call (remember I have all reinvite's set to no, so the gateway and the phone won't talk directly to each other!). This negotiation actually works correctly, because I force the phone's codec using disallow=all; allow=g729 in the SIP phone's peer configuration. The negotiation which doesn't work the way I want is the asterisk-to-gateway part. The gateway can talk either ULAW or G729, whatever I tell it, if I force it using the disallow/allow method in sip.conf. The problem is that I need asterisk to talk to the gateway sometimes with ULAW, sometimes with G729, depending on the SIP phone who placed the call in the first place. What I need is some sort of command which says OK, now Dial(... @gateway), but force G729 (which works *if* I tell asterisk that the gateway supports G729 *only* in sip.conf, but we want it to support both codecs, right?). Apparently I can only force the codec on incoming channels, not on outgoing channels. Is this really an asterisk limitation? -Manuel ___ Ticinocom SA - Via Stazione 5 - 6600 Muralto Tel 0844 007070 - Fax 0844 007071 http://www.ticinocom.com ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users -- taridium.communications dominique kull, partner the old lodge, london sw6 6ee uk t: +44 207 731 1562 f: +44 207 900 6564 v: fwd 268167 w: http://taridium.com e: [EMAIL PROTECTED] ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
R: [Asterisk-Users] How to force G729
Did you try having two sip.conf entries for your gateway? Forcing one with G729 and the other with ulaw? You would obviously need to change your dialplan accordingly and have each phone configured so that it would take the proper extension. I have not tried this, it is just really an idea... That's actually a very good idea, and I have tried it: for outgoing calls it works like charm. But then the problem is transferred to incoming calls (from the gateway-asterisk-SIP client). Because the gateway now has 2 entries, asterisk is confused about what codec it has to use for incoming calls, and for some reason I can't force it, because the 2 entries have the same IP. I'm starting to think that I won't be able to solve that myself, but that someone will have to program something for this to work... But if I'm the only one having this kind of request, I'm not too optimistic -Manuel ___ Ticinocom SA - Via Stazione 5 - 6600 Muralto Tel 0844 007070 - Fax 0844 007071 http://www.ticinocom.com ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: R: [Asterisk-Users] How to force G729
Hmmm, I was thinking about this problem too... What type of gateway are you using? Is it registering with the Asterisk server? I would try using two different 'virtual' extensions on the gateway and in sip.conf. That way you would have full control on how calls from the gw to * are handled. Manuel Wenger wrote: That's actually a very good idea, and I have tried it: for outgoing calls it works like charm. But then the problem is transferred to incoming calls (from the gateway-asterisk-SIP client). Because the gateway now has 2 entries, asterisk is confused about what codec it has to use for incoming calls, and for some reason I can't force it, because the 2 entries have the same IP. I'm starting to think that I won't be able to solve that myself, but that someone will have to program something for this to work... But if I'm the only one having this kind of request, I'm not too optimistic -Manuel ___ Ticinocom SA - Via Stazione 5 - 6600 Muralto Tel 0844 007070 - Fax 0844 007071 http://www.ticinocom.com ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users -- taridium.communications dominique kull, partner the old lodge, london sw6 6ee uk t: +44 207 731 1562 f: +44 207 900 6564 v: fwd 268167 w: http://taridium.com e: [EMAIL PROTECTED] ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
R: [Asterisk-Users] How to force G729
Hmmm, I was thinking about this problem too... What type of gateway are you using? Is it registering with the Asterisk server? I would try using two different 'virtual' extensions on the gateway and in sip.conf. That way you would have full control on how calls from the gw to * are handled. I had thought about that, too ... Unfortunately the gateway is unable to register. We authenticate based on the IP address only. Otherwise, like you say, I could have 2 virtual extensions, but with IP only this is not possible. Maybe I will find a solution by sleeping over the problem (not physically, that is) tonight :-) -Manuel ___ Ticinocom SA - Via Stazione 5 - 6600 Muralto Tel 0844 007070 - Fax 0844 007071 http://www.ticinocom.com ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
R: [Asterisk-Users] How to force G729
They don't need to have the same IP. Assign several IP numbers to your linux box: ifconfig eth0:1 10.1.1.1 netmask 255.255.255.0 ifconfig eth0:2 10.1.1.2 netmask 255.255.255.0 Sorry guys... These are all great tips, but also this doesn't work: the gateway is not under my control, it is actually a real phone switch, which isn't owned by us. Unfortunately I can't tell them to add a second IP ... :-) -Manuel ___ Ticinocom SA - Via Stazione 5 - 6600 Muralto Tel 0844 007070 - Fax 0844 007071 http://www.ticinocom.com ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
R: [Asterisk-Users] How to force G729
Use two separate entries with type=peer and type=user instead of one entry with type=friend. Tried that as well. This triggers yet another misbehaviour... I tried to define 2 peers (for the outgoing calls), one called [gateway-g729] and one called [gateway-ulaw], each allowing only the codec specified in the name. Then I defined 1 user for incoming calls from the gateway (called [gateway-in]), with both g729 and ulaw in the allow list. And you know what happens? Outgoing calls are now fine (I can direct them either to @gateway-g729 or @gateway-ulaw in the Dial() command), but incoming calls seem to have a live on their own, and choose whatever codec they prefer. Even if I setvar(SIP_CODEC=ulaw), the gateway-to-asterisk channel seems to remain in g729 (at least that's what I can tell from show g729 - because sip show channels looks correct, both ULAW). At some point I get that message: Jun 24 16:37:14 NOTICE[1104739248]: chan_sip.c:1314 sip_answer: Changing codec to 'ulaw' for this call because of ${SIP_CODEC) variable And yes, in sip show channels the gateway-to-asterisk channel is marked as ULAW, but for some reason a G729 license is used up, because the call did start in G729... Any ideas? I guess I'm very close to the solution, but now G729 licenses are acting weird and are being used even in ULAW-to-ULAW calls which started with G729 in the beginning... -Manuel ___ Ticinocom SA - Via Stazione 5 - 6600 Muralto Tel 0844 007070 - Fax 0844 007071 http://www.ticinocom.com ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: R: R: R: [Asterisk-Users] How to force G729
On 07:01 AM 6/24/2004, Rich Adamson wrote: Now I better understand what you're trying to do. I'm not a programmer, but I'm fairly certain that you can't dynamically change codec preference within asterisk on a per call basis. However, just as soon as this gets posted, someone will likely jump all over that statement and post a way to do it. I don't think its and incoming vs outgoing issue. For each outgoing call, an rtp session is established between * and the gateway. That rtp session goes through a codec negotiation process that automatically selects a compatible codec based on what's common, and, when multiple choices are available, some other decision making process (transcode time, quality or something) that you probably don't have control over on a per call basis. So, my guess is you're not going to be able to do what you want. It sounds like what you are looking for is an Asterisk-wide (or perhaps channel-specific) preserve_codec option. Where preserve_codec=1 means that asterisk tries to preserve the originating codec if at all possible, and preserve_codec=0 lets asterisk freely choose any codec per whatever algorithm it chooses. As far as I know, this option doesn't exist, but depending upon the need, perhaps someone should issue a feature request. It seems like this might be an easy feature to add. -Chris ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: R: [Asterisk-Users] How to force G729
Sorry guys... These are all great tips, but also this doesn't work: the gateway is not under my control, it is actually a real phone switch, which isn't owned by us. Unfortunately I can't tell them to add a second IP ... :-) As I could understand so far, you wanna do G729 passthu from a SIP connection and the PSTN running in the asterisk. What I am asking to myself now if it is technically possible without transcoding or having G729 licenses. Isamar ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: R: R: R: [Asterisk-Users] How to force G729
On Thu, Jun 24, 2004 at 09:52:45AM -0700, Chris A. Icide wrote: It sounds like what you are looking for is an Asterisk-wide (or perhaps channel-specific) preserve_codec option. Where preserve_codec=1 means that asterisk tries to preserve the originating codec if at all possible, and preserve_codec=0 lets asterisk freely choose any codec per whatever algorithm it chooses. As far as I know, this option doesn't exist, but depending upon the need, perhaps someone should issue a feature request. It seems like this might be an easy feature to add. I wonder, if you remove all the codec converters, or set their cost very high, would that help? Given that the cost of no conversion is by definition zero, it's a bit odd that asterisk is changing them at all unless absolutly required. There must be something else going on... -- Martijn van Oosterhout IT Manager Ecomtel ___ Asterisk-Users mailing list [EMAIL PROTECTED] http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users