Problem with stun server

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

 



Hi Samuel,

lets ignore the "unknown msg type" error for now and do the more 
basic tests first.

There are two STUN implementations in pjsip: the old implementation 
in pjlib-util which is used to query the public address of socket, 
and the new implementation in pjnath which is used by ICE and the 
NAT detection function. I'm not sure which has problem in Nintendo 
DS port since both are used (or it could be that both have 
problems!), so lets test both of them.

To test the new STUN (and ICE) in pjnath, you can use pjnath-test. 
There are many messaging related tests there, so if there is a 
problem with alignment or the like, the error should hopefully appear.

To test the old STUN, could you test the following code?

#include <pjlib.h>
#include <pjlib-util.h>

#define THIS_FILE   "test.c"

static void check_error(const char *func, pj_status_t status)
{
     if (status != PJ_SUCCESS) {
	char errmsg[PJ_ERR_MSG_SIZE];
	pj_strerror(status, errmsg, sizeof(errmsg));
	PJ_LOG(1,(THIS_FILE, "%s error: %s", func, errmsg));
	exit(1);
     }
}

#define DO(func)  status = func; check_error(#func, status);

int main()
{
     pj_sock_t sock;
     pj_sockaddr_in addr;
     pj_str_t stun_srv = pj_str("stun.fwdnet.net");
     pj_caching_pool cp;
     pj_status_t status;

     DO( pj_init() );

     pj_caching_pool_init(&cp, NULL, 0);

     DO( pjlib_util_init() );
     DO( pj_sock_socket(pj_AF_INET(), pj_SOCK_DGRAM(), 0, &sock) );
     DO( pj_sock_bind_in(sock, 0, 0) );

     DO( pjstun_get_mapped_addr(&cp.factory, 1, &sock,
			       &stun_srv, 3478,
			       &stun_srv, 3478,
			       &addr) );

     PJ_LOG(3,(THIS_FILE, "Mapped address is %s:%d",
	      pj_inet_ntoa(addr.sin_addr),
	      (int)pj_ntohs(addr.sin_port)));

     DO( pj_sock_close(sock) );
     pj_caching_pool_destroy(&cp);
     pj_shutdown();

     return 0;
}

cheers,
  -benny


Samuel Vinson wrote:
> Hi,
> 
> I recompiled all pjsip and my program. Now, it doesn't abort, but when 
> STUN message  is parsed  (pjstun_parse_msg)
> it tells that an unknown message type. Nevertheless I use the same 
> login/pwd and server  with Windows and  it works.
> 
> Do you have an idea where is the problem ?
> 
>  01:01:24.000   pjsua_core.c No SIP worker threads created
>  01:01:24.000   pjsua_core.c pjsua version 0.8.0-trunk for nds initialized
>  01:01:24.000         call.c Add UDP transport.
>  01:01:28.000         stun.c Error: unknown msg type 17257
>  01:01:28.000  stun_client.c STUN parsing error ignored: Unknown STUN 
> message type  (PJLIB_UTIL_ESTUNINMSGTYPE)





[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