Yes you're right ! I did something like in simpleua.c example : // Main Loop for (;;) { char option[10]; pj_time_val timeout = {0, 10}; pjsip_endpt_handle_events(g_endpt, &timeout); puts("\nPress 'q' to quit\n"); fgets(option, sizeof(option), stdin); if (option[0] == 'q') break; } Unfortunately, it still blocks the execution of pjsip_endpt_handle_events(). To continue, I have to press a letter other than 'q'. I think I need to use threads, but you didn't use that in simpleua.c. Is there another solution ? Sorry for these questions completely related to C programming ! Damien On Mon, May 26, 2008 at 2:45 AM, Benny Prijono <bennylp at pjsip.org> wrote: > On Sun, May 25, 2008 at 8:56 PM, Damien Herraud <d.herraud at gmail.com> > wrote: > > Hi, > > > > > > I've captured the SIP packets I send/receive with wireshark. The packet > I > > send seems to be good (when I compare it to the one from pjsua), the > server > > answers me with 401, what is correct. But then my program doesn't answer > > back to give the password and finalize registering. I thought it was done > > automatically with pjsip_regc functions I used... > > > > Anyway my callback is still not called, maybe it is related to what's > > above. > > > > Please find attached my source code and my wireshark capture. > > > > Isn't it getchar() will block the main thread? > > -benny > > > Cheers, > > > > > > Damien > > > > > > > > On Thu, May 22, 2008 at 2:57 PM, Damien Herraud <d.herraud at gmail.com> > wrote: > >> > >> Oooops, I forgot the output of the terminal : > >> > >> 14:54:47.152 os_core_unix.c pjlib 0.8.0 for POSIX initialized > >> 14:54:47.152 sip_endpoint.c Creating endpoint instance... > >> 14:54:47.153 pjlib select() I/O Queue created (0x816068c) > >> 14:54:47.153 sip_endpoint.c Module "mod-msg-print" registered > >> 14:54:47.153 sip_transport. Transport manager created. > >> 14:54:47.154 udp0x8174b3c SIP UDP transport started, published > address > >> is 137.122.91.64:5060 > >> 14:54:47.154 sip_endpoint.c Module "mod-tsx-layer" registered > >> 14:54:47.154 sip_endpoint.c Module "mod-stateful-util" registered > >> 14:54:47.154 sip_endpoint.c Module "mod-ua" registered > >> 14:54:47.154 sip_endpoint.c Module "mod-invite" registered > >> 14:54:47.154 sip_endpoint.c Module "mod-100rel" registered > >> 14:54:47.154 sip_endpoint.c Module "mod-simpleua" registered > >> 14:54:47.154 endpoint Request msg REGISTER/cseq=50498 > >> (tdta0x819ba10) created. > >> 14:54:47.154 tsx0x819ca7c Transaction created for Request msg > >> REGISTER/cseq=50499 (tdta0x819ba10) > >> 14:54:47.154 tsx0x819ca7c Sending Request msg REGISTER/cseq=50499 > >> (tdta0x819ba10) in state Null > >> 14:54:47.154 sip_resolve.c DNS resolver not available, target > >> 'pcscf.open-ims.test:4060' type=Unspecified will be resolved with > >> gethostbyname() > >> 14:54:47.155 sip_resolve.c Target 'pcscf.open-ims.test:4060' > >> type=Unspecified resolved to '137.122.89.83:4060' type=UDP > >> 14:54:47.155 tsx0x819ca7c State changed from Null to Calling, > >> event=TX_MSG > >> > >> Thanks, > >> > >> Damien > >> > >> > >> > >> > >> On Thu, May 22, 2008 at 12:14 PM, Damien Herraud <d.herraud at gmail.com> > >> wrote: > >>> > >>> You were totally right again. Sorry I panicked !!! > >>> > >>> Now I get all basic registration functions working, but the callback > >>> doesn't seem to be called so I have no way to watch the registration > status. > >>> I thought the callback was automatically called with > pjsip_regc_create(). > >>> > >>> Is there something to do to call it ? You can find my ugly source code > >>> attached. > >>> > >>> > >>> Cheers, > >>> > >>> Damien > >>> > >>> > >>> > >>> On Thu, May 22, 2008 at 4:05 AM, Benny Prijono <bennylp at pjsip.org> > wrote: > >>>> > >>>> On Wed, May 21, 2008 at 11:40 PM, Damien Herraud <d.herraud at gmail.com > > > >>>> wrote: > >>>> > Hi, > >>>> > > >>>> > I have a problem with pjsip_regc_register. I get : > >>>> > > >>>> >> ../src/pjsip-ua/sip_reg.c:239: pjsip_regc_init: Assertion `regc && > >>>> >> srv_url > >>>> >> && from_url && to_url && contact_cnt && contact && expires' failed. > >>>> > > >>>> > when I launch my program. > >>>> > > >>>> > >>>> That assertion of course means that one (or more) of the listed > >>>> variables/parameters is zero or NULL. I suspect it's > >>>> acc->cfg.reg_timeout, since you didn't initialize this value. > >>>> According to the API, you should set this argument to > >>>> PJSIP_REGC_EXPIRATION_NOT_SPECIFIED if you don't want to specify > >>>> expiration. > >>>> > >>>> > > >>>> > It is driving me crazy since I am sure it has worked before > >>>> > (pjsip_regc_send > >>>> > also worked, I mean I got no error. I was getting into regc_cb() > code > >>>> > when I > >>>> > got this error). > >>>> > I tried to use many saves but I still get this error !!! > >>>> > > >>>> > >>>> Since the acc->cfg.reg_timeout is not initialized it may contain any > >>>> value. It could be that last time it contains a garbage non-zero value > >>>> hence it passed the assertion. > >>>> > >>>> Cheers > >>>> Benny > >>>> > >>>> > >>>> > You can find my source code (very simple modification of simpleua.c > >>>> > and > >>>> > util.h) attached ! > >>>> > > >>>> > > >>>> > Cheers, > >>>> > > >>>> > Damien > >>>> > > >>>> > > >>>> > On Wed, May 21, 2008 at 7:01 AM, Benny Prijono <bennylp at pjsip.org> > >>>> > wrote: > >>>> >> > >>>> >> On Tue, May 20, 2008 at 11:39 PM, Damien Herraud > >>>> >> <d.herraud at gmail.com> > >>>> >> wrote: > >>>> >> > Ok ! I am indeed using version 0.8. > >>>> >> > > >>>> >> > Do you advise me to use svn version instead ? > >>>> >> > > >>>> >> > > >>>> >> > >>>> >> No, I didn't and won't advise you to use svn version just because > 0.8 > >>>> >> lacks pj_sockaddr_get_addr() function. You could use other ways to > >>>> >> retrieve IP address from a socket address, please see <pj/sock.h> > for > >>>> >> more info. > >>>> >> > >>>> >> Cheers > >>>> >> Benny > >>>> >> > >>>> >> > >>>> >> > Damien > >>>> >> > > >>>> >> > > >>>> >> > > >>>> >> > On Sat, May 17, 2008 at 6:27 AM, Benny Prijono < > bennylp at pjsip.org> > >>>> >> > wrote: > >>>> >> >> > >>>> >> >> On Fri, May 16, 2008 at 5:28 PM, Damien Herraud > >>>> >> >> <d.herraud at gmail.com> > >>>> >> >> wrote: > >>>> >> >> > Thanks for that, I get my address ! > >>>> >> >> > > >>>> >> >> > By the way when I was trying getting my address with another > >>>> >> >> > method, > >>>> >> >> > I > >>>> >> >> > tried > >>>> >> >> > to use pj_sockaddr_get_addr() function defined here . I got an > >>>> >> >> > error > >>>> >> >> > in > >>>> >> >> > compilation, saying that this is not declared. I searched > PJSIP > >>>> >> >> > project > >>>> >> >> > for > >>>> >> >> > this function with eclipse and I could not find it. > >>>> >> >> > > >>>> >> >> > >>>> >> >> This only exists in SVN version, not in 0.8 release version. > >>>> >> >> Perhaps > >>>> >> >> you're using 0.8? > >>>> >> >> > >>>> >> >> Cheers > >>>> >> >> Benny > >>>> >> >> > >>>> >> >> > Cheers, > >>>> >> >> > > >>>> >> >> > Damien > >>>> >> >> > > >>>> >> >> > >>>> >> >> _______________________________________________ > >>>> >> >> 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 > >>>> >> > > >>>> >> > > >>>> >> > _______________________________________________ > >>>> >> > 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 > >>>> >> > > >>>> >> > > >>>> >> > >>>> >> _______________________________________________ > >>>> >> 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 > >>>> > > >>>> > > >>>> > _______________________________________________ > >>>> > 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 > >>>> > > >>>> > > >>>> > >>>> _______________________________________________ > >>>> 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 > >>> > >> > > > > > > _______________________________________________ > > 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 > > > > > > _______________________________________________ > 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 > -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20080526/01a463fa/attachment.html