• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java SipUri类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中gov.nist.javax.sip.address.SipUri的典型用法代码示例。如果您正苦于以下问题:Java SipUri类的具体用法?Java SipUri怎么用?Java SipUri使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SipUri类属于gov.nist.javax.sip.address包,在下文中一共展示了SipUri类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: createContactHeader

import gov.nist.javax.sip.address.SipUri; //导入依赖的package包/类
public ContactHeader createContactHeader() {
    try {
        String ipAddress = this.getIPAddress();
        int port = this.getPort();
        SipURI sipURI = new SipUri();
        sipURI.setHost(ipAddress);
        sipURI.setPort(port);
        sipURI.setTransportParam(this.transport);
        Contact contact = new Contact();
        AddressImpl address = new AddressImpl();
        address.setURI(sipURI);
        contact.setAddress(address);
        
        return contact;
    } catch (Exception ex) {
        InternalErrorHandler.handleException("Unexpected exception",logger);
        return null;
    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:20,代码来源:ListeningPointImpl.java


示例2: setDefaults

import gov.nist.javax.sip.address.SipUri; //导入依赖的package包/类
/**
 * Set the default values in the request URI if necessary.
 */
protected void setDefaults() {
    // The request line may be unparseable (set to null by the
    // exception handler.
    if (requestLine == null)
        return;
    String method = requestLine.getMethod();
    // The requestLine may be malformed!
    if (method == null)
        return;
    GenericURI u = requestLine.getUri();
    if (u == null)
        return;
    if (method.compareTo(Request.REGISTER) == 0 || method.compareTo(Request.INVITE) == 0) {
        if (u instanceof SipUri) {
            SipUri sipUri = (SipUri) u;
            sipUri.setUserParam(DEFAULT_USER);
            try {
                sipUri.setTransportParam(DEFAULT_TRANSPORT);
            } catch (ParseException ex) {
            }
        }
    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:27,代码来源:SIPRequest.java


示例3: createRequest

import gov.nist.javax.sip.address.SipUri; //导入依赖的package包/类
/**
 * Generate a request from a response.
 * 
 * @param requestURI
 *            -- the request URI to assign to the request.
 * @param via
 *            -- the Via header to assign to the request
 * @param cseq
 *            -- the CSeq header to assign to the request
 * @param from
 *            -- the From header to assign to the request
 * @param to
 *            -- the To header to assign to the request
 * @return -- the newly generated sip request.
 */
public SIPRequest createRequest(SipUri requestURI, Via via, CSeq cseq,
        From from, To to) {
    SIPRequest newRequest = new SIPRequest();
    String method = cseq.getMethod();

    newRequest.setMethod(method);
    newRequest.setRequestURI(requestURI);
    this.setBranch(via, method);
    newRequest.setHeader(via);
    newRequest.setHeader(cseq);
    newRequest.setHeader(from);
    newRequest.setHeader(to);
    newRequest.setHeader(getCallId());

    try {
        // JvB: all requests need a Max-Forwards
        newRequest.attachHeader(new MaxForwards(70), false);
    } catch (Exception d) {

    }

    if (MessageFactoryImpl.getDefaultUserAgentHeader() != null) {
        newRequest
                .setHeader(MessageFactoryImpl.getDefaultUserAgentHeader());
    }
    return newRequest;

}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:44,代码来源:SIPDialog.java


示例4: testUserNullabilityInSipUri

import gov.nist.javax.sip.address.SipUri; //导入依赖的package包/类
public void testUserNullabilityInSipUri() throws ParseException {
	// Given a URI with host set and null set as the user
	SipUri uri = new SipUri();
	uri.setUser(null);
	uri.setHost("172.18.3.242");

	// When
	String userAtHost = uri.getUserAtHost();
	String userAtHostPort = uri.getUserAtHostPort();

	// Then
	assertEquals("userAtHost equals host", userAtHost, "172.18.3.242");
	assertEquals("userAtHostPort equals host", userAtHostPort, "172.18.3.242");
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:15,代码来源:JainSipUriTest.java


示例5: get

import gov.nist.javax.sip.address.SipUri; //导入依赖的package包/类
private static String get(HeaderAddress header, Function<SipUri, String> getter) {
    URI uri = getURI(header);
    if (uri instanceof SipUri) {
        return getter.apply((SipUri) uri);
    } else if (uri instanceof TelURL) {
        return ((TelURL) uri).getPhoneNumber();
    }
    return null;
}
 
开发者ID:sip3io,项目名称:tapir,代码行数:10,代码来源:HeaderAddressUtil.java


示例6: parseUser

import gov.nist.javax.sip.address.SipUri; //导入依赖的package包/类
public static String parseUser(HeaderAddress header) {
    return get(header, SipUri::getUser);
}
 
开发者ID:sip3io,项目名称:tapir,代码行数:4,代码来源:HeaderAddressUtil.java


示例7: parseUserAtHostPort

import gov.nist.javax.sip.address.SipUri; //导入依赖的package包/类
public static String parseUserAtHostPort(HeaderAddress header) {
    return get(header, SipUri::getUserAtHostPort);
}
 
开发者ID:sip3io,项目名称:tapir,代码行数:4,代码来源:HeaderAddressUtil.java


示例8: parseSIPUrl

import gov.nist.javax.sip.address.SipUri; //导入依赖的package包/类
/**
 * Parse a SIP url from a string and return a URI structure for it.
 *
 * @param url
 *            a String containing the URI structure to be parsed.
 * @return A parsed URI structure
 * @exception ParseException
 *                if there was an error parsing the message.
 */

public SipUri parseSIPUrl(String url) throws ParseException {
    try {
        return new URLParser(url).sipURL(true);
    } catch (ClassCastException ex) {
        throw new ParseException(url + " Not a SIP URL ", 0);
    }
}
 
开发者ID:YunlongYang,项目名称:LightSIP,代码行数:18,代码来源:StringMsgParser.java



注:本文中的gov.nist.javax.sip.address.SipUri类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java FieldOrMethod类代码示例发布时间:2022-05-22
下一篇:
Java ConstrainedToolbarLayout类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap