简体   繁体   中英

PJSIP VOIP call not connected using SIP2SIP.info server

i am using PJSIP for voice calling. When i used our server, everything fine ie call connected, communicate. But when i am using SIP2SIP.INFO server. Registration is OK But Call is not connected. i saw log in SIP2SIP.info there wasn't log of outgoing or incoming call. 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". but confused how can i used in pjsip code.

please help expert.

If you read the Sip2Sip device configuration page it states that:

" the SIP device must always perform DNS lookups as defined in SIP standard RFC3263 (NAPTR + SRV + A DNS lookups)"

PJSIP supports DNS SRV lookups.

In PJSUA it will only do DNS SRV lookup if you don't provide the port number in the SIP URL.

"sip:xxx@sip2sip.info" will try to do a DNS SRV record lookup first then fail over to DNS A/C name lookup.

and

"sip:xxx@sip2sip.info:5060" will only do DNS A/C name lookup.

What PJSUA will not support automatically is failover support, they say:

"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". 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.

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. If they ever add more then it would become more useful.

_sip._udp.sip2sip.info Server: fritz.box Address: fd00::2665:11ff:fef9:ec51
Non-authoritative answer:
_sip._udp.sip2sip.info SRV service location:
priority = 100
weight = 100
port = 5060
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 also support STUN setup, so I would also setup the STUN settings on the account as well:

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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