Hi,

I noticed a strange assertion error on every other outgoing SIP
registration (only on OSX but not on linux), similar to
https://freeswitch.org/jira/browse/FS-3541

su_time_ms() will return an unsigned 32bit value of the milliseconds passed
since 1900-01-01 (not since 1970-01-01).
According to my limited understanding of math this could have only worked
until the 18th of February in 1900.

After that it will overflow and cause the agent_timer in nta.c to not be
scheduled, ending up in the "time not set" if-clause starting at line 1271
in nta.c and crashing due to the assert of "agent->sa_out.trying->q_head"

Does anybody have an idea how to easily fix this (without breaking things
on 32bit systems)?

Cheers,

Klaus

P.S. To test this i made a very simple test program:

#include <stdlib.h>

#include <sofia-sip/nua.h>


static su_root_t *root = NULL;

static nua_t *sip_nua = NULL;


void sip_register(char *username, char *password, char *host) {

  char to[512];

  char uri[512];



  snprintf(to, sizeof(to) - 1, "\"%s\" <sip:%s@%s>", username, username,
host);

  snprintf(uri, sizeof(uri) - 1, "sip:%s", host);


  nua_handle_t *handle = nua_handle(sip_nua, NULL, SIPTAG_TO_STR(to),
TAG_END());

  nua_register(handle,

    NUTAG_REGISTRAR(uri),

    SIPTAG_FROM_STR(to),

    TAG_END()

  );

}


static void sip_event_callback(nua_event_t   event,

                    int           status,

                    char const   *phrase,

                    nua_t        *nua,

                    nua_magic_t  *magic,

                    nua_handle_t *nh,

                    nua_hmagic_t *hmagic,

                    sip_t const  *sip,

                    tagi_t        tags[]) {


    switch (event) {

case nua_r_register:


    break;


default:

    printf("sofia_event_callback: unhandled event %s\n",
nua_event_name(event));

    }

}


static void register_test() {

    sip_register("test", "test", "127.0.0.1");

}


int main(int argc, char *argv[]) {

  struct rlimit limits;

  int i = 0;

  limits.rlim_cur = RLIM_INFINITY;

  limits.rlim_max = RLIM_INFINITY;

  setrlimit(RLIMIT_CORE, &limits);



    su_init();

    root = su_root_create(NULL);


    sip_nua = nua_create(root,

                    sip_event_callback,

                    NULL,

    NUTAG_URL("sip:0.0.0.0:*"),

                    TAG_END());

    for (i = 0; i < 1000; i++) {

      su_root_step(root, 100);

      register_test();

    }

    printf("completed %d register tests.\n", i);

}
------------------------------------------------------------------------------
_______________________________________________
Sofia-sip-devel mailing list
Sofia-sip-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sofia-sip-devel

Reply via email to