Запрос Jain-Sip-сообщения не отправляется в UA (пользовательский агент)

Я создаю IM-сервер, используя мобильный сервер jain-slee jboss as5 и SipRA. До сих пор я был в состоянии подписать UA (Jitsi, Microsip) друг на друга, однако, когда я отправляю свои Сообщения через, я могу получать только на одном конце, в моем случае Microsip получает, но не может отправить в jitsi. Это из-за отсутствия запроса на публикацию / уведомление? Любая помощь будет принята с благодарностью

private void processInitialRequest(ServerTransaction serverTransaction, Request request, ActivityContextInterface ac) {
    tracer.info("Processing Request");
    try {
        //ac.detach(sbbContext.getSbbLocalObject());
        Request tmpNewRequest = (Request) request.clone();
        URI requestURI = request.getRequestURI();
        //get To-address from LS
        URI registeredAddress = locationEjbTargets(requestURI);
        //get From-address from LS
        URI fromAddress = locationEjbTargets(uriFromHeader(getCanonicalAddress((HeaderAddress)tmpNewRequest.getHeader(FromHeader.NAME))));
        //record address
        if(registeredAddress == null || fromAddress == null)
            return;

        //CMP fields used to hold URIs from and to address
        setToURI(registeredAddress.toString());
        setFromURI(fromAddress.toString());

        //null request
        Request newRequest = null;
        //get and create parameters for the notification request
        FromHeader fromHeader = (FromHeader) tmpNewRequest.getHeader(FromHeader.NAME);
        ToHeader toHeader = (ToHeader) tmpNewRequest.getHeader(ToHeader.NAME);
        CallIdHeader callIdHeader = (CallIdHeader) tmpNewRequest.getHeader(CallIdHeader.NAME);
        //create cSeqheader
        CSeqHeader cSeqHeader = headerFactory.createCSeqHeader(1, Request.NOTIFY);
        MaxForwardsHeader maxForwardsHeader = (MaxForwardsHeader) tmpNewRequest.getHeader(MaxForwardsHeader.NAME);
        ViaHeader viaHeader = (ViaHeader) tmpNewRequest.getHeader(ViaHeader.NAME);
        List<ViaHeader> viaHeaders = new ArrayList<ViaHeader>();
        viaHeaders.add(viaHeader);
        ExpiresHeader expiresHeader = (ExpiresHeader) tmpNewRequest.getHeader(ExpiresHeader.NAME);
        //create subscription state-header
        SubscriptionStateHeader subscriptionState = headerFactory.createSubscriptionStateHeader(SubscriptionStateHeader.ACTIVE);
        newRequest = (Request) tmpNewRequest.clone();
        addViaHeader(newRequest, serverTransaction);
        if(tmpNewRequest.getMethod().equals(Request.SUBSCRIBE)){                
            //set Request URI and forward upstream
            //get Event header
            /*EventHeader eventHeader = (EventHeader) tmpNewRequest.getHeader(EventHeader.NAME);
            if ( eventHeader == null) {
                tracer.severe("Cannot find event header.... dropping request.");
                return;
            }*/
            //add headers
            newRequest.addHeader(subscriptionState);
            /*newRequest.addHeader(expiresHeader);
            newRequest.addHeader(acceptHeader);
            newRequest.addHeader(eventHeader);*/
            newRequest.setRequestURI(registeredAddress);
        }else if(tmpNewRequest.getMethod().equals(Request.PUBLISH)){
            //get Event header
            EventHeader eventHeader = (EventHeader) tmpNewRequest.getHeader(EventHeader.NAME);
            if ( eventHeader == null) {
                tracer.severe("Cannot find event header.... dropping request.");
                return;
            }
            //create NOTIFY request
            newRequest = messageFactory.createRequest(registeredAddress,Request.NOTIFY,callIdHeader,cSeqHeader,fromHeader,toHeader, viaHeaders, maxForwardsHeader);
            //a*dd headers
            newRequest.addHeader(subscriptionState);
            //newRequest.addHeader(acceptHeader);
            newRequest.addHeader(eventHeader);
            /*newRequest.addHeader(expiresHeader);
            newRequest.addHeader(acceptHeader);
            newRequest.addHeader(eventHeader);*/
            //get all the URIs from LS and send to each
            List<URI> addresses = locationEjbTargetsALL();
            //adding addresses to request and sending
            Iterator<URI> to = addresses.iterator();
            while (to.hasNext()) {
                URI target = (URI) to.next();
                tracer.info("---Sending to address : " + target);
                Request requestTmp = (Request) newRequest.clone();
                //set Request URI and forward upstream
                requestTmp.setRequestURI(target);
                //sending stateless Request
                provider.sendRequest(requestTmp);
            }
        }else{
            //simply forward
            tracer.info("Notify request not created");
            newRequest = (Request) tmpNewRequest.clone();
            newRequest.setRequestURI(registeredAddress);
            ClientTransaction ctx = forwardRequest(serverTransaction, newRequest);
        }
    } catch (ParseException e) {
        tracer.severe("process Initial Request Error : ", e);
    } catch (InvalidArgumentException e) {
        tracer.severe("Error during header creation : ", e);
    } catch (SipException e) {
        tracer.severe("Error during Requesting sending : ", e);
    }
}

0 ответов

Другие вопросы по тегам