I have an updated version of my app.
Here are the changes:
I added some error checking. Before if the call didn't complete the phone went silent. Now you are notified of the problem.
In the new version Tropo does not bridge the call. The call is transferred back to the OBi and the OBi bridges the call. In my previous testing I had Tropo send the call directly to the OBi via URI. The OBi would bridge the call, but I had no audio. I found routing the call through another SIP provider that was registered on SP2 fixed the audio problem. I'm using PBXes, but any SIP provider that accepts URI calls will work. If you don't have an SIP provider,
SIP2SIP.INFO is a free service.
Here is the sequence of events:
The OBi sends Tropo the dial string.
Tropo transfers the call to PBXes with the CallerID = "9" plus 1st 10 digits of the dialed string.
When the OBi receives the call on SP2, it uses the CallerID minus the "9" to bridge the call out SP1.
After the call is connected, Tropo completes the call after the specified pause.
To implement:
Add the following to the beginning of the SP2 Service X_InboundCallRoute:
{(<9:1>xxxxxxxxxx):sp1($1)},
Replace the previous Tropo App with the following:
num = $currentCall.callerID.to_s
num = num.gsub("\*","p")
dial1 = num[0,10]
L1 = num.length
dial2 = num[11,L1-11]
say "Calling Now"
transfer ["user@www2.pbxes.com;postd=" + dial2 + ";pause=3000ms"],
{:callerID => "9" + dial1,
:timeout => 30,
:onTimeout => lambda { |event|
say "Sorry, nobody answered. Goodbye."},
:onCallFailure => lambda { |event|
say "Line is busy, invalid dialed number or similar error occurred. Goodbye."},
:onError => lambda { |event|
say "An error occurred. Please try again."}}
Disclaimer:
I did a minimal amount of testing, so no guarantee the above is bug free.