简体   繁体   English

使用SIP2SIP.info服务器未连接PJSIP VOIP呼叫

[英]PJSIP VOIP call not connected using SIP2SIP.info server

i am using PJSIP for voice calling. 我正在使用PJSIP进行语音通话。 When i used our server, everything fine ie call connected, communicate. 当我使用我们的服务器时,一切都很好,即呼叫连接,通信。 But when i am using SIP2SIP.INFO server. 但是当我使用SIP2SIP.INFO服务器时。 Registration is OK But Call is not connected. 注册正常但呼叫未连接。 i saw log in SIP2SIP.info there wasn't log of outgoing or incoming call. 我看到登录SIP2SIP.info没有传出或来电记录。 so call is not initiate. 所以呼叫不是发起的。

    char cfg_reg_uri[] = "sip:sip2sip.info";
    char cfg_cred_realm[] = "sip2sip.info";
    char cfg_cred_scheme[]="digest";

    pjsua_acc_config cfg;
    pjsua_acc_config_default(&cfg);
    cfg.id = pj_str(cfg_id);
    cfg.reg_uri = pj_str(cfg_reg_uri);
    cfg.cred_count = 1;
    cfg.cred_info[0].realm = pj_str(cfg_cred_realm);
    cfg.cred_info[0].scheme = pj_str(cfg_cred_scheme);
    cfg.cred_info[0].username = pj_str(cfg_cred_username);
    cfg.cred_info[0].data_type = PJSIP_CRED_DATA_PLAIN_PASSWD;
    cfg.cred_info[0].data = pj_str(cfg_cred_password);
    status = pjsua_acc_add(&cfg, PJ_TRUE, &_acc_id);

I noted that we need to use outbound proxy in sip2sip called "proxy.sipthor.net". 我注意到我们需要在sip2sip中使用名为“proxy.sipthor.net”的出站代理。 but confused how can i used in pjsip code. 但混淆了如何在pjsip代码中使用。

please help expert. 请帮助专家。

If you read the Sip2Sip device configuration page it states that: 如果您阅读Sip2Sip设备配置页面,则说明:

" the SIP device must always perform DNS lookups as defined in SIP standard RFC3263 (NAPTR + SRV + A DNS lookups)" “SIP设备必须始终执行SIP标准RFC3263(NAPTR + SRV + A DNS查找)中定义的DNS查找”

PJSIP supports DNS SRV lookups. PJSIP支持DNS SRV查找。

In PJSUA it will only do DNS SRV lookup if you don't provide the port number in the SIP URL. 在PJSUA中,如果您未在SIP URL中提供端口号,它将仅执行DNS SRV查找。

"sip:xxx@sip2sip.info" will try to do a DNS SRV record lookup first then fail over to DNS A/C name lookup. “sip:xxx@sip2sip.info”将首先尝试进行DNS SRV记录查找,然后故障转移到DNS A / C名称查找。

and

"sip:xxx@sip2sip.info:5060" will only do DNS A/C name lookup. “sip:xxx@sip2sip.info:5060”只会进行DNS A / C名称查找。

What PJSUA will not support automatically is failover support, they say: PJSUA不会自动支持的是故障转移支持,他们说:

"What we've been suggesting is to implement the failover mechanism in the application layer." “我们建议的是在应用层实现故障转移机制。”

If you want a "quick and easy" setup, what you want to do is set the outbound_proxy to "proxy.sipthor.net". 如果您想要“快速简便”的设置,您想要做的是将outbound_proxy设置为“proxy.sipthor.net”。 eg 例如

    cfg.outbound_proxy_cnt = 1;
    cfg.outbound_proxy[0] = pj_str("sip:proxy.sipthor.net:5060");

If you want a more robust solution, you need to use pjsip's SRV resolution functions to resolve sip2sip.info srv record eg: "_sip._udp.sip2sip.info" and then set the outbound_proxy records with the result. 如果您需要更强大的解决方案,则需要使用pjsip的SRV解析函数来解析sip2sip.info srv记录,例如:“_ sip._udp.sip2sip.info”,然后使用结果设置outbound_proxy记录。

The code is a little bit involved. 代码有点涉及。

pjsip_resolver_t* resolver_;

...

status = pjsip_resolver_create( pool, &resolver_ );

...

pjsip_host_info host;
host.flag = PJSIP_TRANSPORT_DATAGRAM; // is using UDP, see pjsip_transport_flags_e
host.type = PJSIP_TRANSPORT_UDP; // if using UDP, see pjsip_transport_type_e
host.addr.host = pj_str("sip2sip.info");
host.addr.port = 5060;

pjsip_resolve(resolver_, pool, &host, token, resolver_cb_func);

...


static void resolver_cb_func( pj_status_t status, void *token, const struct pjsip_server_addresses *addr)
{
    ...
            // use results to fill in the outbound_proxy
}

You could also take it further to support failover, but it looks like sip2sip doesn't have multiple sip servers in there DNS SRV record so it will not be used currently. 您还可以进一步支持故障转移,但看起来sip2sip在DNS SRV记录中没有多个SIP服务器,因此它不会在当前使用。 If they ever add more then it would become more useful. 如果他们添加更多,那么它将变得更有用。

_sip._udp.sip2sip.info Server: fritz.box Address: fd00::2665:11ff:fef9:ec51 _sip._udp.sip2sip.info服务器:fritz.box地址:fd00 :: 2665:11ff:fef9:ec51
Non-authoritative answer: 非权威性答案:
_sip._udp.sip2sip.info SRV service location: _sip._udp.sip2sip.info SRV服务地点:
priority = 100 优先级= 100
weight = 100 重量= 100
port = 5060 port = 5060
svr hostname = proxy.sipthor.net svr hostname = proxy.sipthor.net
sip2sip.info nameserver = ns2.dns-hosting.info sip2sip.info nameserver = ns1.dns-hosting.info sip2sip.info nameserver = ns7.dns-hosting.info sip2sip.info nameserver = ns2.dns-hosting.info sip2sip.info nameserver = ns1.dns-hosting.info sip2sip.info nameserver = ns7.dns-hosting.info

Sip2Sip also support STUN setup, so I would also setup the STUN settings on the account as well: Sip2Sip也支持STUN设置,所以我也会在帐户上设置STUN设置:

cfg.stun_srv_cnt = 1;
cfg.stun_srv[0] = pj_str("sip2sip.info");

Since your example seems to not provide the port information it should work. 由于您的示例似乎不提供端口信息,它应该工作。 To diagnose this further would require see the pjsip log output. 要进一步诊断,需要查看pjsip日志输出。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM