pjsua unregister upon register for ipv6 client

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,


I want to use the pjsua to try send an instant message to another IPV6 client. So, according to one of the mailing list of title, "how to enable IPv6 address calling" there has the step to modify the pjsua for IPv6 support (I guess including support for IM). Part of the mail is as below:

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

First of all you need to use SVN trunk version since 0.8 release
doesn't support IPv6. Then put this in your config_site.h:

  #define PJ_HAS_IPV6 1

Then you need to modify pjsua_app.c to create IPv6 SIP and media
transports. For the SIP transport, replace PJSIP_TRANSPORT_UDP with
PJSIP_TRANSPORT_UDP6 (and same for TCP, although I haven't tested with
TCP. But it should work).

For
 IPv6 media transports, you'd need to create the media transports
manualy with pjmedia_transport_udp_create3(), specifying pj_AF_INET6()
as "af" argument, then give the media transport instances in the array
to pjsua-lib with pjsua_media_transports_attach().

Then when making calls, don't forget to enclose the IPv6 host part of
the URI with square brackets (e.g. "sip:user@[::1]"), otherwise you'll
get the Invalid URI error. You may be able to resolve IPv6 hosts as
long as DNS resolver is disabled (i.e. don't use --nameserver option
in pjsua), but I haven't tried this.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Currently I'm using PJProject 1.0.1. Is it suitable for use?
In the pjsua_apps.c I have following modified code portion as the guide 
(replace PJSIP_TRANSPORT_UDP with PJSIP_TRANSPORT_UDP6 (and same for TCP)):


    /* Add UDP transport unless it's disabled. */
    if (!app_config.no_udp) {
    pjsua_acc_id aid;

    status = pjsua_transport_create(PJSIP_TRANSPORT_UDP6,
                    &app_config.udp_cfg, 
                    &transport_id);
    if (status != PJ_SUCCESS)
        goto on_error;

    /* Add local account */
    pjsua_acc_add_local(transport_id, PJ_TRUE, &aid);
    //pjsua_acc_set_transport(aid, transport_id);
    pjsua_acc_set_online_status(current_acc, PJ_TRUE);

    if (app_config.udp_cfg.port == 0) {
        pjsua_transport_info ti;
        pj_sockaddr_in *a;

        pjsua_transport_get_info(transport_id, &ti);
        a = (pj_sockaddr_in*)&ti.local_addr;

        tcp_cfg.port = pj_ntohs(a->sin_port);
    }
    }

    /* Add TCP transport unless it's disabled */
    if (!app_config.no_tcp) {
    status = pjsua_transport_create(PJSIP_TRANSPORT_TCP6,
                    &tcp_cfg, 
                    &transport_id);
    if (status != PJ_SUCCESS)
        goto on_error;

    /* Add local account */
    pjsua_acc_add_local(transport_id, PJ_TRUE, NULL);
    pjsua_acc_set_online_status(current_acc, PJ_TRUE);

    }


I also change the code as guide (create the media transports manualy with pjmedia_transport_udp_create3(), specifying pj_AF_INET6() as "af" argument, then give the media transport instances in the array to pjsua-lib with pjsua_media_transports_attach())
Following is my code portion:


static pj_status_t create_transport_adapter(pjmedia_endpt *med_endpt, int port,
                        pjmedia_transport **p_tp)
{
    pjmedia_transport *udp;
    pj_status_t status;

    /* Create the UDP media transport */
    status = pjmedia_transport_udp_create3(med_endpt, pj_AF_INET6(), NULL, NULL, port, 0, &udp);
    if (status != PJ_SUCCESS)
    return status;

    /* Create the adapter */
    status = pjmedia_tp_adapter_create(med_endpt, NULL, udp, p_tp);
    if (status != PJ_SUCCESS) {
    pjmedia_transport_close(udp);
    return status;
    }

    return PJ_SUCCESS;
}

Is it all that I need to do?

However, after done all the change, when i start the pjsua with command below:

./pjsua-i686-pc-linux-gnu --id sip:mobile@[2001:db8:121::3] --registrar sip:[2001:db8:121::3]

the pjsua register to sip server (SER) , and then it straight unregister. Can I know whats happen here?

I urgently need helps from you all since I google around but with very little information about this.

Thanks in advance.

Sincerely,
ws


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20090320/2686534e/attachment.html>
-------------- next part --------------
_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip at lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org


[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux