[Freeswitch-users] forcing codec on leg b

Michael Collins msc at freeswitch.org
Tue Dec 21 20:33:34 MSK 2010


No, you cannot do this in SIP profiles. The whole point of xml_curl is to
allow you to make these kinds of decisions outside of FreeSWITCH using the
dialplan binding. When using xml_curl you are not *forced* into using a
dynamic dialplan. You can always fall back to the static XML. You would
still need to create a dialplan extension that matches based on the criteria
that are important to you. If I understand correctly you want to route the
call based upon the source IP address. If that's the case then you could
have a few extensions in the public context like this:

<extension name="sample route, PCMA">
  <condition field="network_address" expression="^10\.20\.30\.40$"/>
  <condition field="destination_number" expression="^(\d+)$">
    <action application="bridge" data="{absolute_codec_string=PCMA}
sofia/gateway/your_gateway/$1"/>
  </condition>
</extension>

<extension name="sample route, GSM">
  <condition field="network_address" expression="^11\.22\.33\.44$"/>
  <condition field="destination_number" expression="^(\d+)$">
    <action application="bridge" data="{absolute_codec_string=GSM}
sofia/gateway/your_other_gateway/$1"/>
  </condition>
</extension>

To keep the dialplan simple I would use one extension per IP address.

Hope this helps,
-MC

On Tue, Dec 21, 2010 at 2:54 AM, Sameer Khan <sameer2k3t at gmail.com> wrote:

> i know that but i want such things from sip profiles,
>
> i dont want to pass this value from dialplan as my dialplan is binded in
> xml curl
>
> can i set this in sip settings? different codecs for different ips
>
>
> On Tue, Dec 21, 2010 at 2:54 PM, Sam <u2nsam at gmail.com> wrote:
>
>> Hi,
>>
>> You can use this,
>>
>> absolute_codec_string=PCMA
>>
>> http://wiki.freeswitch.org/wiki/Codec_negotiation#Early_Negotiation_parameters
>>
>> Regds
>> Sam
>>
>>
>>
>>
>> On Tue, Dec 21, 2010 at 2:28 PM, Sameer Khan <sameer2k3t at gmail.com>wrote:
>>
>>> in asterisk i m doing it like
>>>
>>> i call perl file via agi and in that perl file i check in  the database
>>> what should be the forwarding address for the incoming number
>>> lets say call arrives at my box for 12121212 then a perl file is called
>>> which checks in the database for the destination address and lets say the
>>> destination address is xyz at 1.1.1.1
>>>
>>> this all is achieved by xml curl
>>>
>>> now in asterisk i add these lines in sip.conf
>>> [1.1.1.1]
>>> host=1.1.1.1
>>> type=peer
>>> disallow=all
>>> allow=alaw
>>>
>>> so when asterisk find that ip in sip.conf it force the codec on leg b to
>>> alaw.
>>>
>>>
>>> this i want to achieve in fs
>>>
>>>
>>> On Tue, Dec 21, 2010 at 1:40 PM, David Ponzone <david.ponzone at ipeva.fr>wrote:
>>>
>>>> sorry, I dont understand what you want to achieve
>>>>
>>>>  David Ponzone  Direction Technique
>>>> email: david.ponzone at ipeva.fr
>>>> tel:      01 74 03 18 97
>>>> gsm:   06 66 98 76 34
>>>>
>>>> Service Client IPeva
>>>> tel:      0811 46 26 26
>>>> www.ipeva.fr  -   www.ipeva-studio.com
>>>>
>>>> *Ce message et toutes les pièces jointes sont confidentiels et établis
>>>> à l'intention exclusive de ses destinataires. Toute utilisation ou diffusion
>>>> non autorisée est interdite. Tout message électronique est susceptible
>>>> d'altération. **IPeva** décline toute responsabilité au titre de ce
>>>> message s'il a été altéré, déformé ou falsifié. Si vous n'êtes pas
>>>> destinataire de ce message, merci de le détruire immédiatement et d'avertir
>>>> l'expéditeur.*
>>>> *
>>>> *
>>>>
>>>>
>>>>
>>>> Le 21/12/2010 à 09:32, Sameer Khan a écrit :
>>>>
>>>> thanks for your reply david,
>>>>
>>>> but for that i will need to call absolute_Codec_string value from
>>>> datbase which i dont want to do now.
>>>>
>>>> as i have one data base and running two asterisk on them with this fs
>>>>
>>>> cant i define in sip users or profile ,
>>>>
>>>> i saw an option there in brian.xml for cidr but all examples are
>>>> username dependent
>>>>
>>>> i dont want user authentication as i am just forwarding the calls to my
>>>> user
>>>>
>>>> i just want to check if ip is 1.1.1.1 it uses pcma for all
>>>> numbers/extension going to the ip like this XXX at 1.1.1.1
>>>>
>>>>
>>>> On Tue, Dec 21, 2010 at 1:22 PM, David Ponzone <david.ponzone at ipeva.fr>wrote:
>>>>
>>>>> in the dialplan, use a condition to match network_addr and then set
>>>>> absolute_codec_string to PCMA.
>>>>>
>>>>>  David Ponzone  Direction Technique
>>>>> email: david.ponzone at ipeva.fr
>>>>> tel:      01 74 03 18 97
>>>>> gsm:   06 66 98 76 34
>>>>>
>>>>> Service Client IPeva
>>>>> tel:      0811 46 26 26
>>>>> www.ipeva.fr  -   www.ipeva-studio.com
>>>>>
>>>>> *Ce message et toutes les pièces jointes sont confidentiels et établis
>>>>> à l'intention exclusive de ses destinataires. Toute utilisation ou diffusion
>>>>> non autorisée est interdite. Tout message électronique est susceptible
>>>>> d'altération. **IPeva** décline toute responsabilité au titre de ce
>>>>> message s'il a été altéré, déformé ou falsifié. Si vous n'êtes pas
>>>>> destinataire de ce message, merci de le détruire immédiatement et d'avertir
>>>>> l'expéditeur.*
>>>>> *
>>>>> *
>>>>>
>>>>>
>>>>>
>>>>> Le 21/12/2010 à 09:18, Sameer Khan a écrit :
>>>>>
>>>>> Hello guyz,
>>>>> Need your help
>>>>>
>>>>> I want my fs to behave like this
>>>>>
>>>>> when call arrives for a number 1234656789 at fs i call a php file in
>>>>> which i check in the database that what should be the forwarding address of
>>>>> this number. for example the forwarding address is 123456789 at 1.1.1.1then i return that forwarding address in bridge application in the end
>>>>> i want to define some setting in sip profiles, user directory or
>>>>> wherever so when ever ip is 1.1.1.1 it set the codec on leg b to pcma
>>>>> like it is defined in asterisk as
>>>>> [1.1.1.1]
>>>>> host=1.1.1.1
>>>>> type=peer
>>>>> disallow=all
>>>>> allow=alaw
>>>>>
>>>>>
>>>>> i want my sip profile to check if network address is 1.1.1.1, it uses a
>>>>> particular codec lets say pcma but if network address is 2.2.2.2 it uses the
>>>>> defult
>>>>> and this i want to define for around 40 ip addresses
>>>>>  _______________________________________________
>>>>> FreeSWITCH-users mailing list
>>>>> FreeSWITCH-users at lists.freeswitch.org
>>>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>>>> UNSUBSCRIBE:
>>>>> http://lists.freeswitch.org/mailman/options/freeswitch-users
>>>>> http://www.freeswitch.org
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> FreeSWITCH-users mailing list
>>>>> FreeSWITCH-users at lists.freeswitch.org
>>>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>>>> UNSUBSCRIBE:
>>>>> http://lists.freeswitch.org/mailman/options/freeswitch-users
>>>>> http://www.freeswitch.org
>>>>>
>>>>>
>>>> _______________________________________________
>>>> FreeSWITCH-users mailing list
>>>> FreeSWITCH-users at lists.freeswitch.org
>>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>>> UNSUBSCRIBE:
>>>> http://lists.freeswitch.org/mailman/options/freeswitch-users
>>>> http://www.freeswitch.org
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> FreeSWITCH-users mailing list
>>>> FreeSWITCH-users at lists.freeswitch.org
>>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>>> UNSUBSCRIBE:
>>>> http://lists.freeswitch.org/mailman/options/freeswitch-users
>>>> http://www.freeswitch.org
>>>>
>>>>
>>>
>>> _______________________________________________
>>> FreeSWITCH-users mailing list
>>> FreeSWITCH-users at lists.freeswitch.org
>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>>> http://www.freeswitch.org
>>>
>>>
>>
>> _______________________________________________
>> FreeSWITCH-users mailing list
>> FreeSWITCH-users at lists.freeswitch.org
>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>> http://www.freeswitch.org
>>
>>
>
> _______________________________________________
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20101221/36ddba2f/attachment-0001.html 


More information about the FreeSWITCH-users mailing list