yes:
My sip test (see 'snapshot sipunittest' below)
-send invite and wait for answer
-send ack
-wait
-send bye
My sipservlet (see 'snapshot sipservlet' below)
- recieves the call doInvite will trigger setupcall method
- proxies (seq) the call
- on ringing changes the timeout (this is a bit out of the ordanary !!)
- done
I hope this is of any help, just let me know when I can be of any help.
[start snapshot sipunittest]
SipCall call1 = ua
.makeCall(
ENDPOINT_AUDIO_TEST,
SipResponse.OK,
WAIT_FOR_RESPONSE_TIMEOUT,
properties
.getProperty(PROP_MOBICENTS_IP)
+ ':'
+ properties
.getProperty(PROP_MOBICENTS_PORT)
+ '/' + testProtocol);
// acknowledge ok
call1.sendInviteOkAck();
call1.waitForAnswer(WAIT_FOR_RESPONSE_TIMEOUT);
wait(3000);
// send bye
call1.disconnect();
call1.waitForAnswer(WAIT_FOR_RESPONSE_TIMEOUT);
// assert X_FAST_VOIP_MAX_DIAL_TIME header is there
ArrayList<SipResponse> allReceivedResponses = call1
.getAllReceivedResponses();
SipResponse sr = allReceivedResponses
.get(allReceivedResponses.size() - 1);
Message message = sr.getMessage();
Header header = message
.getHeader(X_FAST_VOIP_MAX_DIAL_TIME);
assertTrue("Has '" + X_FAST_VOIP_MAX_DIAL_TIME
+ " header", header != null);
callCount++;
[end snapshot sipunittest]
[start snapshot sipservlet]
private void setupCall(SipServletRequest request, String rawDestination,
int maxCallTime, String defaultLanguage)
throws ServletParseException, TooManyHopsException {
ArrayList<URI> proxyToList = new ArrayList<URI>();
// fill the proxy to list code...
proxyToList.add(destURI);
// proxy the call
logger.debug("forward the call / setup the proxy");
Proxy proxy = request.getProxy();
if (routingHostResponseTimeout > 0) {
proxy.setProxyTimeout(routingHostResponseTimeout);
}
proxy.setRecordRoute(true); // set to true to receive bye
proxy.setParallel(false); // proxy sequentially / try one by one
proxy.proxyTo(proxyToList);
}
@Override
protected void doBranchResponse(SipServletResponse resp)
throws ServletException, IOException {
if (INVITE.equalsIgnoreCase(resp.getMethod())) {
if (resp.getStatus() == SipServletResponse.SC_RINGING
|| resp.getStatus() == SipServletResponse.SC_OK) {
if (proxyTimeout > 0) {
resp.getProxy().setProxyTimeout(proxyTimeout);
}
}
}
super.doBranchResponse(resp);
}
[end snapshot sipservlet]
2009/8/18 Vladimir Ralev <
vladimi...@gmail.com>: