[Users] RE: failure_route.... I could cry...

Douglas Garstang dgarstang at oneeighty.com
Wed Dec 14 17:31:32 CET 2005


Klaus,

Yes. It's necessary to replicate 4 times. We're implementing a 'farm' of Asterisk hosts. Asterisk has a serious limitation where there's no way to share contact info for phones between them. OpenSER seemed like it may be able to address this issue, by accepting registrations from the phones and then 'fanning' them out to ALL the Asterisk boxes. In this way, each Asterisk box knows where every phone is. Up to this point I had just been calling forward() multiple times, once to each Asterisk system and it seemed to work well. With the addition of extra ethernet ports in each Asterisk box (for extra redundancy), it got more complicated as I didn't want to register twice to the same Asterisk system. While I don't think that would cause a problem, I was just trying to make it as bullet-proof as I could.

Doug.

-----Original Message-----
From: Klaus Darilion [mailto:klaus.mailinglists at pernau.at]
Sent: Wednesday, December 14, 2005 9:06 AM
To: Douglas Garstang
Cc: users at openser.org
Subject: Re: [Users] RE: failure_route.... I could cry...


That's a difficult setup. I've never did this yet and do not know if it 
is possible at all. you can use t_replicate but this works only with 1 
host. I think someone solved this using forward_tcp.

is it really necessary to replicate 4 times?

regards
klaus

Douglas Garstang wrote:
> Oh dear... it's failing because as far as t_relay() is concerned, the packet has been delivered, and the transaction is complete, right? If that's the case, how can I also send the REGISTRATION packet to another destination? Can I use forward() with failure_route? Arrgh!.
> 
> 
>> -----Original Message-----
>>From: 	Douglas Garstang  
>>Sent:	Tuesday, December 13, 2005 6:01 PM
>>To:	'users at openser.org'
>>Subject:	failure_route.... I could cry...
>>
>>I am trying to have OpenSER forward registration requests to multiple Asterisk boxes with failover. Each Asterisk box has two ip addresses. My logic tries to relay to the first IP on the first Asterisk box (192.168.10.100). If that fails, it tries to relay to the second IP on the first Asterisk box (192.168.10.17). It then goes on and repeats the process with another Asterisk box who's IP's are 192.168.10.10.101 and 192.168.10.8. 
>>
>>Actually the first IP address on each Asterisk system is fake (100 and 101)... that's how I am testing that it will fail to the second one.
>>
>>The openser.cfg below  is causing this to be logged to messages:
>>Dec 13 17:50:08 bil-pdev-3 openser[22318]: route10: Asterisk-1, NIC-1
>>Dec 13 17:50:08 bil-pdev-3 openser[22318]: route20: Asterisk-2, NIC-1
>>Dec 13 17:50:08 bil-pdev-3 openser[22318]: ERROR: t_newtran: transaction already in process 0xb6126560      < --- Why?
>>Dec 13 17:50:08 bil-pdev-3 openser[22318]: route20: t_relay returned error                                                       <--- Why?
>>Dec 13 17:50:09 bil-pdev-3 openser[22328]: failure21: Failed to register with Asterisk-2, NIC-1
>>Dec 13 17:50:09 bil-pdev-3 openser[22328]: route22: Asterisk-2, NIC-2
>>Dec 13 17:50:09 bil-pdev-3 openser[22328]: route22: End of routine
>>Dec 13 17:50:10 bil-pdev-3 openser[22322]: User local found
>>Dec 13 17:50:10 bil-pdev-3 openser[22320]: User local found
>>
>>Why am I getting the t_newtran and t_relay errors in there? What am I doing wrong? I'm just calling rewritehostport(next-ip), followed by append_branch() and t_relay. In fact something really weird happens. When I have the code there for route[20], failure_route[21] and route[22], it causes the code for the first three routing blocks, route[10], failure_route[11] and route[12] to act differently. It seems to make route20 fail to connect eventhough it comes AFTER it in the code.
>>
>>I'd really appreciate some help! Am I doing something wrong with rewritehostport and append_branch, because quite frankly the docs are terrible. 
>>
>>
>>        if ( method == REGISTER ) {
>>            if ( !www_authorize("voip.com", "subscriber") ) {
>>                www_challenge("voip.com", "0");
>>            };
>>            save("location");
>>            route(10);
>>            route(20);
>>
>>#
>># First Asterisk System. 
>>#
>>
>># Try first IP on this system (fake - will fail)
>>route[10] {
>>    xlog ("L_INFO","route10: Asterisk-1, NIC-1");
>>    t_on_failure("11");
>>    rewritehostport("192.168.10.100:5060");
>>    append_branch();
>>    if ( !t_relay() ) {
>>        xlog ("L_INFO","route10: t_relay returned error");
>>    }
>>}
>>
>>failure_route[11] {
>>    xlog ("L_INFO","failure11: Failed to register with Asterisk-1, NIC-1");
>>    route(12);
>>}   
>>
>># Try second IP on this system (real - should work)
>>route[12] {
>>    xlog ("L_INFO","route12: Asterisk-1, NIC-2");
>>    t_on_failure("13");
>>    rewritehostport("192.168.10.17:5060");
>>    append_branch();
>>    if ( !t_relay() ) {
>>        xlog ("L_INFO","route12: t_relay returned error");
>>    }
>>    xlog ("L_INFO","route12: End of routine");
>>    return;
>>}
>>
>>#
>># Second Asterisk System
>>#
>>   
>># Try first IP on this system (fake - will fail)
>>route[20] {
>>    xlog ("L_INFO","route20: Asterisk-2, NIC-1");
>>    t_on_failure("21");
>>    rewritehostport("192.168.10.101:5060");
>>    append_branch();
>>    if ( !t_relay() ) {
>>        xlog ("L_INFO","route20: t_relay returned error");> 
>>    }
>>}
>>
>>failure_route[21] {
>>    xlog ("L_INFO","failure21: Failed to register with Asterisk-2, NIC-1");
>>    route(22);
>>}
>>
>># Try second IP on this system (real - should work)
>>route[22] {
>>    xlog ("L_INFO","route22: Asterisk-2, NIC-2");
>>    t_on_failure("23");
>>    rewritehostport("192.168.10.8:5060");
>>    append_branch();
>>    if ( !t_relay() ) {
>>        xlog ("L_INFO","route22: t_relay returned error");
>>    }
>>    xlog ("L_INFO","route22: End of routine");
>>    return;
>>}
>>
>>Doug
>>
>>
> 
> 
> _______________________________________________
> Users mailing list
> Users at openser.org
> http://openser.org/cgi-bin/mailman/listinfo/users
> 
> 





More information about the Users mailing list