[asterisk-users] Sending Calls via SIP trunk from two different IP addresses from same Asterisk Machine

Jeff LaCoursiere jeff at jeff.net
Sun Feb 1 14:34:01 CST 2009


I briefly glanced at the code before responding, and it does seem that if 
you specify a bind address it will use that address when responding.  I 
stick by my comment that the change you want is not exactly simple - 
unless you are very familiar with the 18,000 line chan_sip.c :)  It also 
appears that the bind address is a global in this implementation... so 
some thought would have to go into efficiently representing all the 
possible peer bind addresses in a thread safe manner... and if the change 
is made to this channel it really out to be for all of them.

So a "hack" is probably possible without too much trouble.  For it to be 
done right is not a simple change.  Sorry for the rambling.

j

On Sun, 1 Feb 2009, Mike wrote:

> At the risk of seeming impolite (I really am not), why not? Isn't Asterisk
> able to send packets using another interface using bindaddr?  The problem,
> for the two of us, is that bindaddr is Asterisk-wide, and not per-peer.
>
> Mike
>
>> -----Original Message-----
>> From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-
>> bounces at lists.digium.com] On Behalf Of Jeff LaCoursiere
>> Sent: Sunday, February 01, 2009 14:56
>> To: bilal ghayyad
>> Cc: Asterisk Users Mailing List - Non-Commercial Discussion
>> Subject: Re: [asterisk-users] Sending Calls via SIP trunk from two
>> different IP addresses from same Asterisk Machine
>>
>>
>> Ah, that makes more sense.  Asterisk binding to another IP is not the
>> issue, actually, and even running another instance will not do what you
>> need.  Your problem is that the OS itself will stamp outbound packets
>> with the main source IP of the main interface.  Asterisk could be modified
>> to send packets with specific IP source, but I don't think that would be a
>> simple change.
>>
>> j
>>
>> On Sun, 1 Feb 2009, bilal ghayyad wrote:
>>
>>> OK, if I send for my provider (the destination), it will authenticate
>> based on the IP ONLY, this is the provider system. And once authenticated
>> me based on that IP, it will give me all the schema related to this
>> account. Sometimes I need to use another schema for some calls, I am not
>> able until send for the provider from another IP.
>>>
>>> Did u get what I need?
>>> Regards
>>> Bilal
>>>
>>>
>>> --- On Sun, 2/1/09, Jeff LaCoursiere <jeff at jeff.net> wrote:
>>>
>>>> From: Jeff LaCoursiere <jeff at jeff.net>
>>>> Subject: Re: [asterisk-users] Sending Calls via SIP trunk from two
>> different IP addresses from same Asterisk Machine
>>>> To: bilmar_gh at yahoo.com, "Asterisk Users Mailing List - Non-Commercial
>> Discussion" <asterisk-users at lists.digium.com>
>>>> Date: Sunday, February 1, 2009, 12:44 PM
>>>> I am confused as to what you are trying to accomplish.  Can
>>>> you be more specific?  It seems that you are making this too
>>>> complicated.  You say that the remote end is providing you
>>>> two SIP trunks that will come from the same IP address.  To
>>>> distinguish them simply have them authenticate with two
>>>> different usernames.
>>>>
>>>> This does beg the question, though, if the endpoint is the
>>>> same, why have a separate trunk?  How about routing the
>>>> calls based on differing CID?
>>>>
>>>> If you can explain the situation more distinctly perhaps an
>>>> alternate method will present itself.  Hard to imagine a
>>>> real need for binding to multiple local IP addresses on the
>>>> asterisk side.
>>>>
>>>> If you are REALLY stuck on doing it that way, however, how
>>>> about simply running a second instance of asterisk?  You
>>>> would have to recompile the source to read config from a
>>>> second tree, but then your second instance could bind to
>>>> your aliased address.  I suppose you could even trunk the
>>>> two together if the two instances must pass traffic between
>>>> each other.
>>>>
>>>> How odd :)
>>>>
>>>> j
>>>>
>>>>
>>>>
>>>> On Sun, 1 Feb 2009, bilal ghayyad wrote:
>>>>
>>>>> Hi All;
>>>>>
>>>>> I can assign for my Asterisk Machine a two IP
>>>> addresses (xxx.xxx.xxx.yyy and xxx.xxx.xxx.yyz), how can I
>>>> use these two IP's so I can let one call sent with a
>>>> source IP address xxx.xxx.xxx.yyy and another call to be
>>>> sent with another source IP address xxx.xxx.xxx.yyz, I need
>>>> this because I need the side to authorize my calls by the IP
>>>> address, and some calls to be authorized with the first IP
>>>> address and other calls to be authorized with another IP
>>>> address, ofcourse I have some reason for this.
>>>>>
>>>>> The idea is: how to control the source IP address that
>>>> I am sending from it to the other side?
>>>>>
>>>>> Can I determine the source IP address of the SIP trunk
>>>> while I am configuing my SIP section for that connection?
>>>> What about the bindaddress?
>>>>>
>>>>> Any help?
>>>>> Regards
>>>>> Bilal
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> -- Bandwidth and Colocation Provided by
>>>> http://www.api-digital.com --
>>>>>
>>>>> asterisk-users mailing list
>>>>> To UNSUBSCRIBE or update options visit:
>>>>>
>>>> http://lists.digium.com/mailman/listinfo/asterisk-users
>>>>>
>>>
>>>
>>>
>>>
>>
>> _______________________________________________
>> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>>
>> asterisk-users mailing list
>> To UNSUBSCRIBE or update options visit:
>>    http://lists.digium.com/mailman/listinfo/asterisk-users
>
>
> _______________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-users
>



More information about the asterisk-users mailing list