Asterisk ip resiolution, tired

i have 2 external providers for sip call-out but when i configure them i put something like sip.myprovider.com in sip.conf the problem is that my providers has more than one ip assigned to that domain name:
sip.myprovider.com
Type A IP Addresses:
80.239.235.195
80.239.235.192
194.221.62.197
194.221.62.194
194.120.0.196
194.120.0.193

Asterisk take only one from that list and try to connect, if not succesfull i got ‘unreachable’ i need it to try all ip’s, if i enter good ip manually, it work for some time, till my provider swith the working server farm, and i got ‘unreachable’ again. Any cheapest fxs boxes switch automaticly, asterisk isn’t. Any way ho help me out?
asterisk zaptel librpi: latest versions

This may not be the best answer, but since you haven’t recieved any other answers here is a cheap hack. (this is ugly… but it should work)

  1. find all your dial out accounts ip’s

  2. create seperate peer entries for each for this example
    let’s call them peer1, peer2, peer3, peer4

  3. edit your extensions to use each one in order

id

exten => INSERT YOUR OUTGOING EXT HERE,1,Dial(SIP/peer1)
exten => INSERT YOUR OUTGOING EXT HERE,2,Dial(SIP/peer2)
exten => INSERT YOUR OUTGOING EXT HERE,3,Dial(SIP/peer3)
exten => INSERT YOUR OUTGOING EXT HERE,4,Dial(SIP/peer4)

don’t flame me if this solution is ugly or it doesn’t work, but just offhand I believe it will. I know I use a similar method using IAX2 to different PRIs on different “outgoing servers” in case one server is down, or doesn’t have any free circuits on it’s PRIs.

-brian

i allready use this method, it could work only if:
sip provider has 3 ip adresses max (if more the delay between the switch is too big)
Second if you dont need to register, and use outgoing only.

Another solution could be:
Create sip peer for each ip adress and try to register (use j option to switch in Dial() or dialstatus) it could resolve 1 from 2 problems - incoming calls, but if your provider decides to change ip at 4 am, and you are gone off work this day… i want to say it is not reliable and what it not reliable could not be put in production.
The only one solution could be the implementation of this basic feature in asterisk.