Multiple IP Addresses And Using Same IP For Outbound Calls As Inbound
Hello,
We have an Asterisk server with two public IP addresses, let’s say 1.1.1.1
and 2.2.2.2. Normally calls come in to 1.1.1.1 and are bridged with a call dialled from Asterisk to an external destination. The external destination sees the SIP packet as coming from 1.1.1.1 and the media address in the SDP
is 1.1.1.1, which is great.
However if we receive a call in to 2.2.2.2 then the call dialled from Asterisk to an external destination still comes from 1.1.1.1, whereas we want it to come from 2.2.2.2. The source of any dialled call (the IP packet and the SDP media address) should be the same as the address the related inbound call was received to.
For example:
INVITE received to 1.1.1.1:5060 -> Asterisk dials destination@termination.com -> INVITE sent from 1.1.1.1:5060 to termination.com INVITE received to 2.2.2.2:5060 -> Asterisk dials destination@pstn.com ->
INVITE sent from 2.2.2.2:5060 to pstn.com
Does anyone know how this can be achieved?
Thanks in advance for your help,
14 thoughts on - Multiple IP Addresses And Using Same IP For Outbound Calls As Inbound
–000000000000bf97c005b2408c33
Content-Type: text/plain; charset=”UTF-8″
If termination.com is only on 1.1.1.1 and pstn.com is only on 2.2.2.2, create 2 transports, one specifically bound to 1.1.1.1, transport-1.1.1.1
for instance, and another to 2.2.2.2: transport-2.2.2.2. The names aren’t important as long as you can tell the difference. Then explicitly configure endpoint termination.com’s “transport” parameter to
“transport-1.1.1.1” and pstn.com’s “transport” parameter to
“transport-2.2.2.2”. In your dialplan, you can see which endpoint the call came in on, and route it out the same endpoint.
If both providers are available from both interfaces, you can create 2
endpoint for each provider: termination.com-1.1.1.1, pstn.com-1.1.1.1, termination.com-2.2.2.2 and pstn.com-2.2.2.2; Then configure each with the same transports as above.
–000000000000d0e45d05b249c12b Content-Type: text/plain; charset=”UTF-8″
Hi George,
Thank you for the response. I’m a little unclear on what you mean by a transport. We’re using chan_sip, not pjsip.
Do you mean a device in sip.conf, using bindaddr to set the address to bind for that device? We’ve only used bindaddr in the [general] section before, but if it will work in a device that could be the answer.
–00000000000066f72605b25737d7
Content-Type: text/plain; charset=”UTF-8″
Sorry. I just assume chan_pjsip these days. Not sure how you’d do it for chan_sip.
–000000000000abec8a05b25ca2bf Content-Type: text/plain; charset=”UTF-8″
OK, thank you George.
–000000000000f61b5705b2d8aee4
Content-Type: text/plain; charset=”UTF-8″
Hello,
Does anyone know a way with chan_sip to tell Asterisk to use a specific IP
address for its end of the communication for a specific device? Something like:
[device]
type = friend host = 11.22.11.22
ouraddress = 33.44.33.44
This is for use on a server with multiple IP addresses. There is the
“extenip” setting, but it’s really designed for NAT, and can only appear in the [general] section.
Any suggestions would be greatly appreciated.
–00000000000090023405b2d99a79
Content-Type: text/plain; charset=”UTF-8″
Why not use OpenSips/Kamailoo in between? Where you want 1.1.1.1 you pass it along as is. Where you want 2.2.2.2 change the sdp in opensips/kamailio
–00000000000090023405b2d99a79
Content-Type: text/html; charset=”UTF-8″
Content-Transfer-Encoding: quoted-printable
–00000000000090023405b2d99a79
–0000000000001ed62d05b2d9d7f2
Content-Type: text/plain; charset=”UTF-8″
Hi Dovid,
We can change the SDP in Kamailio, but Asterisk will still send its RTP
from its default address. The remote end is strict about accepting RTP from the specified source and won’t accept it. Have you any suggestions to solve that problem?
Thank you.
I didn’t want to post this because its kind of ugly, but we *did*
actually do it a number of years ago to get around this issue with chan_sip.
Our original architecture was based on LXC, and we had large servers running hundreds of containers, each running asterisk. The “host” ran asterisk too, as the gateway for all the container instances.
We once used two of those containers to run asterisk on specific host interfaces (one instance bridged to one nic, the other to the other).
The host asterisk would route calls out one container or the other, with the effect you are looking for…
Cheers,
Jeff LaCoursiere StratusTalk, Inc.
–000000000000f6ec6f05b2daecc6
Content-Type: text/plain; charset=”UTF-8″
Content-Transfer-Encoding: quoted-printable
David, can you play around with the routing table and get the OS to handle it for you? So long as asterisk isn’t calling bind() (or is calling with
0.0.0.0) I would imagine adding a route for the peer, with your normal gateway, and the correct device would work.
–0000000000003adfa105b2e1173a Content-Type: text/plain; charset=”UTF-8″
Run rtp proxy on the asterisk box (not sure if it would work since you can’t use the same ports).
–0000000000003adfa105b2e1173a Content-Type: text/html; charset=”UTF-8″
Content-Transfer-Encoding: quoted-printable
–0000000000003adfa105b2e1173a
I didn’t want to post this because its kind of ugly, but we *did*
actually do it a number of years ago to get around this issue with chan_sip.
Our original architecture was based on LXC, and we had large servers running hundreds of containers, each running asterisk. The “host” ran asterisk too, as the gateway for all the container instances.
We once used two of those containers to run asterisk on specific host interfaces (one instance bridged to one nic, the other to the other).
The host asterisk would route calls out one container or the other, with the effect you are looking for…
Cheers,
Jeff LaCoursiere StratusTalk, Inc.
I didn’t want to post this because its kind of ugly, but we *did*
actually do it a number of years ago to get around this issue with chan_sip.
Our original architecture was based on LXC, and we had large servers running hundreds of containers, each running asterisk. The “host” ran asterisk too, as the gateway for all the container instances.
We once used two of those containers to run asterisk on specific host interfaces (one instance bridged to one nic, the other to the other).
The host asterisk would route calls out one container or the other, with the effect you are looking for…
Cheers,
Jeff LaCoursiere StratusTalk, Inc.
–00000000000020f4f405b2e9039e Content-Type: text/plain; charset=”UTF-8″
Content-Transfer-Encoding: quoted-printable
Thanks for the suggestions. We’d prefer not to complicate the architecture with additional proxies in front, so will try setting the Linux network routes to see if that helps.
CkhlbGxvIERhdmlkLArCoAp5b3UgbWF5IHN0YXJ0IDIgQXN0ZXJpc2sgaW5zdGFuY2VzIG9uIHRo ZSBzYW1lIG1hY2hpbmUsCm9uZSBiaW5kIHRvIDEuMS4xLjEgSVAtYWRkcmVzcywgdGhlIG90aGVy IHRvIDIuMi4yLjIuCsKgCkp1c3QgY29uZmlndXJlIHRoZSBhcHByb3ByaWF0ZSBzZXR0aW5ncyBp biBlYWNoIGluc3RhbmNlIGFzdGVyaXNrLmNvbmYg4oCUCnlvdeKAmWxsIGhhdmUgdG8gc2V0IGNv cnJlY3QgZGlyZWN0b3JpZXMgbGlrZSBhc3RzcG9vbGRpciwgYWdpLWJpbiBhbmQgc28gb24uCkFu ZCBvZiBjb3Vyc2UgY3JlYXRlIHRoZW0gaW4geW91ciBmaWxlc3lzdGVtLgrCoApJbiB0aGlzIGNh c2UgeW91IHdpbGwgYWNoaWV2ZSB3aGF0IHlvdSBuZWVkIGV2ZW4gdXNpbmcgY2hhbl9zaXAuCsKg ClRoZW4gZWl0aGVyIHN0YXJ0IEFzdGVyaXNrcyBtYW51YWxseSwgb3IgY3JlYXRlIHNvbWUgY3Vz dG9tIHNjcmlwdHMsCm9yIGVkaXQvYWRkIFN5c3RlbWQgc2V0dGluZ3MgdG8gc3RhcnQgZWFjaCBp bnN0YW5jZSBhdXRvbWF0aWNhbGx5IGFuZApiZSBhYmxlIHRvIHVzZSBhbGwgU3lzdGVtZCBmdW5j dGlvbmFsaXR5LCBidXQgdGhpcyBpcyBiZXlvdW5kIHRoZSBzY29wZSBvZiB0aGlzIHRocmVhZC4K
wqAKwqAKLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0KQlIs IEFsZXhleQpodHRwOi8vYWxleGV5a2EuemFudHNldi5jb20v