private void addTelestaxProxyHeaders(HttpPost post, String requestType) { //This will work as a flag for LB that this request will need to be modified and proxied to VI post.addHeader("TelestaxProxy", "true"); //Adds the Provision provider class name post.addHeader("Provider", ProvisionProvider.voipinnovationsClass); //This will tell LB that this request is a getAvailablePhoneNumberByAreaCode request post.addHeader("RequestType", requestType); //This will let LB match the DID to a node based on the node host+port List<SipURI> uris = containerConfiguration.getOutboundInterfaces(); for (SipURI uri: uris) { post.addHeader("OutboundIntf", uri.getHost()+":"+uri.getPort()+":"+uri.getTransportParam()); } } }
public Object extract(Object input) { URI uri = (URI) input; if (uri.isSipURI()) { SipURI sipuri = (SipURI) uri; if ("phone".equals(sipuri.getParameter("user"))) { return stripVisuals(sipuri.getUser()); } } else if ("tel".equals(uri.getScheme())) { return stripVisuals(((TelURL) uri).getPhoneNumber()); } return null; }
public Object extract(Object input) { URI uri = (URI) input; if (uri.isSipURI()) { SipURI sipuri = (SipURI) uri; int port = sipuri.getPort(); if (port < 0) { String scheme = sipuri.getScheme(); if (scheme.equals("sips")) { return "5061"; } else { return "5060"; } } else { return Integer.toString(port); } } else { return null; } } }
public void setOutboundInterface(SipURI outboundInterface) { if(!isValid()) { throw new IllegalStateException("the session has been invalidated"); } if(outboundInterface == null) { throw new NullPointerException("parameter is null"); } List<SipURI> list = sipFactory.getSipNetworkInterfaceManager().getOutboundInterfaces(); SipURI networkInterface = null; for(SipURI networkInterfaceURI : list) { if(networkInterfaceURI.equals(outboundInterface)) { networkInterface = networkInterfaceURI; break; } } if(networkInterface == null) throw new IllegalArgumentException("Network interface for " + outboundInterface + " not found"); this.outboundInterface = outboundInterface.toString(); if(outboundInterface.getTransportParam() != null) { this.transport = outboundInterface.getTransportParam(); } }
outboundTransport = ((javax.sip.address.SipURI)clonedRequest.getRequestURI()).getTransportParam(); if(destination != null && destination.isSipURI()) { String destinationTransport = ((SipURI)destination).getTransportParam(); if(outboundTransport == null) { outboundTransport = destinationTransport; rrHeaderTransport = routeRecord.getTransportParam(); if(proxy.getOutboundInterface().isSecure()) { outboundTransport = ListeningPoint.TLS; proxy.getOutboundInterface().getHost(), proxy.getOutboundInterface().getPort(), outboundTransport, branchId); javax.sip.address.SipURI inboundRURI = JainSipUtils.createRecordRouteURI(sipFactoryImpl.getSipNetworkInterfaceManager(), clonedRequest, inboundTransport); if(originalRequest.getTransport() != null) inboundRURI.setTransportParam(originalRequest.getTransport()); final Iterator<String> paramNames = routeRecord.getParameterNames(); if(!paramName.equalsIgnoreCase("transport")) { inboundRURI.setParameter(paramName, routeRecord.getParameter(paramName)); final Iterator<String> paramNames = routeRecord.getParameterNames(); if(!paramName.equalsIgnoreCase("transport")) { rrURI.setParameter(paramName, routeRecord.getParameter(paramName));
if (fromClient != null) { Address fromAddress = sipFactory.createAddress(from, fromClient.getFriendlyName()); Address toAddress = sipFactory.createAddress(to, to.getUser()); outRequest = sipFactory.createRequest(request.getApplicationSession(), request.getMethod(), fromAddress, toAddress); Address originalFromAddress = request.getFrom(); SipURI originalFromUri = (SipURI) originalFromAddress.getURI(); int port = originalFromUri.getPort(); if (port == -1) { port = request.getRemotePort(); originalFromUri.setPort(port); builder.setDateCreated(DateTime.now()); builder.setAccountSid(fromClient.getAccountSid()); builder.setTo(to.toString()); builder.setCallerName(fromClient.getFriendlyName()); builder.setFrom(fromClient.getFriendlyName()); incomingSession.setAttribute(CDR_FROM, fromClient.getLogin()); outgoingSession.setAttribute(CDR_FROM, fromClient.getLogin()); incomingSession.setAttribute(CDR_TO, to.toString()); outgoingSession.setAttribute(CDR_TO, to.toString());
public Object extract(Object input) { URI uri = (URI) input; if (uri.isSipURI()) { return ((SipURI) uri).getHost(); } else { return null; } } }
public Object extract(Object input) { URI uri = (URI) input; if (uri.isSipURI()) { return ((SipURI)uri).getUser(); } else { return null; } } }
public Object extract(Object input) { URI uri = (URI) input; if (uri.isSipURI()) { return ((SipURI) uri).getParameter(param); } else if ("tel".equals(uri.getScheme())) { return ((TelURL) uri).getParameter(param); } return null; } }
response.getAddressHeader("Contact").getURI() != null) { originalURI = (SipURI) response.getAddressHeader("Contact").getURI(); if (originalURI != null && originalURI.getUser() != null && !originalURI.getUser().isEmpty()) { ((SipURI) clonedResponse.getAddressHeader("Contact").getURI()).setUser(originalURI.getUser()); } else if (response.getStatus() == 200 || response.getStatus() == 202) { callRecord = callRecord.setStatus(CallStateChanged.State.IN_PROGRESS.name()); callRecord = callRecord.setAnsweredBy(((SipURI) response.getTo().getURI()).getUser()); final DateTime now = DateTime.now(); callRecord = callRecord.setStartTime(now);
/** * @param originalRequest the originalRequest to set */ public void setOriginalRequest(SipServletRequestImpl originalRequest) { this.originalRequest = originalRequest; if(originalRequest == null && recordRouteURI != null) { recordRouteURIString = recordRouteURI.toString(); recordRouteURI = null; } }
sipURI.setParameter("modifier", "route_back"); Header routeHeader = SipFactoryImpl.headerFactory.createHeader(RouteHeader.NAME, sipURI.toString());
SipURI uri = sipFactoryImpl.createSipURI(null, uriString); if(lastVia.getTransport() != null) { uri.setTransportParam(lastVia.getTransport()); } else { uri.setTransportParam("udp"); return uri.toString();
public Object extract(Object input) { URI uri = (URI) input; if (uri.isSipURI()) { return ((SipURI)uri).getHost(); } else { return null; } } }
public Object extract(Object input) { URI uri = (URI) input; if (uri.isSipURI()) { return ((SipURI) uri).getUser(); } else { return null; } } }
public Object extract(Object input) { URI uri = (URI) input; if (uri.isSipURI()) { return ((SipURI) uri).getParameter(param); } else if ("tel".equals(uri.getScheme())) { return ((TelURL) uri).getParameter(param); } return null; } }
public void setOutboundInterface(InetSocketAddress inetSocketAddress) { if(inetSocketAddress == null) { throw new NullPointerException("outbound Interface param shouldn't be null"); } String address = inetSocketAddress.getAddress().getHostAddress() + ":" + inetSocketAddress.getPort(); List<SipURI> list = this.sipFactoryImpl.getSipNetworkInterfaceManager().getOutboundInterfaces(); SipURI networkInterface = null; for(SipURI networkInterfaceURI : list) { if(networkInterfaceURI.toString().contains(address)) { networkInterface = networkInterfaceURI; break; } } if(networkInterface == null) throw new IllegalArgumentException("Network interface for " + address + " not found"); outboundInterface = networkInterface; }
sipURI.setParameter("modifier", "route_back"); Header routeHeader = SipFactoryImpl.headerFactory.createHeader(RouteHeader.NAME, sipURI.toString()); request.addHeader(routeHeader);
private void addTelestaxProxyHeaders(HttpRequest httpRequest, String requestType) { //This will work as a flag for LB that this request will need to be modified and proxied to VI httpRequest.addHeader("TelestaxProxy", "true"); //Adds the Provision provider class name httpRequest.addHeader("Provider", ProvisionProvider.bandiwidthClass); //This will tell LB that this request is a getAvailablePhoneNumberByAreaCode request httpRequest.addHeader("RequestType", requestType); //This is will add the instance id for the CancelNumber request that is missing SiteId from the request body httpRequest.addHeader("SiteId", siteId); //This will let LB match the DID to a node based on the node host+port List<SipURI> uris = containerConfiguration.getOutboundInterfaces(); for (SipURI uri: uris) { httpRequest.addHeader("OutboundIntf", uri.getHost()+":"+uri.getPort()+":"+uri.getTransportParam()); } }
public Object extract(Object input) { URI uri = (URI) input; if (uri.isSipURI()) { SipURI sipuri = (SipURI) uri; int port = sipuri.getPort(); if (port < 0) { String scheme = sipuri.getScheme(); if (scheme.equals("sips")) { return "5061"; } else { return "5060"; } } else { return Integer.toString(port); } } else { return null; } } }