We're writing an IVR application which register itself as a CTI Route Point. This CTI RP has one line, 2000, which receive the external call (PSTN) from a voice gateway. A customer calls 0800 number, then flows thru PSTN->E1->Gateway->CallManager (2000)->CTI RP.
JTAPI triggers an incoming call event (TermConnRingingEv), I answer this call (terminalConnection.answer()), I receive a TermEv event (CiscoRTPOutputStartedEv), get remote address and port by rtpOutStarted.getRTPOutputProperties() (getRemoteAddress and getRemotePort properties) and start sending RTP audio (CiscoRTPPayload.G711ULAW64K, 160).
Here begins my problems. Testing this scenario with internal calls only, it was 100% perfect! But using external calls (E1->gateway), all the time getRemoteAddress answers the same IP Address (of course, gateway address). But each time there's a different port, one for each call. Usually we have success and the audio comes to final destination: the mobile phone on PSTN; but sometimes the DatagramSocket.send(DatagramPacket) method throws exception "ICMP Port Unreachable" and the call remains active but mute.
There's no pattern for this problem, sometimes it works, sometimes doesn't.
Our CUCM version is 7.1, there's no Unity or IPCC on environment, just CallManager, Gateway and application.
java.net.PortUnreachableException: ICMP Port Unreachable
at java.net.PlainDatagramSocketImpl.send(Native Method)