Issue 586

Hi Mike,

Please can you look over these changes I've made? They've come about as a result of #586. The changes I've made can be split into two categories. I've changed terminating I-CSCF processing and I've changed the logic which decides when we route to the BGCF when we have a telephone number.

I-CSCF changes (see 24.229, section 5.3.2.1):

When we receive a terminating request which contains a req uri that is a sip uri with user=phone we translate this into a tel uri.

When we then come to do an LIR, if this fails with the user not found, and we have a tel URI, we try doing an ENUM lookup. If this succeeds we loop back round and try another LIR.

S-CSCF changes (see story 382 spec, and 24.229 section 5.4.3.2):

If we fail to find a match when we do an ENUM lookup for a phone number, we go to the BGCF to try and find a route.

This doesn't include any unit tests, and hasn't been tested, so there may be bugs, but I wanted to send it to you now to root out any major problems as early as possible. I'm working on the unit tests now.

Thanks,
Graeme
Is this really a loop we could go round an arbitrary number of times, or will it always be at most two attempts - one before the enum look-up and one after if the first one failed?  If it's always going to be twice we shouldn't be using a loop but should refactor some of the code into their own methods and keep the top-level logic simple.