Germán Aracil Boned
2007-Feb-11 19:05 UTC
[asterisk-users] realtime and save ip server in database
Hello I change this from chan_sip.conf (see ipsvr): static void realtime_update_peer(const char *peername, struct sockaddr_in *sin, const char *username, const char *fullcontact, int expirey) { char port[10]; char ipaddr[20]; char regseconds[20]; time_t nowtime; -> char ipsvr[20]; time(&nowtime); nowtime += expirey; snprintf(regseconds, sizeof(regseconds), "%d", (int)nowtime); /* Expiration time */ ast_inet_ntoa(ipaddr, sizeof(ipaddr), sin->sin_addr); snprintf(port, sizeof(port), "%d", ntohs(sin->sin_port)); -> ast_inet_ntoa(ipsvr, sizeof(ipsvr), sin->sin_addr); if (fullcontact) ast_update_realtime("sippeers", "name", peername, "ipaddr", ipaddr, "port", port, "regseconds", regseconds, "username", username, "fullcontact", fullcontact, "ipsvr", ipsvr, NULL); else ast_update_realtime("sippeers", "name", peername, "ipaddr", ipaddr, "port", port, "regseconds", regseconds, "username", username, "ipsvr", ipsvr, NULL); } I need put a asterisk ip address on client was registered. But I don't know how get this address. Exist any variable ? Any struct ? I think, this is a good idea for add to asterisk. If I have more of one asterisk in realtime database, I can send call to that server where sipendpoint was registered. Thanks for all !!!