1



我正在尝试将传出的 sip 请求发送到另一台服务器,但该请求只是路由回我的服务器。我需要通过 UDP 发送请求。我正在使用 MOBIENTS Sip Servlet。

这是日志:

2013-05-20 23:30:35,175 信息 [gov.nist.javax.sip.stack.SIPTransactionStack] (SelfRoutingThread-19)
from="10.214.77.65:5060"
to="10.214.77.65:5060"
time=" 0"
isSender="false"
transactionId="z9hg4bk1a739dca-0982-4c19-91c2-d6b30cde0e44_8017d156_6924298232771001"
callId="cec3692d7ee2e3771d3b2ecbd5408cf5@10.214.77.65"
firstLine="MESSAGE sip:1404xxxxxxx@sms-proxy-01.bandwidthclec.com:5060 SIP/ 2.0"

<![CDATA[MESSAGE sip:1404xxxxxxx@sms-proxy-01.bandwidthclec.com:5060 SIP/2.0`
Call-ID: cec3692d7ee2e3771d3b2ecbd5408cf5@10.214.77.65
CSeq: 1 MESSAGE
From:`<sip:1404xxxxxxx@216.27.87.216>`;tag=32496860_8017d156_1a739dca-0982-4c19-91c2- d6b30cde0e44
To:`<sip:63917xxxxxxx@216.27.87.216>`
Max-Forwards: 70
Content-Type: text/plain
Via: SIP/2.0/UDP 23.21.213.9:5060;branch=z9hG4bK1a739dca-0982-4c19-91c2-
d6b30cde0e44_8017d156_6924298232771001
Route:
pid=1a739dca-0982-4c19-91c2-d6b30cde0e44>
Content-Length: 7

foo-bar]]>

Here's my DAR config:

ALL:("RestComm", "DAR:From", "NEUTRAL", "", "NO_ROUTE", "0")
INVITE:("org.mobicents.servlet.sip.example.CallBlockingApplication", "DAR:From", "ORIGINATING", "", "NO_ROUTE", "0")
REGISTER:("RestComm", "DAR:From", "NEUTRAL", "", "NO_ROUTE", "0")
MESSAGE:("SmsReceiver", "DAR:TO", "ORIGINATING", "", "NO_ROUTE", "0", "DIRECTION=OUTBOUND")

Here's my code (using HttpServlet) that sends the message:

    public void doGet(HttpServletRequest request, HttpServletResponse response) {
            SipFactory sf = (SipFactory) getServletContext().getAttribute(
                            "javax.servlet.sip.SipFactory");

            SipApplicationSession appSession = ((ConvergedHttpSession) request
                            .getSession()).getApplicationSession();

            logger.info("sipfactory= " + sf);
            logger.info("appSession=" + appSession);

            try {
                    SipServletRequest sipRequest = sf.createRequest(appSession, "MESSAGE","sip:1404xxxxxxx8@216.27.87.216",
                                    "sip:63917xxxxxxx@216.27.87.216");


                   //the uri where I want to send my message
                    SipURI uri = sf.createSipURI("1404xxxxxxx", "sms-proxy-01.bandwidthclec.com");
                    uri.setPort(5060);                                                

                    sipRequest.setRequestURI(uri);


                   //message content
                    sipRequest.setContent("foo-bar", "text/plain");
                    logger.info("sipRequest= " + sipRequest);
                    sipRequest.send();
            } catch (ServletParseException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
            } catch (UnsupportedEncodingException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
            } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
            }

    }

任何帮助/建议都会很棒。

提前致谢。

4

0 回答 0